Skip to content

Instantly share code, notes, and snippets.

@georgefs
Created May 9, 2013 14:29
Show Gist options
  • Save georgefs/5547788 to your computer and use it in GitHub Desktop.
Save georgefs/5547788 to your computer and use it in GitHub Desktop.
除了主要編輯視窗都上迷霧0..0 額外付送十字游標喔 lol XD window 開太多 常會找不到現在的編輯區~攤手 找了一下.. vim原生不支援單一window 修改background color.. 只能用這種蠢方法XDDD ColorColumn 的highlight 來模擬了- -+ 雖然不完美但是夠用了~
"height ligth cusor
set t_Co=256
set cursorline
set cursorcolumn
highlight CursorColumn cterm=none ctermbg=236
highlight CursorLine cterm=none ctermbg=236
highlight ColorColumn ctermbg=none ctermbg=240
" Dim inactive windows using 'colorcolumn' setting
" This tends to slow down redrawing, but is very useful.
" Based on https://groups.google.com/d/msg/vim_use/IJU-Vk-QLJE/xz4hjPjCRBUJ
" XXX: this will only work with lines containing text (i.e. not '~')
function! s:DimInactiveWindows()
for i in range(1, tabpagewinnr(tabpagenr(), '$'))
let l:range = ""
if i != winnr()
if &wrap
" HACK: when wrapping lines is enabled, we use the maximum number
" of columns getting highlighted. This might get calculated by
" looking for the longest visible line and using a multiple of
" winwidth().
let l:width=999 " max
else
let l:width=winwidth(i)
endif
let l:range = join(range(1, l:width), ',')
endif
call setwinvar(i, '&colorcolumn', l:range)
endfor
endfunction
augroup DimInactiveWindows
au!
au WinEnter * call s:DimInactiveWindows()
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment