changes regarding autocomplete

This commit is contained in:
gurkenhabicht 2023-07-18 23:56:32 +02:00
parent b07c0fa407
commit beca3fccfb
6 changed files with 34 additions and 43 deletions

1
.gitignore vendored
View File

@ -2,4 +2,5 @@ vim/.vim/bundle/
vim/.vim/.swap/*
vim/.vim/.backup/*
vim/.vim/.undo/*
vim/.vim/.netrwhist
#vim/.vim/pack/

3
.gitmodules vendored
View File

@ -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

View File

@ -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'

View File

@ -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\\)\\>

@ -0,0 +1 @@
Subproject commit e0d131d95364edf940a70127fcb5748b86e6955e

View File

@ -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<CR>
" nmap K :ALEHover<CR>
" 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("\<C-x>\<C-o>", "n")
endif
endfunction
set completeopt+=menuone,noselect,noinsert
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
autocmd InsertCharPre * call OpenCompletion()
autocmd CompleteDone * pclose