-
Notifications
You must be signed in to change notification settings - Fork 0
/
gvimrc
52 lines (42 loc) · 1.22 KB
/
gvimrc
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
if has("gui_macvim")
macmenu File.New\ Tab key=<nop>
map <D-t> :CommandT<CR>
macmenu Tools.Next\ Error key=<nop>
macmenu Tools.Previous\ Error key=<nop>
" switch to previous buffer
map <C-D-Left> :bp<CR>
" switch to next buffer
map <C-D-Right> :bN<CR>
" delimitMate fixes
imap <M-Left> <Plug>delimitMateC-Left
imap <M-Right> <Plug>delimitMateC-Right
imap <D-Left> <Plug>delimitMateHome
imap <D-Right> <Plug>delimitMateEnd
set lines=50 columns=120
elseif has("X11")
map <M-t> :CommandT<CR>
endif
autocmd VimEnter * call s:CdIfDirectory(expand("<amatch>"))
" If the parameter is a directory, cd into it
function s:CdIfDirectory(directory)
let explicitDirectory = isdirectory(a:directory)
let directory = explicitDirectory || empty(a:directory)
if empty(expand("<amatch>"))
NERDTree
endif
if explicitDirectory
exe "cd " . a:directory
endif
endfunction
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
" Close all open buffers on entering a window if the only
" buffer that's left is the NERDTree buffer
function s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
q
endif
endif
endif
endfunction