/
gvimrc
87 lines (69 loc) · 1.7 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
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
78
79
80
81
82
83
84
85
86
87
" Start without the toolbar
set guioptions-=T
set guioptions-=L
set guioptions-=r
set transparency=5
color atom
" color monokaidark
" color tomorrow_night
" color darkburn
" color badwolf
" color solarized
" color inkpot
" Some *special* options if we're in macvim
if has("gui_macvim")
" Fullscreen takes up entire screen
set fuoptions=maxhorz,maxvert
" CtrlP
macmenu &File.New\ Tab key=<nop>
map <D-t> :CtrlP<CR>
imap <D-t> <ESC>:CtrlP<CR>
" Command-/ to toggle comments
map <D-/> <Plug>Commentary<CR>
let g:gist_clip_command = 'pbcopy'
let g:gist_open_browser_after_post = 1
let g:gist_detect_filetype = 1
" Set font preference
set guifont=Source\ Code\ Pro\ for\ Powerline:h13
endif
" Project Tree
autocmd VimEnter * call s:CdIfDirectory(expand("<amatch>"))
autocmd FocusGained * call s:UpdateNERDTree()
" Some NerdTree Halper functions from Janus
" 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 explicitDirectory
exe "cd " . a:directory
endif
if directory
NERDTree
wincmd p
bd
endif
endfunction
" NERDTree utility function
function s:UpdateNERDTree(...)
let stay = 0
if(exists("a:1"))
let stay = a:1
end
if exists("t:NERDTreeBufName")
let nr = bufwinnr(t:NERDTreeBufName)
if nr != -1
exe nr . "wincmd w"
exe substitute(mapcheck("R"), "<CR>", "", "")
if !stay
wincmd p
end
endif
endif
if exists(":CommandTFlush") == 2
CommandTFlush
endif
endfunction
" Include user's local vim config
if filereadable(expand("~/.gvimrc.local"))
source ~/.gvimrc.local
endif