Compare commits

..

1 Commits

Author SHA1 Message Date
Stefan Friese f342cded6d added vim linting for json and yaml 2022-01-20 18:23:29 +01:00
1 changed files with 20 additions and 30 deletions

View File

@ -1,5 +1,5 @@
"set runtimepath^=~/.vim/bundle/ctrlp.vim
""set runtimepath^=~/.vim/bundle/nerdtree
"set runtimepath^=~/.vim/bundle/nerdtree
set nocompatible
syntax on
filetype plugin on
@ -8,23 +8,21 @@ set number
set hlsearch
"set relativenumber
""folding
"folding
set foldenable foldlevelstart=20 foldmethod=indent
" finding files
set path+=**
set wildmenu
set path+=**
set wildmenu
" tags
command! MakeTags !ctags -R .
" " tags
command! MakeTags !ctags -R .
"
" linter
autocmd FileType python setlocal makeprg=pylint\ --output-format=parseable
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 makeprg=yamllint\ --f\
parsable\ %
autocmd FileType json autocmd BufWritePre <buffer> %!python -m json.tool
2>/dev/null
autocmd BufWritePost *.py silent make! <afile> | silent redraw!
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 makeprg=yamllint\ --f\ parsable\ %
autocmd FileType json autocmd BufWritePre <buffer> %!python -m json.tool 2>/dev/null
autocmd BufWritePost *.py,*.yaml,*.yml silent make! <afile> | silent redraw!
autocmd QuickFixCmdPost [^l]* cwindow
" file browsing
@ -40,25 +38,19 @@ set cursorline
hi CursorLine cterm=NONE ctermbg=darkgrey ctermfg=white
" statusline
let g:gitparsedbranchname = ' '
function! UpdateGitBranch()
let l:branchname = system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
let g:branchstatus = strlen(l:branchname) > 0?' '.l:branchname.' ':''
function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
endfunction
augroup UPDATE_GITBRANCH
" clear old commands
autocmd!
" update git branch
autocmd BufWritePre * :call UpdateGitBranch()
autocmd BufReadPost * :call UpdateGitBranch()
autocmd BufEnter * :call UpdateGitBranch()
augroup END
function! StatuslineGit()
let l:branchname = GitBranch()
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
endfunction
set laststatus=2
set statusline=
set statusline+=%#PmenuSel#
set statusline+=%{g:branchstatus}
set statusline+=%{StatuslineGit()}
set statusline+=%#BufTabLineCurrent#
set statusline+=\ %M
set statusline+=\ %r
@ -73,14 +65,12 @@ set statusline+=\ %p%%
set statusline+=\ [%n]
" Tree of files
"map <C-n> :NERDTreeToggle<CR>
map <C-n> :Lex <bar> vertical resize 30 <CR>
"let g:vimspector_enable_mappings = 'HUMAN'
"packadd! vimspector
let g:vimspector_enable_mappings = 'HUMAN'
packadd! vimspector
"packadd! gruvbox
colorscheme gruvbox
set bg=dark