From e253c1fbe510ccc4a8de3372b7cd74ca499faedd Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Thu, 18 May 2023 14:40:19 +0100 Subject: [PATCH] [MAJOR] Tmux + nvim integration panels --- .config/nvim/lua/plugins/lazy.lua | 77 ++++++++++++++++++++++--------- .config/tmux/tmux.conf | 30 +++++++++++- 2 files changed, 83 insertions(+), 24 deletions(-) diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua index 69e1364..7ca756e 100644 --- a/.config/nvim/lua/plugins/lazy.lua +++ b/.config/nvim/lua/plugins/lazy.lua @@ -6,7 +6,8 @@ lazy.setup({ -------------------------------------------THEMES------------------------------------------ 'joshdick/onedark.vim', - { 'catppuccin/nvim', + { + 'catppuccin/nvim', lazy = false, priority = 1000, config = function() @@ -15,16 +16,18 @@ lazy.setup({ }, -------------------------------------------------------QOL--------------------------------- --better navigation with 's-letter' - { 'ggandor/leap.nvim', + { + 'ggandor/leap.nvim', config = function() require('leap').add_default_mappings() end }, - { 'folke/zen-mode.nvim', + { + 'folke/zen-mode.nvim', config = function() require("zen-mode").setup { - vim.keymap.set('n', 'z', ' ZenMode ',{noremap=true,silent=true}) + vim.keymap.set('n', 'z', ' ZenMode ', { noremap = true, silent = true }) } end }, @@ -32,11 +35,28 @@ lazy.setup({ --Change add and remove surroundings from words 'tpope/vim-surround', + --Tmux navigation + { + 'alexghergh/nvim-tmux-navigation', + config = function() + require 'nvim-tmux-navigation'.setup { + disable_when_zoomed = true, -- defaults to false + keybindings = { + left = "", + down = "", + up = "", + right = "", + } + } + end + }, -- Rename variable pop up 'stevearc/dressing.nvim', - { 'windwp/nvim-autopairs', - config = function() require('nvim-autopairs').setup {} + { + 'windwp/nvim-autopairs', + config = function() + require('nvim-autopairs').setup {} end }, @@ -51,14 +71,15 @@ lazy.setup({ }, -------------------------------------------------------LSP---------------------------------------------- - { 'hrsh7th/nvim-cmp', + { + 'hrsh7th/nvim-cmp', dependencies = { - 'hrsh7th/cmp-nvim-lsp', -- lsp - 'hrsh7th/cmp-nvim-lua', -- Nvim API completions + 'hrsh7th/cmp-nvim-lsp', -- lsp + 'hrsh7th/cmp-nvim-lua', -- Nvim API completions 'hrsh7th/cmp-nvim-lsp-signature-help', -- Show function signatures - 'hrsh7th/cmp-buffer', --buffer completions - 'hrsh7th/cmp-path', --path completions - 'hrsh7th/cmp-cmdline', --cmdline completions + 'hrsh7th/cmp-buffer', --buffer completions + 'hrsh7th/cmp-path', --path completions + 'hrsh7th/cmp-cmdline', --cmdline completions 'L3MON4D3/LuaSnip', 'rafamadriz/friendly-snippets', 'saadparwaiz1/cmp_luasnip', @@ -69,7 +90,8 @@ lazy.setup({ }, --LSP Status - { 'j-hui/fidget.nvim', + { + 'j-hui/fidget.nvim', config = function() require('fidget').setup { window = { @@ -79,7 +101,8 @@ lazy.setup({ end }, - { 'williamboman/mason.nvim', + { + 'williamboman/mason.nvim', config = function() require 'plugins.mason' end @@ -87,42 +110,48 @@ lazy.setup({ 'williamboman/mason-lspconfig.nvim', - { 'neovim/nvim-lspconfig', + { + 'neovim/nvim-lspconfig', config = function() require 'plugins.lspconfig' end }, - { 'jose-elias-alvarez/null-ls.nvim', + { + 'jose-elias-alvarez/null-ls.nvim', config = function() require 'plugins.null-ls' end }, - { 'lervag/vimtex', + { + 'lervag/vimtex', config = function() require 'plugins.vimtex' end }, - {'github/copilot.vim'}, + { 'github/copilot.vim' }, ------------------------------------------------------------------------------------------- -- Syntax Highlighting - { 'nvim-treesitter/nvim-treesitter', + { + 'nvim-treesitter/nvim-treesitter', config = function() require 'plugins.treesitter' end }, --Sticky headers - { 'nvim-treesitter/nvim-treesitter-context', + { + 'nvim-treesitter/nvim-treesitter-context', config = function() require 'plugins.treesitter-context' end }, --Tabs - { 'akinsho/bufferline.nvim', + { + 'akinsho/bufferline.nvim', version = 'v3.*', dependencies = 'nvim-tree/nvim-web-devicons', config = function() @@ -132,7 +161,8 @@ lazy.setup({ --does so much { - 'nvim-telescope/telescope.nvim', tag = '0.1.0', + 'nvim-telescope/telescope.nvim', + tag = '0.1.0', -- or , branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' }, config = function() require('plugins.telescope') end @@ -140,7 +170,8 @@ lazy.setup({ --Main menu - { 'startup-nvim/startup.nvim', + { + 'startup-nvim/startup.nvim', dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' }, config = function() require('startup').setup { theme = 'dashboard' } diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index fe96d3b..6dc62c0 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -3,7 +3,35 @@ set -ag terminal-overrides ",$TERM:RGB" set -sg escape-time 0 #binds -bind-key x kill-pane +bind-key 'x' kill-pane +bind-key 'h' previous-window +bind-key 'j' switch-client -p +bind-key 'k' switch-client -n +bind-key 'l' next-window +bind-key 'n' new-window +bind-key 'c' kill-window +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator + +# decide whether we're in a Vim process +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" + +unbind y +bind-key 'y' if-shell "$is_vim" 'send-keys F5' 'select-pane -L' +unbind u +bind-key 'u' if-shell "$is_vim" 'send-keys F6' 'select-pane -D' +unbind i +bind-key 'i' if-shell "$is_vim" 'send-keys F7' 'select-pane -U' +unbind o +bind-key 'o' if-shell "$is_vim" 'send-keys F8' 'select-pane -R' + +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' + +bind-key -T copy-mode-vi 'y' select-pane -L +bind-key -T copy-mode-vi 'u' select-pane -D +bind-key -T copy-mode-vi 'i' select-pane -U +bind-key -T copy-mode-vi 'o' select-pane -R # List of plugins set -g @plugin 'tmux-plugins/tpm'