feat: reload after plug install
This commit is contained in:
@ -1,51 +1,50 @@
|
||||
|
||||
-- luasnip setup
|
||||
local luasnip = require 'luasnip'
|
||||
local luasnip = require "luasnip"
|
||||
|
||||
local cmp = require 'cmp'
|
||||
local cmp = require "cmp"
|
||||
|
||||
cmp.setup {
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noselect"
|
||||
},
|
||||
preselect = "none",
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
select = true
|
||||
},
|
||||
['<Tab>'] = function(fallback)
|
||||
["<Tab>"] = function(fallback)
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n')
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-n>", true, true, true), "n")
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '')
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<S-Tab>'] = function(fallback)
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n')
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-p>", true, true, true), "n")
|
||||
elseif luasnip.jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '')
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
},
|
||||
{name = "nvim_lsp"},
|
||||
{name = "luasnip"}
|
||||
}
|
||||
}
|
||||
|
||||
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)
|
||||
|
@ -3,6 +3,7 @@ local u = require "utils"
|
||||
-- Config Formatter
|
||||
u.create_augroup(
|
||||
{
|
||||
--{"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.svelte", "OrganizeImports"},
|
||||
{"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.lua", "FormatWrite"}
|
||||
},
|
||||
"FormatAutogroup"
|
||||
|
@ -10,7 +10,7 @@ g.mapleader = " "
|
||||
|
||||
map("n", "<C-p>", ":Telescope find_files<CR>", options)
|
||||
map("n", "<C-f>", ":Telescope grep_string<CR>", options)
|
||||
map("n", "<Leader><C-f>", ":Telescope live_grep<CR>", options)
|
||||
map("n", "<C-S-f>", ":Telescope live_grep<CR>", options)
|
||||
-- Navigate Buffers
|
||||
map("n", "<C-h>", "<C-w>h", options)
|
||||
map("n", "<C-j>", "<C-w>j", options)
|
||||
|
@ -20,9 +20,9 @@ local function on_attach(client)
|
||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
buf_set_keymap("n", "<space><C-f>", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
buf_set_keymap("n", "<Leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||
buf_set_keymap("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
buf_set_keymap("n", "<Leader><C-f>", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||
|
||||
|
Reference in New Issue
Block a user