forked from cookiengineer/dotvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmappings.vim
78 lines (53 loc) · 1.16 KB
/
mappings.vim
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
" Toggle NetRW Explorer
function! ToggleNetRW()
if exists("t:explorer_buf_num")
let explorer_win_num = bufwinnr(t:explorer_buf_num)
if explorer_win_num != -1
let cur_win_num = winnr()
exec explorer_win_num . 'wincmd w'
close
exec cur_win_num . 'wincmd w'
unlet t:explorer_buf_num
else
unlet t:explorer_buf_num
endif
else
exec '1wincmd w'
Vexplore
vertical resize 32
let t:explorer_buf_num = bufnr("%")
endif
endfunction
" Toggle Window Zoom
function ToggleWindowZoom()
if 1 == winnr('$')
return
endif
let restore_cmd = winrestcmd()
wincmd |
wincmd _
if restore_cmd ==# winrestcmd()
exe t:zoom_restore
else
let t:zoom_restore = restore_cmd
endif
return '<Nop>'
endfunction
" Toggle Zoom
function! ToggleZoom()
if v:count
exe 'norm! '.v:count.'|'
else
call ToggleWindowZoom()
endif
endfunction
" Function Key Bindings
nnoremap <silent> <F1> :call ToggleNetRW()<CR>
nnoremap <silent> <F2> :nohl<CR>
nnoremap <silent> <F3> mzgg=G'z
" Zoom/Unzoom Window
nnoremap <silent> + :call ToggleZoom()<CR>
" Auto Format bad indent of copy/paste
nnoremap p p=`]
" Special Commands
command W w !sudo tee % > /dev/null