summaryrefslogtreecommitdiffstats
path: root/.config/nvim/plugin/50-completion.lua
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-06-12 22:56:03 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-06-12 22:57:34 +0200
commitaa15a0fe47418a2fe1354589a3dafd3ae8c3db42 (patch)
treeb5d3b55fd2e2dd629545f00e4071e389d8ddeed2 /.config/nvim/plugin/50-completion.lua
parentce4e655884418a6e92846cd4ea30eb185b013f46 (diff)
downloaddotfiles-aa15a0fe47418a2fe1354589a3dafd3ae8c3db42.tar.gz
dotfiles-aa15a0fe47418a2fe1354589a3dafd3ae8c3db42.zip
refactor(nvim): rename file
Diffstat (limited to '.config/nvim/plugin/50-completion.lua')
-rw-r--r--.config/nvim/plugin/50-completion.lua81
1 files changed, 0 insertions, 81 deletions
diff --git a/.config/nvim/plugin/50-completion.lua b/.config/nvim/plugin/50-completion.lua
deleted file mode 100644
index caf749d..0000000
--- a/.config/nvim/plugin/50-completion.lua
+++ /dev/null
@@ -1,81 +0,0 @@
---
--- Completion configuration plugin
---
-
-------------------------------------------------------------------------------------------------------------------------
--- Insert mode completion
-------------------------------------------------------------------------------------------------------------------------
--- See `:help ins-completion-menu`
-
-vim.opt.autocomplete = true -- Show completion menu automatically
-vim.opt.completeopt = {
- "noselect", -- No item selected initially
- "fuzzy",
- "menuone", -- Show matches in a menu, even if there's only one match
- "popup", -- Menu items show extra info in the popup window
-}
-
--- Completion sources (in order of priority)
-vim.opt.complete = {
- "o", -- 'omnifunc'
-}
-vim.opt.pumwidth = 25
-vim.keymap.set("i", "<Tab>", function()
- return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>"
-end, { expr = true })
-vim.keymap.set("i", "<S-Tab>", function()
- return vim.fn.pumvisible() == 1 and "<C-p>" or "<S-Tab>"
-end, { expr = true })
-
--- Jump between snippet placeholders, falling back to native behavior when no snippet is active
-vim.keymap.set({ "i", "s" }, "<C-n>", function()
- return vim.snippet.active({ direction = 1 }) and "<Cmd>lua vim.snippet.jump(1)<CR>" or "<C-n>"
-end, { expr = true })
-vim.keymap.set({ "i", "s" }, "<C-p>", function()
- return vim.snippet.active({ direction = -1 }) and "<Cmd>lua vim.snippet.jump(-1)<CR>" or "<C-p>"
-end, { expr = true })
-
-------------------------------------------------------------------------------------------------------------------------
--- Command-line mode completion
-------------------------------------------------------------------------------------------------------------------------
--- See `:help cmdline-completion` and `:help cmdline-autocompletion`
-
--- Show completion menu automatically
-vim.api.nvim_create_autocmd({ "CmdlineChanged", "CmdlineEnter" }, {
- desc = "Autocompletion",
- group = vim.g.dotfiles.augroup,
- pattern = "[:\\/\\?]",
- callback = function()
- vim.fn.wildtrigger()
- end,
-})
-vim.opt.wildmenu = true -- Show completions in a menu
-vim.opt.wildchar = 9 -- Char code assigned to command line wildcard expansion
-vim.opt.pumborder = "rounded"
-vim.opt.wildoptions = {
- "exacttext", -- Discard regex artifacts when performing search pattern completion
- "pum", -- Show completions in a popup menu
- "tagfile", -- Show tag kind and file
- "fuzzy", -- Fuzzy matching (doesn't work with files/dirs, see `:help 'wildoptions'`, but patterns do work!)
-}
--- Completion modes triggered in order by `wildtrigger()` or 'wildchar'
-vim.opt.wildmode = {
- "noselect", -- List matches without inserting
- "full", -- List matches and insert first full match
-}
--- Insert unique match
-vim.keymap.set("c", string.format("%c", vim.o.wildchar), function()
- local complete_info = vim.fn.cmdcomplete_info()
- if complete_info.pum_visible == 1 then
- return #complete_info.matches == 1 and "<C-n><Space><BS>" or "<C-n>"
- end
- vim.fn.wildtrigger()
-end, { expr = true, desc = "Command line wildcard expansion" })
--- Show next completion choices after accepting an entry with `<C-y>`
-vim.keymap.set("c", "<C-y>", function()
- local complete_info = vim.fn.cmdcomplete_info()
- if complete_info.pum_visible == 1 then
- return complete_info.selected ~= -1 and "<Space><BS>" or "<C-e>"
- end
- return "<C-y>"
-end, { expr = true })