From 6ca9992ff561a5a6411c33c2f173b02eb81fe6ca Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 18 Sep 2021 17:42:45 +0200 Subject: [PATCH] vim: more stuff --- .vimrc | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/.vimrc b/.vimrc index a87fc1d..24cd979 100644 --- a/.vimrc +++ b/.vimrc @@ -24,5 +24,50 @@ map :nohlsearch set colorcolumn=72,120 hi colorcolumn ctermbg=NONE ctermfg=red cterm=bold guibg=NONE guifg=red gui=bold +" Tab navigation +set showtabline=2 +set tabpagemax=1000 +nmap ä gt +nmap ö gT +nmap Ä :+tabm +nmap Ö :-tabm + au BufRead /tmp/neomutt-* set tw=72 au BufRead /tmp/mutt-* set tw=72 + +" No littering. +if isdirectory('/tmp/vim-' . $USER) == 0 + :silent !install -dm700 /tmp/vim-$USER >/dev/null 2>&1 +endif +set directory=/tmp/vim-$USER// +set nobackup +set nowritebackup +set viminfo="" + + +" Set default file type to text +" https://stackoverflow.com/questions/5487338/vim-set-filetype-txt-for-every-new-file-no-name +autocmd BufEnter * if &filetype == "" | setlocal ft=text | endif + +" X11 clipboard. +fun X11Copy() + silent %w !setsid xclip -selection clipboard +endfun + +fun X11CopyRegister(reg) + let l:ignore = system('setsid xclip -selection clipboard', getreg(a:reg)) +endfun + +fun X11PasteClipboard() + r !xclip -selection clipboard -o +endfun + +fun X11PastePrimary() + r !xclip -o +endfun + +nmap xc :call X11Copy() +vmap xc "xy:call X11CopyRegister('x') +nmap xp :call X11PasteClipboard() +nmap xP :call X11PastePrimary() +