Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 971 lines (824 sloc) 30.458 kB
c7ab3b7 @kennethlove new bundles, new colorscheme, js checker
kennethlove authored
1 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2 " PATHOGEN
3 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
46c5958 @kennethlove various changes.
kennethlove authored
4 filetype off
c7ab3b7 @kennethlove new bundles, new colorscheme, js checker
kennethlove authored
5 call pathogen#runtime_append_all_bundles()
520ce8b @kennethlove updates
kennethlove authored
6 call pathogen#helptags()
c7ab3b7 @kennethlove new bundles, new colorscheme, js checker
kennethlove authored
7
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
8 set nocompatible
9 set cpoptions=aABceFsmq
ce6c0d1 @kennethlove removed git-wip and more
kennethlove authored
10 "set autochdir
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
11 set nostartofline " don't jump to the first character when paging
12 set title
13 set backspace=indent,eol,start " allow backspacing over everything in insert mode
14 set ttyfast
771f909 @kennethlove changes to .vimrc
kennethlove authored
15 let mapleader = ','
16 let g:mapleader = ','
cb95406 @kennethlove changed localleader. added gundo again and added threesome
kennethlove authored
17 let localleader = '\'
18 let g:localleader = '\'
150f752 @kennethlove updates to .vimrc/.gvimrc files. added pydiction plugin. deleted .DS_…
kennethlove authored
19 let leader = ','
20 let g:leader = ','
5f55b6b @kennethlove initial
kennethlove authored
21
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
22 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
23 " DISPLAY
24 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
25 set ruler
26 set number
27 set showcmd
28 set laststatus=2
29 set winminheight=0
30 set winminwidth=0
31 set winheight=10
32 set display+=lastline
33 set textwidth=0
ea039d5 @kennethlove new colors. new settings for terminal and gui vim. only show colorcol…
kennethlove authored
34 "set columns=90
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
35 set wrapmargin=10
36 set numberwidth=5
1aeb97e @kennethlove added .zshrc and zsh theme
kennethlove authored
37 "set relativenumber
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
38
39 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
40 " BEHAVIOR
41 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
42 set autoread
43 set noautowrite
44 set visualbell
45 set t_vb= " visual bell
46 set shellcmdflag=-c
47 set shell=bash\ -l
48 set modeline
49 set modelines=5
50 set tabpagemax=100
51 set mousemodel=extend
f7de3d7 @kennethlove updated
kennethlove authored
52 set mouse=a
53 set ttymouse=xterm2
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
54 set noea
f7de3d7 @kennethlove updated
kennethlove authored
55 set shortmess=aOstTI " shortens messages to avoid 'press a key' prompt
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
56 set magic
57 set viminfo='10,\"100,:20,%,n~/.viminfo
58 set confirm
59 set report=0
60 set smartcase
61
62 " Saving sessions
46c5958 @kennethlove various changes.
kennethlove authored
63 set sessionoptions=buffers,folds,tabpages
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
64
65 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
66 " TEXT EDITING
67 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
68 set imd
69 set wildmenu
70 set wildmode=list:longest,full
9c6ef26 @kennethlove removed extraneous rules. added new mappings
kennethlove authored
71 set wildignore+=*.o,*~,.lo,*.pyc,*.bak,*.jpg,*.png,*.gif
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
72 set whichwrap=b,s,h,l,<,>,~,[,] "everything wraps
201b447 @kennethlove lots of updates
kennethlove authored
73 set undolevels=5000
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
74 set autoindent
75 set preserveindent
76 set nosmartindent
77 set smarttab
78 set expandtab
79 set tabstop=4
80 set softtabstop=4
81 set shiftwidth=4
82 set wrap
83 set formatoptions=lcroqwan2vb1
84 set showmatch
85 set matchtime=5
86 set list
87 " Use the same symbols as TextMate for tabstops and EOLs
88 set listchars=tab:\ ,eol:¬,trail:-
89 set showbreak=…
90 set encoding=utf-8 fileencodings=.
91 set showfulltag
448796e @kennethlove updates
kennethlove authored
92 set completeopt=longest,menuone,preview
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
93
94 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
95 " FOLDS
96 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
97 "set foldmethod=indent
46c5958 @kennethlove various changes.
kennethlove authored
98 set foldmethod=manual
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
99 set foldenable
100 set foldopen=block,hor,mark,percent,quickfix,tag
101 set foldminlines=2
d4b5fd9 @kennethlove updates
kennethlove authored
102 set fillchars+=fold:\
99f7e7c @kennethlove updates. removed minibufexpl after too many buffer problems. added ca…
kennethlove authored
103 set foldcolumn=2
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
104
105 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
106 " BUFFERS
107 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
108 au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
109 set bufhidden=hide
110 set hidden " you can change buffers without saving
111 set switchbuf=usetab
112 set splitright
d3d93c5 @kennethlove show line numbers in NERDTree, smaller scroll offset, new statusline
kennethlove authored
113 set scrolloff=2
114 set sidescrolloff=2
771f909 @kennethlove changes to .vimrc
kennethlove authored
115 set showtabline=1
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
116
117 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
118 " COLORS
119 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
120 syntax on
b21f7b4 @kennethlove added simplenote plugin and Tomorrow theme
kennethlove authored
121 set t_Co=256
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
122 set background=dark
d683499 @kennethlove meh
kennethlove authored
123 colorscheme solarized
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
124 hi NonText ctermfg=7 guifg=gray
125 hi SpecialKey ctermfg=8
126
127 " Use the below highlight group when displaying bad whitespace is desired.
3fb1f7e @kennethlove coloring
kennethlove authored
128 highlight ExtraWhitespace ctermbg=red guibg=red
129 match ExtraWhitespace /\s\+$/
130 autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
131 autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
132 autocmd InsertLeave * match ExtraWhitespace /\s\+$/
133 autocmd BufWinLeave * call clearmatches()
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
134
135 " full Python syntax highlighting
136 let python_highlight_all=1
448796e @kennethlove updates
kennethlove authored
137 let g:pyflakes_use_quickfix=0
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
138
46c5958 @kennethlove various changes.
kennethlove authored
139 " use brief mode for Javascript indenter
140 let g:SimpleJsIndenter_BriefMode = 1
141
9ce3167 @kennethlove updates to .vimrc, removed yankring history and added it to the ignor…
kennethlove authored
142 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
143 " STATUS LINE
144 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
145 set laststatus=2
3ff59ac @kennethlove functions to show bad whitespace and long lines
kennethlove authored
146
147 set statusline=%-.50F " Full path to file, 50 characters max
7c8ee09 @kennethlove added chapa
kennethlove authored
148 set statusline+=\ %{fugitive#statusline()} " Fugitive status line
73222ee @kennethlove new colorschemes. other changes/settings
kennethlove authored
149 set statusline+=\ %{g:HgStatusForFile()} " Thermometer status line
98fcb12 @kennethlove removed misplaced bundle
kennethlove authored
150 set statusline+=\ %{VirtualEnvStatusline()} " Virtualenv status line
3ff59ac @kennethlove functions to show bad whitespace and long lines
kennethlove authored
151 set statusline+=\ (%n) " buffer number
152 set statusline+=\ %([%M%R%H%W]\ %) " Modified, Read-only, Help, and Preview flags
153 set statusline+=\ %y " Filetype
154 set statusline+=\ %#error# " switch to error color
155 set statusline+=%{StatuslineTabWarning()} " show warning about mixed tabs or bad &et
156 set statusline+=%{StatuslineTrailingSpaceWarning()} " show warning about trailing whitespace
98fcb12 @kennethlove removed misplaced bundle
kennethlove authored
157 set statusline+=%{StatuslineLongLineWarning()} " show warning about long lines
3ff59ac @kennethlove functions to show bad whitespace and long lines
kennethlove authored
158 set statusline+=%* " back to normal color
159 set statusline+=\ %#warningmsg# " switch to warningmsg color
160 set statusline+=%{SyntasticStatuslineFlag()} " show Syntastic flag
161 set statusline+=%* " back to normal color
98fcb12 @kennethlove removed misplaced bundle
kennethlove authored
162 set statusline+=\ %= " Right-align and start truncation
3ff59ac @kennethlove functions to show bad whitespace and long lines
kennethlove authored
163 set statusline+=\ [%04l/%04L\ %03c] " Show current line number, total lines, current column
164 set statusline+=\ %p%% " Percentage through file in lines
165
166 " recalculate the warning flags when idle and after writing
167 autocmd cursorhold,bufwritepost * unlet! b:statusline_tab_warning
168 autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning
169 autocmd cursorhold,bufwritepost * unlet! b:statusline_long_line_warning
170
171 " return '[mixed]' if spaces and tabs are used to indent
172 " return an empty string if everything is fine
173 function! StatuslineTabWarning()
174 if !exists("b:statusline_tab_warning")
175 let tabs = search('^\t', 'nw') != 0
176 let spaces = search('^ ', 'nw') != 0
177
178 if tabs && spaces
179 let b:statusline_tab_warning = '[mixed]'
180 else
181 let b:statusline_tab_warning = ''
182 endif
183 endif
184 return b:statusline_tab_warning
185 endfunction
186
187 " return '[\s]' if trailing white space is detected
188 " return '' otherwise
189 function! StatuslineTrailingSpaceWarning()
190 if !exists("b:statusline_trailing_space_warning")
191 let tabs = search('\t\+$', 'nw') != 0
192 let spaces = search('\s\+$', 'nw') != 0
193 if tabs || spaces
194 let b:statusline_trailing_spaces_warning = '[\s]'
195 else
196 let b:statusline_trailing_spaces_warning = ''
197 endif
198 endif
199 return b:statusline_trailing_spaces_warning
200 endfunction
201
202 " return a warning for 'long lines' where 'long' is either &textwidth
203 " or 80 (if no &textwidth is set)
204 "
205 " return '' if no long lines
206 " return '[#x, my, $z]' if long lines are found, where 'x' is the number
207 " of long lines, 'y' is the median length of the long lines, and 'z' is
208 " the length of the longest line
209 function! StatuslineLongLineWarning()
210 if !exists("b:statusline_long_line_warning")
211 let long_line_lens = s:LongLines()
212
213 if len(long_line_lens) > 0
214 let b:statusline_long_line_warning = "[" .
215 \ '#' . len(long_line_lens) . ", " .
216 \ 'm' . s:Median(long_line_lens) . ", " .
217 \ '$' . max(long_line_lens) . "]"
218 else
219 let b:statusline_long_line_warning = ''
220 endif
221 endif
222 return b:statusline_long_line_warning
223 endfunction
224
225 " return a list containing the lengths of the long lines in this buffer
226 function! s:LongLines()
227 let threshold = (&tw ? &tw : 80)
228 let spaces = repeat(" ", &ts)
229
230 let long_line_lens = []
231
232 let i = 1
233 while i <= line("$")
234 let len = strlen(substitute(getline(i), '\t', spaces, 'g'))
235 if len > threshold
236 call add(long_line_lens, len)
237 endif
238 let i += 1
239 endwhile
240
241 return long_line_lens
242 endfunction
243
244 " find the median of the given array of numbers
245 function! s:Median(nums)
246 let nums = sort(a:nums)
247 let l = len(nums)
248
249 if l % 2 == 1
250 let i = (l-1) / 2
251 return nums[i]
252 else
253 return (nums[l/2] + nums[(l/2)-1]) / 2
254 endif
255 endfunction
5f55b6b @kennethlove initial
kennethlove authored
256
257 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
258 " BACKUPS
259 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
771f909 @kennethlove changes to .vimrc
kennethlove authored
260 set nowb
261 set noswapfile
9c6ef26 @kennethlove removed extraneous rules. added new mappings
kennethlove authored
262 set nobackup
5f55b6b @kennethlove initial
kennethlove authored
263 set viminfo=%100,'100,/100,h,\"500,:100,n~/.viminfo
264 set history=500
265 set updatecount=100
266
267 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
268 " SEARCH
269 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
270 set incsearch " do incremental searching
271 set ignorecase
272 set infercase
273 set hlsearch
274 set showmatch
275 set diffopt=filler,iwhite
811868d @kennethlove updates to vim config after stevelosh's article
kennethlove authored
276 nnoremap / /\v
277 vnoremap / /\v
278 set gdefault
5f55b6b @kennethlove initial
kennethlove authored
279
280 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
771f909 @kennethlove changes to .vimrc
kennethlove authored
281 " COMMAND-LINE
282 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
283 cno $q <C-\>eDeleteTilSlash()<CR>
284
285 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5f55b6b @kennethlove initial
kennethlove authored
286 " SETTINGS PER FILETYPE
287 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
520ce8b @kennethlove updates
kennethlove authored
288 filetype plugin indent on
5f55b6b @kennethlove initial
kennethlove authored
289 if has("autocmd")
290 " Syntax of these languages is fussy over tabs Vs spaces
291 autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
292 autocmd FileType yaml setlocal ts=4 sts=4 sw=4 expandtab
293
294 " Customisations based on house-style (arbitrary)
d683499 @kennethlove meh
kennethlove authored
295 autocmd FileType html setlocal ts=4 sts=4 sw=4 expandtab
296 autocmd FileType xhtml setlocal ts=4 sts=4 sw=4 expandtab
297 autocmd FileType htmldjango.html setlocal ts=4 sts=4 sw=4 expandtab
298 autocmd FileType htmldjango setlocal ts=4 sts=4 sw=4 expandtab
299 autocmd FileType css setlocal ts=4 sts=4 sw=4 expandtab
c7ab3b7 @kennethlove new bundles, new colorscheme, js checker
kennethlove authored
300 autocmd FileType javascript setlocal ts=4 sts=4 sw=4 expandtab
5e958c4 @kennethlove lots of updates
kennethlove authored
301 autocmd FileType python setlocal ts=4 sts=4 sw=4 expandtab
5f55b6b @kennethlove initial
kennethlove authored
302
303 " Treat .rss files as XML
d683499 @kennethlove meh
kennethlove authored
304 autocmd BufNewFile,BufRead *.rss setlocal filetype=xml
5f55b6b @kennethlove initial
kennethlove authored
305
367df1e @kennethlove updates. added autocomplpop. moved colors into a bundle
kennethlove authored
306 " Autodetect todo files
d683499 @kennethlove meh
kennethlove authored
307 autocmd BufNewFile,BufRead *.todo setlocal filetype=todo
367df1e @kennethlove updates. added autocomplpop. moved colors into a bundle
kennethlove authored
308
5e958c4 @kennethlove lots of updates
kennethlove authored
309 " Autodetect Actionscript files
2abaa01 @kennethlove updated command-t
kennethlove authored
310 au BufNewFile,BufRead *.as setlocal filetype=actionscript
5e958c4 @kennethlove lots of updates
kennethlove authored
311
5f55b6b @kennethlove initial
kennethlove authored
312 " Automatically strip extraneous whitespace when saving Python or
313 " Javascript files.
d683499 @kennethlove meh
kennethlove authored
314 "autocmd BufWritePre *.py,*.js :call <SID>StripTrailingWhitespaces()
5f55b6b @kennethlove initial
kennethlove authored
315
316 " markdown
317 augroup mkd
2abaa01 @kennethlove updated command-t
kennethlove authored
318 autocmd BufRead *.mkd setlocal ai formatoptions=tcroqn2 comments=n:>
5f55b6b @kennethlove initial
kennethlove authored
319 augroup END
320
321 " JSON syntax
d683499 @kennethlove meh
kennethlove authored
322 au! BufRead,BufNewFile *.json setlocal filetype=json
5f55b6b @kennethlove initial
kennethlove authored
323
324 " jQuery syntax
2abaa01 @kennethlove updated command-t
kennethlove authored
325 au! BufRead,BufNewFile *.js setlocal ft=javascript.jquery
5f55b6b @kennethlove initial
kennethlove authored
326
327 " Display tabs at the beginning of a line in Python mode as bad
3fb1f7e @kennethlove coloring
kennethlove authored
328 au BufRead,BufNewFile *.py,*.pyw match ExtraWhitespace /^\t\+/
5f55b6b @kennethlove initial
kennethlove authored
329 " Make trailing whitespace be flagged as bad
1aeb97e @kennethlove added .zshrc and zsh theme
kennethlove authored
330 " au BufRead,BufNewFile *.py,*.pyw match ExtraWhitespace /\s\+$/
3fb1f7e @kennethlove coloring
kennethlove authored
331 au BufRead,BufNewFile *.py,*.pyw let python_space_errors = 1
3ff59ac @kennethlove functions to show bad whitespace and long lines
kennethlove authored
332 au BufRead,BufNewfile *.py,*.pyw call s:HighlightLongLines(79)
98fcb12 @kennethlove removed misplaced bundle
kennethlove authored
333 au BufNewFile,BufRead *.py compiler nose
5f55b6b @kennethlove initial
kennethlove authored
334
335 " only UNIX line endings.
336 au BufNewFile *.* set fileformat=unix
337
338 autocmd BufEnter * :syntax sync fromstart
339
2abaa01 @kennethlove updated command-t
kennethlove authored
340 autocmd BufRead *.html setlocal filetype=htmldjango.html
341 autocmd BufRead *.py setlocal smartindent cinwords=if,else,elif,for,while,try,except,finally,def,class
46c5958 @kennethlove various changes.
kennethlove authored
342
343 " mapping to mark HTML5 files
344 autocmd BufEnter *html nmap <F7> :setfiletype html5<CR>
5f55b6b @kennethlove initial
kennethlove authored
345
346 if version >= 700
ea039d5 @kennethlove new colors. new settings for terminal and gui vim. only show colorcol…
kennethlove authored
347 autocmd FileType python setlocal omnifunc=pythoncomplete#Complete colorcolumn=80
2abaa01 @kennethlove updated command-t
kennethlove authored
348 autocmd FileType css,sass setlocal omnifunc=csscomplete#CompleteCSS
349 autocmd FileType html setlocal omnifunc=htmlcomplete#CompleteTags
350 autocmd FileType ruby,eruby setlocal omnifunc=rubycomplete#Complete
5e958c4 @kennethlove lots of updates
kennethlove authored
351 autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
352 autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
353 autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
5f55b6b @kennethlove initial
kennethlove authored
354 endif
355
2b71760 @kennethlove autocommands for HTML and css
kennethlove authored
356 " CSS, XML, and HTML file shoulds be folded based on indent
2abaa01 @kennethlove updated command-t
kennethlove authored
357 au BufNewFile,BufRead *css,*xml,*htm*,*as setlocal foldmethod=indent
2b71760 @kennethlove autocommands for HTML and css
kennethlove authored
358
359 " CSS and Sass files should see - as part of a keyword
d683499 @kennethlove meh
kennethlove authored
360 au! BufRead,BufNewFile *.sass,*.scss setlocal filetype=sass
361 au! BufRead,BufNewFile *.less setlocal filetype=less
d4b5fd9 @kennethlove updates
kennethlove authored
362
201b447 @kennethlove lots of updates
kennethlove authored
363 " PHP
364 augroup php
365 autocmd!
366 autocmd FileType php let php_sql_query=1
367 autocmd FileType php let php_htmlInString=1
368 autocmd FileType php let php_noShortTags=1
369 autocmd FileType php let php_folding=1
2abaa01 @kennethlove updated command-t
kennethlove authored
370 autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
371 augroup END
372
373 " JS
374 augroup js
375 autocmd!
d683499 @kennethlove meh
kennethlove authored
376 au FileType javascript,javascript.jquery,json setlocal foldmethod=indent
201b447 @kennethlove lots of updates
kennethlove authored
377 augroup END
378
c7ab3b7 @kennethlove new bundles, new colorscheme, js checker
kennethlove authored
379 " USE GOOGLE'S JAVASCRIPT LINTER
380 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2abaa01 @kennethlove updated command-t
kennethlove authored
381 au BufNewFile,BufRead *.js setlocal makeprg=gjslint\ %
382 au BufNewFile,BufRead *.js setlocal errorformat=%-P-----\ FILE\ \ :\ \ %f\ -----,Line\ %l\\,\ E:%n:\ %m,%-Q,%-GFound\ %s,%-GSome\ %s,%-Gfixjsstyles%s,%-Gscript\ can\ %s,%-G
c7ab3b7 @kennethlove new bundles, new colorscheme, js checker
kennethlove authored
383
079ae8a @kennethlove added abolish, minibuf++ plugins and updated .vimrc
kennethlove authored
384 " SAVE FILES WHEN VIM LOSES FOCUS
385 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
201b447 @kennethlove lots of updates
kennethlove authored
386 au FocusLost *.htm*,*.js,*.css,*.php :wa
079ae8a @kennethlove added abolish, minibuf++ plugins and updated .vimrc
kennethlove authored
387
5f55b6b @kennethlove initial
kennethlove authored
388 endif
389
390
391 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
392 " KEY MAPPINGS
393 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
367df1e @kennethlove updates. added autocomplpop. moved colors into a bundle
kennethlove authored
394 " Shortcut for square brackets "
395 onoremap id i[
396 onoremap ad a[
397
d683499 @kennethlove meh
kennethlove authored
398 " Toggle paste mode quickly
399 nnoremap <localleader>pp :set invpaste paste?<CR>
400
367df1e @kennethlove updates. added autocomplpop. moved colors into a bundle
kennethlove authored
401 " Next ()
402 vnoremap <silent> inb :<C-U>normal! f(vib<cr>
403 onoremap <silent> inb :<C-U>normal! f(vib<cr>
404 vnoremap <silent> anb :<C-U>normal! f(vab<cr>
405 onoremap <silent> anb :<C-U>normal! f(vab<cr>
406 vnoremap <silent> in( :<C-U>normal! f(vi(<cr>
407 onoremap <silent> in( :<C-U>normal! f(vi(<cr>
408 vnoremap <silent> an( :<C-U>normal! f(va(<cr>
409 onoremap <silent> an( :<C-U>normal! f(va(<cr>
410
411 " Next {}
412 vnoremap <silent> inB :<C-U>normal! f{viB<cr>
413 onoremap <silent> inB :<C-U>normal! f{viB<cr>
414 vnoremap <silent> anB :<C-U>normal! f{vaB<cr>
415 onoremap <silent> anB :<C-U>normal! f{vaB<cr>
416 vnoremap <silent> in{ :<C-U>normal! f{vi{<cr>
417 onoremap <silent> in{ :<C-U>normal! f{vi{<cr>
418 vnoremap <silent> an{ :<C-U>normal! f{va{<cr>
419 onoremap <silent> an{ :<C-U>normal! f{va{<cr>
420
421 " Next []
422 vnoremap <silent> ind :<C-U>normal! f[vi[<cr>
423 onoremap <silent> ind :<C-U>normal! f[vi[<cr>
424 vnoremap <silent> and :<C-U>normal! f[va[<cr>
425 onoremap <silent> and :<C-U>normal! f[va[<cr>
426 vnoremap <silent> in[ :<C-U>normal! f[vi[<cr>
427 onoremap <silent> in[ :<C-U>normal! f[vi[<cr>
428 vnoremap <silent> an[ :<C-U>normal! f[va[<cr>
429 onoremap <silent> an[ :<C-U>normal! f[va[<cr>
430
431 " Next <>
432 vnoremap <silent> in< :<C-U>normal! f<vi<<cr>
433 onoremap <silent> in< :<C-U>normal! f<vi<<cr>
434 vnoremap <silent> an< :<C-U>normal! f<va<<cr>
435 onoremap <silent> an< :<C-U>normal! f<va<<cr>
436
437 " Next ''
438 vnoremap <silent> in' :<C-U>normal! f'vi'<cr>
439 onoremap <silent> in' :<C-U>normal! f'vi'<cr>
440 vnoremap <silent> an' :<C-U>normal! f'va'<cr>
441 onoremap <silent> an' :<C-U>normal! f'va'<cr>
442
443 " Next ""
444 vnoremap <silent> in" :<C-U>normal! f"vi"<cr>
445 onoremap <silent> in" :<C-U>normal! f"vi"<cr>
446 vnoremap <silent> an" :<C-U>normal! f"va"<cr>
447 onoremap <silent> an" :<C-U>normal! f"va"<cr>
448
f50f235 @kennethlove added html5 submodule
kennethlove authored
449 " Omnicompletion keymappings
450 inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
451 inoremap <expr> <C-n> pumvisible() ? '<C-n>' : '<C-n><C-r>=pumvisible() ? "\<Down>" : ""<CR>'
452 inoremap <expr> <M-,> pumvisible() ? '<C-n>' : '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<Down>" : ""<CR>'
453
771f909 @kennethlove changes to .vimrc
kennethlove authored
454 " CD to directory of current file
455 map <Leader>cd :cd %:p:h<CR>
456
5f55b6b @kennethlove initial
kennethlove authored
457 " Grep/QuickFix window bindings
771f909 @kennethlove changes to .vimrc
kennethlove authored
458 map <Leader>c :botright cw 10<CR>
5f55b6b @kennethlove initial
kennethlove authored
459
460 " Don't move around in Insert mode
461 inoremap <Left> <Esc><Right><Left>
462 inoremap <Right> <Esc><Right><Right>
463 inoremap <Up> <Esc><Right><Up>
464 inoremap <Down> <Esc><Right><Down>
465
466 " Easily move chunks of text
467 nnoremap <A-j> :m+<CR>==
468 nnoremap <A-k> :m-2<CR>==
469 inoremap <A-j> <Esc>:m+<CR>==gi
470 inoremap <A-k> <Esc>:m-2<CR>==gi
471 vnoremap <A-j> :m'>+<CR>gv=gv
472 vnoremap <A-k> :m-2<CR>gv=gv
473
474 " Mac OS X/Safari keybindings for tabs
6d1d7d8 @kennethlove stuff
kennethlove authored
475 nmap <D-{> :tabprevious<CR>
476 nmap <D-}> :tabnext<CR>
477 map <D-{> :tabprevious<CR>
478 map <D-}> :tabnext<CR>
479 imap <D-{> <Esc>:tabprevious<CR>i
480 imap <D-}> <Esc>:tabnext<CR>i
5f55b6b @kennethlove initial
kennethlove authored
481 nmap <D-t> :tabnew<CR>
482 imap <D-t> <Esc>:tabnew<CR>
483
484 " Bind Command-arrow/movement to move between windows
485 map <D-J> <C-W>j
486 map <D-S-Down> <C-W>j
487 map <D-K> <C-W>k
488 map <D-S-Up> <C-W>k
489 map <D-H> <C-W>h
490 map <D-S-Left> <C-W>h
491 map <D-L> <C-W>l
492 map <D-S-Right> <C-W>l
493
3ff59ac @kennethlove functions to show bad whitespace and long lines
kennethlove authored
494 map <D-0> <C-W>= " make Command-0 equal windows
5f55b6b @kennethlove initial
kennethlove authored
495
811868d @kennethlove updates to vim config after stevelosh's article
kennethlove authored
496 nnoremap <leader>w <C-w>v<C-w>l
497
5f55b6b @kennethlove initial
kennethlove authored
498 " If I forgot to sudo a file, do that with :w!!
499 cmap w!! %!sudo tee > /dev/null %
500
501 " Don't use Ex mode, use Q for formatting
502 nmap Q gq
503
504 " Turn hidden characters on/off
cb95406 @kennethlove changed localleader. added gundo again and added threesome
kennethlove authored
505 nmap <silent> <leader>s :set nolist!<CR>
5f55b6b @kennethlove initial
kennethlove authored
506
507 " Up/down go visually instead of by physical lines
508 " Interactive ones need to check whether we're in the autocomplete popup
509 map <up> gk
d4b5fd9 @kennethlove updates
kennethlove authored
510 "inoremap <up> <C-R>=pumvisible() ? "\<lt>up>" : "\<lt>C-o>gk"<Enter>
5f55b6b @kennethlove initial
kennethlove authored
511 map <down> gj
d4b5fd9 @kennethlove updates
kennethlove authored
512 "inoremap <down> <C-R>=pumvisible() ? "\<lt>down>" : "\<lt>C-o>gj"<Enter>
5f55b6b @kennethlove initial
kennethlove authored
513
514 " Map normal mode Enter to add a new line before the current one
515 nmap <Enter> O<Esc>
516
811868d @kennethlove updates to vim config after stevelosh's article
kennethlove authored
517 " Makes ; work for :
518 nnoremap ; :
5f55b6b @kennethlove initial
kennethlove authored
519
520 " Makes W send w when it's a command
521 command! W w
522
811868d @kennethlove updates to vim config after stevelosh's article
kennethlove authored
523 " Deactivate the default F1 behavior of launching VIM help.
524 inoremap <F1> <ESC>
525 nnoremap <F1> <ESC>
526 vnoremap <F1> <ESC>
527
5f55b6b @kennethlove initial
kennethlove authored
528 " bind command-]/command-[ to act like TextMate
529 nmap <D-]> >>
530 nmap <D-[> <<
531 vmap <D-]> >gv
532 vmap <D-[> <gv
533
771f909 @kennethlove changes to .vimrc
kennethlove authored
534 " Toggle search highlight
e25d648 @kennethlove moved color column. change shortcut to turn off search highlight. add…
kennethlove authored
535 nnoremap <silent> \ :silent :set invhlsearch<CR>:set hlsearch?<CR>
5f55b6b @kennethlove initial
kennethlove authored
536
537 " Folds
538 nnoremap <silent> <Space> @=(foldlevel('.')?'za':'l')<CR>
539 " set <space> to toggle folds in normal & visual modes
540 nnoremap <space> za
541 vnoremap <space> zf
542
543 " Searching
544 nmap n nzzzv
545 nmap N Nzzzv
546 nmap * *zzzv
547 nmap # #zzzv
548 nmap g* g*zzzv
549 nmap g# g#zzzv
550
771f909 @kennethlove changes to .vimrc
kennethlove authored
551 " Mappings for cope
9c6ef26 @kennethlove removed extraneous rules. added new mappings
kennethlove authored
552 nmap <leader>cc :botright cope<CR>
553 nmap <leader>n :cn<CR>
554 nmap <leader>p :cp<CR>
555 nmap <leader>ll :ll<CR>
771f909 @kennethlove changes to .vimrc
kennethlove authored
556
d4b5fd9 @kennethlove updates
kennethlove authored
557 " Mapping for tabs/buffers
9c6ef26 @kennethlove removed extraneous rules. added new mappings
kennethlove authored
558 nmap gz :bdelete<CR>
559 nmap gb :bnext<CR>
560 nmap gB :bprev<CR>
99f7e7c @kennethlove updates. removed minibufexpl after too many buffer problems. added ca…
kennethlove authored
561 nmap <leader>reset :0,3000bd<CR>
d4b5fd9 @kennethlove updates
kennethlove authored
562
19a46b8 @kennethlove binding to sort css files alphabetically
kennethlove authored
563 " Sort CSS files alphabetically
564 nmap sort :g#\({\n\)\@<=#.,/}/sort<CR>
565
811868d @kennethlove updates to vim config after stevelosh's article
kennethlove authored
566 " Make <leader>ft fold an HTML tag
567 nnoremap <leader>ft Vatzf
568
569 " Sort CSS properties
570 nnoremap <leader>S ?{<CR>jV/^\s*\}?$<CR>k:sort<CR>:noh<CR>
571
572 " Reselect just-pasted text
573 nnoremap <leader>v V`]
574
575 " In addition to <esc>, jj will exit to normal mode.
576 inoremap jj <ESC>
577
578 " Launch Ack quicker
579 nnoremap <leader>a :Ack
580
46c5958 @kennethlove various changes.
kennethlove authored
581 " Use - to open Explore
582 nnoremap - :Explore<CR>
583
5f55b6b @kennethlove initial
kennethlove authored
584 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
585 " PLUGIN SETTINGS
586 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
f96d789 @kennethlove removed command-t since i'm using ctrlp
kennethlove authored
587
588 " Buffergator
589 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
590 let g:buffergator_viewport_split_policy="T"
591 let g:buffergator_split_size=10
592
593 " CtrlP
594 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
595 let g:ctrlp_map = "<c-a>"
7e14074 @kennethlove ignore .git/.hg etc folders and all .pyc files
kennethlove authored
596 let g:ctrlp_custom_ignore = {
597 \ 'dir': '\.git$\|\.hg$\|\.svn$',
598 \ 'file': '\.pyc$',
599 \ }
f96d789 @kennethlove removed command-t since i'm using ctrlp
kennethlove authored
600 let g:ctrlp_working_path_mode = 2
7e14074 @kennethlove ignore .git/.hg etc folders and all .pyc files
kennethlove authored
601 let g:ctrlp_dotfiles = 0
f96d789 @kennethlove removed command-t since i'm using ctrlp
kennethlove authored
602
98fcb12 @kennethlove removed misplaced bundle
kennethlove authored
603 " POWERLINE
604 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
605 let g:Powerline_symbols = "fancy"
5f55b6b @kennethlove initial
kennethlove authored
606
b21f7b4 @kennethlove added simplenote plugin and Tomorrow theme
kennethlove authored
607 " SIMPLENOTE
608 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
609 source ~/.simplenoterc
610
448796e @kennethlove updates
kennethlove authored
611 " DJANGO NOSE & PYTEST
612 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
613 map <leader>dt :set makeprg=python\ manage.py\ test\|:call MakeGreen()<CR>
614 " Execute the tests
615 nmap <silent><Leader>tf <Esc>:Pytest file<CR>
616 nmap <silent><Leader>tc <Esc>:Pytest class<CR>
617 nmap <silent><Leader>tm <Esc>:Pytest method<CR>
618 " cycle through test errors
619 nmap <silent><Leader>tn <Esc>:Pytest next<CR>
620 nmap <silent><Leader>tp <Esc>:Pytest previous<CR>
621 nmap <silent><Leader>te <Esc>:Pytest error<CR>
622
623 " ROPEVIM
624 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
625 map <leader>j :RopeGotoDefinition<CR>
626 map <leader>r :RopeRename<CR>
627
628 " TASKLIST
629 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
630 nnoremap <leader>td <Plug>TaskList
631
7c75aea @kennethlove colors for easymotion
kennethlove authored
632 " EASYMOTION
633 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
634 let g:EasyMotion_do_shade = 1
635
2b56a2b @kennethlove updates
kennethlove authored
636 " CHAPA
637 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
638 let g:chapa_default_mappings=1
639
99f7e7c @kennethlove updates. removed minibufexpl after too many buffer problems. added ca…
kennethlove authored
640 " VIMWIKI
641 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
642 map <leader>tt <Plug>VimwikiToggleListItem
ce6c0d1 @kennethlove removed git-wip and more
kennethlove authored
643 let g:vimwiki_list= [{'path': '~/Dropbox/PlainText/vimwiki/', 'path_html': '~/Dropbox/Public/vimwiki/', 'ext': '.txt'}]
99f7e7c @kennethlove updates. removed minibufexpl after too many buffer problems. added ca…
kennethlove authored
644
e2887f0 @kennethlove lots of new colorschemes. rearranged python, html, and css plugins/sy…
kennethlove authored
645
33ebbd3 @kennethlove removed sparkup. added autocomplpop.
kennethlove authored
646 " ZENCODING
647 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
648 let g:user_zen_expandabbr_key = '<c-e>'
649
910de4e @kennethlove all sorts of stuff
kennethlove authored
650 " SEQUENCE
651 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
652 vmap <m-a> <plug>SequenceV_Increment
653 vmap <m-x> <plug>SequenceV_Decrement
654 nmap <m-a> <plug>SequenceN_Increment
655 nmap <m-x> <plug>SequenceN_Decrement
656 vmap <c-a> <plug>SequenceAdd
657 vmap <c-x> <plug>SequenceSubtract
658
201b447 @kennethlove lots of updates
kennethlove authored
659 " GUNDO
660 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
661 nnoremap <F4> :GundoToggle<CR>
662
46c5958 @kennethlove various changes.
kennethlove authored
663 " SUPERTAB
fd702d4 @kennethlove updates
kennethlove authored
664 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
448796e @kennethlove updates
kennethlove authored
665 let g:SuperTabDefaultCompletionType = 'context'
46c5958 @kennethlove various changes.
kennethlove authored
666 let g:SuperTabMappingTabLiteral = '<a-tab>'
fd702d4 @kennethlove updates
kennethlove authored
667
46c5958 @kennethlove various changes.
kennethlove authored
668 " PYDICTION
9c6ef26 @kennethlove removed extraneous rules. added new mappings
kennethlove authored
669 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
46c5958 @kennethlove various changes.
kennethlove authored
670 let g:pydiction_location = "~/.vim/bundle/pydiction/complete-dict"
5f55b6b @kennethlove initial
kennethlove authored
671
672 " MATCHIT
673 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
674 runtime plugins/matchit.vim
675 let b:match_ignorecase = 1
676
677 " NETRW
678 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
679 " Default to tree view
680 let g:netrw_lifestyle = 3
681 " hide common hidden files
682 let g:netrw_list_hide = '.*\.py[co]$,\.git$,\.swp$'
683 " Don't use fricken elinks, wtf
684 let g:netrw_http_cmd = "wget -q -O" " or 'curl -Ls -o'
685 let g:netrw_winsize = 10
686 let g:netrw_alto = 1
687
35ce71e @kennethlove removed unused plugins. added testing to .vimrc for python files/djan…
kennethlove authored
688 " EASYTAGS
689 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
690 let g:easytags_resolve_links = 1
3fb1f7e @kennethlove coloring
kennethlove authored
691 let g:easytags_cmd = '/usr/local/bin/ctags'
35ce71e @kennethlove removed unused plugins. added testing to .vimrc for python files/djan…
kennethlove authored
692
5f55b6b @kennethlove initial
kennethlove authored
693 " TAGLIST
694 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3fb1f7e @kennethlove coloring
kennethlove authored
695 let Tlist_Use_Right_Window = 1
696 let Tlist_Auto_Open = 0
697 let Tlist_Enable_Fold_Column = 0
698 let Tlist_Compact_Format = 1
699 let Tlist_WinWidth = 40
700 let Tlist_Exit_OnlyWindow = 1
701 let Tlist_File_Fold_Auto_Close = 1
702 let Tlist_Sort_Type = 'name'
703 let Tlist_Ctags_Cmd = '/usr/local/bin/ctags'
704 let Tlist_Show_Menu = 1
705 let Tlist_GainFocus_On_ToggleOpen = 1
706 let Tlist_Close_On_Select = 1
707 let Tlist_Auto_Update = 1
e25d648 @kennethlove moved color column. change shortcut to turn off search highlight. add…
kennethlove authored
708 let Tlist_Show_One_File = 1
e735b4c @kennethlove solarized theme w/ changes to bash prompt
kennethlove authored
709 let g:tlist_javascript_settings = 'js;javascript;s:string;a:array;o:object;f:function'
e25d648 @kennethlove moved color column. change shortcut to turn off search highlight. add…
kennethlove authored
710
5f85194 @kennethlove updates to .zshrc for brew and to .vimrc for tagbar
kennethlove authored
711 "nnoremap <silent> <Leader>T :TlistToggle<CR>
712
713 " TAGBAR
714 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
715 let g:tagbar_usearrows = 1
716 let g:tagbar_ctags_bin = "/usr/local/bin/ctags"
717 let g:tagbar_autoshowtag = 1
718
719 nnoremap <leader>T :TagbarOpenAutoClose<CR>
5f55b6b @kennethlove initial
kennethlove authored
720
721 " RAGTAG
722 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
079ae8a @kennethlove added abolish, minibuf++ plugins and updated .vimrc
kennethlove authored
723 inoremap <M-o> <Esc>o
724 inoremap <C-j> <Down>
5f55b6b @kennethlove initial
kennethlove authored
725 let g:ragtag_global_maps = 1
726
727 " NERD_TREE
728 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
20eef6f @kennethlove conque plugin. .vimrc changes to make nerd tree better. .gvimrc chang…
kennethlove authored
729 nmap <Leader>d :NERDTreeFind<CR>
5f55b6b @kennethlove initial
kennethlove authored
730 let g:NERDChristmasTree = 1
731 let g:NERDTreeQuitOnOpen = 1
732 let g:NERDTreeWinPos = 'right'
201b447 @kennethlove lots of updates
kennethlove authored
733 let g:NERDTreeWinSize = 30
5f55b6b @kennethlove initial
kennethlove authored
734 let g:NERDTreeChDirMode = 2
735 let g:NERDTreeShowHidden = 1
736 let g:NERDTreeAutoCenter = 1
737 let g:NERDTreeIgnore = ['\.git$', '\.svn$', '\.jpg$', '\.gif$', '\.png$', '\.pyc', '\.DS_Store']
738 let g:NERDTreeShowBookmarks = 1
739 let g:NERDTreeSortOrder = ['\/$', '*']
d3d93c5 @kennethlove show line numbers in NERDTree, smaller scroll offset, new statusline
kennethlove authored
740 let g:NERDTreeShowLineNumbers = 1
ea039d5 @kennethlove new colors. new settings for terminal and gui vim. only show colorcol…
kennethlove authored
741 let g:NERDTreeMinimalUI = 1
5f55b6b @kennethlove initial
kennethlove authored
742
743 " YANKRING
744 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
811868d @kennethlove updates to vim config after stevelosh's article
kennethlove authored
745 nnoremap <silent> <F3> :YRShow<CR>
746 inoremap <silent> <F3> <ESC>:YRShow<CR>
5f55b6b @kennethlove initial
kennethlove authored
747 "
748 " skip all single-letter deletes (x)
749 let g:yankring_min_element_length = 2
750 "
751 " save last 50 items in history, only show last 50 in window
752 let g:yankring_max_history = 50
753 let g:yankring_max_display = 50
754 "
755 " save yankring entries across vim instances
756 let g:yankring_persist = 1
757 let g:yankring_share_between_instances = 1
758 "
759 " don't save duplicates
760 let g:yankring_ignore_duplicate = 1
761
762 " use a separate vertical split window that auto-closes and
763 " is 30 chars wide on the right side
764 let g:yankring_window_use_separate = 1
765 let g:yankring_window_use_horiz = 0
766 let g:yankring_window_auto_close = 1
767 let g:yankring_window_width = 50
768 let g:yankring_window_use_right = 1
769
770 " pressing <space> will increase the size of the window by 15 columns
771 let g:yankring_window_increment = 15
772
773 " have yankring manage Vim's numbered registers ("0-"9)
774 let g:yankring_manage_numbered_reg = 1
775
776 " keep the history file in the $HOME/.vim folder instead of $HOME
777 let g:yankring_history_dir = '$HOME/.vim'
778
779 " yankring keeps an eye on the clipboard
780 let g:yankring_clipboard_monitor = 1
781
782 " if something changes the default register without going through
783 " yankring, use the default register value rather than the top item in
784 " yankring's history
785 let g:yankring_paste_check_default_buffer = 1
786
787 " SYNTASTIC
788 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
789 " use signs to indicate lines with errors
790 " only if signs are available
0d39e09 @kennethlove re-added the signs check for syntastic
kennethlove authored
791 if has('signs')
792 let g:syntastic_enable_signs = 1
793 endif
794 "let g:syntastic_enable_signs = 1
5f55b6b @kennethlove initial
kennethlove authored
795
796 " automatically open the location list when a buffer has errors
797 let g:syntastic_auto_loc_list = 1
798
799 " always show warnings
800 let g:syntastic_quiet_warnings = 0
801
802 " ignore djangohtml
46c5958 @kennethlove various changes.
kennethlove authored
803 let g:syntastic_disabled_filetypes = ['htmldjango', 'txt', 'text', 'tumblr', 'css', 'html5']
5f55b6b @kennethlove initial
kennethlove authored
804
a5ffb2d @kennethlove updates
kennethlove authored
805 " ARGUMENT REWRAP
806 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
807 nnoremap <silent> <leader>ar :call argumentrewrap#RewrapArguments()<CR>
808
5f55b6b @kennethlove initial
kennethlove authored
809 " SCRATCH BUFFER
810 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
f7de3d7 @kennethlove updated
kennethlove authored
811 function! s:ToggleScratch()
812 if expand('%') == g:ScratchBufferName
813 quit
814 else
815 Sscratch
816 endif
817 endfunction
811868d @kennethlove updates to vim config after stevelosh's article
kennethlove authored
818 nmap <leader><tab> :call <SID>ToggleScratch()<CR>
5f55b6b @kennethlove initial
kennethlove authored
819
820 " BUFEXPLORER
821 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
822 let g:bufExplorerSortBy = 'mru'
823 let g:bufExplorerSplitBelow = 1
824 let g:bufExplorerSplitRight = 1
771f909 @kennethlove changes to .vimrc
kennethlove authored
825 let g:bufExplorerDefaultHelp = 0
826 let g:bufExplorerShowRelativePath = 1
5f55b6b @kennethlove initial
kennethlove authored
827
828 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3ff59ac @kennethlove functions to show bad whitespace and long lines
kennethlove authored
829 " FUNCTIONS
5f55b6b @kennethlove initial
kennethlove authored
830 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
831
3ff59ac @kennethlove functions to show bad whitespace and long lines
kennethlove authored
832 " HIGHLIGHT LONG LINES
5f55b6b @kennethlove initial
kennethlove authored
833 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3ff59ac @kennethlove functions to show bad whitespace and long lines
kennethlove authored
834 command! -nargs=? HighlightLongLines call s:HighlightLongLines('<args>')
835 function! s:HighlightLongLines(width)
836 let targetWidth = a:width != '' ? a:width : 79
837 if targetWidth > 0
838 exec 'match Error /\%>' . (targetWidth) . 'v/'
839 else
840 echomsg "Usage: HighlightLongLines [natural number]"
841 endif
842 endfunction
1370b6a @kennethlove updates
kennethlove authored
843 nmap <leader>h :HighlightLongLines<CR>
5f55b6b @kennethlove initial
kennethlove authored
844
845 " SEARCH FOR VISUAL SELECTION
846 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3723edb @kennethlove new visual search function and better nerdtree map
kennethlove authored
847 function! s:VSetSearch()
848 let temp = @@
849 norm! gvy
850 let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g')
851 let @@ = temp
5f55b6b @kennethlove initial
kennethlove authored
852 endfunction
853
3723edb @kennethlove new visual search function and better nerdtree map
kennethlove authored
854 vnoremap * :<C-u>call <SID>VSetSearch()<CR>//<CR>
855 vnoremap # :<C-u>call <SID>VSetSearch()<CR>??<CR>
856
5f55b6b @kennethlove initial
kennethlove authored
857 " STAB: SET TABSTOPS
858 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
859 " Set tabstop, softtabstop and shiftwidth to the same value
860 command! -nargs=* Stab call Stab()
861 function! Stab()
862 let l:tabstop = 1 * input('set tabstop = softtabstop = shiftwidth = ')
863 if l:tabstop > 0
864 let &l:sts = l:tabstop
865 let &l:ts = l:tabstop
866 let &l:sw = l:tabstop
867 endif
868 call SummarizeTabs()
869 endfunction
870
871 function! SummarizeTabs()
872 try
873 echohl ModeMsg
874 echon 'tabstop='.&l:ts
875 echon ' shiftwidth='.&l:sw
876 echon ' softtabstop='.&l:sts
877 if &l:et
878 echon ' expandtab'
879 else
880 echon ' noexpandtab'
881 end
882 finally
883 echohl None
884 endtry
885 endfunction
886
887 " STRIP TRAILING WHITESPACE
888 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
889 function! <SID>StripTrailingWhitespaces()
890 " Preparation: save last search, and cursor position.
891 let _s=@/
892 let l = line(".")
893 let c = col(".")
894 " Do the business:
895 %s/\s\+$//e
896 " Clean up: restore previous search history, and cursor position
897 let @/=_s
898 call cursor(l, c)
899 endfunction
900
901 nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>
902
903 " DISPLAY OUTPUT OF SHELL COMMANDS IN SCRATCH BUFFER
904 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
905 command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
906 function! s:RunShellCommand(cmdline)
907 let isfirst = 1
908 let words = []
909 for word in split(a:cmdline)
910 if isfirst
911 let isfirst = 0 " don't change first word (shell command)
912 else
913 if word[0] =~ '\v[%#<]'
914 let word = expand(word)
915 endif
916 let word = shellescape(word, 1)
917 endif
918 call add(words, word)
919 endfor
920 let expanded_cmdline = join(words)
921 botright new
922 setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
923 silent execute '$read !'. expanded_cmdline
924 1
925 endfunction
926
771f909 @kennethlove changes to .vimrc
kennethlove authored
927 func! Cwd()
928 let cwd = getcwd()
929 return "e " . cwd
930 endfunc
931
932 func! DeleteTilSlash()
933 let g:cmd = getcmdline()
934 let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*", "\\1", "")
935 if g:cmd == g:cmd_edited
936 let g:cmd_edited = substitute(g:cmd, "\\(.*\[/\]\\).*/", "\\1", "")
937 endif
938 return g:cmd_edited
939 endfunc
940
941 func! CurrentFileDir(cmd)
942 return a:cmd . " " . expand("%:p:h") . "/"
943 endfunc
944
945 func! CurDir()
946 let curdir = substitute(getcwd(), '/Users/kennethlove', "~/", "g")
947 return curdir
948 endfunc
5f55b6b @kennethlove initial
kennethlove authored
949
950 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
951 " MISCELLANEOUS
952 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
953 " This beauty remembers where you were the last time you edited the file, and returns to the same position.
954 au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
955
448796e @kennethlove updates
kennethlove authored
956 " Add the virtualenv's site-packages to vim path
da3ba54 @kennethlove removed some stuff
kennethlove authored
957 py << EOF
958 import os.path
959 import sys
960 import vim
961 if os.environ['VIRTUAL_ENV']:
962 project_base_dir = os.environ['VIRTUAL_ENV']
963 sys.path.insert(0, project_base_dir)
964 activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
965 execfile(activate_this, dict(__file__=activate_this))
966 EOF
a6aa179 @kennethlove added vimtodo
kennethlove authored
967
d683499 @kennethlove meh
kennethlove authored
968 nmap <F3> <C-R>=strftime("%Y-%m-%d %H:%M:%S")<CR><Esc>
969 imap <F3> <C-R>=strftime("%Y-%m-%d %H:%M:%S")<CR>
98fcb12 @kennethlove removed misplaced bundle
kennethlove authored
970
Something went wrong with that request. Please try again.