I am just starting out using neovim v0.9.1 and using kickstrat.nvim and I love it.
I just have one small complain: when writing code (especially for bash) if I type something that matches a snippet, nvim will insert it when I press enter. For example the typing in fi + <enter>
for the closing statement of an if statement in a bash script inserts the bash for loop code snippet.
Is there a way I can get finer control over when snippets are inserted (for example by using the arrow keys) ? At the moment I have to go back to insert mode and then o
to start on the next line.
1 Like
I have not personally used kickstart.nvim
, but I would assume it’s using nvim-cmp
for auto completion menus.
In my configuration, I have Enter as the key to confirm my completion selection, but I don’t have your issue because by default none of the completion options are selected. This is one option you could use to solve that issue.
You can look at the recommended configuration here to see an example. In the cmp.setup()
function, when mappings are being configured, there’s an inline comment that explains using cmp.mapping.confirm({select = false})
will only accept the currently selected item if it was explicitly selected by you (using arrow keys, in your example).
Another option is to change the completion confirmation key bind. I know a lot of people use ctrl-y
for confirmation, so that might work well for you too.
1 Like