-
Notifications
You must be signed in to change notification settings - Fork 7
/
.vimrc.local
192 lines (149 loc) · 5.75 KB
/
.vimrc.local
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
180
181
182
183
184
185
186
187
188
189
190
set mouse=
set nospell
set background=dark
colorscheme darkburn
" map ; to : to save all those senseless shifts
" but wait -- that ; can be useful!
" "nnoremap ; :
" don't display indent guides on startup ( enable with ,ig )
let g:indent_guides_enable_on_vim_startup = 0
" start out files with all folds opened
autocmd Syntax * normal zR
let g:DisableAutoPHPFolding = 1
" Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e ~/.vimrc.local<CR>
nmap <silent> <leader>sv :so ~/.vimrc.local<CR>
"custom copy'n'paste
"slightly modified version of tip from brudermarkus on vim.wikia.com
"use leader y to yank content to a temporary buffer file, leader p
"to paste it. This supports pasting between instances of vim.
vmap <silent> <leader>y :w! ~/.vbuf<CR>
nmap <silent> <leader>y :.w! ~/.vbuf<CR>
nmap <silent> <leader>p :r ~/.vbuf<CR>
" Add support for 'paste mode', which allows you to mass paste text without it
" getting munged.
set pastetoggle=<F2>
" Use Q for formatting the current paragraph (or selection)
vmap Q gq
nmap Q gqap
" remap up and down so that they don't jump past wrapped lines
nnoremap j gj
nnoremap k gk
" ... add ignore rules
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
" don't remember position in svn and git commit temporary files
let g:skipview_files = ['*\.vim', 'svn-commit\.*', 'COMMIT_EDITMSG']"
" the default configuration for ctrlp in spf13 sets a custom user
" command, but that ends up causing our custom ignore rules to
" be useless because it overrides them. So instead, we'll fall back
" to the default ctrlp behavior of globbing, which works with the ignore
" rules. You have to do this here rather than the bundles file or else it
" gets overwritten.
unlet g:ctrlp_user_command
let g:ctrlp_user_command = ''
" let's modify those ignore rules slightly
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn\|cache$\|\/web\/assets$',
\ 'file': '\.exe$\|\.so$\|\.dll$' }
" ... regex mode by default
let g:ctrlp_regexp = 1
" show hidden files, such as dotfiles
let g:ctrlp_show_hidden = 1
" working path from root of starting directory
let g:ctrlp_working_path_mode = 'a'
" bind ctrl-P to run ctrlp in buffer mode
nnoremap <silent> <leader>b :CtrlPBuffer<CR>
" let's turn off arrow keys to get used to using the proper keys for
" navigation
"map <up> <nop>
"map <down> <nop>
"map <left> <nop>
"map <right> <nop>
" Easy window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Disable annoying closing of quotes, braces, tags, etc.
UnBundle 'spf13/vim-autoclose'
UnBundle 'amirh/HTML-AutoCloseTag'
let g:autoclose_on = 0
set shiftwidth=2 " Use indents of 2 spaces
set tabstop=2 " An indentation every two columns
set softtabstop=2 " Let backspace delete indent
" disable automatic autocomplete, instead only do it on <Tab>
" I have commented this out because I'm trying living without neocomplcache.
"let g:neocomplcache_disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<C-n>" : <SID>check_back_space() ? "\<TAB>" : "\<C-x>\<C-u>"
"function! s:check_back_space()"{{{
"let col = col('.') - 1
"return !col || getline('.')[col - 1] =~ '\s'
"endfunction"}}
" the following lines from the spf vimrc cause delays in mode switching
" couldn't figure out a way to fix this aside from commenting the lines
" in the main .spf-13 .vimrc
"map ^[[F $
"imap ^[[F ^O$
"map ^[[H g0
"imap ^[[H ^Og0
" replace parts of airline status bar we aren't using with information we can
let g:airline_section_b = '%{getcwd()}'
let g:airline_section_c = '%t'
" for now we're not going to use the full php linting chain,
" instead just show syntax errors
"let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd']
"let g:syntastic_php_phpcs_args = "--standard=psr2 -n --report=csv"
let g:syntastic_php_checkers=['php', 'phpmd']
" Map F1 to Esc, since that's what I'm usually reach for when I
" accidentally hit it!
map <F1> <Esc>
imap <F1> <Esc>
" Since I use an aliased grep, tell various parts of the config to
" use a raw grep instead
let g:gitgutter_escape_grep = 1
"set grepprg=grep\ -nH
" Map F5 to a simple menu of buffers
nnoremap <F5> :buffers<CR>:buffer<Space>
" Remove period from keyword definition, so that
" motions stop at periods.
set iskeyword -=.
" Set g:haddock_browser to prevent annoying errors when opening Haskell files
let g:haddock_browser="/usr/bin/firefox"
" by default, when you do a replace replace all cases on the line
set gdefault
" Toggle line numbers and signs column
nmap <silent> <leader>l :set invnumber<CR>:SignifyToggle<CR>
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
" bind leader-g to Ag shortcut
nmap <silent> <leader>g :Ag<SPACE>
endif
" bind leader-k to search for word under cursor
map <silent> <leader>k :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" Python settings!
" Re-map breakpoint support as it conflicts with my buffer search
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_bind = '<leader>k'
" Defines a function which calls NERDTreeFind if we have an open
" buffer, but NERDTreeToggle if we don't. This makes it so we can
" always open NERDTree in the appropriate directory.
function! NERDTreeToggleInCurDir()
" If NERDTree is open in the current buffer
if (exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1)
exe ":NERDTreeClose"
else
if (expand("%:t") != '')
exe ":NERDTreeFind"
else
exe ":NERDTreeToggle"
endif
endif
endfunction
map <leader>e :call NERDTreeToggleInCurDir()<CR>
nmap <leader>nt :call NERDTreeToggleInCurDir()<CR>