feat: vimux
This commit is contained in:
		
					parent
					
						
							
								3b0950e88b
							
						
					
				
			
			
				commit
				
					
						68f807ecf2
					
				
			
		
					 11 changed files with 118 additions and 65 deletions
				
			
		dotfiles
fish
neovim
tmux
modules/applications
|  | @ -2,6 +2,9 @@ set fish_cursor_default block # Set the normal and visual mode cursors to a bloc | ||||||
| set fish_cursor_insert line # Set the insert mode cursor to a line | set fish_cursor_insert line # Set the insert mode cursor to a line | ||||||
| set fish_cursor_replace_one underscore # Set the replace mode cursor to an underscore | set fish_cursor_replace_one underscore # Set the replace mode cursor to an underscore | ||||||
| 
 | 
 | ||||||
|  | # Force fish to skip some checks (I think) | ||||||
|  | set fish_vi_force_cursor  | ||||||
|  | 
 | ||||||
| function fish_user_key_bindings | function fish_user_key_bindings | ||||||
|   # Use the vim keybinds |   # Use the vim keybinds | ||||||
|   fish_vi_key_bindings |   fish_vi_key_bindings | ||||||
|  |  | ||||||
|  | @ -1,36 +1,4 @@ | ||||||
| local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd') |  | ||||||
| local fn = vim.fn -- to call Vim functions e.g. fn.bufnr() |  | ||||||
| local g = vim.g -- a table to access global variables |  | ||||||
| local opt = vim.opt -- to set options |  | ||||||
| 
 |  | ||||||
| -- Basic options |  | ||||||
| opt.joinspaces = false -- No double spaces with join |  | ||||||
| opt.list = true -- Show some invisible characters |  | ||||||
| 
 |  | ||||||
| opt.number = true -- Show line numbers |  | ||||||
| opt.relativenumber = true -- Relative line numbers |  | ||||||
| 
 |  | ||||||
| opt.scrolloff = 4 -- Lines of context |  | ||||||
| opt.shiftround = true -- Round indent |  | ||||||
| opt.shiftwidth = 2 -- Size of an indent |  | ||||||
| opt.termguicolors = true -- True color support |  | ||||||
| 
 |  | ||||||
| opt.ignorecase = true -- Ignore case |  | ||||||
| opt.smartcase = true -- Do not ignore case with capitals |  | ||||||
| 
 |  | ||||||
| opt.smartindent = true -- Insert indents automatically |  | ||||||
| 
 |  | ||||||
| opt.splitbelow = true -- Put new windows below current |  | ||||||
| opt.splitright = true -- Put new windows right of current |  | ||||||
| 
 |  | ||||||
| opt.wrap = false -- Disable line wrap |  | ||||||
| opt.wildmode = {'list', 'longest'} -- Command-line completion mode |  | ||||||
| 
 |  | ||||||
| opt.completeopt = {"menu", "menuone", "noselect"} |  | ||||||
| 
 |  | ||||||
| -- Set theme |  | ||||||
| require('github-theme').setup({theme_style = "light", dark_float = true}) |  | ||||||
| 
 |  | ||||||
| -- Import my other files | -- Import my other files | ||||||
|  | require("my.options").setup() | ||||||
| require('my.keymaps').setup() | require('my.keymaps').setup() | ||||||
| require('my.plugins').setup() | require('my.plugins').setup() | ||||||
|  |  | ||||||
|  | @ -4,4 +4,13 @@ function M.global(name, value) | ||||||
|     vim.g[name] = value |     vim.g[name] = value | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
|  | function M.mergeTables(t1, t2) | ||||||
|  |     local t3 = {} | ||||||
|  | 
 | ||||||
|  |     for k, v in pairs(t1) do t3[k] = v end | ||||||
|  |     for k, v in pairs(t2) do t3[k] = v end | ||||||
|  | 
 | ||||||
|  |     return t3 | ||||||
|  | end | ||||||
|  | 
 | ||||||
| return M | return M | ||||||
|  |  | ||||||
|  | @ -1,20 +1,21 @@ | ||||||
|  | local helpers = require("my.helpers") | ||||||
|  | 
 | ||||||
| local M = {} | local M = {} | ||||||
| 
 | 
 | ||||||
| function M.map(mode, lhs, rhs, opts) | function M.map(mode, lhs, rhs, opts) | ||||||
|     local options = {noremap = true} |     local options = helpers.mergeTables(opts, {noremap = true}) | ||||||
|     if opts then options = vim.tbl_extend('force', options, opts) end |  | ||||||
|     vim.api.nvim_set_keymap(mode, lhs, rhs, options) |     vim.api.nvim_set_keymap(mode, lhs, rhs, options) | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function M.mapSilent(mode, lhs, rhs, opts) | function M.mapSilent(mode, lhs, rhs, opts) | ||||||
|     local options = {silent = true} |     local options = helpers.mergeTables(opts, {silent = true}) | ||||||
|     if opts then options = vim.tbl_extend('force', options, opts) end |     M.map(mode, lhs, rhs, options) | ||||||
|     M.map(mode, lhs, rhs, opts) |  | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| function M.setup() | function M.setup() | ||||||
|     M.map("i", "jj", "<Esc>") -- Remap Esc to jj |     M.map("i", "jj", "<Esc>") -- Remap Esc to jj | ||||||
|     M.map("n", "<Space><Space>", ":w<cr>") -- Double space to sace |     M.map("n", "<Space><Space>", ":w<cr>") -- Double space to sace | ||||||
|  |     M.map("n", "vv", "<C-w>v") -- Create vertical split | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| return M | return M | ||||||
|  |  | ||||||
							
								
								
									
										39
									
								
								dotfiles/neovim/lua/my/options.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								dotfiles/neovim/lua/my/options.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,39 @@ | ||||||
