Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 771 lines (644 sloc) 23.091 kb
27043da Added some helpers for graphviz and tex in the XPTemplate configuration,...
Derek Wyatt authored
1 "
2 " Derek Wyatt's Vim Configuration
3 "
4 " It's got stuff in it.
5 "
6
451f244 first commit
Derek Wyatt authored
7 "-----------------------------------------------------------------------------
8 " Global Stuff
9 "-----------------------------------------------------------------------------
10
11 " Get pathogen up and running
12 filetype off
13 call pathogen#runtime_append_all_bundles()
14 call pathogen#helptags()
15
93494a5 Added ActionScript bundle to Vim. Modified a bit to handle the recent X...
Derek Wyatt authored
16 " Add xptemplate global personal directory value
17 if has("unix")
18 set runtimepath+=~/.vim/xpt-personal
19 endif
20
451f244 first commit
Derek Wyatt authored
21 " Set filetype stuff to on
22 filetype on
23 filetype plugin on
24 filetype indent on
25
26 " Tabstops are 4 spaces
083691b Lots of little updates. Most notably, as of late, added some maps to pu...
Derek Wyatt authored
27 set tabstop=2
28 set shiftwidth=2
29 set softtabstop=2
451f244 first commit
Derek Wyatt authored
30 set expandtab
31 set autoindent
32
9db6c66 Added the ultra-cool 'clear text op-pending command'. Awesome.
Derek Wyatt authored
33 " Printing options
34 set printoptions=header:0,duplex:long,paper:letter
35
451f244 first commit
Derek Wyatt authored
36 " set the search scan to wrap lines
37 set wrapscan
38
39 " I'm happy to type the case of things. I tried the ignorecase, smartcase
40 " thing but it just wasn't working out for me
41 set noignorecase
42
43 " set the forward slash to be the slash of note. Backslashes suck
44 set shellslash
45 if has("unix")
46 set shell=bash
47 else
48 set shell=ksh.exe
49 endif
50
51 " Make command line two lines high
52 set ch=2
53
54 " set visual bell -- i hate that damned beeping
55 set vb
56
57 " Allow backspacing over indent, eol, and the start of an insert
58 set backspace=2
59
60 " Make sure that unsaved buffers that are to be put in the background are
61 " allowed to go in there (ie. the "must save first" error doesn't come up)
62 set hidden
63
64 " Make the 'cw' and like commands put a $ at the end instead of just deleting
65 " the text and replacing it
66 set cpoptions=ces$
67
68 " Set the status line the way i like it
69 set stl=%f\ %m\ %r%{fugitive#statusline()}\ Line:%l/%L[%p%%]\ Col:%v\ Buf:#%n\ [%b][0x%B]
70
71 " tell VIM to always put a status line in, even if there is only one window
72 set laststatus=2
73
74 " Don't update the display while executing macros
75 set lazyredraw
76
77 " Don't show the current command int he lower right corner. In OSX, if this is
78 " set and lazyredraw is set then it's slow as molasses, so we unset this
79 set showcmd
80
81 " Show the current mode
82 set showmode
83
84 " Switch on syntax highlighting.
85 syntax on
86
87 " Hide the mouse pointer while typing
88 set mousehide
89
90 " Set up the gui cursor to look nice
91 set guicursor=n-v-c:block-Cursor-blinkon0,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor,r-cr:hor20-Cursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
92
93 " set the gui options the way I like
94 set guioptions=acg
95
96 " Setting this below makes it sow that error messages don't disappear after one second on startup.
97 "set debug=msg
98
99 " This is the timeout used while waiting for user input on a multi-keyed macro
100 " or while just sitting and waiting for another key to be pressed measured
101 " in milliseconds.
102 "
103 " i.e. for the ",d" command, there is a "timeoutlen" wait period between the
104 " "," key and the "d" key. If the "d" key isn't pressed before the
105 " timeout expires, one of two things happens: The "," command is executed
106 " if there is one (which there isn't) or the command aborts.
107 set timeoutlen=500
108
109 " Keep some stuff in the history
110 set history=100
111
112 " These commands open folds
113 set foldopen=block,insert,jump,mark,percent,quickfix,search,tag,undo
114
115 " When the page starts to scroll, keep the cursor 8 lines from the top and 8
116 " lines from the bottom
117 set scrolloff=8
118
119 " Allow the cursor to go in to "invalid" places
120 set virtualedit=all
121
122 " Disable encryption (:X)
123 set key=
124
125 " Make the command-line completion better
126 set wildmenu
127
128 " Same as default except that I remove the 'u' option
129 set complete=.,w,b,t
130
131 " When completing by tag, show the whole tag, not just the function name
132 set showfulltag
133
134 " Set the textwidth to be 80 chars
135 set textwidth=80
136
137 " get rid of the silly characters in separators
138 set fillchars = ""
139
140 " Add ignorance of whitespace to diff
141 set diffopt+=iwhite
142
143 " Enable search highlighting
144 set hlsearch
145
146 " Incrementally match the search
147 set incsearch
148
149 " Add the unnamed register to the clipboard
150 set clipboard+=unnamed
151
152 " Automatically read a file that has changed on disk
153 set autoread
154
155 set grepprg=grep\ -nH\ $*
156
56df4f3 Added a bunch of bundles of Marc Weber's in preparation for ENSIME
Derek Wyatt authored
157 " Trying out the line numbering thing... never liked it, but that doesn't mean
158 " I shouldn't give it another go :)
159 set relativenumber
160
451f244 first commit
Derek Wyatt authored
161 " dictionary for english words
162 " I don't actually use this much at all and it makes my life difficult in general
163 "set dictionary=$VIM/words.txt
164
165 " Let the syntax highlighting for Java files allow cpp keywords
166 let java_allow_cpp_keywords = 1
167
168 " System default for mappings is now the "," character
169 let mapleader = ","
170
171 " Wipe out all buffers
172 nmap <silent> ,wa :1,9000bwipeout<cr>
173
174 " Toggle paste mode
175 nmap <silent> ,p :set invpaste<CR>:set paste?<CR>
176
177 " cd to the directory containing the file in the buffer
178 nmap <silent> ,cd :lcd %:h<CR>
179 nmap <silent> ,md :!mkdir -p %:p:h<CR>
180
181 " Turn off that stupid highlight search
182 nmap <silent> ,n :nohls<CR>
183
184 " put the vim directives for my file editing settings in
185 nmap <silent> ,vi ovim:set ts=2 sts=2 sw=2:<CR>vim600:fdm=marker fdl=1 fdc=0:<ESC>
186
187 " Show all available VIM servers
188 nmap <silent> ,ss :echo serverlist()<CR>
189
190 " The following beast is something i didn't write... it will return the
191 " syntax highlighting group that the current "thing" under the cursor
192 " belongs to -- very useful for figuring out what to change as far as
193 " syntax highlighting goes.
194 nmap <silent> ,qq :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
195
196 " Make shift-insert work like in Xterm
197 map <S-Insert> <MiddleMouse>
198 map! <S-Insert> <MiddleMouse>
199
200 " set text wrapping toggles
201 nmap <silent> ,ww :set invwrap<CR>:set wrap?<CR>
202
203 " allow command line editing like emacs
204 cnoremap <C-A> <Home>
205 cnoremap <C-B> <Left>
206 cnoremap <C-E> <End>
207 cnoremap <C-F> <Right>
208 cnoremap <C-N> <End>
209 cnoremap <C-P> <Up>
210 cnoremap <ESC>b <S-Left>
211 cnoremap <ESC><C-B> <S-Left>
212 cnoremap <ESC>f <S-Right>
213 cnoremap <ESC><C-F> <S-Right>
214 cnoremap <ESC><C-H> <C-W>
215
216 " Maps to make handling windows a bit easier
217 "noremap <silent> ,h :wincmd h<CR>
218 "noremap <silent> ,j :wincmd j<CR>
219 "noremap <silent> ,k :wincmd k<CR>
220 "noremap <silent> ,l :wincmd l<CR>
221 "noremap <silent> ,sb :wincmd p<CR>
222 noremap <silent> <C-F9> :vertical resize -10<CR>
223 noremap <silent> <C-F10> :resize +10<CR>
224 noremap <silent> <C-F11> :resize -10<CR>
225 noremap <silent> <C-F12> :vertical resize +10<CR>
226 noremap <silent> ,s8 :vertical resize 83<CR>
227 noremap <silent> ,cj :wincmd j<CR>:close<CR>
228 noremap <silent> ,ck :wincmd k<CR>:close<CR>
229 noremap <silent> ,ch :wincmd h<CR>:close<CR>
230 noremap <silent> ,cl :wincmd l<CR>:close<CR>
231 noremap <silent> ,cc :close<CR>
232 noremap <silent> ,cw :cclose<CR>
233 noremap <silent> ,ml <C-W>L
234 noremap <silent> ,mk <C-W>K
235 noremap <silent> ,mh <C-W>H
236 noremap <silent> ,mj <C-W>J
237 noremap <silent> <C-7> <C-W>>
238 noremap <silent> <C-8> <C-W>+
239 noremap <silent> <C-9> <C-W>+
240 noremap <silent> <C-0> <C-W>>
241
242 " Edit the vimrc file
243 nmap <silent> ,ev :e $MYVIMRC<CR>
244 nmap <silent> ,sv :so $MYVIMRC<CR>
245
246 " Make horizontal scrolling easier
247 nmap <silent> <C-o> 10zl
248 nmap <silent> <C-i> 10zh
249
250 " Add a GUID to the current line
251 imap <C-J>d <C-r>=substitute(system("uuidgen"), '.$', '', 'g')<CR>
252
253 " Search the current file for what's currently in the search register and display matches
254 nmap <silent> ,gs :vimgrep /<C-r>// %<CR>:ccl<CR>:cwin<CR><C-W>J:nohls<CR>
255
256 " Search the current file for the word under the cursor and display matches
257 nmap <silent> ,gw :vimgrep /<C-r><C-w>/ %<CR>:ccl<CR>:cwin<CR><C-W>J:nohls<CR>
258
259 " Search the current file for the WORD under the cursor and display matches
260 nmap <silent> ,gW :vimgrep /<C-r><C-a>/ %<CR>:ccl<CR>:cwin<CR><C-W>J:nohls<CR>
261
262 " Swap two words
263 nmap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
264
265 " Toggle fullscreen mode
266 nmap <silent> <F3> :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
267
268 " Underline the current line with '='
16c4e68 @derekwyatt GPG stuff for the mac, better maps for doing my underlining, ditched vim...
authored
269 nmap <silent> ,u= :t.\|s/./=/g\|:nohls<cr>
270 nmap <silent> ,u- :t.\|s/./-/g\|:nohls<cr>
451f244 first commit
Derek Wyatt authored
271
272 " Shrink the current window to fit the number of lines in the buffer. Useful
273 " for those buffers that are only a few lines
274 nmap <silent> ,sw :execute ":resize " . line('$')<cr>
275
276 " Use the bufkill plugin to eliminate a buffer but keep the window layout
277 nmap ,bd :BD<cr>
278
279 " Use CTRL-E to replace the original ',' mapping
280 nnoremap <C-E> ,
281
61232c8 @derekwyatt Trying out the 'imap jj <esc>' mapping that I've seen a lot of people go...
authored
282 " Alright... let's try this out
283 imap jj <esc>
284
22af512 Inserting of the filename has been somewhat useful. gonna keep it for n...
Derek Wyatt authored
285 " I like jj - Let's try something else fun
286 imap ,fn <c-r>=expand('%:t:r')<cr>
287
9db6c66 Added the ultra-cool 'clear text op-pending command'. Awesome.
Derek Wyatt authored
288 " Clear the text using a motion / text object and then move the character to the
289 " next word
290 nmap <silent> ,C :set opfunc=ClearText<CR>g@
291 vmap <silent> ,C :<C-U>call ClearText(visual(), 1)<CR>
292
083691b Lots of little updates. Most notably, as of late, added some maps to pu...
Derek Wyatt authored
293 " Make the current file executable
294 nmap ,x :w<cr>:!chmod 755 %<cr>:e<cr>
295
296 " Digraphs
297 " Alpha
298 imap <c-l><c-a> <c-k>a*
299 " Beta
300 imap <c-l><c-b> <c-k>b*
301 " Gamma
302 imap <c-l><c-g> <c-k>g*
303 " Delta
304 imap <c-l><c-d> <c-k>d*
305 " Epslion
306 imap <c-l><c-e> <c-k>e*
307 " Lambda
308 imap <c-l><c-l> <c-k>l*
309 " Eta
310 imap <c-l><c-y> <c-k>y*
311 " Theta
312 imap <c-l><c-h> <c-k>h*
313 " Mu
314 imap <c-l><c-m> <c-k>m*
315 " Rho
316 imap <c-l><c-r> <c-k>r*
317 " Pi
318 imap <c-l><c-p> <c-k>p*
319 " Phi
320 imap <c-l><c-f> <c-k>f*
321
9db6c66 Added the ultra-cool 'clear text op-pending command'. Awesome.
Derek Wyatt authored
322 function! ClearText(type, ...)
323 let sel_save = &selection
324 let &selection = "inclusive"
325 let reg_save = @@
326 if a:0 " Invoked from Visual mode, use '< and '> marks
327 silent exe "normal! '<" . a:type . "'>r w"
328 elseif a:type == 'line'
329 silent exe "normal! '[V']r w"
330 elseif a:type == 'line'
331 silent exe "normal! '[V']r w"
332 elseif a:type == 'block'
333 silent exe "normal! `[\<C-V>`]r w"
334 else
335 silent exe "normal! `[v`]r w"
336 endif
337 let &selection = sel_save
338 let @@ = reg_save
339 endfunction
340
451f244 first commit
Derek Wyatt authored
341 " Syntax coloring lines that are too long just slows down the world
342 set synmaxcol=2048
343
344 " I don't like it when the matching parens are automatically highlighted
345 let loaded_matchparen = 1
346
347 " Highlight the current line and column
348 " Don't do this - It makes window redraws painfully slow
349 set nocursorline
350 set nocursorcolumn
351
5c8178b @derekwyatt There were some immediate problems trying to get this thing working on m...
authored
352 if has("mac")
c781e93 I rebuilt my mac recently and when I put the files back, git told me I w...
Derek Wyatt authored
353 let g:main_font = "Anonymous\\ Pro:h16"
354 let g:small_font = "Anonymous\\ Pro:h2"
5c8178b @derekwyatt There were some immediate problems trying to get this thing working on m...
authored
355 else
578cbfd Enhanced the scala stuff so that it works better with a Play repository.
Derek Wyatt authored
356 let g:main_font = "DejaVu\\ Sans\\ Mono\\ 10"
357 let g:small_font = "DejaVu\\ Sans\\ Mono\\ 2"
5c8178b @derekwyatt There were some immediate problems trying to get this thing working on m...
authored
358 endif
359
451f244 first commit
Derek Wyatt authored
360 "-----------------------------------------------------------------------------
361 " Perforce Stuff
362 "-----------------------------------------------------------------------------
363 let g:p4DefaultDiffOptions = '-dwb'
364 let g:p4EnableRuler = 1
365 let g:p4EnableMenu = 0
366 let g:p4EnableActiveStatus = 0
367 let g:p4OptimizeActiveStatus = 1
368 let g:p4EnableFileChangedShell = 0
369 let g:p4DefaultListSize = 1000
370 let g:p4UseVimDiff2 = 1
371 let g:p4UseVimDiff = 1
372 let g:p4Autoread = -1
373 let g:p4PromptToCheckout = 0
374 let g:no_plugin_maps = 1
375 let g:loaded_perforcemenu = 1
376
377 nmap <silent> ,co :PO<CR>
378 if has("unix")
379 nmap <silent> ,ce :execute ":!p4 edit " . resolve(expand("%:p")) . "&"<CR>
380 nmap <silent> ,cr :execute ":!p4 revert " . resolve(expand("%:p")) . "&"<CR>
381 nmap <silent> ,ca :execute ":!p4 add " . resolve(expand("%:p")) . "&"<CR>
382 else
383 nmap <silent> ,ce :!start p4 edit %:p<CR>
384 nmap <silent> ,cr :!start p4 revert %:p<CR>
385 nmap <silent> ,ca :!start p4 add %:p<CR>
386 endif
387 nmap <silent> ,cf :PFilelog<CR>
388 nmap <silent> ,cD :'a,.PFilelogDiff<CR>
389 nmap <silent> ,zz :nmap <buffer><CR>
390 command! DiffPre :PD2 #-1 #-0
391 command! PendingChanges :PF changes -s pending -u dwyatt -m -l <args>
392 command! MyChanges :PF changes -u dwyatt -m -l <args>
393
394 " Initial path seeding
395 set path=
396 set tags=
397
398 "-----------------------------------------------------------------------------
399 " NERD Tree Plugin Settings
400 "-----------------------------------------------------------------------------
401 " Toggle the NERD Tree on an off with F7
402 nmap <F7> :NERDTreeToggle<CR>
403
404 " Close the NERD Tree with Shift-F7
405 nmap <S-F7> :NERDTreeClose<CR>
406
407 " Show the bookmarks table on startup
408 let NERDTreeShowBookmarks=1
409
410 " Don't display these kinds of files
411 let NERDTreeIgnore=[ '\.ncb$', '\.suo$', '\.vcproj\.RIMNET', '\.obj$',
412 \ '\.ilk$', '^BuildLog.htm$', '\.pdb$', '\.idb$',
413 \ '\.embed\.manifest$', '\.embed\.manifest.res$',
414 \ '\.intermediate\.manifest$', '^mt.dep$' ]
415
416 "-----------------------------------------------------------------------------
16c4e68 @derekwyatt GPG stuff for the mac, better maps for doing my underlining, ditched vim...
authored
417 " GPG Stuff
418 "-----------------------------------------------------------------------------
419 if has("mac")
420 let g:GPGExecutable = "gpg2"
421 let g:GPGUseAgent = 0
422 endif
423
424 "-----------------------------------------------------------------------------
451f244 first commit
Derek Wyatt authored
425 " FSwitch mappings
426 "-----------------------------------------------------------------------------
427 nmap <silent> ,of :FSHere<CR>
428 nmap <silent> ,ol :FSRight<CR>
429 nmap <silent> ,oL :FSSplitRight<CR>
430 nmap <silent> ,oh :FSLeft<CR>
431 nmap <silent> ,oH :FSSplitLeft<CR>
432 nmap <silent> ,ok :FSAbove<CR>
433 nmap <silent> ,oK :FSSplitAbove<CR>
434 nmap <silent> ,oj :FSBelow<CR>
435 nmap <silent> ,oJ :FSSplitBelow<CR>
436
437 "-----------------------------------------------------------------------------
438 " XPTemplate settings
439 "-----------------------------------------------------------------------------
440 let g:xptemplate_brace_complete = ''
441
442 "-----------------------------------------------------------------------------
443 " TwitVim settings
444 "-----------------------------------------------------------------------------
445 let twitvim_enable_perl = 1
446 let twitvim_browser_cmd = 'firefox'
447 nmap ,tw :FriendsTwitter<cr>
448 nmap ,tm :UserTwitter<cr>
449 nmap ,tM :MentionsTwitter<cr>
450 function! TwitVimMappings()
451 nmap <buffer> U :exe ":UnfollowTwitter " . expand("<cword>")<cr>
452 nmap <buffer> F :exe ":FollowTwitter " . expand("<cword>")<cr>
c07a591 Cleanups of the old cruft nonsense stuff.
Derek Wyatt authored
453 nmap <buffer> 7 :BackTwitter<cr>
454 nmap <buffer> 8 :ForwardTwitter<cr>
451f244 first commit
Derek Wyatt authored
455 nmap <buffer> 1 :PreviousTwitter<cr>
456 nmap <buffer> 2 :NextTwitter<cr>
457 nmap <buffer> ,sf :SearchTwitter #scala OR #akka<cr>
458 nmap <buffer> ,ss :SearchTwitter #scala<cr>
459 nmap <buffer> ,sa :SearchTwitter #akka<cr>
460 nmap <buffer> ,sv :SearchTwitter #vim<cr>
461 endfunction
462 augroup derek_twitvim
463 au!
464 au FileType twitvim call TwitVimMappings()
465 augroup END
466
467 "-----------------------------------------------------------------------------
468 " VimSokoban settings
469 "-----------------------------------------------------------------------------
b1046ee A tiny bit of cleanup... most major thing is get Sokoban working again :...
Derek Wyatt authored
470 " Sokoban stuff
471 let g:SokobanLevelDirectory = "/home/dwyatt/.vim/bundle/vim-sokoban/VimSokoban/"
451f244 first commit
Derek Wyatt authored
472
473 "-----------------------------------------------------------------------------
474 " FuzzyFinder Settings
475 "-----------------------------------------------------------------------------
476 let g:fuf_file_exclude = '\v\~$|\.(o|exe|dll|bak|class|meta|lock|orig|jar|swp)$|/test/data\.|(^|[/\\])\.(hg|git|bzr)($|[/\\])'
3700362 Finally got around to changing some defaults on FuzzyFinder that were bu...
Derek Wyatt authored
477 let g:fuf_splitPathMatching = 0
478 let g:fuf_maxMenuWidth = 110
479 let g:fuf_timeFormat = ''
b1046ee A tiny bit of cleanup... most major thing is get Sokoban working again :...
Derek Wyatt authored
480 nmap <silent> ,fv :FufFile ~/.vim/<cr>
451f244 first commit
Derek Wyatt authored
481 nmap <silent> ,fb :FufBuffer<cr>
482 nmap <silent> ,ff :FufFile<cr>
483 nmap <silent> ,fc :FufMruCmd<cr>
484 nmap <silent> ,fm :FufMruFile<cr>
485 nmap <silent> ,fp :FufFile ~/git/*<cr>
486
487 "-----------------------------------------------------------------------------
27043da Added some helpers for graphviz and tex in the XPTemplate configuration,...
Derek Wyatt authored
488 " Gundo Settings
489 "-----------------------------------------------------------------------------
490 nmap <c-F5> :GundoToggle<cr>
491
492 "-----------------------------------------------------------------------------
493 " Conque Settings
494 "-----------------------------------------------------------------------------
495 let g:ConqueTerm_FastMode = 1
496 let g:ConqueTerm_ReadUnfocused = 1
497 let g:ConqueTerm_InsertOnEnter = 1
498 let g:ConqueTerm_PromptRegex = '^-->'
499 let g:ConqueTerm_TERM = 'xterm'
500
501 "-----------------------------------------------------------------------------
451f244 first commit
Derek Wyatt authored
502 " Functions
503 "-----------------------------------------------------------------------------
504 if !exists('g:bufferJumpList')
505 let g:bufferJumpList = {}
506 endif
507
508 function! MarkBufferInJumpList(bufstr, letter)
509 let g:bufferJumpList[a:letter] = a:bufstr
510 endfunction
511
512 function! JumpToBufferInJumpList(letter)
513 if has_key(g:bufferJumpList, a:letter)
514 exe ":buffer " . g:bufferJumpList[a:letter]
515 else
516 echoerr a:letter . " isn't mapped to any existing buffer"
517 endif
518 endfunction
519
520 function! ListJumpToBuffers()
521 for key in keys(g:bufferJumpList)
522 echo key . " = " . g:bufferJumpList[key]
523 endfor
524 endfunction
525
526 function! IndentToNextBraceInLineAbove()
527 :normal 0wk
528 :normal "vyf(
529 let @v = substitute(@v, '.', ' ', 'g')
530 :normal j"vPl
531 endfunction
532
533 nmap <silent> ,ii :call IndentToNextBraceInLineAbove()<cr>
534
535 nmap <silent> ,mba :call MarkBufferInJumpList(expand('%:p'), 'a')<cr>
536 nmap <silent> ,mbb :call MarkBufferInJumpList(expand('%:p'), 'b')<cr>
537 nmap <silent> ,mbc :call MarkBufferInJumpList(expand('%:p'), 'c')<cr>
538 nmap <silent> ,mbd :call MarkBufferInJumpList(expand('%:p'), 'd')<cr>
539 nmap <silent> ,mbe :call MarkBufferInJumpList(expand('%:p'), 'e')<cr>
540 nmap <silent> ,mbf :call MarkBufferInJumpList(expand('%:p'), 'f')<cr>
541 nmap <silent> ,mbg :call MarkBufferInJumpList(expand('%:p'), 'g')<cr>
542 nmap <silent> ,jba :call JumpToBufferInJumpList('a')<cr>
543 nmap <silent> ,jbb :call JumpToBufferInJumpList('b')<cr>
544 nmap <silent> ,jbc :call JumpToBufferInJumpList('c')<cr>
545 nmap <silent> ,jbd :call JumpToBufferInJumpList('d')<cr>
546 nmap <silent> ,jbe :call JumpToBufferInJumpList('e')<cr>
547 nmap <silent> ,jbf :call JumpToBufferInJumpList('f')<cr>
548 nmap <silent> ,jbg :call JumpToBufferInJumpList('g')<cr>
549 nmap <silent> ,ljb :call ListJumpToBuffers()<cr>
550
551 function! DiffCurrentFileAgainstAnother(snipoff, replacewith)
552 let currentFile = expand('%:p')
553 let otherfile = substitute(currentFile, "^" . a:snipoff, a:replacewith, '')
554 only
555 execute "vertical diffsplit " . otherfile
556 endfunction
557
558 command! -nargs=+ DiffCurrent call DiffCurrentFileAgainstAnother(<f-args>)
559
560 function! RunSystemCall(systemcall)
561 let output = system(a:systemcall)
562 let output = substitute(output, "\n", '', 'g')
563 return output
564 endfunction
565
566 function! HighlightAllOfWord(onoff)
567 if a:onoff == 1
568 :augroup highlight_all
569 :au!
570 :au CursorMoved * silent! exe printf('match Search /\<%s\>/', expand('<cword>'))
571 :augroup END
572 else
573 :au! highlight_all
574 match none /\<%s\>/
575 endif
576 endfunction
577
578 :nmap ,ha :call HighlightAllOfWord(1)<cr>
579 :nmap ,hA :call HighlightAllOfWord(0)<cr>
580
581 function! LengthenCWD()
582 let cwd = getcwd()
583 if cwd == '/'
584 return
585 endif
586 let lengthend = substitute(cwd, '/[^/]*$', '', '')
587 if lengthend == ''
588 let lengthend = '/'
589 endif
590 if cwd != lengthend
591 exec ":lcd " . lengthend
592 endif
593 endfunction
594
595 :nmap ,ld :call LengthenCWD()<cr>
596
597 function! ShortenCWD()
598 let cwd = split(getcwd(), '/')
599 let filedir = split(expand("%:p:h"), '/')
600 let i = 0
601 let newdir = ""
602 while i < len(filedir)
603 let newdir = newdir . "/" . filedir[i]
604 if len(cwd) == i || filedir[i] != cwd[i]
605 break
606 endif
607 let i = i + 1
608 endwhile
609 exec ":lcd /" . newdir
610 endfunction
611
612 :nmap ,sd :call ShortenCWD()<cr>
613
614 function! RedirToYankRegisterF(cmd, ...)
615 let cmd = a:cmd . " " . join(a:000, " ")
616 redir @*>
617 exe cmd
618 redir END
619 endfunction
620
621 command! -complete=command -nargs=+ RedirToYankRegister
622 \ silent! call RedirToYankRegisterF(<f-args>)
623
624 function! ToggleMinimap()
625 if exists("s:isMini") && s:isMini == 0
626 let s:isMini = 1
627 else
628 let s:isMini = 0
629 end
630
631 if (s:isMini == 0)
632 " save current visible lines
633 let s:firstLine = line("w0")
634 let s:lastLine = line("w$")
635
636 " make font small
5c8178b @derekwyatt There were some immediate problems trying to get this thing working on m...
authored
637 exe "set guifont=" . g:small_font
451f244 first commit
Derek Wyatt authored
638 " highlight lines which were visible
639 let s:lines = ""
640 for i in range(s:firstLine, s:lastLine)
641 let s:lines = s:lines . "\\%" . i . "l"
642
643 if i < s:lastLine
644 let s:lines = s:lines . "\\|"
645 endif
646 endfor
647
648 exe 'match Visible /' . s:lines . '/'
649 hi Visible guibg=lightblue guifg=black term=bold
650 nmap <s-j> 10j
651 nmap <s-k> 10k
652 else
5c8178b @derekwyatt There were some immediate problems trying to get this thing working on m...
authored
653 exe "set guifont=" . g:main_font
451f244 first commit
Derek Wyatt authored
654 hi clear Visible
655 nunmap <s-j>
656 nunmap <s-k>
657 endif
658 endfunction
659
660 command! ToggleMinimap call ToggleMinimap()
7ae913c @derekwyatt Got rid of stupid Minimap toggle. Fixed up some stuff in my templates fo...
authored
661
662 " I /literally/ never use this and it's pissing me off
663 " nnoremap <space> :ToggleMinimap<CR>
451f244 first commit
Derek Wyatt authored
664
665 "-----------------------------------------------------------------------------
666 " Commands
667 "-----------------------------------------------------------------------------
668 function! FreemindToListF()
669 setl filetype=
670 silent! :%s/^\(\s*\).*TEXT="\([^"]*\)".*$/\1- \2/
671 silent! :g/^\s*</d
672 silent! :%s/&quot;/"/g
673 silent! :%s/&apos;/\'/g
674 silent! g/^-/s/- //
675 silent! g/^\w/t.|s/./=/g
676 silent! g/^\s*-/normal O
677 silent! normal 3GgqG
678 silent! %s/^\s\{4}\zs-/o/
679 silent! %s/^\s\{12}\zs-/+/
680 silent! %s/^\s\{16}\zs-/*/
681 silent! %s/^\s\{20}\zs-/#/
682 silent! normal gg
683 endfunction
684
685 command! FreemindToList call FreemindToListF()
686
687 "-----------------------------------------------------------------------------
688 " Auto commands
689 "-----------------------------------------------------------------------------
690 augroup derek_xsd
691 au!
692 au BufEnter *.xsd,*.wsdl,*.xml setl tabstop=4 shiftwidth=4
693 au BufEnter *.xsd,*.wsdl,*.xml setl formatoptions=crq textwidth=120 colorcolumn=120
694 augroup END
695
696 augroup Binary
697 au!
698 au BufReadPre *.bin let &bin=1
699 au BufReadPost *.bin if &bin | %!xxd
700 au BufReadPost *.bin set filetype=xxd | endif
701 au BufWritePre *.bin if &bin | %!xxd -r
702 au BufWritePre *.bin endif
703 au BufWritePost *.bin if &bin | %!xxd
704 au BufWritePost *.bin set nomod | endif
705 augroup END
706
707
708 "-----------------------------------------------------------------------------
709 " Fix constant spelling mistakes
710 "-----------------------------------------------------------------------------
711
d612adf @derekwyatt Enhancements for working with latex files
authored
712 iab Acheive Achieve
713 iab acheive achieve
714 iab Alos Also
715 iab alos also
716 iab Aslo Also
717 iab aslo also
718 iab Becuase Because
719 iab becuase because
720 iab Bianries Binaries
721 iab bianries binaries
722 iab Bianry Binary
723 iab bianry binary
724 iab Charcter Character
725 iab charcter character
726 iab Charcters Characters
727 iab charcters characters
728 iab Exmaple Example
729 iab exmaple example
730 iab Exmaples Examples
731 iab exmaples examples
732 iab Fone Phone
733 iab fone phone
734 iab Lifecycle Life-cycle
735 iab lifecycle life-cycle
736 iab Lifecycles Life-cycles
737 iab lifecycles life-cycles
738 iab Seperate Separate
739 iab seperate separate
740 iab Seureth Suereth
741 iab seureth suereth
742 iab Shoudl Should
743 iab shoudl should
744 iab Taht That
745 iab taht that
746 iab Teh The
747 iab teh the
451f244 first commit
Derek Wyatt authored
748
749 "-----------------------------------------------------------------------------
750 " Set up the window colors and size
751 "-----------------------------------------------------------------------------
752 if has("gui_running")
5c8178b @derekwyatt There were some immediate problems trying to get this thing working on m...
authored
753 exe "set guifont=" . g:main_font
6ec2440 My new office has a ton of glare... gotta default to the light backgroun...
Derek Wyatt authored
754 if hostname() == "dqw-linux"
755 set background=light
756 else
757 set background=dark
758 endif
451f244 first commit
Derek Wyatt authored
759 colorscheme solarized
760 if !exists("g:vimrcloaded")
761 winpos 0 0
762 if !&diff
763 winsize 130 120
764 else
765 winsize 227 120
766 endif
767 let g:vimrcloaded = 1
768 endif
769 endif
770 :nohls
Something went wrong with that request. Please try again.