-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
293 lines (218 loc) · 6.47 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
set shell=/bin/bash
set nocompatible " be iMproved, required
set hidden
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle, required
Bundle 'gmarik/vundle'
"core plugins
Bundle 'kien/ctrlp.vim'
"most used
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/syntastic'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'ervandew/supertab'
"<leader><leader>w
Bundle 'sjl/gundo.vim'
Bundle 'bling/vim-airline'
Bundle 'vim-scripts/tComment'
Bundle 'tpope/vim-surround'
"Bundle 'msanders/snipmate.vim'
"^^ doesnt work at the same time as supertab.
Bundle 'tpope/vim-abolish'
Bundle 'kien/rainbow_parentheses.vim'
Bundle 'nathanaelkane/vim-indent-guides'
Bundle 'scrooloose/nerdcommenter'
Bundle 'altercation/vim-colors-solarized'
Bundle 'Keithbsmiley/swift.vim'
Bundle 'mjbrownie/pythoncomplete.vim'
" Bundle 'ehamberg/vim-cute-python'
"rarely used
filetype plugin indent on " required
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install (update) bundles
" :BundleSearch(!) foo - search (or refresh cache first) for foo
" :BundleClean(!) - confirm (or auto-approve) removal of unused bundles
"Sets how many lines of history VIM has to remember
set history=700
set nocp
let mapleader = "'"
let g:mapleader = "'"
set relativenumber
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
" How many tenths of a second to blink when matching brackets
set mat=2
" shortcut to open new buffer/tab with .vimrc
map <leader>; :e ~/.vimrc<cr>
map <leader>: :newtab ~/.vimrc<cr>
"complete html tags with </
inoremap >> ></<C-X><C-O><Esc>%i<cr><cr><Esc>ki<tab><tab>
inoremap << </<C-X><C-O>
"indent lines custom
let g:indent_guides_guide_size = 1
" automatically close open curly brace
inoremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O<Left>
inoremap {{ {
inoremap {} {}
"disable arrow keys in insert mode
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
" control-Q to quit
nnoremap Q <nop>
nnoremap <C-q> :q<cr>
" select pasted
nnoremap gp '[v']
" space, backsace, and enter enters insert mode
nnoremap <space> a
nnoremap <BS> i<BS>
nnoremap <CR> i<CR><Esc>
"map s to easymotion
nmap s <Plug>(easymotion-s)
" 'a' saves
nnoremap a :w!<cr>
" control-a enters normal mode
nnoremap <C-a> <Esc>
" control-d enters normal mode and saves
nnoremap <C-d> <Esc>:w!<cr>
vnoremap <C-d> <Esc>gV:w!<cr>
onoremap <C-d> <Esc>:w!<cr>
inoremap <C-d> <Esc>`^:w!<cr>
" 'w enters nerdtree
nnoremap <leader>w :NERDTree<CR>
" 'e enters gundo
nnoremap <leader>e :GundoToggle<CR>
" 'r enters Tlist
nnoremap <leader>r :TlistToggle<CR>
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" redraw window so that search terms are centered
nnoremap n nzz
nnoremap N Nzz
set lines=45 " Show 45 lines instead of default 24
set columns=90 " Show 90 columns
"Always show current position
set ruler
" Makes search act like search in modern browsers
set incsearch
"Ignore case when searching
set ignorecase
" When searchin try to be smart about cases
set smartcase
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them
set showmatch
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
"Rainbow parenthesis toggle
nnoremap <leader>( :RainbowParenthesesToggle<cr>
nnoremap <leader>{ :RainbowParenthesesLoadBraces<cr>
nnoremap <leader>[ :RainbowParenthesesLoadSquare<cr>
nnoremap <leader>< :RainbowParenthesesLoadChevrons<cr>
" Enable syntax highlighting
syntax enable
colorscheme desert
set background=dark
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
" " Visual mode pressing * or # searches for the current selection
" " Super useful! From an idea by Michael Naumann
" vnoremap <silent> * :call VisualSelection('f')<CR>
" vnoremap <silent> # :call VisualSelection('b')<CR>
" Treat long lines as break lines (useful when moving around in them)
map j gj
map k gk
" Close all the buffers
map <leader>ca :1,1000 bd!<cr>
" tab works
nnoremap <tab> i<tab>
" i dont really use tabs anymore, so im going to repurpose the commands
" Useful mappings for managing tabs
" map <leader>tn :tabnew<cr>
" map <leader>tc :tabclose<cr>
" map <leader>tm :tabmove<cr>
map <leader>d :tabn<cr>
map <leader>s :tabp<cr>
" map <leader>f :tablast<cr>
" map <leader>a :tabfirst<cr>
" go to matching curly brace
map <leader>s %
"list buffers
map <leader>l :ls<cr>
" this turns buffers into tabs
map <leader>tb :tab ball<cr>
" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
map <leader>t :tabedit <c-r>=expand("%:p:h")<cr>/
" autocomplete like fish
inoremap <C-f> <C-n>
" rotate buffers
map <C-b> :bn<cr>
map <C-n> :bp<cr>
nnoremap <C-f> <nop>
" new buffer with file
map <leader>n :e <c-r>=expand("%:p:h")<cr>/
" close buffer
map <leader>c :bd<cr>
"switch split screen focus
map <leader>z <c-w><c-w>
"close screen section
map <leader>x <c-w><c-q>
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
set viminfo^=%
" Remap VIM 0 to first non-blank character
map 0 ^
map 9 $
" Delete trailing white space on save, useful for Python and CoffeeScript ;)
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.coffee :call DeleteTrailingWS()
" Always show the status line
set laststatus=2
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
en
return ''
endfunction
" Format the status line
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l