Use vim-colorschemes and configure statusline to work

pull/1/head
Ensar Sarajčić 2021-01-16 19:24:47 +01:00
parent d634473980
commit 4e844a01a4
3 changed files with 72 additions and 1441 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,51 +2,87 @@
" - Statusline setup - " - Statusline setup -
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
" Configure user colors for proper focus management function s:UpdateColors()
hi! link User1 StatusLineGreenFg let ctermbg = synIDattr(synIDtrans(hlID('StatusLine')), 'bg', 'cterm')
hi! link User2 StatusLineRedFg let guibg = synIDattr(synIDtrans(hlID('StatusLine')), 'bg', 'gui')
hi! link User3 StatusLineYellowFg let idguifg1 = synIDattr(synIDtrans(hlID('Function')), 'fg', 'gui')
hi! link User4 StatusLineBlueFg let idctermfg1 = synIDattr(synIDtrans(hlID('Function')), 'fg', 'cterm')
hi! link User5 StatusLinePurpleFg " Green in gruvbox
exec 'hi User1 guifg=' . l:idguifg1 .
\' ctermfg=' . l:idctermfg1 .
\' cterm=bold,reverse gui=bold,reverse'
let idguifg2 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'gui')
let idctermfg2 = synIDattr(synIDtrans(hlID('WarningMsg')), 'fg', 'cterm')
" Red in gruvbox
exec 'hi User2 guifg=' . l:idguifg2 .
\' ctermfg=' . l:idctermfg2 .
\' cterm=bold,reverse gui=bold,reverse'
let idguifg3 = synIDattr(synIDtrans(hlID('MoreMsg')), 'fg', 'gui')
let idctermfg3 = synIDattr(synIDtrans(hlID('MoreMsg')), 'fg', 'cterm')
" Yellow in gruvbox
exec 'hi User3 guifg=' . l:idguifg3 .
\' ctermfg=' . l:idctermfg3 .
\' cterm=bold,reverse gui=bold,reverse'
let idguifg4 = synIDattr(synIDtrans(hlID('Identifier')), 'fg', 'gui')
let idctermfg4 = synIDattr(synIDtrans(hlID('Identifier')), 'fg', 'cterm')
" Blue in gruvbox
exec 'hi User4 guifg=' . l:idguifg4 .
\' ctermfg=' . l:idctermfg4 .
\' cterm=bold,reverse gui=bold,reverse'
let idguifg5 = synIDattr(synIDtrans(hlID('Number')), 'fg', 'gui')
let idctermfg5 = synIDattr(synIDtrans(hlID('Number')), 'fg', 'cterm')
" Blue in gruvbox
exec 'hi User5 guifg=' . l:idguifg5 .
\' ctermfg=' . l:idctermfg5 .
\' cterm=bold,reverse gui=bold,reverse'
endfunction
augroup statuslineconf
autocmd!
autocmd ColorScheme * call s:UpdateColors()
augroup END
call s:UpdateColors()
" Checks file type to add a pretty glyph if available " Checks file type to add a pretty glyph if available
function s:GetFileType() function s:GetFileType()
if &filetype ==# "rust" if &filetype ==# "rust"
return "%2*%*" return "%2* %*"
elseif &filetype ==# "c" elseif &filetype ==# "c"
return "%4*%*" return "%4* %*"
elseif &filetype ==# "python" elseif &filetype ==# "python"
return "%3*%*" return "%3* %*"
elseif &filetype ==# "javascript" elseif &filetype ==# "javascript"
return "" return " "
elseif &filetype ==# "typescript" elseif &filetype ==# "typescript"
return "%4*%*" return "%4* %*"
elseif &filetype ==# "vim" elseif &filetype ==# "vim"
return "%1*%*" return "%1* %*"
elseif &filetype ==# "clojure" elseif &filetype ==# "clojure"
return "" return " "
elseif &filetype ==# "html" elseif &filetype ==# "html"
return "" return " "
elseif &filetype ==# "haskell" elseif &filetype ==# "haskell"
return "" return " "
elseif &filetype ==# "markdown" elseif &filetype ==# "markdown"
return "" return " "
elseif &filetype ==# "org" elseif &filetype ==# "org"
return "" return " "
elseif &filetype ==# "scss" elseif &filetype ==# "scss"
return "" return " "
elseif &filetype ==# "scala" elseif &filetype ==# "scala"
return "" return " "
elseif &filetype ==# "elixir" elseif &filetype ==# "elixir"
return "%5*%*" return "%5* %*"
elseif &filetype ==# "kotlin" elseif &filetype ==# "kotlin"
return "%2*洞%*" return "%2* %*"
elseif &filetype ==# "yml" elseif &filetype ==# "yml"
return "" return " "
elseif &filetype ==# "toml" elseif &filetype ==# "toml"
return "" return " "
elseif &filetype ==# "json" elseif &filetype ==# "json"
return "" return " "
else else
return "%y" return "%y"
endfunction endfunction
@ -85,8 +121,8 @@ function! s:LinterStatus() abort
let l:all_errors = l:counts.error + l:counts.style_error let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '%1*OK%*' : printf( return l:counts.total == 0 ? '%1* OK %*' : printf(
\ '%%3*%dW%%* %%2*%dE%%*', \ '%%3* %dW %%* %%2* %dE %%*',
\ all_non_errors, \ all_non_errors,
\ all_errors \ all_errors
\) \)
@ -95,14 +131,20 @@ endfunction
function GetStatusLine() function GetStatusLine()
let l:status_line_left = s:GetMode() let l:status_line_left = s:GetMode()
if exists('g:loaded_fugitive') if exists('g:loaded_fugitive')
let l:status_line_left .= "%4* " . FugitiveHead() . "%*" let l:fugitive_head = FugitiveHead()
if strlen(l:fugitive_head)
let l:status_line_left .= "%4*  " . l:fugitive_head . " %*"
endif
endif endif
let l:status_line_left .= " %f" " Filename let l:status_line_left .= " %f" " Filename
let l:status_line_left .= " %1*%M%*" " Modified let l:status_line_left .= " %1*%M%*" " Modified
let l:status_line_left .= " %2*%r%*" " Read only let l:status_line_left .= " %2*%r%*" " Read only
let l:status_line_left .= s:PasteForStatusline() let l:status_line_left .= s:PasteForStatusline()
if exists('g:did_coc_loaded') if exists('g:did_coc_loaded')
let l:status_line_left .= "%2*" . coc#status() . "%*" let l:coc_status = coc#status()
if strlen(l:coc_status)
let l:status_line_left .= "%2* " . l:coc_status . " %*"
endif
endif endif
let l:status_line_right = "%= " " Align right statusline let l:status_line_right = "%= " " Align right statusline
if exists('g:loaded_ale') if exists('g:loaded_ale')

View File

@ -45,6 +45,8 @@ Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
Plug 'mhinz/vim-grepper' Plug 'mhinz/vim-grepper'
Plug 'direnv/direnv.vim' Plug 'direnv/direnv.vim'
Plug 'flazz/vim-colorschemes'
Plug 'tpope/vim-speeddating'
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
" - Autocompletion - " - Autocompletion -
@ -85,11 +87,6 @@ Plug 'tpope/vim-rails'
Plug 'mattn/emmet-vim' Plug 'mattn/emmet-vim'
Plug 'vimwiki/vimwiki' Plug 'vimwiki/vimwiki'
" -----------------------------------------------------------------------------
" - Other Improvements -
" -----------------------------------------------------------------------------
Plug 'tpope/vim-speeddating'
call plug#end() call plug#end()
filetype plugin indent on filetype plugin indent on