dotwryn/vim/rc.vim
2024-08-16 09:41:26 -06:00

64 lines
1.8 KiB
VimL

if empty($DOTWRYN)
if !empty(glob(expand("$HOME/.wryn")))
let $DOTWRYN=expand("$HOME/.wryn")
elseif !empty(glob(expand("$XDG_DATA_HOME/wryn")))
let $DOTWRYN=expand("$XDG_DATA_HOME/wryn")
else
let $DOTWRYN=expand("$HOME/.local/share/wryn")
endif
endif
let $VIMRC=expand("$DOTWRYN/vim/rc.vim")
for vimrcfile in split(trim(system("find " . expand("$DOTWRYN/vim/rc.d") . " -type f | sort -u")), '\n')
execute 'source ' . vimrcfile
endfor
" -------------------------------------------------------------------
" --- generic bindings (easy reference) -----------------------------
" -------------------------------------------------------------------
" <SPACE> to execute macro on q
nnoremap <Space> @q
" \q for `q:`
nnoremap <Leader>q q:
" \s previous selection command
nnoremap <Leader>s :'<,'>
" Q to replace current line(s) with shell execution
vnoremap Q !$SHELL<CR>
nnoremap Q !!$SHELL<CR>
" \j like J, but append current line to the line below
nnoremap <Leader>j ddpkJ
" move the current line down/up one
nnoremap - :move +1 <CR>
nnoremap _ :move -2 <CR>
" \d insert formatted date below
nnoremap <Leader>d :let @d = system("date '+%A, %B %-d, %Y'")<CR>o<C-r>d<BS> <esc>
" \m to set buffer to modifiable
nnoremap <Leader>m :set modifiable<CR>
" (c)opy / (p)aste from xclip
" TODO: learn how to compile vim with x11 compatibility and delete
vnoremap <Leader>c :w !xclip<CR><CR>
nnoremap <Leader>v o<esc>!!xclip -o<CR>
nnoremap <Leader>sc :'<,'>w !xclip<CR><CR>
" enable/disable true color
nnoremap <f12> :set invtermguicolors<CR>
" -------------------------------------------------------------------
" --- available / rarely used bindings (personal reference) ---------
" -------------------------------------------------------------------
" nnoremap <BS>
" nnoremap <C-t>
" nnoremap <C-b>
" nnoremap z
" nnoremap ^