-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.after
180 lines (134 loc) · 5.49 KB
/
vimrc.after
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
" Scratch buffer
noremap <silent> <Leader><Tab> :Scratch<CR>
" Select current file in NERDTree
map <silent> <Leader>f :NERDTreeFind<CR>
" change pwd when nt changes root
let NERDTreeChDirMode=1
let NERDTreeShowHidden=1
let NERDTreeCasadeOpenSingleChildDir=1
"let NERDTreeIgnore += ['^\.DS_Store$']
" turns off jshint
let g:syntastic_javascript_checkers = ['jsl']
" alias NERDTree to cd :-)
cnoreabbrev cd NERDTree
" switch windows
map <silent> <C-H> :wincmd h<CR>
map <silent> <C-J> :wincmd j<CR>
map <silent> <C-K> :wincmd k<CR>
map <silent> <C-L> :wincmd l<CR>
" http://vim.wikia.com/wiki/Insert_newline_without_entering_insert_mode
nnoremap <S-Enter> O<Esc>
nnoremap <CR> o<Esc>
nnoremap <silent> <F8> :Godoc<CR>
nnoremap <silent> <F9> :Fmt<CR>
nnoremap <silent> <F10> :w<CR>:Fmt<CR>:!go run %<CR>
au FocusLost * silent! wall
" Highlight currently open file in nerdtree
" see http://superuser.com/questions/195022/vim-how-to-synchronize-nerdtree-with-current-opened-tab-file-path
" returns true iff is NERDTree open/active
function! rc:isNTOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
" returns true iff focused window is NERDTree window
function! rc:isNTFocused()
return -1 != match(expand('%'), 'NERD_Tree')
endfunction
" returns true iff focused window is Scratch bugger
function! rc:isScratchFocused()
return -1 != match(expand('%'), '__Scratch__')
endfunction
" returns true iff current window contains a file in current pwd
function! rc:isInsideCwd()
return -1 != stridx(expand('%:p'), getcwd())
endfunction
" calls NERDTreeFind iff NERDTree is active, current window contains a modifiable file, and we're not in vimdiff
function! rc:syncTree()
if &modifiable && rc:isNTOpen() && !rc:isNTFocused() && !rc:isScratchFocused() && strlen(expand('%')) > 0 && !&diff && rc:isInsideCwd()
NERDTreeFind
wincmd p
endif
endfunction
" autocmd BufEnter * call rc:syncTree()
set hidden
" Set 7 lines to the cursor when moving vertical from http://amix.dk/vim/vimrc.html
set so=7
" after using ., move cursor back to editing location when you started (http://www.rousette.org.uk/blog/archives/vim-and-zsh-oh-my/)
nmap . .`[
" everything that goes to or from unnamed register will affect *, too (OSX cliboard)"
set clipboard=unnamed
" Edit .vimrc
nmap <F12> :tabe ~/.vimrc.after<CR>
" source current buffer
nmap <F11> :source %<CR>
let g:ctrlp_max_files = 100000
let g:ctrlp_working_path_mode = 0
let g:ctrlp_clear_cache_on_exit = 1
let g:ctrlp_max_height = 40
let g:ctrlp_show_hidden = 1
map <silent> <C-t> :CtrlP<CR>
map <silent> <C-y> :CtrlPMRUFiles<CR>
set listchars="" " Reset the listchars
set listchars=tab:▸\ " a tab should display as "▸ "
"set listchars=tab:\ \ " a tab should display as " "
set listchars+=trail:· " show trailing spaces as "·"
"set listchars+=trail:\ " show trailing spaces as "·"
set listchars+=extends:> " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the last column when wrap is
"
" source .vimrc in pwd when vim is started
set exrc
set secure
" go to normal mode on tab or window change
" http://superuser.com/questions/236534/change-to-normal-mode-when-macvim-goes-background
" au FocusLost,TabLeave * call feedkeys("\<C-\>\<C-n>")
" indent java with 4 spaces
au FileType java set tabstop=4 shiftwidth=4
" eclim, fix imports and format source
au FileType java map <silent> <C-i> :JavaImportMissing<CR>:JavaImportClean<CR>:%JavaFormat<CR>
au FileType java map <silent> <D-I> :JavaImport<CR>
au FileType java imap <silent> <D-I> :JavaImport<CR>
let g:EclimMavenPomClasspathUpdate = 0
let g:EclimJavaCompleteCaseSensitive = 1
" rebind user completion to C-Space
au FileType java imap <C-Space> <C-x><C-u>
set noignorecase
" ESC to cancel completion
inoremap <expr> <Esc> pumvisible() ? "\<C-e>" : "\<Esc>"
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"
inoremap <expr> <PageUp> pumvisible() ? "\<PageUp>\<C-p>\<C-n>" : "\<PageUp>"
set completeopt+=longest
""
"" Wild settings
set wildignore="" " reset
" Disable output and VCS files
set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem
" Disable archive files
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz
" Ignore bundler and sass cache
"set wildignore+=*/vendor/gems/*,*/vendor/cache/*,*/.bundle/*,*/.sass-cache/*
set wildignore+=*/vendor/cache/*,*/.bundle/*,*/.sass-cache/*,*/tmp/*
" Ignore temp and backup files
set wildignore+=*.swp,*~,._*
" Ignore image files
set wildignore+=*.png,*.jpg,*.jpeg,*.gif,*.psd,*.tiff
" Ignore .DS_Store files
set wildignore+=*.DS_Store
" solarized goodness
colorscheme solarized
set background=dark
set statusline+=%{fugitive#statusline()}
" enable mouse integration, for normal an visual modes
set mouse=nvc
" derp?
" check if really needed:
" http://vim.wikia.com/wiki/Using_the_mouse_for_Vim_in_an_xterm
" map <xCSI>[62~ <MouseDown>
" resize window
nnoremap <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
nnoremap <Leader>. :exe "vertical resize " . (winwidth(0) * 3/2)<CR>
nnoremap <Leader>, :exe "vertical resize " . (winwidth(0) * 2/3)<CR>