forked from sontek/homies
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
Latest commit
312 lines (258 loc) · 10.6 KB
/
Copy pathvimrc
File metadata and controls
312 lines (258 loc) · 10.6 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
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
" https://github.com/pade/vim-python.git
" ==========================================================
" Dependencies - Libraries/Applications outside of vim
" ==========================================================
" Pep8 - http://pypi.python.org/pypi/pep8
" Pyflakes
" Ack
" Rake & Ruby for command-t
" nose, django-nose
" ==========================================================
" Plugins included
" ==========================================================
" Pathogen
" Better Management of VIM plugins
"
" GunDo
" Visual Undo in vim with diff's to check the differences
"
" Pytest
" Runs your Python tests in Vim.
"
" Commant-T
" Allows easy search and opening of files within a given path
"
" Snipmate
" Configurable snippets to avoid re-typing common comands
"
" PyFlakes
" Underlines and displays errors with Python on-the-fly
"
" Fugitive
" Interface with git from vim
"
" Git
" Syntax highlighting for git config files
"
" Pydoc
" Opens up pydoc within vim
"
" Surround
" Allows you to surround text with open/close tags
"
" Py.test
" Run py.test test's from within vim
"
" MakeGreen
" Generic test runner that works with nose
"
" ==========================================================
" Shortcuts
" ==========================================================
setnocompatible" Don't be compatible with vi
let mapleader="!"" change the leader
" Seriously, guys. It's not like :W is bound to anything anyway.
command! W :w
fu!SplitScroll()
:wincmdv
:wincmdw
execute"normal! \<C-d>"
:setscrollbind
:wincmdw
:setscrollbind
endfu
nmap<leader>sb :call SplitScroll()<CR>
"<CR><C-w>l<C-f>:set scrollbind<CR>
" sudo write this
cmapW!w !sudo tee % >/dev/null
" Toggle the tasklist
map<leader>td <Plug>TaskList
" Run pep8
letg:pep8_map='<leader>8'
" run py.test's
nmap<silent><Leader>tf <Esc>:Pytest file<CR>
nmap<silent><Leader>tc <Esc>:Pytest class<CR>
nmap<silent><Leader>tm <Esc>:Pytest method<CR>
nmap<silent><Leader>tn <Esc>:Pytest next<CR>
nmap<silent><Leader>tp <Esc>:Pytest previous<CR>
nmap<silent><Leader>te <Esc>:Pytest error<CR>
" Run django tests
map<leader>dt :set makeprg=python\ manage.py\ test\|:call MakeGreen()<CR>
" Reload Vimrc
map<silent><leader>V:source ~/.vimrc<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
" open/close the quickfix window
nmap<leader>q :copen<CR>
nmap<leader>qq :cclose<CR>
" for when we forget to use sudo to open/edit a file
cmapw!!w !sudo tee % >/dev/null
" Windows navigation with Alt-arrow
nmap<silent><A-Up>:wincmd k<CR>
nmap<silent><A-Down>:wincmd j<CR>
nmap<silent><A-Left>:wincmd h<CR>
nmap<silent><A-Right>:wincmd l<CR>
" and lets make these all work in insert mode too ( <C-O> makes next cmd
" happen as if in command mode )
imap<C-W><C-O><C-W>
" Open NerdTree
map<F11>:NERDTreeToggle<CR>
" Run command-t file search
map<leader>f :CommandT<CR>
" Ack searching
" Set ack program
letg:ackprg="ack-grep -H --nocolor --nogroup --column"
nmap<C-f><Esc>:Ack!
" Load the Gundo window
"map <leader>g :GundoToggle<CR>
" Jump to the definition of whatever the cursor is on
map<leader>j :RopeGotoDefinition<CR>
" Rename whatever the cursor is on (including references to it)
map<leader>r :RopeRename<CR>
" ==========================================================
" Pathogen - Allows us to organize our vim plugins
" ==========================================================
" Load pathogen with docs for all plugins
filetypeoff
callpathogen#runtime_append_all_bundles()
callpathogen#helptags()
" ==========================================================
" Basic Settings
" ==========================================================
syntaxon" syntax highlighing
filetypeon" try to detect filetypes
filetypepluginindenton" enable loading indent file for filetype
setnumber" Display line numbers
setnumberwidth=1" using only 1 column (and 1 space) while possible
setbackground=dark" We are using dark background in vim
settitle" show title in console title bar
setwildmenu" Menu completion in command mode on <Tab>
setwildmode=full" <Tab> cycles between all matching choices.
" don't bell or blink
setnoerrorbells
setvbt_vb=
" Ignore these files when completing
setwildignore+=*.o,*.obj,.git,*.pyc
setwildignore+=eggs/**
setwildignore+=*.egg-info/**
setgrepprg=ack" replace the default grep program with ack
" Set working directory
nnoremap<leader>. :lcd %:p:h<CR>
" Disable the colorcolumn when switching modes. Make sure this is the
" first autocmd for the filetype here
"autocmd FileType * setlocal colorcolumn=0
""" Insert completion
" don't select first item, follow typing in autocomplete
setcompleteopt=menuone,longest,preview
setpumheight=6" Keep a small completion window
""" Moving Around/Editing
"set cursorline " have a line indicate the cursor location
setruler" show the cursor position all the time
setnostartofline" Avoid moving cursor to BOL when jumping around
setvirtualedit=block" Let cursor move past the last char in <C-v> mode
setscrolloff=3" Keep 3 context lines above and below the cursor
setbackspace=2" Allow backspacing over autoindent, EOL, and BOL
setshowmatch" Briefly jump to a paren once it's balanced
setwrap" wrap text
setlinebreak" don't wrap textin the middle of a word
setautoindent" always set autoindenting on
"set smartindent " use smart indent if there is no indent file
setcindent" cindent works better than smartindent for # comment indent
settabstop=4" <tab> inserts 4 spaces
setshiftwidth=4" but an indent level is 2 spaces wide.
setsofttabstop=4" <BS> over an autoindent deletes both spaces.
setexpandtab" Use spaces, not tabs, for autoindent/tab key.
setshiftround" rounds indent to a multiple of shiftwidth
setmatchpairs+=<:>" show matching <> (html mainly) as well
setfoldmethod=indent" allow us to fold on indents
setfoldlevel=99" don't fold by default
" don't outdent hashes
inoremap##
" close preview window automatically when we move around
autocmdCursorMovedI*ifpumvisible() ==0|pclose|endif
autocmdInsertLeave*ifpumvisible() ==0|pclose|endif
"""" Reading/Writing
setnoautowrite" Never write a file unless I request it.
setnoautowriteall" NEVER.
setnoautoread" Don't automatically re-read changed files.
setmodeline" Allow vim options to be embedded in files;
setmodelines=5" they must be within the first or last 5 lines.
setffs=unix,dos,mac" Try recognizing dos, unix, and mac line endings.
"""" Messages, Info, Status
setls=2" allways show status line
setvbt_vb=" Disable all bells. I hate ringing/flashing.
setconfirm" Y-N-C prompt if closing with unsaved changes.
setshowcmd" Show incomplete normal mode commands as I type.
setreport=0" : commands always print changed line count.
setshortmess+=a" Use [+]/[RO]/[w] for modified/readonly/written.
setruler" Show some info, even without statuslines.
setlaststatus=2" Always show statusline, even if only 1 window.
setstatusline=[%l,%v\ %P%M]\ %f\ %r%h%w\ (%{&ff})\ %{fugitive#statusline()}
" displays tabs with :set list & displays when a line runs off-screen
setlistchars=tab:>-,eol:$,trail:-,precedes:<,extends:>
setlist
""" Searching and Patterns
setignorecase" Default to using case insensitive searches,
setsmartcase" unless uppercase letters are used in the regex.
setsmarttab" Handle tabs more intelligently
sethlsearch" Highlight searches by default.
setincsearch" Incrementally search while typing a /regex
"""" Display
ifhas("gui_running")
colorschemedarkblue
hiCursorLineterm=underline cterm=underline ctermfg=9gui=underline guifg=NONE guibg=NONE
hiSpecialKeyterm=bold ctermfg=1 guifg=#0030ff
"colorscheme wombat-custom
"set guifont=Inconsolata\ 11
else
colorscheme default
endif
" Paste from clipboard
map<leader>p "+p
" hide matches on <leader>space
nnoremap<leader><space> :nohlsearch<cr>
" Remove trailing whitespace on <leader>S
nnoremap<leader>S :%s/\s\+$//<cr>:let @/=''<CR>
" Select the item in the list with enter
inoremap<expr><CR>pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Open/close taglist window on <F12>
nnoremap<silent><F12>:TlistToggle<CR>
" ==========================================================
" Javascript
" ==========================================================
auBufRead*.jssetmakeprg=jslint\ %
" Use tab to scroll through autocomplete menus
"autocmd VimEnter * imap <expr> <Tab> pumvisible() ? "<C-N>" : "<Tab>"
"autocmd VimEnter * imap <expr> <S-Tab> pumvisible() ? "<C-P>" : "<S-Tab>"
letg:acp_completeoptPreview=1
" ===========================================================
" FileType specific changes
" ============================================================
" Mako/HTML
autocmdBufNewFile,BufRead*.mako,*.mak,*.jinja2setlocalft=html
autocmdFileTypehtml,xhtml,xml,csssetlocalexpandtabshiftwidth=2tabstop=2softtabstop=2
" Python
"au BufRead *.py compiler nose
auFileTypepythonsetomnifunc=pythoncomplete#Complete
auFileTypepythonsetlocalexpandtabshiftwidth=4tabstop=8softtabstop=4smartindentcinwords=if,elif,else,for,while,try,except,finally,def,class,with
auFileTypecoffeesetlocalexpandtabshiftwidth=4tabstop=8softtabstop=4smartindentcinwords=if,elif,else,for,while,try,except,finally,def,class,with
auBufRead*.pysetefm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
" Don't let pyflakes use the quickfix window
letg:pyflakes_use_quickfix=0
" Suppress trailing space
autocmdBufWritePre*.py :%s/\s\+$//e
" Add the virtualenv's site-packages to vim path
ifhas('python')
py << EOF
import os.path
import sys
importvim
if'VIRTUAL_ENV'in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
sys.path.insert(0, project_base_dir)
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
endif
" Load up virtualenv's vimrc if it exists
iffilereadable($VIRTUAL_ENV . '/.vimrc')
source$VIRTUAL_ENV/.vimrc
endif