From d7b7044536d6d8809741e5edd3cff30e2b88f3fb Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sun, 12 Mar 2023 23:50:09 +0900 Subject: [PATCH] update: nvim: add path & cmdline cmp --- dotfiles/neovim/init.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index d255886..34e6d28 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -34,7 +34,10 @@ require('lazy').setup({ 'hrsh7th/cmp-nvim-lsp', -- LSP 'L3MON4D3/LuaSnip', -- snippets 'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip + 'hrsh7th/cmp-buffer', -- nvim-cmp source for buffer words 'kdheepak/cmp-latex-symbols', -- latex math + 'hrsh7th/cmp-path', -- nvim-cmp source for filesystem paths + 'hrsh7th/cmp-cmdline', -- command line }, }, { @@ -233,14 +236,40 @@ cmp.setup { sources = { { name = 'nvim_lsp' }, { name = 'luasnip' }, + { name = 'buffer' }, { name = 'latex_symbols', option = { strategy = 0, -- mixed (show the comand and insert the symbol) }, }, + { name = 'path' }, }, } +-- cmdline completions +-- `/` cmdline setup. +cmp.setup.cmdline('/', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) +-- ':' +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { + name = 'cmdline', + option = { + ignore_cmds = { 'Man', '!' } + } + } + }) +}) + + -----------------------------------------------------------