From e91d840f90d0c52bb6b87ee584892c08d417a0f7 Mon Sep 17 00:00:00 2001 From: Andrei Stoica Date: Thu, 25 Jan 2024 02:25:12 -0500 Subject: [PATCH] vim-tmux-navigator(needs some work on bindings) --- .nvchad-custom/mappings.lua | 7 +++++++ .nvchad-custom/plugins.lua | 11 +++++++++++ .tmux.conf##os.Linux,hostname.tower | 21 +++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/.nvchad-custom/mappings.lua b/.nvchad-custom/mappings.lua index 1888f30..4d263b2 100644 --- a/.nvchad-custom/mappings.lua +++ b/.nvchad-custom/mappings.lua @@ -17,6 +17,13 @@ M.general = { ["n"] = {"nzz", "find next"}, ["N"] = {"Nzz", "find prev"}, + -- navigation + [""] = {" TmuxNavigateLeft", "window left" }, + [""] = {" TmuxNavigateDown", "window down" }, + [""] = {" TmuxNavigateUp", "window up" }, + [""] = {" TmuxNavigateRight", "window right" }, + [""] = {" TmuxNavigatePrevious", "window previous" }, + }, } diff --git a/.nvchad-custom/plugins.lua b/.nvchad-custom/plugins.lua index c42461a..ffe02c3 100644 --- a/.nvchad-custom/plugins.lua +++ b/.nvchad-custom/plugins.lua @@ -4,6 +4,17 @@ local overrides = require "custom.configs.overrides" ---@type NvPluginSpec[] local plugins = { + { + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + }, + lazy = false, + }, -- Override plugin definition options { diff --git a/.tmux.conf##os.Linux,hostname.tower b/.tmux.conf##os.Linux,hostname.tower index cee4db8..eff9ea0 100644 --- a/.tmux.conf##os.Linux,hostname.tower +++ b/.tmux.conf##os.Linux,hostname.tower @@ -1,3 +1,9 @@ +# plugins +set -g @plugin 'alexghergh/nvim-tmux-navigation' + +run '~/.tmux/plugins/tpm/tpm' + + # remap prefix from 'C-b' to 'C-a' unbind C-b set-option -g prefix C-a @@ -28,3 +34,18 @@ bind h attach-session -t . -c "#{pane_current_path}" # status bar set -g status-right '%H:%m %d-%b-%y ' + +# Start windows and panes at 1, not 0 +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +# navigation +bind-key 'j' select-pane -D +bind-key 'k' select-pane -U +bind-key 'l' select-pane -R +bind-key 'h' select-pane -L + +bind -n S-Left previous-window +bind -n S-Right next-window