4

The OP's question is whether there is a good omnifunc for Vimscript itself, such as offering semantically or syntactically are completion suggestions for vimscript functions, variables, etc. A number of answers just note general autocompletion plugins like YCM and snippet plugins like UltiSnips. So to answer the original question: Yes, there's vim-verdin: ...


3

Thanks for the answer from @D. Ben Knoble This feature is called wildmenu, putting this line set wildmenu in the .vimrc or .gvimrc (_vimrc or _gvimrc on MS Windows version) can turn this feature on. Typing :help wildmenu in vim to check further detail of wildmenu.


3

If your Vim binary includes the patch 8.1.1068, you can use complete_info(). To get the list of all matches, while the pum is visible, you could use it like this: map(get(complete_info(['items']), 'items', {}), {_,v -> v.word}) ^^^^^^^^^^^^^^^^^^^^^^^^ If your Vim binary also includes 8.1.1803, you can rewrite the expression in a more readable ...


3

A buffer is listed if it's in the buffer list, you can see it in :h :buffers , you can refer to it with :h :buffer , :h :bnext , etc . It's controled by setting :h 'buflisted' . A buffer is loaded if the corresponding file is loaded into memory. Not all buffers should be listed, e.g. help type buffer is not listed, as no one wants to refer to it with :h :...


3

Get variable value make -p -f/dev/null 2>/dev/null | grep -Po 'var\s*=\s*\K.+' Complete in vim I use :h complete() in this case, you need to tell it where complete starts and give it a list of candidates. Assume your current line looks like this: ........$(var)/mid0/mid1/mid2/base ^---cursor position in insert mode ...


3

TL;DR: Set 'path' to include the path to your include files. In your example: set path+=/path Native completion from include files Vim native completion is quite useful for C and C++ files, Vim can search for your include files and find candidate completion targets in them and the defaults in Vim are already pretty useful for Vim completion. You can use ...


2

Ok, after years of trying many things, I finally found a viable solution! And the winner is: COC "It's a completion framework and language server client which supports extension features of VSCode." The only thing is that to get the "floating windows" (which is the really cool stuff) you need to a "Build neovim from master code or use nightly build" But ...


2

Your terminal send ^@ as <c-space> to vim, ^@ is ctrl-@, it's equivalent to <Nul> in vim, check :h keycodes if you have doubts. You get E29: No inserted text yet error message because :h i_CTRL-@ is trying to insert previously inserted text (it doesn't exist). To fix it, use: inoremap <Nul> <c-n> or inoremap <c-@> <c-n&...


2

I believe you’ve got the map syntax backwards (see :help :map): try inoremap <C-Space> <C-n> Also see :help ins-completion


2

To implement your stated use case, the :imap ..<any> ..<any> would leverage Vim's built-in 'timeoutlen'; it's implementation wouldn't be so outrageous, there's only a limited set of available keys and you can use metaprogramming with a :for loop to build all these mappings. The biggest challenge here is enumerating all desired keys. However, I ...


2

The situation with buffers is quite complicated. Use :ls (of :buffers) to inspect them. There can be the following states: Active buffer --- both loaded into RAM and shown in (at least one) window. This is what you normally got after :e filename, :buffer N and so on. (flagged "a" by :ls; also when it's in active window, it's flagged by "%") Hidden buffer --...


2

I have had moderate success with pydoc.vim for documentation; it can be helpful to use a virtualenv/run setup.py develop, but you may still have to point it at the right python. I’ve also had moderate success with tags (I use universal ctags and these hooks to keep them up to date). With tags, I can quickly jump to the source and read a docstring. ...


2

feedkeys() is the correct approach, but to respect the special keys, I must use double quotes (as mentioned in the vimhelp): execute 'normal! 27Go' startinsert call feedkeys("\<c-x>\<c-o>")


2

set complete=.,w,b,u,t,i the 'i' flag makes vim autocompletion search the including files. Also, you can use 'gf' command at the including file to verify vim can actually find the file. However, 'i' flag may slows down vim autocompletion significantly depending on the including file size and I avoid to use it.


2

:o[pen] comes from Vi. It's intended to support so called "open mode" which is no-op in Vim. You should use :e[dit] instead.


2

Remap <up> key to close popup menu and move cursor up when popup menu is visible: inoremap <expr> <up> pumvisible() ? '<c-e><up>' : '<up>' :h :map-expression :h complete_CTRL-E :h pumvisible()


2

I use <esc>A, it's 2.5 key strokes(0.5 for shift), it's not the shortest solution, but it's the most natural one if you are used to move around in normal mode. IMO, <esc> doesn't count as a keystroke. <c-o>A works too, but I don't like it, I can't remember the last time i use :h i_CTRL-O . You can also create a map for this: inoremap <...


1

I agree with @D.BenKnoble's comment that Pattern not found is not strictly an error, more of an exceptional condition, and therefore doesn't have an E... number and no way to :catch. If you use the completion menu, you could use :help pumvisible() to use the side effect of showing (or not) the menu in case of matches. Also, there's the :help CompleteDone ...


1

To actually trigger the completion dropdown I think your best bet is to use feedkeys() which more closely simulates a user entering text through a keyboard... try call feedkeys("i\<C-n>") catch This shows the completion dropdown for me. When the cursor follows text that won't result in any completion candidates I do see the "Pattern not found" ...


1

If you're looking for a super simple solution, you can add the code from this page to your .vimrc. https://gist.github.com/maxboisvert/a63e96a67d0a83d71e9f49af73e71d93 There is also a plugin version of it which can be found here. https://github.com/maxboisvert/vim-simple-complete


1

What you want is to use a Language Server through the Language Server Protocol (LSP). Read more about it on Wikipedia or on the official website. As the Wikipedia article points out: The Language Server Protocol was originally developed for Microsoft's Visual Studio Code and is now an open standard. So what you get in VS Code is actually being backed ...


1

It sounds as though the supertab plugin has either overwritten or removed your insert mode mapping. You can check if this is the case with the command: :verbose imap <C-X> You can reinstate your mapping simply by re-running your map command again: :inoremap <C-X> <BS> The best way to do this automatically in your vim configuration is ...


1

The insert mode completion menu and the command-line completion menu are two different beasts. They behave differently in many ways, in particular a keystroke to cancel completion and return to the original word is only available in the insert mode completion menu. The insert mode completion menu is typically invoked with Ctrl+P or Ctrl+N (or some of the ...


1

The word completition as you describe it's just how Ctrl-n works. I use the following mapping to make autocompletition: inoremap <expr> <Tab> getline('.')[col('.') - 2] =~ '\w' ? "<C-N>" : "<Tab>" which uses <Tab> to automatically complete the current word if there is only one match, otherwise it shows the dropdown list if the ...


1

Put the following insert-mode mapping (see :h mapmode-i) in your vimrc: inoremap <expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>" inoremap <expr> <S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>" :h pumvisible() returns non-zero when popupmenu is visible and zero otherwise. :h :map-<expr> maps the key to the ...


1

To add sentences as thesaurus, you need the 'iskeyword' option to contain the space character (32 in ascii). Your thesaurus file should then contain spaces only to separate words in a thesaurus sentence and not to separate entries : iterate,loop,loop over branch,condition ... I found this post that works well to add 32 to 'iskeyword' just before launching ...


Only top voted, non community-wiki answers of a minimum length are eligible