Skip to content

Commit

Permalink
Move <CR> tip slightly below
Browse files Browse the repository at this point in the history
  • Loading branch information
deathbeam committed Feb 22, 2024
1 parent 6118b4f commit 8574bbd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ You also probably want to enable `popup` in completeopt to show documentation pr
vim.o.completeopt = 'menuone,noinsert,popup'
```

If you want to disable `<CR>` to accept completion (as with autocomplete its very annoying) you can do this:

```lua
vim.keymap.set("i", "<CR>", function()
return vim.fn.pumvisible() ~= 0 and "<C-e><CR>" or "<CR>"
end, { expr = true, replace_keycodes = true })
```

And you also ideally want to set the capabilities so Neovim will fetch documentation and additional text edits
when resolving completion items:

Expand All @@ -91,6 +83,14 @@ require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
}
```

If you want to disable `<CR>` to accept completion (as with autocomplete its very annoying) you can do this:

```lua
vim.keymap.set("i", "<CR>", function()
return vim.fn.pumvisible() ~= 0 and "<C-e><CR>" or "<CR>"
end, { expr = true, replace_keycodes = true })
```

## Similar projects

I used some of this projects as reference and they are also good alternatives:
Expand Down

0 comments on commit 8574bbd

Please sign in to comment.