|
@@ -6,14 +6,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+local uConfig = require("uConfig")
|
|
|
|
+local keys = uConfig.keys
|
|
vim.g.mapleader = " "
|
|
vim.g.mapleader = " "
|
|
vim.g.maplocalleader = " "
|
|
vim.g.maplocalleader = " "
|
|
|
|
|
|
alt_send_esc = true
|
|
alt_send_esc = true
|
|
|
|
|
|
local opt = {
|
|
local opt = {
|
|
- noremap = true,
|
|
+ noremap = true,
|
|
- silent = true
|
|
+ silent = true,
|
|
}
|
|
}
|
|
local keymap = vim.keymap
|
|
local keymap = vim.keymap
|
|
keymap.set("i", "jj", "<ESC>")
|
|
keymap.set("i", "jj", "<ESC>")
|
|
@@ -32,7 +34,7 @@ map("n", "<A-Up>", "<C-w>k", opt)
|
|
map("n", "<A-Left>", "<C-w>h", opt)
|
|
map("n", "<A-Left>", "<C-w>h", opt)
|
|
|
|
|
|
map("n", "<leader>h", ":Dashboard<CR>", opt)
|
|
map("n", "<leader>h", ":Dashboard<CR>", opt)
|
|
|
|
+
|
|
map("n", "git", ":Gitsigns toggle_current_line_blame<CR>", opt)
|
|
map("n", "git", ":Gitsigns toggle_current_line_blame<CR>", opt)
|
|
|
|
|
|
map("n", "<leader>lg", ":LazyGit<CR>", opt)
|
|
map("n", "<leader>lg", ":LazyGit<CR>", opt)
|
|
@@ -60,8 +62,8 @@ map("v", "<A-j>", "5j", opt)
|
|
map("v", "<A-k>", "5k", opt)
|
|
map("v", "<A-k>", "5k", opt)
|
|
|
|
|
|
|
|
|
|
-map("n", "<leader>hw", ":HopWord<CR>",opt)
|
|
+map("n", "<leader>hw", ":HopWord<CR>", opt)
|
|
-map("n", "<leader>hww", ":HopWordMW<CR>",opt)
|
|
+map("n", "<leader>hww", ":HopWordMW<CR>", opt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -80,133 +82,134 @@ map("n", "<leader>cf", ":Prettier<CR>", opt)
|
|
|
|
|
|
|
|
|
|
local pluginKeys = {}
|
|
local pluginKeys = {}
|
|
|
|
+local lsp = uConfig.lsp
|
|
|
|
+pluginKeys.mapLSP = function(mapbuf)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Lspsaga 替换 rn
|
|
|
|
+ mapbuf("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opt)
|
|
|
|
+
|
|
|
|
+ mapbuf("n", lsp.rename, "<cmd>lua vim.lsp.buf.rename()<CR>")
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Lspsaga 替换 ca
|
|
|
|
+ mapbuf("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opt)
|
|
|
|
+
|
|
|
|
+ mapbuf("n", lsp.code_action, "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ mapbuf('n', 'gd', '<cmd>Lspsaga preview_definition<CR>', opt)
|
|
|
|
+ mapbuf("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opt)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ mapbuf("n", lsp.definition, function()
|
|
|
|
+ require("telescope.builtin").lsp_definitions({
|
|
|
|
+ initial_mode = "normal",
|
|
|
|
+
|
|
|
|
+ })
|
|
|
|
+ end)
|
|
|
|
+
|
|
|
|
+ mapbuf("n", "gh", "<cmd>Lspsaga hover_doc<cr>", opt)
|
|
|
|
+ Lspsaga 替换 gh
|
|
|
|
+
|
|
|
|
+ mapbuf("n", lsp.hover, "<cmd>lua vim.lsp.buf.hover()<CR>")
|
|
|
|
+
|
|
|
|
+ Lspsaga 替换 gr
|
|
|
|
+ mapbuf("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opt)
|
|
|
|
+ mapbuf("n", "gr", "<cmd>Lspsaga lsp_finder<CR>", opt)
|
|
|
|
+
|
|
|
|
+ mapbuf(
|
|
|
|
+ "n",
|
|
|
|
+ lsp.references,
|
|
|
|
+ "<cmd>lua require'telescope.builtin'.lsp_references(require('telescope.themes').get_ivy())<CR>"
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ if vim.fn.has("nvim-0.8") == 1 then
|
|
|
|
+ mapbuf("n", lsp.format, "<cmd>lua vim.lsp.buf.format({ async = true })<CR>")
|
|
|
|
+ else
|
|
|
|
+ mapbuf("n", lsp.format, "<cmd>lua vim.lsp.buf.formatting()<CR>")
|
|
|
|
+ end
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Lspsaga 替换 gp, gj, gk
|
|
|
|
+ mapbuf("n", "gp", "<cmd>lua vim.diagnostic.open_float()<CR>", opt)
|
|
|
|
+ mapbuf("n", "gj", "<cmd>lua vim.diagnostic.goto_next()<CR>", opt)
|
|
|
|
+ mapbuf("n", "gk", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opt)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ mapbuf("n", lsp.open_flow, "<cmd>lua vim.diagnostic.open_float()<CR>")
|
|
|
|
+ mapbuf("n", lsp.goto_next, "<cmd>lua vim.diagnostic.goto_next()<CR>")
|
|
|
|
+ mapbuf("n", lsp.goto_prev, "<cmd>lua vim.diagnostic.goto_prev()<CR>")
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+end
|
|
|
|
|
|
|
|
|
|
map("n", "<leader>e", ":NvimTreeToggle<CR>", opt)
|
|
map("n", "<leader>e", ":NvimTreeToggle<CR>", opt)
|
|
|
|
|
|
-pluginKeys.nvimTreeList = {
|
|
|
|
- {
|
|
|
|
- key = { "o", "<2-LeftMouse>" },
|
|
|
|
- action = "edit"
|
|
|
|
- }, {
|
|
|
|
- key = "<CR>",
|
|
|
|
- action = "system_open"
|
|
|
|
-},
|
|
|
|
- {
|
|
|
|
- key = "v",
|
|
|
|
- action = "vsplit"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- key = "h",
|
|
|
|
- action = "split"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- key = "i",
|
|
|
|
- action = "toggle_ignored"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- key = ".",
|
|
|
|
- action = "toggle_dotfiles"
|
|
|
|
- }, {
|
|
|
|
- key = "R",
|
|
|
|
- action = "refresh"
|
|
|
|
-},
|
|
|
|
- {
|
|
|
|
- key = "a",
|
|
|
|
- action = "create"
|
|
|
|
- }, {
|
|
|
|
- key = "d",
|
|
|
|
- action = "remove"
|
|
|
|
-}, {
|
|
|
|
- key = "r",
|
|
|
|
- action = "rename"
|
|
|
|
-}, {
|
|
|
|
- key = "x",
|
|
|
|
- action = "cut"
|
|
|
|
-}, {
|
|
|
|
- key = "c",
|
|
|
|
- action = "copy"
|
|
|
|
-}, {
|
|
|
|
- key = "p",
|
|
|
|
- action = "paste"
|
|
|
|
-}, {
|
|
|
|
- key = "y",
|
|
|
|
- action = "copy_name"
|
|
|
|
-}, {
|
|
|
|
- key = "Y",
|
|
|
|
- action = "copy_path"
|
|
|
|
-}, {
|
|
|
|
- key = "gy",
|
|
|
|
- action = "copy_absolute_path"
|
|
|
|
-}, {
|
|
|
|
- key = "I",
|
|
|
|
- action = "toggle_file_info"
|
|
|
|
-}, {
|
|
|
|
- key = "n",
|
|
|
|
- action = "tabnew"
|
|
|
|
-},
|
|
|
|
- {
|
|
|
|
- key = { "]" },
|
|
|
|
- action = "cd"
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- key = { "[" },
|
|
|
|
- action = "dir_up"
|
|
|
|
- } }
|
|
|
|
-
|
|
|
|
|
|
|
|
pluginKeys.lspList = function(bufnr)
|
|
pluginKeys.lspList = function(bufnr)
|
|
-
|
|
+
|
|
- bufmap(bufnr, "n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opt)
|
|
+ bufmap(bufnr, "n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opt)
|
|
-
|
|
+
|
|
- bufmap(bufnr, "n", "<leader>ca", "<cmd>Lspsaga cade_action<CR>", opt)
|
|
+ bufmap(bufnr, "n", "<leader>ca", "<cmd>Lspsaga cade_action<CR>", opt)
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- bufmap(bufnr, "n", "gd", "<cmd>Lspsaga goto_definition<CR>", opt)
|
|
+ bufmap(bufnr, "n", "gd", "<cmd>Lspsaga goto_definition<CR>", opt)
|
|
-
|
|
+
|
|
- bufmap(bufnr, "n", "gt", "<cmd>Lspsaga goto_type_definition<CR>", opt)
|
|
+ bufmap(bufnr, "n", "gt", "<cmd>Lspsaga goto_type_definition<CR>", opt)
|
|
- bufmap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opt)
|
|
+ bufmap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opt)
|
|
-
|
|
+
|
|
- bufmap(bufnr, "n", "gh", "<cmd>Lspsaga hover_doc<CR>", opt)
|
|
+ bufmap(bufnr, "n", "gh", "<cmd>Lspsaga hover_doc<CR>", opt)
|
|
- bufmap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opt)
|
|
+ bufmap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opt)
|
|
-
|
|
+
|
|
- bufmap(bufnr, "n", "gr", "<cmd>Lspsaga lsp_finder<CR>", opt)
|
|
+ bufmap(bufnr, "n", "gr", "<cmd>Lspsaga lsp_finder<CR>", opt)
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- bufmap(bufnr, "n", "go", "<cmd>Lspsaga show_line_diagnostics<CR>", opt)
|
|
+ bufmap(bufnr, "n", "go", "<cmd>Lspsaga show_line_diagnostics<CR>", opt)
|
|
-
|
|
+
|
|
- bufmap(bufnr, "n", "gn", "<cmd>Lspsaga diagnostic_jump_next<CR>", opt)
|
|
+ bufmap(bufnr, "n", "gn", "<cmd>Lspsaga diagnostic_jump_next<CR>", opt)
|
|
-
|
|
+
|
|
- bufmap(bufnr, "n", "gp", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opt)
|
|
+ bufmap(bufnr, "n", "gp", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opt)
|
|
- bufmap(bufnr, "n", "<leader>f", "<cmd>lua vim.lsp.buf.format({ async = true })<CR>", opt)
|
|
+ bufmap(bufnr, "n", "<leader>f", "<cmd>lua vim.lsp.buf.format({ async = true })<CR>", opt)
|
|
- bufmap(bufnr, "n", [[<M-\>]], "<cmd>Lspsaga term_toggle<CR>", opt)
|
|
+ bufmap(bufnr, "n", [[<M-\>]], "<cmd>Lspsaga term_toggle<CR>", opt)
|
|
- bufmap(bufnr, "t", [[<M-\>]], "<cmd>Lspsaga term_toggle<CR>", opt)
|
|
+ bufmap(bufnr, "t", [[<M-\>]], "<cmd>Lspsaga term_toggle<CR>", opt)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
pluginKeys.cmp = function(cmp)
|
|
pluginKeys.cmp = function(cmp)
|
|
- return {
|
|
+ return {
|
|
-
|
|
+
|
|
- ["<A-.>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
|
+ ["<A-.>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
|
-
|
|
+
|
|
- ["<A-,>"] = cmp.mapping({
|
|
+ ["<A-,>"] = cmp.mapping({
|
|
- i = cmp.mapping.abort(),
|
|
+ i = cmp.mapping.abort(),
|
|
- c = cmp.mapping.close()
|
|
+ c = cmp.mapping.close(),
|
|
- }),
|
|
+ }),
|
|
-
|
|
+
|
|
- ["<C-k>"] = cmp.mapping.select_prev_item(),
|
|
+ ["<C-k>"] = cmp.mapping.select_prev_item(),
|
|
-
|
|
+
|
|
- ["<C-j>"] = cmp.mapping.select_next_item(),
|
|
+ ["<C-j>"] = cmp.mapping.select_next_item(),
|
|
-
|
|
+
|
|
- ["<CR>"] = cmp.mapping.confirm({
|
|
+ ["<CR>"] = cmp.mapping.confirm({
|
|
- select = true,
|
|
+ select = true,
|
|
- behavior = cmp.ConfirmBehavior.Replace
|
|
+ behavior = cmp.ConfirmBehavior.Replace,
|
|
- }),
|
|
+ }),
|
|
-
|
|
+
|
|
- ["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
|
+ ["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
|
- ["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
|
+ ["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
|
- }
|
|
+ }
|
|
end
|
|
end
|
|
|
|
|
|
-
|
|
|
|
return pluginKeys
|
|
return pluginKeys
|