local wk = require("which-key") local Terminal = require('toggleterm.terminal').Terminal local toggle_float = function() local float = Terminal:new({ direction = "float" }) return float:toggle() end local toggle_lazygit = function() local lazygit = Terminal:new({ cmd = "lazygit", direction = "float" }) return lazygit:toggle() end local mappings = { q = {":q", "Quit"}, Z = {":wq", "Save and Quit"}, w = {":w", "Save"}, x ={":bdelete", "Close"}, E = { ":e ~/.config/nvim/init.lua", "Edit config" }, f = { name = "Telescope", f = {":Telescope find_files", "Telescope Find Files" }, h = { ":Telescope find_files hidden=true", "Telescope Find Files" }, g = { ":Telescope live_grep", "Telescope Live Grep" }, }, r = { ":Telescope oldfiles", "Recent files" }, l = { name = "LSP", i = {":LspInfo", "Connected Language Servers"}, I = {'LspInstallInfo', 'Install language server'}, f = {'lua vim.lsp.buf.formatting()', "Format File"}, k = {" lua vim.lsp.buf.signature_help()", "Signature Help"}, -- K = {'lua vim.lsp.buf.hover()', "Hover"}, K = {" Lspsaga hover_doc", "Hover Commands"}, w = {" lua vim.lsp.add_workspace_folder()", "Add Workspace Folder"}, W = {" lua vim.lsp.remove_workspace_folder()", "Remove Workspace Folder"}, l = {" lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", "List Workspace Folder"}, t = {'lua vim.lsp.buf.type_definition()', "Type definition"}, d = {" lua vim.lsp.buf.definition()", "Go to Definition"}, D = {" lua vim.lsp.buf.declaration()", "Go to Declaration"}, r = {" lua vim.lsp.buf.references()", "References"}, R = {" Lspsaga rename", "Rename"}, -- R = {'lua vim.lsp.buf.rename()', "Rename"}, a = {" Lspsaga code_action", "Code Action"}, -- a = {'lua vim.lsp.buf.code_action()', "Code actions"}, -- T = {' Telescope diagnostics bufnr=0', "Get Diagnostics"} go = {"Lspsaga show_line_diagnostics","Show Line Diagnostic"}, -- e = {'lua vim.diagnostic.show_line_diagnostics()', "Show line diagnostics"}, gj = {"Lspsaga diagnostic_jump_next","Go to Next Diagnostic"}, -- n = {'lua vim.diagnostic.goto_next()', "Go to next diagnostic"}, gk = {"Lspsaga diagnostic_jump_prev","Go to Prev Diagnostic"}, -- N = {'lua vim.diagnostic.goto_prev()', "Go to previous diagnostic"}, }, t = { name = "ToggleTerm", t = { ":ToggleTerm", "Split Below" }, f = { toggle_float, "Floating Terminal" }, l = { toggle_lazygit, "Lazygit" }, }, p = { name = "Packer", s = { ":PackerSync", "Sync Plugins" }, r = { ":PackerClean", "Remove Unused Plugins" }, c = { ":PackerCompile profile=true", "Recompile Plugins" }, i = { ":PackerInstall", "Install Plugins" }, p = { ":PackerProfile", "Packer Profile" }, S = { ":PackerStatus", "Packer Status" }, u = { ":PackerUpdate", "Update Plugins" } }, } local opts = {prefix = ''} wk.register(mappings, opts)