dotfiles

My dotfiles, nothing really interesting to see ...
git clone https://git.onna.be/dotfiles.git
Log | Files | Refs | README

commit 390e191b5e8633e5cf14cf696d8ca1db512805ca
parent 16e73537824b4751e405154a7e92a4b1f9cb622d
Author: Paco Esteban <paco@onna.be>
Date:   Tue, 12 Jun 2018 09:38:55 +0200

some mods and vim-slackcat

Diffstat:
nvim/.config/nvim/init.vim | 2++
nvim/.config/nvim/pack/my_plugins/start/vim-slackcat/plugin/vim-slackcat.vim | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
zsh/.zsh/aliases.zsh | 11+++++++++--
zsh/.zshenv | 2+-
4 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim @@ -148,3 +148,5 @@ xmap gs <plug>(GrepperOperator) let g:UltiSnipsEnableSnipMate = 0 " vim-virtualenv let g:virtualenv_directory = "~/Sync/src/virtualenvs" +" vim-slackcat +let g:slackcat_default_channel = "festeban" diff --git a/nvim/.config/nvim/pack/my_plugins/start/vim-slackcat/plugin/vim-slackcat.vim b/nvim/.config/nvim/pack/my_plugins/start/vim-slackcat/plugin/vim-slackcat.vim @@ -0,0 +1,60 @@ +" vim-slackcat.vim +" Ridiculously simple plugin to send a visual selection to an Slack channel +" +" Copyright © 2016 Paco Esteban <paco@onna.be> + +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the 'Software'), +" to deal in the Software without restriction, including without limitation +" the rights to use, copy, modify, merge, publish, distribute, sublicense, +" and/or sell copies of the Software, and to permit persons to whom the +" Software is furnished to do so, subject to the following conditions: + +" The above copyright notice and this permission notice shall be included +" in all copies or substantial portions of the Software. + +" THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +" OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +" it accepts g:slackcat_default_channel +" slackcat (http://slackcat.chat/) must be configured beforehand. + +if !exists("g:slackcat_default_channel") + let g:slackcat_default_channel = "" +endif + +" send selection to slack +vnoremap <Leader>S :<C-u>call SendToSlack()<CR> + +function! SendToSlack() + call inputsave() + let s_channel = input("Slack Channel? ", g:slackcat_default_channel) + let s_lang = input("lang? ", &filetype) + call inputrestore() + echo "\rSending to Slack ..." + let s_selection = s:escapeTildes(s:getVisualSelection()) + if empty(s_lang) + let s_lang = 'txt' + endif + let return = system("echo '". s_selection ."' |slackcat -c " . s_channel . " --filetype " . s_lang) + echo "\rSent !" +endfunction + +function! s:escapeTildes(text) + return substitute(a:text, "'", "'\"'\"'", 'g') +endfunction + +function! s:getVisualSelection() + " Why is this not a built-in Vim script function?! + let [lnum1, col1] = getpos("'<")[1:2] + let [lnum2, col2] = getpos("'>")[1:2] + let lines = getline(lnum1, lnum2) + let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)] + let lines[0] = lines[0][col1 - 1:] + return join(lines, "\n") +endfunction diff --git a/zsh/.zsh/aliases.zsh b/zsh/.zsh/aliases.zsh @@ -13,6 +13,7 @@ if [[ "$MYOS" == "Darwin" ]]; then CLIP_COMMAND="pbcopy" fi +alias lst='ls -latr' alias cp='cp -v' alias tree='tree -C' alias tm='tmux attach' @@ -53,9 +54,13 @@ alias ddf='docker system df' alias cal='cal -3m' alias info='info --vi-keys' # GNU info act like man command alias figletfonts='ls -1 `figlet -I2` | grep "\.flf$" | cut -f 1 -d "." | sort -u' # list figlet fonts -alias r1='ssh r1' alias diff='diff -u' +# various connection aliases +alias sr1='ssh r1' +alias sga='ssh galadriel' +alias ssdf='ssh sdfeu' + # most used config files fast access cfg-i3() { $EDITOR $HOME/.config/i3/config } cfg-nvim() { $EDITOR $HOME/.config/nvim/init.vim } @@ -69,6 +74,9 @@ cfg-mutt() { $EDITOR $HOME/.muttrc } cfg-newsboat() { $EDITOR $HOME/.newsboat/config } cfg-newsboat-urls() { $EDITOR $HOME/.newsboat/urls } cfg-tmux() { $EDITOR $HOME/.tmux.conf } +cfg-ssh() { $EDITOR $HOME/.ssh/config } +cfg-ssh-authorized-keys() { $EDITOR $HOME/.ssh/authorized_keys } +cfg-ssh-known-hosts() { $EDITOR $HOME/.ssh/known_hosts } # directory definitions e=$HOME/Sync/src/electronica @@ -180,4 +188,3 @@ function pubkey () { $CLIP_COMMAND echo "=> Public key ($KEY) copied to clipboard." } - diff --git a/zsh/.zshenv b/zsh/.zshenv @@ -17,7 +17,7 @@ export PASSWORD_STORE_ENABLE_EXTENSIONS=true export DEFAULT_USER=$USER typeset -U path -path=(~/.plenv/bin $GOPATH/bin $path) +path=(/opt/google-cloud-sdk/bin ~/.plenv/bin $GOPATH/bin $path) # for completion colored ... export LS_COLORS='rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'