Add lsp and key mappings
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
require("indent_blankline").setup {
|
||||
indentLine_enabled = 1,
|
||||
char = "▏",
|
||||
filetype_exclude = {"help", "terminal", "dashboard", "nvimtree"},
|
||||
filetype_exclude = {"help", "terminal", "alpha"},
|
||||
buftype_exclude = {"terminal"},
|
||||
show_trailing_blankline_indent = false,
|
||||
show_first_indent_level = false
|
||||
|
||||
46
lua/plugins/config/cmp.lua
Normal file
46
lua/plugins/config/cmp.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
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 {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" }
|
||||
}
|
||||
}
|
||||
8
lua/plugins/config/luasnip.lua
Normal file
8
lua/plugins/config/luasnip.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
luasnip.config.set_config {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI"
|
||||
}
|
||||
|
||||
require("luasnip/loaders/from_vscode").load()
|
||||
@@ -10,6 +10,11 @@ require("nvim-tree").setup {
|
||||
disable_netrw = true,
|
||||
ignore_ft_on_setup = { "dashboard" },
|
||||
hijack_cursor = true,
|
||||
update_cwd = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true
|
||||
},
|
||||
git = {
|
||||
ignore = false
|
||||
},
|
||||
|
||||
35
lua/plugins/config/whichkey.lua
Normal file
35
lua/plugins/config/whichkey.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup {
|
||||
ignore_missing = true
|
||||
}
|
||||
|
||||
wk.register({
|
||||
["<leader>"] = {
|
||||
f = {
|
||||
name = "Files",
|
||||
f = { "<cmd>Telescope find_files<CR>", "Find File" },
|
||||
g = { "<cmd>Telescope live_grep<CR>", "Live Grep" }
|
||||
},
|
||||
b = {
|
||||
name = "Buffers",
|
||||
b = { "<cmd>Telescope buffers<CR>", "Find Buffers" },
|
||||
x = { "<cmd>BufDel<CR>", "Close Buffer" }
|
||||
},
|
||||
t = {
|
||||
name = "NvimTree",
|
||||
t = { "<cmd>NvimTreeToggle<CR>", "NvimTree Toggle" },
|
||||
f = { "<cmd>NvimTreeFocus<CR>", "NvimTree Focus" }
|
||||
}
|
||||
},
|
||||
|
||||
g = {
|
||||
name = "Git",
|
||||
c = { "<cmd>Telescope git_commits<CR>", "Git Commits" },
|
||||
s = { "<cmd>Telescope git_status<CR>", "Git Status" },
|
||||
b = { "<cmd>Gitsigns blame_line<CR>", "Blame Line" },
|
||||
d = { "<cmd>Gitsigns diffthis<CR>", "Diff This" }
|
||||
},
|
||||
|
||||
["<TAB>"] = { "<cmd>BufferLineCycleNext<CR>" }
|
||||
})
|
||||
Reference in New Issue
Block a user