From beca3fccfb2b92733050eeff273bf3b83ee16f1c Mon Sep 17 00:00:00 2001 From: gurkenhabicht Date: Tue, 18 Jul 2023 23:56:32 +0200 Subject: [PATCH] changes regarding autocomplete --- .gitignore | 1 + .gitmodules | 3 ++ vim/.vim/.netrwhist | 12 -------- vim/.vim/after/ftplugin/python.vim | 44 ++++++++++++++--------------- vim/.vim/pack/default/start/fzf.vim | 1 + vim/.vimrc | 16 +++++------ 6 files changed, 34 insertions(+), 43 deletions(-) delete mode 100644 vim/.vim/.netrwhist create mode 160000 vim/.vim/pack/default/start/fzf.vim diff --git a/.gitignore b/.gitignore index a30b63d..728beac 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ vim/.vim/bundle/ vim/.vim/.swap/* vim/.vim/.backup/* vim/.vim/.undo/* +vim/.vim/.netrwhist #vim/.vim/pack/ diff --git a/.gitmodules b/.gitmodules index 00a2108..d11c30f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,6 @@ [submodule "vim/.vim/pack/default/start/vim-surround"] path = vim/.vim/pack/default/start/vim-surround url = https://github.com/tpope/vim-surround.git +[submodule "vim/.vim/pack/default/start/fzf.vim"] + path = vim/.vim/pack/default/start/fzf.vim + url = https://github.com/junegunn/fzf.vim.git diff --git a/vim/.vim/.netrwhist b/vim/.vim/.netrwhist deleted file mode 100644 index 1c347bb..0000000 --- a/vim/.vim/.netrwhist +++ /dev/null @@ -1,12 +0,0 @@ -let g:netrw_dirhistmax =10 -let g:netrw_dirhistcnt =4 -let g:netrw_dirhist_4='/home/whackx' -let g:netrw_dirhist_3='/home/whackx/.local/share/sqlmap/output/10.10.11.220' -let g:netrw_dirhist_2='/home/whackx/Documents/tryhackme/Flip' -let g:netrw_dirhist_1='/home/stefan/Documents/husk' -let g:netrw_dirhist_0='/home/stefan/Documents/husk/static/js' -let g:netrw_dirhist_9='/home/stefan/Documents/husk/static' -let g:netrw_dirhist_8='/home/stefan/Documents/husk/templates/status_code' -let g:netrw_dirhist_7='/home/stefan' -let g:netrw_dirhist_6='/etc/NetworkManager/conf.d' -let g:netrw_dirhist_5='/etc/NetworkManager' diff --git a/vim/.vim/after/ftplugin/python.vim b/vim/.vim/after/ftplugin/python.vim index 1f9cf10..a690174 100644 --- a/vim/.vim/after/ftplugin/python.vim +++ b/vim/.vim/after/ftplugin/python.vim @@ -10,27 +10,27 @@ 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) +" 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/pack/default/start/fzf.vim b/vim/.vim/pack/default/start/fzf.vim new file mode 160000 index 0000000..e0d131d --- /dev/null +++ b/vim/.vim/pack/default/start/fzf.vim @@ -0,0 +1 @@ +Subproject commit e0d131d95364edf940a70127fcb5748b86e6955e diff --git a/vim/.vimrc b/vim/.vimrc index 3e5b18f..9e72c62 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -5,9 +5,9 @@ set hlsearch syntax on filetype plugin on set tabstop=4 shiftwidth=4 autoindent smartindent expandtab +set mouse=a "set noswapfile - " Numbering of lines " set relativenumber set number @@ -139,18 +139,16 @@ endfunction call AutoHighlightToggle() " ----------- Code Completion +let g:ale_enabled = 1 +let g:ale_hover_enabled = 1 +" nmap gr :ALEFindReferences +" nmap K :ALEHover " set omnifunc=syntaxcomplete#Complete set omnifunc=ale#completion#Complete let g:ale_completion_enabled=1 let g:ale_set_balloons=1 -function! OpenCompletion() - if !pumvisible() && ((v:char >= 'a' && v:char <= 'z') || (v:char >= 'A' && v:char <= 'Z')) - call feedkeys("\\", "n") - endif -endfunction set completeopt+=menuone,noselect,noinsert - -autocmd InsertCharPre * call OpenCompletion() -autocmd CompleteDone * pclose +autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif +