Add lsp and key mappings
This commit is contained in:
@@ -14,33 +14,25 @@ end
|
||||
M.bufferline = function()
|
||||
local m = plugins.bufferline
|
||||
|
||||
map("n", m.nextBuffer, ":BufferLineCycleNext <CR>")
|
||||
map("n", m.prevBuffer, ":BufferLineCyclePrev <CR>")
|
||||
-- map("n", m.nextBuffer, ":BufferLineCycleNext <CR>")
|
||||
end
|
||||
|
||||
M.gitsigns = function()
|
||||
local m = plugins.gitsigns
|
||||
|
||||
map("n", m.blameLine, ":Gitsigns blame_line <CR>")
|
||||
map("n", m.diffThis, ":Gitsigns diffthis <CR>")
|
||||
-- map("n", m.blameLine, ":Gitsigns blame_line <CR>")
|
||||
-- map("n", m.diffThis, ":Gitsigns diffthis <CR>")
|
||||
end
|
||||
|
||||
M.nvimtree = function()
|
||||
local m = plugins.nvimtree
|
||||
|
||||
map("n", m.toggle, ":NvimTreeToggle <CR>")
|
||||
map("n", m.focus, ":NvimTreeFocus <CR>")
|
||||
-- map("n", m.toggle, ":NvimTreeToggle <CR>")
|
||||
-- map("n", m.focus, ":NvimTreeFocus <CR>")
|
||||
end
|
||||
|
||||
M.telescope = function()
|
||||
local m = plugins.telescope
|
||||
|
||||
map("n", m.buffers, ":Telescope buffers <CR>")
|
||||
map("n", m.diagnostics, ":Telescope diagnostic <CR>")
|
||||
map("n", m.liveGrep, ":Telescope live_grep <CR>")
|
||||
map("n", m.files, ":Telescope find_files <CR>")
|
||||
map("n", m.gitCommits, ":Telescope git_commits <CR>")
|
||||
map("n", m.gitStatus, ":Telescope git_status <CR>")
|
||||
-- map("n", m.buffers, ":Telescope buffers <CR>")
|
||||
-- map("n", m.liveGrep, ":Telescope live_grep <CR>")
|
||||
-- map("n", m.files, ":Telescope find_files <CR>")
|
||||
-- map("n", m.gitCommits, ":Telescope git_commits <CR>")
|
||||
-- map("n", m.gitStatus, ":Telescope git_status <CR>")
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -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>" }
|
||||
})
|
||||
@@ -82,7 +82,6 @@ require("packer").startup(function(use)
|
||||
|
||||
use {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("plugins.config.blankline")
|
||||
end
|
||||
@@ -141,6 +140,114 @@ require("packer").startup(function(use)
|
||||
end
|
||||
}
|
||||
|
||||
-- LSP
|
||||
use "neovim/nvim-lspconfig"
|
||||
|
||||
use {
|
||||
"ray-x/lsp_signature.nvim",
|
||||
after = "nvim-lspconfig",
|
||||
config = function()
|
||||
require("lsp_signature").setup()
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"rafamadriz/friendly-snippets",
|
||||
module = "cmp_nvim_lsp",
|
||||
event = "InsertCharPre"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/nvim-cmp",
|
||||
after = "friendly-snippets",
|
||||
config = function()
|
||||
require("plugins.config.cmp")
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"L3MON4D3/LuaSnip",
|
||||
wants = "friendly-snippets",
|
||||
after = "nvim-cmp",
|
||||
config = function()
|
||||
require("plugins.config.luasnip")
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
after = "LuaSnip"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
after = "cmp_luasnip"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
after = "cmp-nvim-lua"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/cmp-buffer",
|
||||
after = "cmp-nvim-lsp"
|
||||
}
|
||||
|
||||
use {
|
||||
"hrsh7th/cmp-path",
|
||||
after = "cmp-buffer"
|
||||
}
|
||||
|
||||
use {
|
||||
"williamboman/nvim-lsp-installer",
|
||||
requires = "neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local lspInstaller = require("nvim-lsp-installer")
|
||||
|
||||
lspInstaller.on_server_ready(function(server)
|
||||
local opts = {}
|
||||
server:setup(opts)
|
||||
vim.cmd [[ do User LspAttachBuffers ]]
|
||||
end)
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"simrat39/symbols-outline.nvim",
|
||||
cmd = "SymbolsOutline"
|
||||
}
|
||||
|
||||
use {
|
||||
"folke/trouble.nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
config = function()
|
||||
require("trouble").setup()
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"goolord/alpha-nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
config = function()
|
||||
require("alpha").setup(require("alpha.themes.dashboard").config)
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
require("plugins.config.whichkey")
|
||||
end
|
||||
}
|
||||
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
|
||||
0
lua/plugins/whichkeymap.lua
Normal file
0
lua/plugins/whichkeymap.lua
Normal file
Reference in New Issue
Block a user