This commit is contained in:
Ray Elliott 2020-07-31 14:27:19 +01:00
parent 877df2f084
commit 549eb13f1c
1 changed files with 163 additions and 148 deletions

View File

@ -19,8 +19,8 @@ nmap <space>pp :call <SID>SynStack()<CR>
"}}} "}}}
function! s:RunShellCommand(cmdline) abort"{{{ function! s:RunShellCommand(cmdline) abort"{{{
" Shell command " Shell command
" http://vim.wikia.com/wiki/VimTip1599 " http://vim.wikia.com/wiki/VimTip1599
let l:expanded_cmdline = a:cmdline let l:expanded_cmdline = a:cmdline
for l:part in split(a:cmdline, ' ') for l:part in split(a:cmdline, ' ')
@ -76,8 +76,8 @@ let g:shell_scratch_buffer_nr = -1
"}}} "}}}
function! SaveAndExecute(ex_command) abort "{{{ function! SaveAndExecute(ex_command) abort "{{{
" https://stackoverflow.com/a/40195855 " https://stackoverflow.com/a/40195855
" ex_command: command to run to execute file " ex_command: command to run to execute file
" SOURCE [reusable window]: https://github.com/fatih/vim-go/blob/master/autoload/go/ui.vim " SOURCE [reusable window]: https://github.com/fatih/vim-go/blob/master/autoload/go/ui.vim
" save and reload current file " save and reload current file
@ -291,20 +291,35 @@ set fillchars=stl:\ ,stlnc:\ ,vert:┃,fold:\
set statusline=\ set statusline=\
" buffer number " buffer number
set statusline+=[%n]\ \ set statusline+=[%n]\ \
" line of total_lines " line of total_lines and percentage through file
set statusline+=%l\ of\ %L\ set statusline+=%-20(%l\ of\ %L\ (%p%%)%)
" percentage through file " column, virtual column
set statusline+=(%p%%)\ set statusline+=%-7(:%c\ %((%V)%)%)
" column " separator, highlight color
set statusline+=:%c\ set statusline+=%=%#StatusLineNC#
" virtual column " Ale errors
set statusline+=%((%V)%) set statusline+=%{AleLinterStatus()}
" CoC status
set statusline+=%{coc#status()}\
" separator " separator
set statusline+=%= set statusline+=%=%#StatusLine#
set statusline+=%y\ set statusline+=%y\
set statusline+=%r\ %m\ %f set statusline+=%r\ %m\ %f
set statusline+=\ set statusline+=\
function! AleLinterStatus() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '' : printf(
\ '[ %dW %dE ]',
\ all_non_errors,
\ all_errors
\)
endfunction
set conceallevel=0 set conceallevel=0
"----------------------------------------------------------------------------}}} "----------------------------------------------------------------------------}}}
" #mappings {{{ " #mappings {{{
@ -415,28 +430,28 @@ iabbrev ct'' content-type: '';
" #autocommands {{{ " #autocommands {{{
" template files {{{ " template files {{{
augroup templates augroup templates
autocmd! autocmd!
autocmd BufNewFile *.sh 0read ~/.config/nvim/templates/template.sh | normal G autocmd BufNewFile *.sh 0read ~/.config/nvim/templates/template.sh | normal G
autocmd BufNewFile *.html 0read ~/.config/nvim/templates/template.html | normal gg autocmd BufNewFile *.html 0read ~/.config/nvim/templates/template.html | normal gg
autocmd BufNewFile *.css 0read ~/.config/nvim/templates/template.css | normal G autocmd BufNewFile *.css 0read ~/.config/nvim/templates/template.css | normal G
autocmd BufNewFile *.scss 0read ~/.config/nvim/templates/template.css | normal G autocmd BufNewFile *.scss 0read ~/.config/nvim/templates/template.css | normal G
augroup END augroup END
" }}} " }}}
" persistent folds {{{ " persistent folds {{{
augroup AutoSaveFolds augroup AutoSaveFolds
autocmd! autocmd!
autocmd BufWrite ?* mkview autocmd BufWrite ?* mkview
autocmd BufRead ?* silent! loadview autocmd BufRead ?* silent! loadview
augroup END augroup END
" }}} " }}}
" Show trailing whitepace and spaces before a tab: {{{ " Show trailing whitepace and spaces before a tab: {{{
augroup whitespaceerrors augroup whitespaceerrors
autocmd! autocmd!
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
augroup END augroup END
" }}} " }}}
" automatically reload if color scheme file written {{{ " automatically reload if color scheme file written {{{
@ -454,22 +469,22 @@ iabbrev ct'' content-type: '';
" autocmd CmdlineEnter * :redraw | :set number " autocmd CmdlineEnter * :redraw | :set number
" autocmd CmdlineLeave * :set nonumber " autocmd CmdlineLeave * :set nonumber
" augroup END " augroup END
" endif " endif
" }}} " }}}
" Automatically reload .vimrc if changed {{{ " Automatically reload .vimrc if changed {{{
augroup myvimrc augroup myvimrc
autocmd! autocmd!
autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
augroup END augroup END
" }}} " }}}
" Open quickfix window{{{ " Open quickfix window{{{
augroup QuickFixAutoload augroup QuickFixAutoload
autocmd! autocmd!
autocmd QuickFixCmdPost [^l]* nested botright cwindow autocmd QuickFixCmdPost [^l]* nested botright cwindow
autocmd QuickFixCmdPost l* nested botright lwindow autocmd QuickFixCmdPost l* nested botright lwindow
augroup END augroup END
" }}} " }}}