From 3dbf0bb5eeaeeeabc453fbf87a2a527fb8237297 Mon Sep 17 00:00:00 2001 From: Fabio Lenherr / DashieTM Date: Sat, 13 May 2023 13:19:35 +0200 Subject: [PATCH] chore: Change to use lua functions in keymaps --- nvim/lua/config/keymaps.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index 6d4ed91..42c705a 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -32,21 +32,21 @@ map("n", "dt", ':lua require("dapui").toggle() :lua require("dap").c map("n", "dq", ':lua require("dap").close() :lua require("dapui").toggle()', { desc = "Close DAP" }) -- file tree -map("n", "", ":lua require('nvim-tree.api').tree.toggle()", opts) +map("n", "", function() require('nvim-tree.api').tree.toggle()end, opts) -- toggle terminal -map("n", "", ":lua require('toggleterm').toggle(1)", {desc = "Toggle Terminal"}) +map("n", "", function() require('toggleterm').toggle(1)end, {desc = "Toggle Terminal"}) -- tab switching map("n", "", ":BufferLineCyclePrev", opts) map("n", "", ":BufferLineCycleNext", opts) -- git -map("n", "gq", ":lua require('telescope.builtin').git_commits()", { desc = "Commits" }) -map("n", "gw", ":lua require('telescope.builtin').git_bcommits()", { desc = "Commits in branch" }) -map("n", "ge", ":lua require('telescope.builtin').git_branches()", { desc = "Branches" }) -map("n", "gr", ":lua require('telescope.builtin').git_status()", { desc = "Git status" }) -map("n", "ga", ":lua require('telescope.builtin').git_stash()", { desc = "Git stash" }) +map("n", "gq", function() require('telescope.builtin').git_commits()end, { desc = "Commits" }) +map("n", "gw", function() require('telescope.builtin').git_bcommits()end, { desc = "Commits in branch" }) +map("n", "ge", function() require('telescope.builtin').git_branches()end, { desc = "Branches" }) +map("n", "gr", function() require('telescope.builtin').git_status()end, { desc = "Git status" }) +map("n", "ga", function() require('telescope.builtin').git_stash()end, { desc = "Git stash" }) map("n", "gg", function() Util.float_term({ "gitui" }, { cwd = Util.get_root() }) end, { desc = "gitui (root dir)" }) @@ -61,8 +61,8 @@ function _G.set_terminal_maps() vim.keymap.set("t", "jk", [[]], opts) vim.keymap.set("t", "", [[wincmd h]], opts) vim.keymap.set("t", "", [[wincmd j]], opts) - vim.keymap.set("n", "", ":lua require('toggleterm').toggle(1)", opts) - vim.keymap.set("i", "", ":lua require('toggleterm').toggle(1)", opts) + vim.keymap.set("n", "", function() require('toggleterm').toggle(1)end, opts) + vim.keymap.set("i", "", function() require('toggleterm').toggle(1)end, opts) end -- if you only want these mappings for toggle term use term://*toggleterm#* instead @@ -73,11 +73,11 @@ map("n", "", ":wincmd k", opts) map("n", "", ":wincmd l", opts) -- harpoon man -map("n", "h1", ":lua require('harpoon.ui').nav_file(1)", { desc = "First Harpoon File" }) -map("n", "h2", ":lua require('harpoon.ui').nav_file(2)", { desc = "Second Harpoon File" }) -map("n", "h3", ":lua require('harpoon.ui').nav_file(3)", { desc = "First Harpoon File" }) -map("n", "ha", ":lua require('harpoon.mark').add_file()", { desc = "First Harpoon File" }) -map("n", "hd", ":lua require('harpoon.mark').remove_file()", { desc = "First Harpoon File" }) +map("n", "h1", function() require('harpoon.ui').nav_file(1)end, { desc = "First Harpoon File" }) +map("n", "h2", function() require('harpoon.ui').nav_file(2)end, { desc = "Second Harpoon File" }) +map("n", "h3", function() require('harpoon.ui').nav_file(3)end, { desc = "First Harpoon File" }) +map("n", "ha", function() require('harpoon.mark').add_file()end, { desc = "First Harpoon File" }) +map("n", "hd", function() require('harpoon.mark').remove_file()end, { desc = "First Harpoon File" }) map("n", "hm", ":Telescope harpoon marks", { noremap = true, silent = true, desc = "Show harpoon marks" }) -- telescope @@ -96,7 +96,7 @@ end, { desc = "Help" }) map("n", "fp", function() require("telescope").extensions.project.project({}) end, { noremap = true, silent = true, desc = "Projects" }) -map("n", "z", ":lua require('telescope').extensions.zoxide.list{}", { desc = "Zoxide" }) +map("n", "z", function() require('telescope').extensions.zoxide.list{}end, { desc = "Zoxide" }) -- trouble map("n", "t", "TroubleToggle", term_opts)