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