|
@@ -65,28 +65,53 @@ set encoding=utf-8
|
|
|
scriptencoding utf-8
|
|
|
|
|
|
" Copy Pasta {{{
|
|
|
+
|
|
|
+" Registers
|
|
|
+"
|
|
|
function! RegisterSwapDefaultWith()
|
|
|
" Swap the default register with the contents of another
|
|
|
let l = nr2char(getchar())
|
|
|
execute 'let @x=@' . l . '| let @' . l . '=@" | let @"=@x'
|
|
|
endfunction
|
|
|
nnoremap <Leader>c :call RegisterSwapDefaultWith()<CR>
|
|
|
-" Swap the default register with the contents of the clipboard
|
|
|
nnoremap <Leader>C :call RegisterSwapDefaultWith()<CR>+
|
|
|
+"
|
|
|
+" (visual) <LEADER>ca := swap contents of default register (") with register a
|
|
|
+" (visual) <LEADER>C := swap contents of default register with clipboard (+)
|
|
|
+
|
|
|
" }}}
|
|
|
|
|
|
+" Case {{{
|
|
|
+
|
|
|
+" Uppercase/Lowercase
|
|
|
+"
|
|
|
+" (visual) gu := lowercase selection
|
|
|
+" (normal) guu := lowercase line
|
|
|
+" (visual) gU := uppercase selection
|
|
|
+" (normal) gUU := uppercase line
|
|
|
|
|
|
" Title Case
|
|
|
+"
|
|
|
vnoremap gt :s/\%V\v<(.)(\w*)/\u\1\L\2/g<CR>:noh<CR>
|
|
|
-nnoremap gTT V:s/\v<(.)(\w*)/\u\1\L\2/g<CR>:noh<CR>
|
|
|
+nnoremap gtt V:s/\v<(.)(\w*)/\u\1\L\2/g<CR>:noh<CR>
|
|
|
+"
|
|
|
+" (visual) gt := titlecase selection
|
|
|
+" (normal) gtt := titlecase line
|
|
|
+
|
|
|
+" }}}
|
|
|
|
|
|
" Quote {{{
|
|
|
+
|
|
|
function! SelectionSurroundWith()
|
|
|
" Surround selected text with a single char
|
|
|
let l = nr2char(getchar())
|
|
|
execute "normal! c" . l . "\<C-r>\"" . l . "\<Esc>"
|
|
|
endfunction
|
|
|
vnoremap gi :call SelectionSurroundWith()<CR>
|
|
|
+"
|
|
|
+" (visual) gi" := surround selection with quotes (")
|
|
|
+" (visual) gi{ := surround selection with braces (")
|
|
|
+
|
|
|
" }}}
|
|
|
|
|
|
" Autoformatting (to be tested) {{{
|