kunsis-dotfiles/.vimrc

73 lines
1.5 KiB
VimL

set number
set lbr
set fdc=0
set vb
set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4
set linespace=0
set autoindent
set smartindent
set mouse=a
set cursorline
syntax on
set showcmd
set encoding=utf-8
set autowrite
set noautochdir
set list
set listchars=trail:␣,tab:→\ ,extends:>,precedes:<
set hlsearch
map <silent> <c-k> :nohlsearch<CR>
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<CR>
nmap Ö :-tabm<CR>
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 <Leader>xc :call X11Copy()<CR>
vmap <Leader>xc "xy:call X11CopyRegister('x')<CR>
nmap <Leader>xp :call X11PasteClipboard()<CR>
nmap <Leader>xP :call X11PastePrimary()<CR>