diff --git a/vimrc b/vimrc index eaf466d..fb81f76 100644 --- a/vimrc +++ b/vimrc @@ -454,6 +454,19 @@ let g:instant_markdown_open_to_the_world = 1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " #functions {{{ + +function! DoInsertEnter() "{{{ + " call SetColor('LineNr', '#262626', '', '#cccccc', '', '') + " call SetColor('CursorLineNr', '#bcbcbc', '', '#999999', '', 'bold') +endfunction +"}}} + +function! DoInsertLeave() "{{{ + " call SetColor('LineNr', '#3a3a3a', '', '#999999', '', '') + " call SetColor('CursorLineNr', '#767676', '', '#777777', '', 'bold') +endfunction +"}}} + function! SetColor(name, fg, bg, fg_l, bg_l, style) abort"{{{ if &background ==? 'dark' @@ -825,14 +838,15 @@ function! SaveAndExecute(ex_command) abort "{{{ endfunction "}}} -function! JsIncludeExpr(file) +function! JsIncludeExpr(file)"{{{ " substitute(substitute(v:fname,'^[\\~@]\/','./',''),'^[\\~@]','./node_modules/','') echom v:fname return substitute(substitute(a:file,'^[\\~@]\/','./',''),'^[\\~@]','./node_modules/','') -endfunction +endfunction"}}} + "}}} """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -847,7 +861,8 @@ endif syntax on set background=light -set fillchars=stl:\ ,stlnc:\ ,vert:\| +" set fillchars=stl:\ ,stlnc:\ ,vert:│ +set fillchars=stl:\ ,stlnc:\ ,vert:┃ colorscheme monotonous2 set guioptions-=mTrLb @@ -919,7 +934,9 @@ set textwidth=180 set formatoptions=cq set wrapmargin=0 -set foldcolumn=1 +set cursorline + +set foldcolumn=2 set signcolumn=yes set colorcolumn=80,120 @@ -1134,14 +1151,23 @@ augroup linenumbering augroup END "}}} -" colorcolumns {{{ -augroup colorcolumns +" WinEnter, WinLeave {{{ +augroup windowenteringleaving autocmd! autocmd WinEnter * call SetColorColumn() + autocmd WinEnter * set cursorline autocmd WinLeave * setlocal colorcolumn=0 + autocmd WinLeave * set nocursorline augroup END "}}} +" InsertEnter, InsertLeave {{{ +augroup insertenterleave + au! + au InsertEnter * call DoInsertEnter() + au InsertLeave * call DoInsertLeave() +augroup END + " Automatically reload .vimrc if chanaged {{{ augroup myvimrc autocmd! @@ -1160,7 +1186,7 @@ augroup END """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " #statusline {{{ -set statusline=%!GetStatus(1) +" set statusline=%!GetStatus(1) function! GetStatus(isactive) abort "{{{ " let l:linter = ale#statusline#Count(bufnr('')) @@ -1310,35 +1336,16 @@ function! GetStatus(isactive) abort "{{{ endfunction "}}} -function! DoInsertEnter() "{{{ - set cursorline - call SetColor('LineNr', '#262626', '', '#cccccc', '', '') - call SetColor('CursorLineNr', '#bcbcbc', '', '#999999', '', 'bold') -endfunction +"augroup status "{{{ +" autocmd! +" autocmd WinNew,WinEnter * setlocal statusline=%!GetStatus(1) +" autocmd WinLeave * setlocal statusline=%!GetStatus(0) +" " autocmd WinNew * setlocal statusline=%!GetStatus(1) +" " autocmd InsertChange * setlocal statusline=%!GetStatus(1) +"augroup END +""}}} "}}} -function! DoInsertLeave() "{{{ - set nocursorline - call SetColor('LineNr', '#3a3a3a', '', '#999999', '', '') - call SetColor('CursorLineNr', '#767676', '', '#777777', '', 'bold') -endfunction -"}}} - -augroup status "{{{ - autocmd! - autocmd WinNew,WinEnter * setlocal statusline=%!GetStatus(1) - autocmd WinLeave * setlocal statusline=%!GetStatus(0) - " autocmd WinNew * setlocal statusline=%!GetStatus(1) - " autocmd InsertChange * setlocal statusline=%!GetStatus(1) -augroup END -"}}} - -augroup statuscursorlines "{{{ - au! - au InsertEnter * call DoInsertEnter() - au InsertLeave * call DoInsertLeave() -augroup END -"}}} "}}} """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -1363,9 +1370,8 @@ if exists('+showtabline') let l:customtabline .= '%' . l:tabnumber . 'T' let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%1*' : '%2*') - let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%#TabNumSel#' : '%#TabNum#') - let l:customtabline .= ' ' . l:tabnumber - let l:customtabline .= '%#TabSeparator#:' + let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%#TabLineNumSel#' : '%#TabLineNum#') + let l:customtabline .= ' ' . l:tabnumber . ' ' let l:customtabline .= (l:tabnumber == l:currenttabnum ? '%#TabLineItemSel#' : '%#TabLineItem#') endif @@ -1393,18 +1399,14 @@ if exists('+showtabline') let l:file = "''" endif - let l:customtabline .= l:file . ' %#TabLineNoise# ' + let l:customtabline .= l:file . ' ' let l:tabnumber = l:tabnumber + 1 endwhile let l:customtabline .= '%T%#TabLineFill#%=' - let l:customtabline .= '%#TabLineItemSel# %{fugitive#statusline()}%#TabSeparator# ' - let l:customtabline .= '%#TabLineNoise# ' - let l:customtabline .= '%#TabLineNoise# ' - " let l:customtabline .= '%#TabSeparator# "%#TabLineItemSel#%{v:register}%#TabSeparator#" ' - " let l:customtabline .= '%#TabLineNoise# ' + let l:customtabline .= '%#TabLineItemSel# %{fugitive#statusline()}% ' let l:customtabline .= "%#TabLineItemSel# %{ObsessionStatus(fnamemodify(v:this_session,':t'),'---')} %*" return l:customtabline @@ -1415,6 +1417,11 @@ if exists('+showtabline') set showtabline=2 set tabline=%!MyTabLine() + hi def link TabLineItem TabLine + hi def link TabLineItemSel TabLineSel + hi def link TabLineNum TabLine + hi def link TabLineNumSel TabLineSel + endif " exists("+showtabline") "}}}