diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 74ba012..cb1a279 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -1,111 +1,122 @@ local map = vim.keymap.set -map("i", "", "^i", { desc = "Beginning of line | general" }) -map("i", "", "", { desc = "End of line | general" }) -map("i", "", "", { desc = "Move left | general" }) -map("i", "", "", { desc = "Move right | general" }) -map("i", "", "", { desc = "Move down | general" }) -map("i", "", "", { desc = "Move up | general" }) -map("n", "", "noh", { desc = "Clear highlights | general" }) -map("n", "", "h", { desc = "Window left | general" }) -map("n", "", "l", { desc = "Window right | general" }) -map("n", "", "j", { desc = "Window down | general" }) -map("n", "", "k", { desc = "Window up | general" }) -map("n", "", "w", { desc = "Save file | general" }) -map("n", "", "%y+", { desc = "Copy whole file | general" }) -map("n", "n", "set nu!", { desc = "Toggle line number | general" }) -map("n", "rn", "set rnu!", { desc = "Toggle relative number | general" }) -map("n", "b", "enew", { desc = "New buffer | general" }) -map("n", "ch", "NvCheatsheet", { desc = "Mapping cheatsheet | general" }) +map("i", "", "^i", { desc = "Move Beginning of line" }) +map("i", "", "", { desc = "Move End of line" }) +map("i", "", "", { desc = "Move Left" }) +map("i", "", "", { desc = "Move Right" }) +map("i", "", "", { desc = "Move Down" }) +map("i", "", "", { desc = "Move Up" }) + +map("n", "", "noh", { desc = "General Clear highlights" }) + +map("n", "", "h", { desc = "Switch Window left" }) +map("n", "", "l", { desc = "Switch Window right" }) +map("n", "", "j", { desc = "Switch Window down" }) +map("n", "", "k", { desc = "Switch Window up" }) + +map("n", "", "w", { desc = "File Save" }) +map("n", "", "%y+", { desc = "File Copy whole" }) + +map("n", "n", "set nu!", { desc = "Toggle Line number" }) +map("n", "rn", "set rnu!", { desc = "Toggle Relative number" }) +map("n", "ch", "NvCheatsheet", { desc = "Toggle NvCheatsheet" }) -- global lsp mappings map("n", "fm", function() vim.lsp.buf.format { async = true } -end, { desc = "LSP formatting | lsp" }) +end, { desc = "Lsp formatting" }) -map("n", "lf", vim.diagnostic.open_float, { desc = "floating diagnostics | lsp" }) -map("n", "[d", vim.diagnostic.goto_prev, { desc = "prev diagnostic | lsp" }) -map("n", "]d", vim.diagnostic.goto_next, { desc = "next diagnostic | lsp" }) -map("n", "q", vim.diagnostic.setloclist, { desc = "diagnostic loclist | lsp" }) +map("n", "lf", vim.diagnostic.open_float, { desc = "Lsp floating diagnostics" }) +map("n", "[d", vim.diagnostic.goto_prev, { desc = "Lsp prev diagnostic" }) +map("n", "]d", vim.diagnostic.goto_next, { desc = "Lsp next diagnostic" }) +map("n", "q", vim.diagnostic.setloclist, { desc = "Lsp diagnostic loclist" }) -- tabufline +map("n", "b", "enew", { desc = "Buffer New" }) + map("n", "", function() require("nvchad.tabufline").tabuflineNext() -end, { desc = "Goto next buffer | tabufline" }) +end, { desc = "Buffer Goto next" }) map("n", "", function() require("nvchad.tabufline").tabuflinePrev() -end, { desc = "Goto prev buffer | tabufline" }) +end, { desc = "Buffer Goto prev" }) map("n", "x", function() require("nvchad.tabufline").close_buffer() -end, { desc = "Close buffer | tabufline" }) +end, { desc = "Buffer Close" }) +-- Comment map("n", "/", function() require("Comment.api").toggle.linewise.current() -end, { desc = "Toggle comment | comment" }) +end, { desc = "Comment Toggle" }) map( "v", "/", ":lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", - { desc = "Toggle comment | comment" } + { desc = "Comment Toggle" } ) -map("n", "", "NvimTreeToggle", { desc = "Toggle nvimtree | nvimtree" }) -map("n", "e", "NvimTreeFocus", { desc = "Focus nvimtree | nvimtree" }) - -map("n", "fw", "Telescope live_grep", { desc = "Live grep | telescope" }) -map("n", "fb", "Telescope buffers", { desc = "Find buffers | telescope" }) -map("n", "fh", "Telescope help_tags", { desc = "Help page | telescope" }) -map("n", "fo", "Telescope oldfiles", { desc = "Find oldfiles | telescope" }) -map("n", "fz", "Telescope current_buffer_fuzzy_find", { desc = "Find in current buffer | telescope" }) -map("n", "cm", "Telescope git_commits", { desc = "Git commits | telescope" }) -map("n", "gt", "Telescope git_status", { desc = "Git status | telescope" }) -map("n", "pt", "Telescope terms", { desc = "Pick hidden term | telescope" }) -map("n", "th", "Telescope themes", { desc = "Nvchad themes | telescope" }) -map("n", "ff", "Telescope find_files", { desc = "Find files | telescope" }) - +-- nvimtree +map("n", "", "NvimTreeToggle", { desc = "Nvimtree Toggle window" }) +map("n", "e", "NvimTreeFocus", { desc = "Nvimtree Focus window" }) + +-- telescope +map("n", "fw", "Telescope live_grep", { desc = "Telescope Live grep" }) +map("n", "fb", "Telescope buffers", { desc = "Telescope Find buffers" }) +map("n", "fh", "Telescope help_tags", { desc = "Telescope Help page" }) + +map("n", "fo", "Telescope oldfiles", { desc = "Telescope Find oldfiles" }) +map("n", "fz", "Telescope current_buffer_fuzzy_find", { desc = "Telescope Find in current buffer" }) +map("n", "cm", "Telescope git_commits", { desc = "Telescope Git commits" }) +map("n", "gt", "Telescope git_status", { desc = "Telescope Git status" }) +map("n", "pt", "Telescope terms", { desc = "Telescope Pick hidden term" }) +map("n", "th", "Telescope themes", { desc = "Telescope Nvchad themes" }) +map("n", "ff", "Telescope find_files", { desc = "Telescope Find files" }) map( "n", "fa", "Telescope find_files follow=true no_ignore=true hidden=true", - { desc = "Find all | telescope" } + { desc = "Telescope Find all files" } ) -- terminal -map("t", "", "", { desc = "Escape terminal mode | terminal" }) +map("t", "", "", { desc = "Terminal Escape terminal mode" }) + map("n", "h", function() require("nvchad.term").new { pos = "sp", size = 0.3 } -end, { desc = "New horizontal term | terminal" }) +end, { desc = "Terminal New horizontal term" }) map("n", "v", function() require("nvchad.term").new { pos = "vsp", size = 0.3 } -end, { desc = "New vertical term | terminal" }) +end, { desc = "Terminal New vertical term" }) map({ "n", "t" }, "", function() require("nvchad.term").toggle { pos = "vsp", id = "vtoggleTerm", size = 0.3 } -end, { desc = "Toggleable vertical term | terminal" }) +end, { desc = "Terminal Toggleable vertical term" }) map({ "n", "t" }, "", function() require("nvchad.term").toggle { pos = "sp", id = "htoggleTerm", size = 0.2 } -end, { desc = "New horizontal term | terminal" }) +end, { desc = "Terminal New horizontal term" }) map({ "n", "t" }, "", function() require("nvchad.term").toggle { pos = "float", id = "floatTerm" } -end, { desc = "Toggleable Floating term | terminal" }) +end, { desc = "Terminal Toggle Floating term" }) map("t", "", function() local win = vim.api.nvim_get_current_win() vim.api.nvim_win_close(win, true) -end, { desc = "Close term in terminal mode | terminal" }) +end, { desc = "Terminal Close term in terminal mode" }) -- whichkey -map("n", "wK", "WhichKey ", { desc = "Which-key all keymaps | whichkey" }) +map("n", "wK", "WhichKey ", { desc = "Whichkey all keymaps" }) + map("n", "wk", function() vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ") -end, { desc = "Which-key query lookup | whichkey" }) +end, { desc = "Whichkey query lookup" }) +-- blankline map("n", "cc", function() local config = { scope = {} } config.scope.exclude = { language = {}, node_type = {} } @@ -119,6 +130,6 @@ map("n", "cc", function() vim.api.nvim_feedkeys("_", "n", true) end end -end, { desc = "Jump to current context | blankline" }) +end, { desc = "Blankline Jump to current context" }) pcall(require, "custom.mappings") diff --git a/lua/plugins/configs/lspconfig.lua b/lua/plugins/configs/lspconfig.lua index d260572..3eb71a1 100644 --- a/lua/plugins/configs/lspconfig.lua +++ b/lua/plugins/configs/lspconfig.lua @@ -18,26 +18,26 @@ M.on_attach = function(client, bufnr) return { buffer = bufnr, desc = desc } end - map("n", "gD", vim.lsp.buf.declaration, opts "Go to declaration | lsp") - map("n", "gd", vim.lsp.buf.definition, opts "Go to definition | lsp") - map("n", "K", vim.lsp.buf.hover, opts "Show hover information | lsp") - map("n", "gi", vim.lsp.buf.implementation, opts "Go to implementation | lsp") - map("n", "", vim.lsp.buf.signature_help, opts "Show signature help | lsp") - map("n", "wa", vim.lsp.buf.add_workspace_folder, opts "Add workspace folder | lsp") - map("n", "wr", vim.lsp.buf.remove_workspace_folder, opts "Remove workspace folder | lsp") + map("n", "gD", vim.lsp.buf.declaration, opts "Lsp Go to declaration") + map("n", "gd", vim.lsp.buf.definition, opts "Lsp Go to definition") + map("n", "K", vim.lsp.buf.hover, opts "Lsp hover information") + map("n", "gi", vim.lsp.buf.implementation, opts "Lsp Go to implementation") + map("n", "", vim.lsp.buf.signature_help, opts "Lsp Show signature help") + map("n", "wa", vim.lsp.buf.add_workspace_folder, opts "Lsp Add workspace folder") + map("n", "wr", vim.lsp.buf.remove_workspace_folder, opts "Lsp Remove workspace folder") map("n", "wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, opts "List workspace folders | lsp") + end, opts "Lsp List workspace folders") - map("n", "D", vim.lsp.buf.type_definition, opts "Go to type definition | lsp") + map("n", "D", vim.lsp.buf.type_definition, opts "Lsp Go to type definition") map("n", "ra", function() require "nvchad.renamer"() - end, opts "NvRename symbol | lsp") + end, opts "Lsp NvRenamer") - map({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts "Code action | lsp") - map("n", "gr", vim.lsp.buf.references, opts "Show references | lsp") + map({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts "Lsp Code action") + map("n", "gr", vim.lsp.buf.references, opts "Lsp Show references") end M.capabilities = vim.lsp.protocol.make_client_capabilities()