Permalink
Browse files

Set up indent guides (not always necessary).

  • Loading branch information...
1 parent eb11559 commit e36b00d62cc29fbc4027068cf9030c3b8ef2b0c0 @theIV committed Mar 1, 2012
@@ -0,0 +1,9 @@
+!_TAG_FILE_ENCODING utf-8 //
+l9 l9.jax /*l9*
+l9-about l9.jax /*l9-about*
+l9-author l9.jax /*l9-author*
+l9-contact l9.jax /*l9-contact*
+l9-installation l9.jax /*l9-installation*
+l9-introduction l9.jax /*l9-introduction*
+l9-usage l9.jax /*l9-usage*
+l9.txt l9.jax /*l9.txt*
@@ -143,14 +143,17 @@ function! s:Map() "{{{
let save_keymap = &keymap
let save_iminsert = &iminsert
let save_imsearch = &imsearch
+ let save_cpo = &cpo
set keymap=
+ set cpo&vim
if b:_l_delimitMate_autoclose
call s:AutoClose()
else
call s:NoAutoClose()
endif
call s:ExtraMappings()
finally
+ let &cpo = save_cpo
let &keymap = save_keymap
let &iminsert = save_iminsert
let &imsearch = save_imsearch
@@ -361,6 +364,15 @@ function! s:ExtraMappings() "{{{
exec 'silent! imap <unique> <buffer> <'.map.'> <Plug>delimitMate'.map
endif
endfor
+ " Also for default MacVim movements:
+ if has('gui_macvim')
+ for [key, map] in [['D-Left','Home'], ['D-Right','End'], ['M-Left','C-Left'], ['M-Right','C-Right']]
+ exec 'inoremap <silent> <Plug>delimitMate'.key.' <C-R>=<SID>Finish()<CR><'.map.'>'
+ if mapcheck('<'.key.'>', 'i') == '<'.map.'>'
+ exec 'silent! imap <buffer> <'.key.'> <Plug>delimitMate'.key
+ endif
+ endfor
+ endif
" Except when pop-up menu is active:
for map in ['Up', 'Down', 'PageUp', 'PageDown', 'S-Down', 'S-Up']
exec 'inoremap <silent> <expr> <Plug>delimitMate'.map.' pumvisible() ? "\<'.map.'>" : "\<C-R>=\<SID>Finish()\<CR>\<'.map.'>"'
@@ -30,3 +30,5 @@ let g:delimitMate_autoclose = 1
# Handle backspace gracefully.
set backspace=
"'\<Esc>a\<BS>x" "'x'"
+set cpo=ces$
+"'x" "'x'"
@@ -967,6 +967,8 @@ function! s:CreateAutocommands()
\ s:AutoUpdate(fnamemodify(expand('<afile>'), ':p'))
autocmd BufDelete,BufUnload,BufWipeout * call
\ s:CleanupFileinfo(fnamemodify(expand('<afile>'), ':p'))
+
+ autocmd VimEnter * call s:CorrectFocusOnStartup()
augroup END
let s:autocommands_done = 1
@@ -1521,9 +1523,13 @@ function! s:OpenWindow(flags)
let w:autoclose = autoclose
endif
endif
+ call s:LogDebugMessage("OpenWindow finished, Tagbar already open")
return
endif
+ " This is only needed for the CorrectFocusOnStartup() function
+ let s:last_autofocus = autofocus
+
if !s:Init()
return 0
endif
@@ -1696,6 +1702,23 @@ function! s:ZoomWindow()
endif
endfunction
+" s:CorrectFocusOnStartup() {{{2
+" For whatever reason the focus will be on the Tagbar window if
+" tagbar#autoopen is used with a FileType autocommand on startup and
+" g:tagbar_left is set. This should work around it by jumping to the window of
+" the current file after startup.
+function! s:CorrectFocusOnStartup()
+ if bufwinnr('__Tagbar__') != -1 && !g:tagbar_autofocus && !s:last_autofocus
+ let curfile = s:known_files.getCurrent()
+ if !empty(curfile) && curfile.fpath != fnamemodify(bufname('%'), ':p')
+ let winnr = bufwinnr(curfile.fpath)
+ if winnr != -1
+ call s:winexec(winnr . 'wincmd w')
+ endif
+ endif
+ endif
+endfunction
+
" Tag processing {{{1
" s:ProcessFile() {{{2
" Execute ctags and put the information into a 'FileInfo' object
@@ -3110,6 +3133,8 @@ endfunction
" s:winexec() {{{2
function! s:winexec(cmd)
+ call s:LogDebugMessage("Executing without autocommands: " . a:cmd)
+
let eventignore_save = &eventignore
set eventignore=BufEnter
@@ -3221,6 +3246,7 @@ endfunction
" Automatically open Tagbar if one of the open buffers contains a supported
" file
function! tagbar#autoopen(...)
+ call s:LogDebugMessage('tagbar#autoopen called on ' . bufname('%'))
let always = a:0 > 0 ? a:1 : 1
call s:Init()
@@ -3230,10 +3256,15 @@ function! tagbar#autoopen(...)
let ftype = s:DetectFiletype(bufnr)
if s:IsValidFile(bufname(bufnr), ftype)
call s:OpenWindow('')
+ call s:LogDebugMessage('tagbar#autoopen finished ' .
+ \ 'after finding valid file')
return
endif
endif
endfor
+
+ call s:LogDebugMessage('tagbar#autoopen finished ' .
+ \ 'without finding valid file')
endfunction
" Modeline {{{1
@@ -46,9 +46,9 @@ hi SpecialKey guifg=yellowgreen ctermfg=darkgreen
hi StatusLine guibg=#c2bfa5 guifg=black gui=none
hi StatusLineNC guibg=#c2bfa5 guifg=grey50 gui=none
hi Title guifg=indianred
-hi Visual gui=none guifg=khaki guibg=olivedrab
+hi Visual gui=none guifg=khaki guibg=olivedrab
"hi VisualNOS
-hi WarningMsg guifg=salmon
+hi WarningMsg guifg=salmon
"hi WildMenu
"hi Menu
"hi Scrollbar
@@ -104,4 +104,9 @@ hi Ignore cterm=bold ctermfg=7
hi Ignore ctermfg=darkgrey
hi Error cterm=bold ctermfg=7 ctermbg=1
+" Indent Guides colors
+hi IndentGuidesOdd guibg=grey10
+hi IndentGuidesEven guibg=grey10
+
+
"vim: sw=4
@@ -548,6 +548,8 @@ A limited amount of completion with <Tab> is supported.
:Rserver! {options} Same as |:Rserver|, only first attempts to kill any
other server using the same port. On non-Windows
systems, lsof must be installed for this to work.
+ Pass - as an argument to kill the server without
+ restarting it.
REFACTORING HELPERS *rails-refactoring*
@@ -38,7 +38,7 @@ let g:loaded_repeat = 1
let g:repeat_tick = -1
function! repeat#set(sequence,...)
- silent exe "norm! \"=''\<CR>p"
+ call setline(line('.'), getline('.'))
let g:repeat_sequence = a:sequence
let g:repeat_count = a:0 ? a:1 : v:count
let g:repeat_tick = b:changedtick
View
4 vimrc
@@ -114,3 +114,7 @@ runtime macros/matchit.vim
autocmd BufRead *_spec.rb syn keyword rubyRspec describe context it specify it_should_behave_like before after setup subject
highlight def link rubyRspec Function
+
+" indent guides sizing
+let g:indent_guides_start_level = 2
+let g:indent_guides_guide_size = 1

0 comments on commit e36b00d

Please sign in to comment.