From 219bdecda920dbce8429371a936cf9ece3a97d45 Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Sun, 19 Apr 2020 19:42:48 -0400 Subject: [PATCH] Create Repeatable Test Environment (#5) * Add /test README.md * Add basic Tmux configuration for testing * Add Makefile for testing * Add basic vimrc to source for testing * Comment out vim-tmux-navigator lines from test tmux.conf * Move Makefile out to project root * Replace test/README with a contributing guide * Remove commented lines from /test/.tmux.conf --- CONTRIBUTING.md | 20 ++++++++++++++++++++ Makefile | 4 ++++ test/.tmux.conf | 18 ++++++++++++++++++ test/.vimrc | 1 + 4 files changed, 43 insertions(+) create mode 100644 CONTRIBUTING.md create mode 100644 Makefile create mode 100644 test/.tmux.conf create mode 100644 test/.vimrc diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7635da2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,20 @@ +# Contibuting + +If you find any issues with this repo that you wish to fix, feel free to fork +it and submit Pull Request with a fix. + +## Testing + +This plugin does not currently support any automated testing mechanism. Testing +is instead accomplished manually, aided by using supplied configuration files. + +The easiest way to test changes is to use the Makefile supplied. From a +terminal **with no tmux session**, run: + +``` +make test +``` + +This will load a new vim session inside of a new tmux session. Both sessions +will use the *.tmux.conf* and *.vimrc* from */test* in this repo, instead of +your user's configuration files. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..836755e --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +.PHONY: test + +test: + tmux -f test/.tmux.conf new-session "nvim -u test/.vimrc" diff --git a/test/.tmux.conf b/test/.tmux.conf new file mode 100644 index 0000000..60775c4 --- /dev/null +++ b/test/.tmux.conf @@ -0,0 +1,18 @@ +# Tmux configuration with only bindings required for better-vim-tmux-resizer + +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" + +# Tmux-vim-resizer +bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 10' +bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 5' +bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 5' +bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 10' + +# Tmux-vim-resizer copy-mode +bind-key -T copy-mode-vi 'M-h' resize-pane -L 10 +bind-key -T copy-mode-vi 'M-j' resize-pane -D 5 +bind-key -T copy-mode-vi 'M-k' resize-pane -U 5 +bind-key -T copy-mode-vi 'M-l' resize-pane -R 10 diff --git a/test/.vimrc b/test/.vimrc new file mode 100644 index 0000000..9bd70ac --- /dev/null +++ b/test/.vimrc @@ -0,0 +1 @@ +source plugin/better_vim_tmux_resizer.vim