-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
314 lines (257 loc) · 8.37 KB
/
.vimrc
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
""""""""""""""""""""""""""""""
" vundle setup
""""""""""""""""""""""""""""""
" source ~/.vim/bundles.vim
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'Shougo/neocomplcache.vim'
" Plugin 'Valloric/YouCompleteMe'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" ctrlp file search
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'easymotion/vim-easymotion'
Plugin 'flazz/vim-colorschemes'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'Raimondi/delimitMate'
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'jistr/vim-nerdtree-tabs'
" Plugin 'fatih/vim-go'
" Plugin 'python-mode/python-mode'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
""""""""""""""""""""""""
" vim config
""""""""""""""""""""""""
filetype on
" filetype indent on
" enable filetype dectection and filetype specific plugin/indent
" filetype plugin indent on
syntax enable
syntax on
" no vi-compatile
" set nocompatible
set background=dark
set t_Co=256
set encoding=utf-8
" Use Unix as the standard file type
set ffs=unix,dos,mac
" Set to auto read when a file is changed from the outside
set autoread
" Set how many lines of history VIM has to remember
set history=1000
" Show line numbers
set number
" Show relative number to current line
set relativenumber
" Show current cursor position
set ruler
" Display status line
set laststatus=2
" Makes search act like search in modern browsers
set incsearch
" Highlight search matching
set hlsearch
" Case insensitive when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Always set autoindenting on
set autoindent
set smartindent
" Expand tab to space
set expandtab
" Insert tabs on the start of a line according to context
set smarttab
" 4 space tab
set tabstop=4
set shiftwidth=4
set softtabstop=4
" Show incomplete cmds down the buttom
set showcmd
" Show matching brackets
set showmatch
" Turn on the WiLd menu (Tab comand completion)
set wildmenu
" vsplit in right
set splitright
" Set 5 lines to the cursor - when moving vertically using j/k
set scrolloff=5
" ignore these files while expanding wild chars
" set wildignore=*.o,*.pyc
" Toggle Paste mode on and off
set pastetoggle=<F2>
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Go up from current directory until it finds tags file
set tags=./tags;,tags;
" Remap leader key to , (default \)
let mapleader = ","
let g:mapleader = ","
" Python keyword highlight
let python_highlight_all = 1
" au FileType python syn keyword pythonDecorator True None False self
let g:pyindent_open_paren = ''
" cabbrev command aliases
" :W sudo saves the file
ca W w !sudo tee % > /dev/null
ca te tabedit
ca vh vert help
ca sv so ~/.vimrc
ca gb Gblame
"""""""""""""""""""""""""""""
" Mappings
"""""""""""""""""""""""""""""
" Remap VIM 0 to first non-blank character
map 0 ^
" Remap - to $
map - $
" map space to page down
nnoremap <Space> <C-d>
" clear search highlights
nnoremap <leader>n :nohl<CR>
map <silent> <leader>ee :vs ~/.vimrc<cr>
" Toggle paste mode on and off
map <leader>p :setlocal paste!<cr>
" Easier way to move between split windows
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-H> <C-W>h
nnoremap <C-L> <C-W>l
" navigate windows with meta(alt key) + arrows
map <M-Left> <c-w>h
map <M-Right> <c-w>l
map <M-Up> <c-w>k
map <M-Down> <c-w>j
imap <M-Left> <ESC><c-w>h
imap <M-Right> <ESC><c-w>l
imap <M-Up> <ESC><c-w>k
imap <M-Down> <ESC><c-w>j
" navigate tabs with Alt+<number> (not working in gnome-terminal)
nnoremap <A-1> 1gt
nnoremap <A-2> 2gt
nnoremap <A-3> 3gt
nnoremap <A-4> 4gt
nnoremap <A-5> 5gt
nnoremap <A-0> :tablast<CR>
" auto bracket completion
" inoremap {<CR> {<CR>}<Esc>O
" inoremap { {}<Left>
" inoremap {{ {
" inoremap {} {}
" Speed up scrolling of the viewport slightly
nnoremap <C-e> 2<C-e>
nnoremap <C-y> 2<C-y>
" map Ctr-n to Ctr-] and move cursor to screen top
nnoremap <C-n> <C-]>zz
" nnoremap m *
"""""""""""""""""""""""""""
" Color customization
"""""""""""""""""""""""""""
colorscheme solarized
" colorscheme solarized, deus, zenburn, buddy, Papercolor
" custom color settings ---------------------
" colors may be subjected to terminal pallete settings
" highlight Normal ctermfg=255 ctermbg=234
" highlight LineNr guifg=grey50 ctermfg=245
" highlight Number cterm=none ctermfg=196
" highlight Operator cterm=bold ctermfg=214
" highlight Type cterm=bold ctermfg=green
" highlight Comment ctermfg=39
" highlight String ctermfg=47
" highlight Keyword cterm=bold ctermfg=yellow
" highlight Conditional cterm=bold ctermfg=214
" highlight Repeat cterm=bold ctermfg=214
" highlight Character ctermfg=yellow
" highlight PreProc cterm=bold ctermfg=45
" highlight Constant cterm=bold ctermfg=1
" highlight Statement cterm=bold ctermfg=yellow
" highlight Function cterm=bold ctermfg=208
" highlight Search cterm=NONE ctermfg=NONE ctermbg=23
highlight VertSplit cterm=None ctermfg=242 ctermbg=NONE
highlight CursorLineNr guifg=grey50 ctermfg=248
" highlight ExtraWhitespace ctermbg=52 guibg=52
" match ExtraWhitespace /\s\+$/
""""""""""""""""""""""""""
" Plugin settings
""""""""""""""""""""""""""
" NeoComplCache ------------------------------
" YouCompleteMe ------------------------------
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_autoclose_preview_window_after_completion = 1
" NERDTree -----------------------------
" toggle nerdtree display
map <F3> :NERDTreeToggle<CR>
" open nerdtree with the current file selected
nmap ,t :NERDTreeFind<CR>
" don;t show these file types
let NERDTreeIgnore = ['\.pyc$', '\.pyo$']
" enable line numbers
" let NERDTreeShowLineNumbers=1
" NERDCOMMENTER ------------------------
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_python = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Airline ------------------------------
let g:airline_powerline_fonts = 0
let g:airline_theme = 'serene'
let g:airline#extensions#whitespace#enabled = 0
let g:airline#extensions#tabline#enabled = 0
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
" CtrlP --------------------------------
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" EasyMotion ---------------------------
" s{char}{char} to move to {char}{char}
nmap s <Plug>(easymotion-s2)
" <Leader>f{char} to move to {char}
nmap <Leader>f <Plug>(easymotion-f)
nmap <Leader>F <Plug>(easymotion-F)
" Move to line (j downward, i upward)
nmap <Leader>j <Plug>(easymotion-j)
nmap <Leader>k <Plug>(easymotion-k)
" Move to word
nmap <Leader>w <Plug>(easymotion-w)
nmap <Leader>e <Plug>(easymotion-e)
nmap <Leader>b <Plug>(easymotion-b)
nmap <Leader><Leader>w <Plug>(easymotion-bd-w)
nmap <Leader><Leader>j <Plug>(easymotion-bd-jk)
" auto-pair ---------------------------
" let g:AutoPairsUseInsertedCount = 1
" delimitMate ------------------------
let delimitMate_expand_cr = 1
imap <expr> <CR> pumvisible() ? "\<c-y>" : "<Plug>delimitMateCR"
" Open NERDTree on console vim startup.
let g:nerdtree_tabs_open_on_console_startup = 1