mirror of
https://github.com/zoriya/dotfiles.git
synced 2026-05-27 08:33:29 +00:00
Disabling autocompletion on comments
This commit is contained in:
@@ -16,7 +16,12 @@ neogen.setup({
|
||||
|
||||
local wk = require("which-key")
|
||||
wk.register({
|
||||
n = { "<cmd>Neogen any<cr>", "Generate documentation" },
|
||||
n = {
|
||||
name = "Generate documentation",
|
||||
f = { "<cmd>Neogen func<CR>", "Function" },
|
||||
c = { "<cmd>Neogen class<CR>", "Class" },
|
||||
t = { "<cmd>Neogen type<CR>", "Type" },
|
||||
},
|
||||
}, {
|
||||
prefix = "<leader>",
|
||||
})
|
||||
|
||||
@@ -47,6 +47,17 @@ cmp.setup({
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
enabled = function()
|
||||
-- disable completion in comments
|
||||
local context = require 'cmp.config.context'
|
||||
-- keep command mode completion enabled when cursor is in a comment
|
||||
if vim.api.nvim_get_mode().mode == 'c' then
|
||||
return true
|
||||
else
|
||||
return not context.in_treesitter_capture("comment")
|
||||
and not context.in_syntax_group("Comment")
|
||||
end
|
||||
end,
|
||||
mapping = {
|
||||
["<Up>"] = cmp.mapping.select_prev_item(),
|
||||
["<Down>"] = cmp.mapping.select_next_item(),
|
||||
@@ -69,7 +80,7 @@ cmp.setup({
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
|
||||
Reference in New Issue
Block a user