|  | local helpers = require("my.helpers") | ||||||
|  | 
 | ||||||
|  | local M = {} | ||||||
|  | 
 | ||||||
|  | function M.setup() | ||||||
|  |     local opt = vim.opt -- to set options | ||||||
|  | 
 | ||||||
|  |     -- Basic options | ||||||
|  |     opt.joinspaces = false -- No double spaces with join | ||||||
|  |     opt.list = true -- Show some invisible characters | ||||||
|  | 
 | ||||||
|  |     opt.number = true -- Show line numbers | ||||||
|  |     opt.relativenumber = true -- Relative line numbers | ||||||
|  | 
 | ||||||
|  |     opt.scrolloff = 4 -- Lines of context | ||||||
|  |     opt.shiftround = true -- Round indent | ||||||
|  |     opt.shiftwidth = 2 -- Size of an indent | ||||||
|  |     opt.termguicolors = true -- True color support | ||||||
|  | 
 | ||||||
|  |     opt.ignorecase = true -- Ignore case | ||||||
|  |     opt.smartcase = true -- Do not ignore case with capitals | ||||||
|  | 
 | ||||||
|  |     opt.smartindent = true -- Insert indents automatically | ||||||
|  | 
 | ||||||
|  |     opt.splitbelow = true -- Put new windows below current | ||||||
|  |     opt.splitright = true -- Put new windows right of current | ||||||
|  | 
 | ||||||
|  |     opt.wrap = false -- Disable line wrap | ||||||
|  |     opt.wildmode = {'list', 'longest'} -- Command-line completion mode | ||||||
|  |     opt.completeopt = {"menu", "menuone", "noselect"} | ||||||
|  | 
 | ||||||
|  |     -- Set leader | ||||||
|  |     helpers.global("mapleader", "<Space>") | ||||||
|  | 
 | ||||||
|  |     -- Set theme | ||||||
|  |     require('github-theme').setup({theme_style = "light", dark_float = true}) | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | return M | ||||||
							
								
								
									
										21
									
								
								dotfiles/neovim/lua/my/plugins/arpeggio.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								dotfiles/neovim/lua/my/plugins/arpeggio.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | ||||||
|  | local helpers = require("my.helpers") | ||||||
|  | local arpeggio = vim.fn["arpeggio#map"] | ||||||
|  | 
 | ||||||
|  | local M = {} | ||||||
|  | 
 | ||||||
|  | function M.chord(mode, lhs, rhs, opts) | ||||||
|  |     local options = helpers.mergeTables(opts, {noremap = true}) | ||||||
|  | 
 | ||||||
|  |     local settings = "" | ||||||
|  | 
 | ||||||
|  |     if options.silent then settings = settings .. "s" end | ||||||
|  | 
 | ||||||
|  |     arpeggio(mode, settings, options.noremap, lhs, rhs) | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | function M.chordSilent(mode, lhs, rhs, opts) | ||||||
|  |     local options = helpers.mergeTables(opts, {silent = true}) | ||||||
|  |     M.chord(mode, lhs, rhs, options) | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | return M | ||||||
|  | @ -17,6 +17,7 @@ function M.setup() | ||||||
|     require("my.plugins.nvim-tree").setup() |     require("my.plugins.nvim-tree").setup() | ||||||
|     require("my.plugins.vimtex").setup() |     require("my.plugins.vimtex").setup() | ||||||
|     require("my.plugins.telescope").setup() |     require("my.plugins.telescope").setup() | ||||||
|  |     require("my.plugins.vimux").setup() | ||||||
| end | end | ||||||
| 
 | 
 | ||||||
| return M | return M | ||||||
|  |  | ||||||
							
								
								
									
										9
									
								
								dotfiles/neovim/lua/my/plugins/vimux.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								dotfiles/neovim/lua/my/plugins/vimux.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,9 @@ | ||||||
|  | local arpeggio = require("my.plugins.arpeggio") | ||||||
|  | 
 | ||||||
|  | local M = {} | ||||||
|  | 
 | ||||||
|  | function M.setup() | ||||||
|  |     arpeggio.chordSilent("n", "<Leader>vp", ":VimuxPromptCommand<CR>") | ||||||
|  | end | ||||||
|  | 
 | ||||||
