aboutsummaryrefslogtreecommitdiffstats
path: root/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'nvim')
-rw-r--r--nvim/after/plugin/telescope.lua9
-rw-r--r--nvim/lua/lsp.lua2
-rw-r--r--nvim/lua/plugins/nvim-cmp.lua39
3 files changed, 31 insertions, 19 deletions
diff --git a/nvim/after/plugin/telescope.lua b/nvim/after/plugin/telescope.lua
index 9f0215d..d164bd9 100644
--- a/nvim/after/plugin/telescope.lua
+++ b/nvim/after/plugin/telescope.lua
@@ -3,6 +3,7 @@ local builtin = require('telescope.builtin')
local nnoremap = Remap.nnoremap
-- find file
+-- TODO: add netrw open bind within context
nnoremap("<Leader>ff", function()
builtin.find_files()
end)
@@ -19,7 +20,13 @@ end)
-- lsp find refrences
nnoremap("<Leader>fr", function()
- builtin.lsp_references()
+ -- TODO: if lsp supports reference provider and lsp is attached
+ -- [telescope.builtin.lsp_*]: server does not support referencesProvider
+ if #vim.lsp.get_active_clients({bufnr = 0}) > 0 then
+ builtin.lsp_references()
+ else
+ builtin.grep_string()
+ end
end)
-- -- find git, lists git pickers
diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua
index bdc5734..c0848ef 100644
--- a/nvim/lua/lsp.lua
+++ b/nvim/lua/lsp.lua
@@ -30,5 +30,7 @@ lsp.set_preferences({
--
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
+-- TODO: change bind for lsp.buf.code_actions()
+
lsp.setup()
diff --git a/nvim/lua/plugins/nvim-cmp.lua b/nvim/lua/plugins/nvim-cmp.lua
index 907ba2e..32285bf 100644
--- a/nvim/lua/plugins/nvim-cmp.lua
+++ b/nvim/lua/plugins/nvim-cmp.lua
@@ -2,6 +2,8 @@
local Plugins = {}
+-- FIXME: plugin not loading correctly
+
-- Autocompletion
local cmp_plugin = {
'hrsh7th/nvim-cmp',
@@ -25,8 +27,8 @@ table.insert(Plugins, cmp_plugin)
table.insert(Plugins, {
'aspeddro/cmp-pandoc.nvim',
- enabled = false,
- event = 'InsertEnter',
+ enabled = true,
+ -- event = 'InsertEnter',
ft = {'markdown', 'pandoc', 'rmd'},
dependencies = {
'nvim-lua/plenary.nvim',
@@ -39,7 +41,7 @@ table.insert(Plugins, {
}
})
-function cmp_plugin.config()
+cmp_plugin.config = function()
user.augroup = vim.api.nvim_create_augroup('compe_cmds', {clear = true})
vim.api.nvim_create_user_command('UserCmpEnable', user.enable_cmd, {})
@@ -80,21 +82,22 @@ function cmp_plugin.config()
zindex = 50,
}
},
- -- formatting = {
- -- fields = {'menu', 'abbr', 'kind'},
- -- format = function(entry, item)
- -- local menu_icon = {
- -- nvim_lsp = 'λ',
- -- luasnip = '⋗',
- -- buffer = 'Ω',
- -- path = '🖫',
- -- nvim_lua = 'Π',
- -- }
- --
- -- item.menu = menu_icon[entry.source.name]
- -- return item
- -- end,
- -- },
+ formatting = {
+ fields = {'menu', 'abbr', 'kind'},
+ format = function(entry, item)
+ local menu = {
+ nvim_lsp = '[LSP]',
+ luasnip = '[Snip]',
+ buffer = '[Buffer]',
+ path = '[Path]',
+ nvim_lua = '[Lua]',
+ cmp_pandoc = '[Pandoc]'
+ }
+
+ item.menu = menu[entry.source.name]
+ return item
+ end,
+ },
mapping = {
['<C-k>'] = cmp.mapping.scroll_docs(-5),
['<C-j>'] = cmp.mapping.scroll_docs(5),