Skip to content

Instantly share code, notes, and snippets.

@violetyk
Created September 20, 2013 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save violetyk/6634242 to your computer and use it in GitHub Desktop.
Save violetyk/6634242 to your computer and use it in GitHub Desktop.
" ステータスラインの色 ctermfgがバックの色で、ctermbgがフロントの文字色
highlight StatusLine term=NONE cterm=NONE ctermfg=black ctermbg=white
highlight StatusLine term=reverse cterm=reverse ctermfg=blue ctermbg=white
" 入力モードの時にステータスラインの色を変える。
let g:hi_insert = 'highlight StatusLine guifg=LightGrey guibg=darkblue gui=none ctermfg=white ctermbg=blue cterm=none'
if has('syntax')
augroup InsertHook
autocmd!
autocmd InsertEnter * call s:StatusLine('Enter')
autocmd InsertLeave * call s:StatusLine('Leave')
augroup END
endif
let s:slhlcmd = ''
function! s:StatusLine(mode)
if a:mode == 'Enter'
silent! let s:slhlcmd = 'highlight ' . s:GetHighlight('StatusLine')
silent exec g:hi_insert
else
highlight clear StatusLine
silent exec s:slhlcmd
endif
endfunction
function! s:GetHighlight(hi)
redir => hl
exec 'highlight '.a:hi
redir END
let hl = substitute(hl, '[\r\n]', '', 'g')
let hl = substitute(hl, 'xxx', '', '')
return hl
endfunction
" カーソルラインのハイライト。reverseで反転表示。
" highlight CursorLine term=reverse cterm=reverse
" カーソル列のハイライト。reverseで反転表示。
" highlight CursorColumn term=reverse cterm=reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment