From fff033d7ea89c26f85fb20e3ff1ac03abc1d846b Mon Sep 17 00:00:00 2001 From: gurkenhabicht Date: Sun, 18 Dec 2022 14:54:56 +0100 Subject: [PATCH] vimrc updates --- .gitignore | 5 +- .gitmodules | 9 ++ vim/.vim/.vim/after/ftplugin/go.vim | 2 + vim/.vim/.vim/after/ftplugin/python.vim | 31 +++++ vim/.vim/.vim/bundle/nerdtree | 1 + vim/.vim/.vim/compiler/go.vim | 3 + vim/.vim/.vim/pack/default/start/gruvbox | 1 + vim/.vim/.vim/pack/vimspector/opt/vimspector | 1 + vim/.vim/after/ftplugin/go.vim | 2 + vim/.vim/after/ftplugin/python.vim | 31 +++++ vim/.vim/compiler/go.vim | 3 + vim/.vim/pack/default/start/ale | 1 + vim/.vim/pack/default/start/indentLine | 1 + .../pack/default/start/vim-log-highlighting | 1 + vim/.vimrc | 110 ++++++++++++------ 15 files changed, 165 insertions(+), 37 deletions(-) create mode 100644 vim/.vim/.vim/after/ftplugin/go.vim create mode 100644 vim/.vim/.vim/after/ftplugin/python.vim create mode 160000 vim/.vim/.vim/bundle/nerdtree create mode 100644 vim/.vim/.vim/compiler/go.vim create mode 160000 vim/.vim/.vim/pack/default/start/gruvbox create mode 160000 vim/.vim/.vim/pack/vimspector/opt/vimspector create mode 100644 vim/.vim/after/ftplugin/go.vim create mode 100644 vim/.vim/after/ftplugin/python.vim create mode 100644 vim/.vim/compiler/go.vim create mode 160000 vim/.vim/pack/default/start/ale create mode 160000 vim/.vim/pack/default/start/indentLine create mode 160000 vim/.vim/pack/default/start/vim-log-highlighting diff --git a/.gitignore b/.gitignore index 79e8b04..a30b63d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ vim/.vim/bundle/ -vim/.vim/pack/ +vim/.vim/.swap/* +vim/.vim/.backup/* +vim/.vim/.undo/* +#vim/.vim/pack/ diff --git a/.gitmodules b/.gitmodules index b007216..63f57d1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,12 @@ [submodule "vim/.vim/pack/default/start/gruvbox"] path = vim/.vim/pack/default/start/gruvbox url = https://github.com/morhetz/gruvbox.git +[submodule "vim/.vim/pack/default/start/vim-log-highlighting"] + path = vim/.vim/pack/default/start/vim-log-highlighting + url = https://github.com/MTDL9/vim-log-highlighting.git +[submodule "vim/.vim/pack/default/start/indentLine"] + path = vim/.vim/pack/default/start/indentLine + url = https://github.com/Yggdroot/indentLine.git +[submodule "vim/.vim/pack/default/start/ale"] + path = vim/.vim/pack/default/start/ale + url = https://github.com/dense-analysis/ale.git diff --git a/vim/.vim/.vim/after/ftplugin/go.vim b/vim/.vim/.vim/after/ftplugin/go.vim new file mode 100644 index 0000000..62d6da3 --- /dev/null +++ b/vim/.vim/.vim/after/ftplugin/go.vim @@ -0,0 +1,2 @@ +compiler go +nnoremap :silent make redraw diff --git a/vim/.vim/.vim/after/ftplugin/python.vim b/vim/.vim/.vim/after/ftplugin/python.vim new file mode 100644 index 0000000..4f48a3f --- /dev/null +++ b/vim/.vim/.vim/after/ftplugin/python.vim @@ -0,0 +1,31 @@ +set tabstop=4 shiftwidth=4 autoindent smartindent expandtab +setlocal colorcolumn=80 + +setlocal path=.,** +setlocal wildignore+=*.pyc + +" Add search in other files inside the path +set include=^\\s*\\(from\\\|import\\)\\s*\\zs\\(\\S\\+\\s\\{-}\\)*\\ze\\($\\\|\ as\\) +function! PyInclude(fname) +" Following examples: +" import conv.metrics +" /conv.metrics/ +" conv/metrics.py +" from conv import conversion as conv (2) +" /conv import conversion/ +" conv/conversion.py conv.py + let parts = split(a:fname, ' import ') " (1) [conv.metrics] (2) [conv, conversion] + let l = parts[0] " (1) conv.metrics (2) conv + if len ( parts ) > 1 + let r = parts[1] " conversion + let joined = join([l,r], '.') " conv.conversion + let fp = substitute(joined, '\.', '/', 'g') . '.py' + let found = glob(fp, 1) + if len(found) + return found + endif + endif + return substitute(joined, '\.', '/', 'g') . '.py' +endfunction +setlocal includeexpr=PyInclude(v:fname) +setlocal define=^\\s*\\<\\(def\\\|class\\)\\> diff --git a/vim/.vim/.vim/bundle/nerdtree b/vim/.vim/.vim/bundle/nerdtree new file mode 160000 index 0000000..3595304 --- /dev/null +++ b/vim/.vim/.vim/bundle/nerdtree @@ -0,0 +1 @@ +Subproject commit 35953042fbf5535a7e905b52a6973c3f7f8a5536 diff --git a/vim/.vim/.vim/compiler/go.vim b/vim/.vim/.vim/compiler/go.vim new file mode 100644 index 0000000..20be5c6 --- /dev/null +++ b/vim/.vim/.vim/compiler/go.vim @@ -0,0 +1,3 @@ +let current_compiler = ‘go’ +CompilerSet makeprg=go\ build\ ./... +CompilerSet errorformat=%E%f:%l:%c:%m diff --git a/vim/.vim/.vim/pack/default/start/gruvbox b/vim/.vim/.vim/pack/default/start/gruvbox new file mode 160000 index 0000000..bf2885a --- /dev/null +++ b/vim/.vim/.vim/pack/default/start/gruvbox @@ -0,0 +1 @@ +Subproject commit bf2885a95efdad7bd5e4794dd0213917770d79b7 diff --git a/vim/.vim/.vim/pack/vimspector/opt/vimspector b/vim/.vim/.vim/pack/vimspector/opt/vimspector new file mode 160000 index 0000000..8e2d352 --- /dev/null +++ b/vim/.vim/.vim/pack/vimspector/opt/vimspector @@ -0,0 +1 @@ +Subproject commit 8e2d352eb8958693ea2021f7f43ae0418dcb083b diff --git a/vim/.vim/after/ftplugin/go.vim b/vim/.vim/after/ftplugin/go.vim new file mode 100644 index 0000000..62d6da3 --- /dev/null +++ b/vim/.vim/after/ftplugin/go.vim @@ -0,0 +1,2 @@ +compiler go +nnoremap :silent make redraw diff --git a/vim/.vim/after/ftplugin/python.vim b/vim/.vim/after/ftplugin/python.vim new file mode 100644 index 0000000..4f48a3f --- /dev/null +++ b/vim/.vim/after/ftplugin/python.vim @@ -0,0 +1,31 @@ +set tabstop=4 shiftwidth=4 autoindent smartindent expandtab +setlocal colorcolumn=80 + +setlocal path=.,** +setlocal wildignore+=*.pyc + +" Add search in other files inside the path +set include=^\\s*\\(from\\\|import\\)\\s*\\zs\\(\\S\\+\\s\\{-}\\)*\\ze\\($\\\|\ as\\) +function! PyInclude(fname) +" Following examples: +" import conv.metrics +" /conv.metrics/ +" conv/metrics.py +" from conv import conversion as conv (2) +" /conv import conversion/ +" conv/conversion.py conv.py + let parts = split(a:fname, ' import ') " (1) [conv.metrics] (2) [conv, conversion] + let l = parts[0] " (1) conv.metrics (2) conv + if len ( parts ) > 1 + let r = parts[1] " conversion + let joined = join([l,r], '.') " conv.conversion + let fp = substitute(joined, '\.', '/', 'g') . '.py' + let found = glob(fp, 1) + if len(found) + return found + endif + endif + return substitute(joined, '\.', '/', 'g') . '.py' +endfunction +setlocal includeexpr=PyInclude(v:fname) +setlocal define=^\\s*\\<\\(def\\\|class\\)\\> diff --git a/vim/.vim/compiler/go.vim b/vim/.vim/compiler/go.vim new file mode 100644 index 0000000..20be5c6 --- /dev/null +++ b/vim/.vim/compiler/go.vim @@ -0,0 +1,3 @@ +let current_compiler = ‘go’ +CompilerSet makeprg=go\ build\ ./... +CompilerSet errorformat=%E%f:%l:%c:%m diff --git a/vim/.vim/pack/default/start/ale b/vim/.vim/pack/default/start/ale new file mode 160000 index 0000000..8bcbb29 --- /dev/null +++ b/vim/.vim/pack/default/start/ale @@ -0,0 +1 @@ +Subproject commit 8bcbb2995822c4062d00cb41df713fd76092f04f diff --git a/vim/.vim/pack/default/start/indentLine b/vim/.vim/pack/default/start/indentLine new file mode 160000 index 0000000..d15d63b --- /dev/null +++ b/vim/.vim/pack/default/start/indentLine @@ -0,0 +1 @@ +Subproject commit d15d63bf9c4a74a02470d4bc8ecce53df13e3a75 diff --git a/vim/.vim/pack/default/start/vim-log-highlighting b/vim/.vim/pack/default/start/vim-log-highlighting new file mode 160000 index 0000000..1037e26 --- /dev/null +++ b/vim/.vim/pack/default/start/vim-log-highlighting @@ -0,0 +1 @@ +Subproject commit 1037e26f3120e6a6a2c0c33b14a84336dee2a78f diff --git a/vim/.vimrc b/vim/.vimrc index 604e1c2..0550f75 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,62 +1,95 @@ -"set runtimepath^=~/.vim/bundle/ctrlp.vim -""set runtimepath^=~/.vim/bundle/nerdtree set nocompatible +set backspace=start,eol,indent +set hidden +set hlsearch syntax on filetype plugin on -set tabstop=4 shiftwidth=4 expandtab -set number -set hlsearch -"set relativenumber +set tabstop=4 shiftwidth=4 autoindent smartindent expandtab +"set noswapfile -""folding +" Numbering of lines +" set relativenumber +set number + +" Runtimepath variables +" call -> set rtp? show the runtime path +let $RTP=split(&runtimepath, ',')[0] +let $RC="$HOME/.vimrc" + +" Move Swap,Backup and undo files into .vim directory +set directory^="$HOME/.vim/.swap//" +set backupdir^="$HOME/.vim/.backup//" +set undodir^="$HOME/.vim/.undo//" + +" Split to the right and below +set splitbelow +set splitright + +" Folding set foldenable foldlevelstart=20 foldmethod=indent -" finding files - set path+=** - set wildmenu +" Rebind shortcut to switch splits +nmap h +nmap j +nmap k +nmap l -" " 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 %!python -m json.tool 2>/dev/null -autocmd BufWritePost *.py silent make! | silent redraw! -autocmd QuickFixCmdPost [^l]* cwindow +" Finding files +set path+=** +set wildmenu -" file browsing +" Tags +command! MakeTags !ctags -R . +set autochdir +set tags=tags; + +" Linter +" autocmd FileType python setlocal makeprg=pylint\ --output-format=parseable +" autocmd BufWritePost *.py silent make! | silent redraw! +" autocmd QuickFixCmdPost [^l]* cwindow + +" File browsing let g:netrw_banner=0 let g:netrw_browse_split=4 let g:netrw_altv=1 let g:netrw_liststyle=3 let g:netrw_list_hide=netrw_gitignore#Hide() let g:netrw_list_hide.=',\(\^\|\s\s\)\zs\.\S\+' +"map :NERDTreeToggle +map :Lex vertical resize 30 -" cursorline +" Cursorline set cursorline hi CursorLine cterm=NONE ctermbg=darkgrey ctermfg=white -" statusline -let g:gitparsedbranchname = ' ' +" Statusline +" function! gitbranch() +" return system("git rev-parse --abbrev-ref head 2>/dev/null | tr -d '\n'") +" endfunction +" +" function! statuslinegit() +" let l:branchname = gitbranch() +" return strlen(l:branchname) > 0?' '.l:branchname.' ':'' +" endfunction 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.' ':'' + let l:branchname = system("git rev-parse --abbrev-ref head 2>/dev/null | tr -d '\n'") + let b:branchstatus = strlen(l:branchname) > 0? ' '.l:branchname.' ':'' endfunction augroup UPDATE_GITBRANCH -" clear old commands +" clear previous commands autocmd! -" update git branch +" Update git branch autocmd BufWritePre * :call UpdateGitBranch() autocmd BufReadPost * :call UpdateGitBranch() -autocmd BufEnter * :call UpdateGitBranch() -augroup END +autocmd BufEnter * :call UpdateGitBranch() +augroup end set laststatus=2 set statusline= set statusline+=%#PmenuSel# -set statusline+=%{g:branchstatus} +" set statusline+=%{StatuslineGit()} +set statusline+=%{b:branchstatus} set statusline+=%#BufTabLineCurrent# set statusline+=\ %M set statusline+=\ %r @@ -70,15 +103,20 @@ set statusline+=\ %c:%l/%L set statusline+=\ %p%% set statusline+=\ [%n] +packadd! indentLine +"let g: indentLine_char = '⦙' -" Tree of files -map :Lex vertical resize 30 +" let g:vimspector_enable_mappings = 'HUMAN' +" packadd! vimspector -"let g:vimspector_enable_mappings = 'HUMAN' -"packadd! vimspector - -"packadd! gruvbox +packadd! gruvbox colorscheme gruvbox set bg=dark +packadd! vim-log-highlighting +packadd! ale +packloadall +" Load all of the helptags now, after plugins have been loaded. +" All messages and errors will be ignored. +silent! helptags ALL