|  | return M | ||||||
|  | @ -3,37 +3,37 @@ set -g prefix C-a | ||||||
| unbind C-b | unbind C-b | ||||||
| bind C-a send-prefix | bind C-a send-prefix | ||||||
| 
 | 
 | ||||||
| # More colors | # don't rename windows automatically | ||||||
| set-option -g default-terminal "tmux-256color" | set-option -g allow-rename off | ||||||
| set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' |  | ||||||
| 
 | 
 | ||||||
| # force a reload of the config file (I don't think this works on nixos) | # Visual stuff | ||||||
| unbind r | set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' # Supposedly helps with cursor shapes under vim (spoiler: it does not) | ||||||
| bind r source-file ~/.tmux.conf |  | ||||||
| 
 | 
 | ||||||
| # quick pane cycling | # Split panes with \ and - | ||||||
| unbind ^A | bind \\ split-window -h | ||||||
| bind ^A select-pane -t :.+ | bind - split-window -v | ||||||
|  | unbind '"' | ||||||
|  | unbind % | ||||||
|  | 
 | ||||||
|  | # Zooming | ||||||
|  | unbind C-z | ||||||
|  | bind -n C-z resize-pane -Z | ||||||
| 
 | 
 | ||||||
| # Vim-like keybinds for switching between panes | # Vim-like keybinds for switching between panes | ||||||
| bind -n m-h select-pane -L | bind -n C-h select-pane -L | ||||||
| bind -n m-l select-pane -R | bind -n C-l select-pane -R | ||||||
| bind -n m-k select-pane -U | bind -n C-k select-pane -U | ||||||
| bind -n m-j select-pane -D | bind -n C-j select-pane -D | ||||||
| 
 | 
 | ||||||
| # Vim-mode | # Vim-mode | ||||||
| set-window-option -g mode-keys vi | set-window-option -g mode-keys vi | ||||||
| 
 | 
 | ||||||
| # Vim like keybinds for copying  |  | ||||||
| bind -t vi-copy v begin-selection # begin selection |  | ||||||
| bind -t vi-copy V rectangle-toggle # square selection (?) |  | ||||||
| 
 |  | ||||||
| bind -t vi-copy y copy-pipe 'xclip -in -set clipboard' # copy |  | ||||||
| 
 |  | ||||||
| unbind p |  | ||||||
| bind p run "tmux set-buffer \"$(xclip -o -set clipboard)\"; tmux paste-buffer" # paste |  | ||||||
| 
 |  | ||||||
| # Vim like mode for leaving insert mode | # Vim like mode for leaving insert mode | ||||||
| unbind [ # unbind the default way to copy text | unbind [ # unbind the default way to copy text | ||||||
| bind Escape copy-mode # allow exiting insert mode with Escape | bind -T prefix j copy-mode # allow exiting insert mode with C-a j | ||||||
| bind jj copy-mode # allow exiting insert mode with jj (?) | 
 | ||||||
|  | # Vim like keybinds for copying and pasting | ||||||
|  | bind -T copy-mode-vi p paste-buffer | ||||||
|  | bind -T copy-mode-vi V send-keys -X rectangle-toggle # Check if this works | ||||||
|  | bind -T copy-mode-vi v send-keys -X begin-selection | ||||||
|  | bind -T copy-mode-vi y send-keys -X copy-selection | ||||||
|  |  | ||||||
|  | @ -57,6 +57,8 @@ in | ||||||
|         telescope-file-browser-nvim # file creation/deletion using telescope |         telescope-file-browser-nvim # file creation/deletion using telescope | ||||||
|         lspkind-nvim # show icons in lsp completion menus |         lspkind-nvim # show icons in lsp completion menus | ||||||
|         # symbols-outline-nvim # tree view for symbols in document |         # symbols-outline-nvim # tree view for symbols in document | ||||||
|  |         vimux # interact with tmux from within vim | ||||||
|  |         vim-tmux-navigator # easly switch between tmux and vim panes | ||||||
| 
 | 
 | ||||||
|         # Cmp related stuff. See https://github.com/hrsh7th/nvim-cmp |         # Cmp related stuff. See https://github.com/hrsh7th/nvim-cmp | ||||||
|         cmp-nvim-lsp |         cmp-nvim-lsp | ||||||
|  |  | ||||||
|  | @ -16,11 +16,11 @@ | ||||||
|       ]; |       ]; | ||||||
| 
 | 
 | ||||||
|       extraConfig = '' |       extraConfig = '' | ||||||
|         # load the rest of the config |  | ||||||
|         source-file ${../../dotfiles/tmux/tmux.conf} |  | ||||||
| 
 |  | ||||||
|         # Use github light theme |         # Use github light theme | ||||||
|         source-file ${pkgs.githubNvimTheme}/terminal/tmux/github_light.conf |         source-file ${pkgs.githubNvimTheme}/terminal/tmux/github_light.conf | ||||||
|  | 
 | ||||||
|  |         # load the rest of the config | ||||||
|  |         source-file ${../../dotfiles/tmux/tmux.conf} | ||||||
|       ''; |       ''; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Matei Adriel
				Matei Adriel