-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathkey_mappings.vim
More file actions
39 lines (30 loc) · 1.14 KB
/
Copy pathkey_mappings.vim
File metadata and controls
39 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"map Q to something useful
noremap Q gq
"make Y consistent with C and D
nnoremap Y y$
"visual search mappings
function! s:VSetSearch()
let temp = @@
norm! gvy
let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
let @@ = temp
endfunction
vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR>
vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR>
" CtrlP
map <leader>ff :CtrlP<CR>
map <leader>fb :CtrlPBuffer<CR>
" Directory browsing
map <leader>d :Explore!<CR>
" If the search term highlighting gets annoying, set a key to switch it off temporarily
nmap <silent> <leader>n :silent :nohlsearch<CR>
" Catch trailing whitespace
" set listchars=tab:>-,trail:·,eol:$,nbsp:·
" set listchars=tab:>-,trail:·,nbsp:·
nmap <silent> <leader>s :set nolist!<CR>
" Toggle line wrapping
nmap <silent> <leader>w :set wrap!<CR>
" Run selected text through ruby and replace with output
vmap <Leader>rb :!ruby -e 'eval(STDIN.read)'<CR>
" Extract RSpec let from before @variable
vmap <leader>rrl d?\v^\s*<(describe\|context)><CR>$p==0:s/\v\@?<(\w+)>\s*\=\s*(.+)/let(:\1) { \2 }<CR>mrf:wve"vy?\v^\s*<(describe\|context)><CR>$V%:s/@\<\(<C-R>v\)\>/\1/g<CR>'r