Questions tagged [autocompletion]
For questions about the several commands to complete part of a keyword or line that has been typed.
368
questions
1
vote
0
answers
37
views
How to select file/dir in command mode completion with nvim-cmp?
In command-mode while using nvim-cmp, e.g., when you do :e ~/somedir/file but before pressing enter, file completion pops up. I can press tab if I happened to enter the prefix of a valid entry, and it ...
0
votes
0
answers
27
views
builtin lsp completion not working
Using neovim 0.11 I wanted to use the built in completion feature, here's my configuration to use it when the lsp is being used:
vim.api.nvim_create_autocmd("LspAttach", {
group = ...
1
vote
0
answers
13
views
Why is coc-nvim adding an extra line?
I have the following mapping in .vimrc:
inoremap <silent><expr> <cr> coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"...
0
votes
0
answers
22
views
How could I fuzzy search completions?
Suppose I want to insert px-10 but I don't recall the exact form of this expression. This is an available completion for tailwind css. Suppose I recall the expression begins with p, then some letter, ...
0
votes
1
answer
60
views
How to enable forward slash for directory names on autocompletion with hrsh7th / cmp-path plugin?
I use this plugin https://github.com/hrsh7th/cmp-path for autocompletion, including paths in the command mode.
And the problem is that on a tab press the name is completed, but the slash is not ...
0
votes
2
answers
353
views
How do I get these IntelliSense™ features in Vim?
Previously I used MS Visual Studio Code, which has this very nice feature called IntelliSense™. It works extremely well with HTML, CSS, and Javascript.
You can type ! and the html boilerplate would be ...
0
votes
2
answers
46
views
How to get default Generic Keywords autocomplete functionality when LSP is in use?
I used to rely heavily on the default autocompletion provided by the Ctrl + n keys in the insert mode.
But when I started to use NeoVim and its LSP functionality, the keys started to provide a ...
0
votes
1
answer
573
views
I can't get Python autocomplete to work with NvChad + python-lsp-server
I'm trying to use Neovim with Python, and I can't get autocomplete to work. I have created a minimal example of what I'm trying to do:
For this example, I'll run everything in a fresh Alpine container ...
1
vote
1
answer
32
views
Complete a multi-word phrase or REMAINDER of a line (not single word or whole line)
I know how to complete a word <c-N> or <c-P> and how to complete a whole line <c-X><c-L>. But how can I have vim complete a phrase or REMAINDER of a line?
Example:
one two ...
0
votes
0
answers
39
views
How do I stop the cmp-vimtex completion source from completing latex environments with an extra brace?
I have lua neovim config here. I wrote some latex snippets in luasnip; for example the snippet that makes a new environment is triggered by begin to produce
s({
trig = "begin",
name =...
1
vote
0
answers
39
views
Using count with completions
Say I'm using the completion menu in vim, and I see the word I need as the 9th suggestion. Is there a way to use a count and execute <C-n> 9 times to access the desired completion?
0
votes
0
answers
39
views
Auto importing issue from installed npm packages in neovim (only in js not ts)
I mainly use Neovim for my MERN stack work and it's been a few days, I have noticed that from some of the installed npm packages of my project, I wasn't able to auto-import the functions or components....
0
votes
1
answer
141
views
Get default autocomplete list using Vimscript
If I type an unfinished word in Vim (in insert mode) and press CTRL+N I get a list of autocomplete suggestions.
(this list contains words being used in that file and other files that are currently ...
0
votes
0
answers
64
views
How to make lua_ls provide completion for luasnip methods?
I am using luasnip in Neovim and I'm having problems getting lua_ls to provide information about the functions.
local ls = require("luasnip")
local s = ls.snippet
Basically, I want when ...
0
votes
0
answers
84
views
input with completion in times of lua (nvim-cmp ?)
let user_dir = input('Enter a directory: ', '', 'dir')
This is simple not working for me. When I press <tab> instead of completion, I get ^I .
I use nvim-cmp. Could it be the reason? Can I use ...
0
votes
0
answers
17
views
pum#map#inser_relative(+1) command remap which worked forever recently stopped working
I have a pum command which does tab autocomplete on a completion list and it recently stopped working and I do not know why. The command...
inoremap <silent><expr> <TAB>
\ pum#...
0
votes
1
answer
32
views
html id completion
I'm familiar with vim's built in completion, one of the completion methods allow me to autocomplete filepaths.
I am working with a large html project where I need to reference filepaths along with id'...
1
vote
1
answer
21
views
Insert abbreviation and open completion
I sometimes add abbreviations for local files or projects.
For example having:
PREFIX_FOO
PREFIX_BAR
PREFIX_BAZ
Instead of typing PREFIX_ I map it to something, for example PP or P1, P2, ... etc.
:...
1
vote
1
answer
60
views
Using the completion function for a command that is passed as an argument to another command
Is it possible to programmatically get a command's definition so that its completion function can be called manually? Alternatively, is it possible to define a command such that the first argument is ...
1
vote
0
answers
44
views
How can I ask autocompletion to ignore buffers matching a pattern?
I make use of vim's <C-n>/<C-p> auto-completion menu with the default complete setting .,w,b,u,t,i.
This generally works great, but I'd like to have Vim ignore buffers from a certain ...
1
vote
1
answer
61
views
VimTeX omnicompletion for bibliography
Problem with builtin omnicompletion for bibliography. It works on main.tex, but not in the chapters.
This is the tree structure:
├── chapters
│ ├── actors_behaviour.tex
│ ├── analysis_acts.tex
│ ...
2
votes
1
answer
150
views
E93: More than one match when <C-d> shows only one match
When jumping between buffers in Vim, most the time things work quite smoothly.
I like to jump to buffers by writing :b something1*something2, checking if the match is unique by invoking C-d, and if so ...
3
votes
1
answer
222
views
Is it possible to populate the autocompletion popup before all the results are fetched?
I greatly make use of Vim's <C-n>/<C-p> auto-completion menu. When working on large projects, or on sporadic large files, this may take several seconds or longer to be populated.
Is there ...
1
vote
1
answer
44
views
How to jump to location of completion from another file?
In Vim, oftens I happen to be using some completion that vim provides for me in the Ctrl n/Ctrl p menu. If the completion happens to be from some other file, I know that Vim knows where it comes from ...
1
vote
1
answer
50
views
configure omnicomplete to use `gj` `gk` to go the next and previous completion
Having decided to use the arrow keys to navigate instead of hjkl, and having decided that I want to move to the previous screen line, not actual text line, I have put this on vimrc
nnoremap <Up> ...
1
vote
1
answer
463
views
Cmp conflicts with native autocomplete i_CTRL-P and i_CTRL-N
I use lsp-zero.nvim and it requires nvim-cmp which is what I think is causing the problem.
How can I retain the native autocompletion i_CTRL-P and i_CTRL-N while also using cmp?
0
votes
0
answers
35
views
Popup to show number of matches of a given string while in insert mode, and while completion popup is being shown
This is a follow up to a previous question.
Thanks to that, I could come up with this augroup:
augroup Foo
autocmd!
autocmd TextChangedI,TextChangedP * call <SID>foo()
fun s:foo()
let ...
0
votes
1
answer
26
views
iabbrev with autocompletition
I had setup the following iabbrev for my Verilog settings:
iabbrev module module<Enter>(<Enter><Enter>);<Up><Up><Up><End>
iabbrev begin begin<Enter><...
1
vote
1
answer
91
views
How to restrict tab-completion to the file name when opening a buffer
I know that I can do:
:b home<tab>
and vim will autocomplete to all buffers with the word "home" in them. My problem is that this includes all buffers that have "home" ...
0
votes
0
answers
202
views
OpenMP not detected by clangd despite compile_commands.json
My program compiles fine, but within Vim (with CoC + clangd) I get the linting error: #include <omp.h> 'omp.h' file not found (clang pp_file_not_found)
I use bear -- make as described in https://...
0
votes
1
answer
476
views
Down arrow key triggers coc#pum#visible() ? coc#pum#next(0) : "\"
I am using NVIM 0.9.0 stable release with Conqueror of Completion which I installed recently.
I am used to using the arrow keys in insert mode for quick navigation between two lines. After installing ...
0
votes
0
answers
21
views
Shortcut keys sometimes type commands into the buffer for the file I am editing
I'm using gvim with the included mswin.vim keybindings, so Ctrl+S AKA C-S will save the buffer. It provides these mappings.
" Use CTRL-S for saving, also in Insert mode (<C-O> doesn't work ...
1
vote
1
answer
74
views
Autocomplete opens in the wrong window
When using vim with coc installed, auto-complete is always opening and characters are being inserted into the window where the first auto-complete was displayed.
I have a directory with two files (...
1
vote
0
answers
21
views
Can I interrupt the loop through a command completion custom list to trigger recomputation of the list?
Here's a minimal example:
function s:compl_list(argLead, cmdLine, cursorPos)
if a:argLead == 'opts='
return map(['op1', 'op2', 'op3'], {_, v -> a:argLead . v })
endif
return ['initial', '...
1
vote
1
answer
657
views
Prevent Neovim LSP from opening a scratch preview buffer
When auto-completing with neovim's LSP, whenever selecting a menu entry from the auto-complete list a scracth/preview buffer is created, even if empty:
How can I disable these buffers specifically ...
0
votes
1
answer
93
views
Adding dictionary words list to deoplete plugin
Let's say I have a list of words in one file in my home directory (each word is in a separate line):
bar
barfoo
foo
foobar
...
How can I add this list of words to Vim deoplete auto-completion plugin? ...
0
votes
1
answer
138
views
<tab> autocompletion not working
I installed ycm with vimplug and it's working, but I have to press <C-n> to scroll through the autocompletion menu.
How can I remap that to <tab>?
my .vimrc:
call plug#begin()
Plug '...
2
votes
1
answer
52
views
Access to the CTRL-N auto-complete UI functionality
I have a list of strings in an external file.
I want to be able to access those strings, and perform the auto complete functionality on those, in the same way that CTRL-N works usually.
See the below ...
0
votes
2
answers
2k
views
Go to definition with LSP
I'm trying to use Jedi to do "jump-to-definition". For example, if my cursor is on MLPClassifier, I want to be able jump to the place where that class is defined in Python code from the ...
0
votes
1
answer
36
views
Why inoremapping <c-e> shadows <c-e> completion functionality?
Foreword
Open a new file with vim -Nu NONE and insert the following text (| is to indicate the position of the cursor, in insert mode)
longline
lo|
longerline
Now hit Ctrl-XCtrl-N and the ...
0
votes
0
answers
28
views
Remove words from comments in vim autocompletion
I have looked for similar questions but I was quite surprised to not find anything similar... either I am the first person on this planet to have this issue, or I have searched using bad keywords.
...
2
votes
1
answer
1k
views
In neovim, can I use Enter to accept a command completion instead of executing the command?
Using neovim (v0.8.1 on Fedora 37) with its default configuration in my home directory, when I type :e <tab> the completion menu pops up, the first entry (here Desktop) is highlighted and the ...
1
vote
0
answers
59
views
Completion for ++flags in command-line mode
Is there any way to turn on tab completion for the various ++[flag] flags that some commands take?
For example, :e ++ff=unix whatever.txt overrides fileformat to unix for whatever.txt, but :e ++<...
1
vote
2
answers
122
views
Shorter way to call specific plugin function
In the middle of a Vim session, I need to call a particular plugin's function via:
:call UltiSnips#RefreshSnippets()
When from normal mode I type :call UltiS<Tab>, it auto-expands to ...
0
votes
1
answer
59
views
How do I call a user-defined command from a function, and wait until it finishes?
The two functions in the script below can be called independently via key mappings <leader>1 and <leader>2. In a perfect world, <leader>1 will always be called first. If the user ...
2
votes
1
answer
78
views
How to make file completion for a hidden file?
I use ctrlx f to autocomplete the file path. But the popup window won't have the dot file (hidden file, here it is the .obsidian.vimrc file I want to find) unless I press . first, then press ctrlx f.
...
1
vote
1
answer
97
views
Smart way to type latex `\SI{..}{..}` macro in vim (snipped/autocompletion)
A physics high school student of mine is typesetting latex documents using vim. I noticed however that he doesn't use the siunitx package which typesets units properly. However the syntax for example \...
0
votes
1
answer
39
views
ctrl-x, ctrl-k spelling completion not working on Windows
I use the same configuration on Linux and Windows. This is the config for spelling:
" Set dictionary and regenerate spl files on startup
set dictionary+=/usr/share/dict/words
set spelllang=en_gb
...
0
votes
1
answer
66
views
How to get the command short form for custom commands?
The built-in Vim command have a nice property. You have only to type as much such that Vim can guess the command.
For :cclose you can type:
:ccl
:cclo
:cclos
:cclose
Is there a way to get the same ...
0
votes
0
answers
63
views
How can I enable html autocomplete in .tmpl files?
I'm editing .tmpl files which are mostly html with some template language syntax inside {{ double curly braces }}.
I'm using COC for autocompletion and I want to be able to use the autocomplete ...