-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot-vimrc
More file actions
executable file
·282 lines (215 loc) · 6.81 KB
/
dot-vimrc
File metadata and controls
executable file
·282 lines (215 loc) · 6.81 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
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
" Rob Lass
" <firstname dot lastname at gmail>
"
" I've collected this group of settings over the years. Some of these
" commands have been taken from others, but I don't remember which ones, or
" who they came from.
"""""""""""
" Vundle comes first
"""""""""""
set nocompatible " 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 'gmarik/Vundle.vim'
" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
" ...
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
"""""""""""
" General Settings
"
"""""""""""
" Use Vim settings, rather then Vi settings. This must be first, because it
" changes other options as a side effect.
set nocompatible
" replace tabs with spaces
retab 4
" tabs are 4 spaces
set tabstop=4
" replace a pressed tab key with four spaces
set expandtab
" number of spaces for each level of autoindent
set shiftwidth=4
" this makes it so that you can backspace over a tab with one keystroke
" (instead of having to delete each space individually).
set softtabstop=4
" break lines longer than this
set textwidth=78
" ask vim to try using colors that look good on a dark background
set bg=dark
" i like this colorscheme, nice contrast when i'm facing the window in my
" office with lots of sun coming in
colorscheme habamax
" ignore case when searching. use \C in the search string to do a
" case-sensitive search
set ignorecase
" print the line number on each line (i have a hot key below to toggle this)
set number
" turn on filetype events (used below)
filetype on
" need this to load pyflake when i open a python file
" filetype plugin on
" show matching parenthesis (lisp)
set showmatch
" show matching parenthesis for 0.5 seconds
set matchtime=5
" tab complete menu items
set wildmenu
" do i use this?
set wcm=<C-Z>
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" when a new line is entered, use indent level from previous line
set autoindent
" this automatically indents things. sometimes causes problems in non-c like
" files (LaTeX, python, etc)
set smartindent
" fixes the aforementioned problem for TeX files
autocmd FileType tex set nosmartindent
" yeah
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file
endif
set backupdir=/tmp
" keep 500 lines of command line history
set history=500
" show the cursor position all the time
set ruler
" display incomplete commands
set showcmd
" do incremental searching
set incsearch
" paren matching
set sm
"""""""""""
" Remapping keys
"
"""""""""""
" Don't use Ex mode, use Q for formatting
noremap Q gq
" Make p in Visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvs<C-R>=current_reg<CR><Esc>
" bring up the help menu
nnoremap <F1> :set relativenumber!<CR>
" toggle rid of line numbers
nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>
" delete the current buffer
noremap <F3> :bd<CR>
" move the focus (but not the cursor) up or down
noremap <F5> 2<C-Y>
noremap <F6> 2<C-E>
" unhighlight last search results with \\
noremap <Leader><Leader> :set hlsearch!<CR>
" go to the location mapped (not just the line)
nnoremap ' `
" space inserts a single character (without entering insert mode)
noremap <space> i$<esc>r
" easily edit and re-source this file
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" swap single and double quotes in visually selected text. breaks if you have
" the å character in the selected block.
vnoremap <leader>" :s/\"/å/g<cr>gv:s/'/\"/g<cr>gv:s/å/'/g<cr>
" exit insert mode with jk
inoremap jk <esc>
"""""""""""
" Appearance
"
"""""""""""
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2
syntax on
set hlsearch
endif
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Put vim(filename) in the screen session
function! Update_window_title ()
let &titlestring = "vim(" . expand("%:t") . ")"
if &term == "screen"
set t_ts=k
set t_fs=\
endif
if &term == "screen" || &term == "xterm"
set title
endif
endfunction
if !exists("autocommands_loaded")
let autocommands_loaded = 1
autocmd WinEnter * :call Update_window_title ()
autocmd BufWinEnter * :call Update_window_title ()
endif
"""""""""""
" Plugin Commands
"
"""""""""""
"minibuffer
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
"""""""""""
" File-Specific Editing
"
"""""""""""
" use autocompletion
autocmd FileType python set omnifunc=pythoncomplete#Complete
" i prefer the 100 character pep8 variant
" create a red line at 100 characters in python files
autocmd FileType python set textwidth=99
highlight ColorColumn ctermbg=1
autocmd FileType python set colorcolumn=100
" i also like to see visible whitespace characters in python code
autocmd FileType python set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<
autocmd FileType python set list
"""""""""""""""
" Spelling
" & Formatting
"""""""""""""""
" i am american
set spelllang=en_us
" i might use unicode
set spellfile=~/.vim/spell.en.utf-8.add
autocmd BufNewFile,BufRead /tmp/vim* set ai et tw=68 spell
" check spelling by default
set spell
" color problem words
highlight clear SpellBad
highlight SpellBad term=standout ctermfg=1 term=underline cterm=underline
highlight clear SpellCap
highlight SpellCap term=underline cterm=underline
highlight clear SpellRare
highlight SpellRare term=underline cterm=underline
highlight clear SpellLocal
highlight SpellLocal term=underline cterm=underline
"turn on rainbow parens
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
execute pathogen#infect()
" syntastic stuff
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_python_flake8_args='--ignore=E501'
" allow copying to system clipboard on osx
set clipboard=unnamed