From 833dc6f9ba845a0725c755db9ba1c256cb3f1418 Mon Sep 17 00:00:00 2001 From: doman Date: Tue, 29 Aug 2023 22:06:35 +0200 Subject: [PATCH] tmux and nvim --- .config/nvim/lua/config/keymaps.lua | 43 ++++++-------------------- .config/nvim/lua/plugins/harpoon.lua | 13 ++++++++ .config/nvim/lua/plugins/telescope.lua | 11 +++++++ .config/nvim/lua/plugins/ui.lua | 4 +-- .config/nvim/lua/plugins/undo.lua | 6 ++++ .config/tmux/tmux.conf | 4 +-- 6 files changed, 43 insertions(+), 38 deletions(-) create mode 100644 .config/nvim/lua/plugins/harpoon.lua create mode 100644 .config/nvim/lua/plugins/undo.lua diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 490898e..c677c8e 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -21,9 +21,6 @@ vim.keymap.set("n", "", "resize -2", { desc = "Decrease window vim.keymap.set("n", "", "vertical resize -2", { desc = "Decrease window width" }) vim.keymap.set("n", "", "vertical resize +2", { desc = "Increase window width" }) -vim.keymap.set("n", "bb", "e #", { desc = "Switch to Other Buffer" }) -vim.keymap.set("n", "`", "e #", { desc = "Switch to Other Buffer" }) - -- Clear search with vim.keymap.set({ "i", "n" }, "", "noh", { desc = "Escape and clear hlsearch" }) @@ -46,26 +43,14 @@ vim.keymap.set("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev se vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) vim.keymap.set("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" }) --- Add undo break-points -vim.keymap.set("i", ",", ",u") -vim.keymap.set("i", ".", ".u") -vim.keymap.set("i", ";", ";u") - --- save file -vim.keymap.set({ "i", "v", "n", "s" }, "", "w", { desc = "Save file" }) - --keywordprg vim.keymap.set("n", "K", "norm! K", { desc = "Keywordprg" }) --- better indenting -vim.keymap.set("v", "<", "", ">gv") - -- lazy vim.keymap.set("n", "l", "Lazy", { desc = "Lazy" }) -- new file -vim.keymap.set("n", "fn", "enew", { desc = "New File" }) +vim.keymap.set("n", "n", "enew", { desc = "New File" }) vim.keymap.set("n", "xl", "lopen", { desc = "Location List" }) vim.keymap.set("n", "xq", "copen", { desc = "Quickfix List" }) @@ -83,24 +68,7 @@ vim.keymap.set("t", "", "wincmd h", { desc = "Go to left window" } vim.keymap.set("t", "", "wincmd j", { desc = "Go to lower window" }) vim.keymap.set("t", "", "wincmd k", { desc = "Go to upper window" }) vim.keymap.set("t", "", "wincmd l", { desc = "Go to right window" }) -vim.keymap.set("t", "", "close", { desc = "Hide Terminal" }) -vim.keymap.set("t", "", "close", { desc = "which_key_ignore" }) - --- windows -vim.keymap.set("n", "ww", "p", { desc = "Other window", remap = true }) -vim.keymap.set("n", "wd", "c", { desc = "Delete window", remap = true }) -vim.keymap.set("n", "w-", "s", { desc = "Split window below", remap = true }) -vim.keymap.set("n", "w|", "v", { desc = "Split window right", remap = true }) -vim.keymap.set("n", "-", "s", { desc = "Split window below", remap = true }) -vim.keymap.set("n", "|", "v", { desc = "Split window right", remap = true }) - --- tabs -vim.keymap.set("n", "l", "tablast", { desc = "Last Tab" }) -vim.keymap.set("n", "f", "tabfirst", { desc = "First Tab" }) -vim.keymap.set("n", "", "tabnew", { desc = "New Tab" }) -vim.keymap.set("n", "]", "tabnext", { desc = "Next Tab" }) -vim.keymap.set("n", "d", "tabclose", { desc = "Close Tab" }) -vim.keymap.set("n", "[", "tabprevious", { desc = "Previous Tab" }) +vim.keymap.set("t", "", "close", { desc = "Hide Terminal" }) -- lsp vim.keymap.set("n", "gd", "lua vim.lsp.buf.definition()", { desc = "Goto Definition" }) @@ -119,3 +87,10 @@ vim.keymap.set("n", "lr", "lua vim.lsp.buf.rename()", { desc = -- colorizer vim.keymap.set("n", "cs", "ColorizerToggle", { desc = "Toggle show colors" }) + +-- undo tree +vim.keymap.set('n', 'uu', vim.cmd.UndotreeToggle, { desc = "Toggle undo tree" }) + +-- harpoon +vim.keymap.set("n", "hh", "lua require('harpoon.ui').toggle_quick_menu()", { desc = "Harpoon Menu" }) +vim.keymap.set("n", "ha", "lua require('harpoon.mark').add_file()", { desc = "Harpoon Add File" }) diff --git a/.config/nvim/lua/plugins/harpoon.lua b/.config/nvim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..0e7f311 --- /dev/null +++ b/.config/nvim/lua/plugins/harpoon.lua @@ -0,0 +1,13 @@ +return { + { + 'ThePrimeagen/harpoon', + config = function() + require('harpoon').setup({ + global_settings = { + save_on_toggle = true, + save_on_change = true, + }, + }) + end, + } +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 05ba732..44d30a6 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -16,6 +16,16 @@ return { end, desc = "Find File", }, + { + "fh", + "Telescope harpoon marks", + desc = "Find harpoon", + }, + { + "fb", + "Telescope buffers", + desc = "Find buffer", + }, }, opts = { defaults = { @@ -33,6 +43,7 @@ return { build = "make", config = function() require("telescope").load_extension("fzf") + require("telescope").load_extension("harpoon") end, }, }, diff --git a/.config/nvim/lua/plugins/ui.lua b/.config/nvim/lua/plugins/ui.lua index 8c1b212..e3d8307 100644 --- a/.config/nvim/lua/plugins/ui.lua +++ b/.config/nvim/lua/plugins/ui.lua @@ -180,12 +180,12 @@ return { ["gz"] = { name = "+surround" }, ["]"] = { name = "+next" }, ["["] = { name = "+prev" }, - [""] = { name = "+tabs" }, ["b"] = { name = "+buffer" }, ["c"] = { name = "+colors" }, ["l"] = { name = "+lsp" }, ["f"] = { name = "+file/find" }, - ["g"] = { name = "+goto" }, + ["g"] = { name = "+git" }, + ["h"] = { name = "+harpoon" }, ["u"] = { name = "+ui" }, ["w"] = { name = "+windows" }, ["x"] = { name = "+diagnostics/quickfix" }, diff --git a/.config/nvim/lua/plugins/undo.lua b/.config/nvim/lua/plugins/undo.lua new file mode 100644 index 0000000..44ae56d --- /dev/null +++ b/.config/nvim/lua/plugins/undo.lua @@ -0,0 +1,6 @@ +return { + { + 'mbbill/undotree', + lazy = false, + } +} diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 4a41399..7631cce 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -2,8 +2,8 @@ set-option -sa terminal-overrides ",xterm*:Tc" set -g mouse on unbind C-b -set -g prefix C-a -bind C-a send-prefix +set -g prefix C-i +bind C-i send-prefix # export session name set -g status-interval 0