forked from paulmillr/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvimrc
More file actions
242 lines (193 loc) · 5.55 KB
/
vimrc
File metadata and controls
242 lines (193 loc) · 5.55 KB
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
" UI {{{
syntax enable
set showmode
set laststatus=2
set background=dark
set number " Line numbers
set ruler " Show line numbers on the bar
set hidden " allows changing buffer with unsaved changes
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets
set title " Set window name to file name
set cursorline " highlight current line
set wildmenu " enhanced command-line completion
set lazyredraw " redraw only when we need to.
colorscheme solarized
" }}}
" Spaces & Tabs & Indents {{{
filetype plugin indent on
set smartindent autoindent
set tabstop=2 " # of visual spaces per TAB
set softtabstop=2 " # of fspaces in TAB when editing
set shiftwidth=2
set expandtab " tabs are spaces
set scrolloff=5 " min # lines above/below cursor
set copyindent " use existing indents for new indents
" }}}
" Searching {{{
set hlsearch " highlight the searchterms
set incsearch " jump to matches while typing
set ignorecase " ignore case while searching if all lowercase
set smartcase
" turn off search highlight
nnoremap <leader><space> :nohlsearch<CR>
" }}}
" Folding {{{
set foldenable " enable folding
set foldlevelstart=10 " open most folds by default
" space open/closes folds
nnoremap <space> za
set foldmethod=indent " fold based on indent level
" }}}
" Misc {{{
set autoread
set autowrite
set noerrorbells
set backspace=indent,eol,start "allow backpacing over autoindent, eol, start
set mouse=a
set clipboard=unnamed
set noesckeys
set nocompatible
imap jj <Esc> " Map escape key to jj
" }}}
" Switch Window CMDs {{{
nnoremap <C-k> <C-W>k
nnoremap <C-j> <C-W>j
nnoremap <C-h> <C-W>h
nnoremap <C-l> <C-W>l
imap <c-h> <Esc><c-h>
imap <c-j> <Esc><c-j>
imap <c-k> <Esc><c-k>
imap <c-l> <Esc><c-l>
" }}}
" Leader CMDs {{{
set listchars=tab:>-,trail:·,eol:$
nmap <silent> <leader>s :set nolist!<CR>
" }}}
" Silver Searcher {{{
" open ag.vim
nnoremap <leader>a :Ag
" }}}
" NerdTree {{{
" Leader+d activates NERDTree
nore <leader>d :NERDTreeToggle <Enter>
" }}}
"CtrlP {{{
" tell CtrlP to order matching files top to bottom with ttb
let g:ctrlp_match_window = 'bottom,order:ttb'
" open files in new buffers
let g:ctrlp_switch_buffer = 0
" lets us change the working directory during a Vim session and make CtrlP
" respect that change
let g:ctrlp_working_path_mode = 0
" speeds up CtrlP
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
" }}}
" Syntastic {{{
" Show the error list automatically
" Allows you to easily navigate the quick fix list
let g:syntastic_auto_loc_list=1
" Do not automatically jump to the error when saving the file
" Jump feature is annoying to me as it automatically moves the cursor
let g:syntastic_auto_jump=0
" Don't on save+close
let g:syntastic_check_on_wq = 0
" Replace symbols
let g:syntastic_error_symbol = "✗"
let g:syntastic_warning_symbol = "⚠"
" }}}
" Airline {{{
let g:airline_powerline_fonts = 1
let g:airline_theme='papercolor'
" }}}
" Tagbar {{{
" Leader+t for Tagbar
nnoremap <leader>t :TagbarToggle<CR>
" }}}
" You Complete Me! {{{
" let g:ycm_global_ycm_extra_conf = "~/.vim/plugged/youcompleteme/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py"
" let g:ycm_autoclose_preview_window_after_insertion = 1
" let g:ycm_collect_identifiers_from_tags_files = 1
" let g:ycm_seed_identifiers_with_syntax = 1
" https://github.com/Valloric/YouCompleteMe/issues/1018
" let g:ycm_path_to_python_interpreter = '/usr/bin/python'
" let g:ycm_server_use_vim_stdout = 0
" let g:ycm_server_keep_logfiles = 1
" let g:ycm_server_log_level = 'debug'
" map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
"python with virtualenv support
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
" }}}
" Easymotion {{{
let g:EasyMotion_do_mapping = 0 " Disable default mappings
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{label}`
nmap s <Plug>(easymotion-overwin-f)
" or
" `s{char}{char}{label}`
" Need one more keystroke, but on average, it may be more comfortable.
nmap s <Plug>(easymotion-overwin-f2)
" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
" }}}
" Misc CMDs {{{
imap jj <Esc>
imap jJ <Esc>
imap Jj <Esc>
imap JJ <Esc>
" move vertically by visual line
nnoremap j gj
nnoremap k gk
" highlight last inserted text
nnoremap gV `[v`]
map a <Nop>
map q <Nop>
" }}}
" Vim-Plug {{{
call plug#begin('~/.vim/plugged')
" Nerdtree
Plug 'scrooloose/nerdtree'
" Syntastic
Plug 'scrooloose/syntastic'
" Surround for easy quoting/parans/brackets/etc.
" Usage: cs'{ within 'dfsasfd' to change it to {dfsasfd}
Plug 'tpope/vim-surround'
" CtrlP
Plug 'kien/ctrlp.vim'
" AG - Silver Searcher
Plug 'rking/ag.vim'
" Airline
Plug 'bling/vim-airline'
" Airline Themes
Plug 'vim-airline/vim-airline-themes'
" Fugitive
Plug 'tpope/vim-fugitive'
" VIM solarized colors
Plug 'altercation/vim-colors-solarized'
" NERDCommenter
Plug 'scrooloose/nerdcommenter'
" Tagbar
Plug 'majutsushi/tagbar'
" Git Gutter
Plug 'airblade/vim-gitgutter'
" You complete me!
" Plug 'valloric/youcompleteme', { 'do': './install.py --clang-completer' }
" Easymotion
Plug 'easymotion/vim-easymotion'
" Tabular
Plug 'godlygeek/tabular'
" Add plugins to &runtimepath
call plug#end()
" }}}
set modelines=1 " check the last line for a mode line
" vim:foldmethod=marker:foldlevel=0