|
@@ -69,33 +69,28 @@ scriptencoding utf-8
|
|
|
|
|
|
" Copy Pasta {{{
|
|
" Copy Pasta {{{
|
|
function! RegisterSwapDefaultWith()
|
|
function! RegisterSwapDefaultWith()
|
|
|
|
+ " Swap the default register with the contents of another
|
|
let l = nr2char(getchar())
|
|
let l = nr2char(getchar())
|
|
execute 'let @x=@' . l . '| let @' . l . '=@" | let @"=@x'
|
|
execute 'let @x=@' . l . '| let @' . l . '=@" | let @"=@x'
|
|
endfunction
|
|
endfunction
|
|
nnoremap <Leader>c :call RegisterSwapDefaultWith()<CR>
|
|
nnoremap <Leader>c :call RegisterSwapDefaultWith()<CR>
|
|
-nnoremap <Leader>C :let @x=@+ \| let @+=@" \| let @"=@x<CR>
|
|
|
|
|
|
+" Swap the default register with the contents of the clipboard
|
|
|
|
+nnoremap <Leader>C :call RegisterSwapDefaultWith()<CR>+
|
|
" }}}
|
|
" }}}
|
|
|
|
|
|
-" Formatting {{{
|
|
|
|
|
|
|
|
" Title Case
|
|
" Title Case
|
|
vnoremap gt :s/\%V\v<(.)(\w*)/\u\1\L\2/g<CR>:noh<CR>
|
|
vnoremap gt :s/\%V\v<(.)(\w*)/\u\1\L\2/g<CR>:noh<CR>
|
|
nnoremap gT V:s/\v<(.)(\w*)/\u\1\L\2/g<CR>:noh<CR>
|
|
nnoremap gT V:s/\v<(.)(\w*)/\u\1\L\2/g<CR>:noh<CR>
|
|
|
|
|
|
-" Quote selection
|
|
|
|
-vnoremap gi" c"<C-r>""<Esc>
|
|
|
|
-vnoremap gi' c'<C-r>"'<Esc>
|
|
|
|
-vnoremap gi` c`<C-r>"`<Esc>
|
|
|
|
-
|
|
|
|
-" Bracket selection
|
|
|
|
-vnoremap gi( c(<C-r>")<Esc>
|
|
|
|
-vnoremap gi) c(<C-r>")<Esc>
|
|
|
|
-vnoremap gi[ c[<C-r>"]<Esc>
|
|
|
|
-vnoremap gi] c[<C-r>"]<Esc>
|
|
|
|
-vnoremap gi{ c{<C-r>"{<Esc>
|
|
|
|
-vnoremap gi} c}<C-r>"}<Esc>
|
|
|
|
-
|
|
|
|
-"}}}
|
|
|
|
|
|
+" 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>
|
|
|
|
+" }}}
|
|
|
|
|
|
" Autoformatting (to be tested) {{{
|
|
" Autoformatting (to be tested) {{{
|
|
"set formatoptions+=c
|
|
"set formatoptions+=c
|