From 52978bca4c30a553861b1d560c1bc81bd866ed25 Mon Sep 17 00:00:00 2001 From: Andrea Rogers Date: Wed, 15 Nov 2023 13:01:49 -0600 Subject: [PATCH] vimrc: Make Terminal-spawning helpers and mappings On Mac systems with MacPorts-installed Bash and Vim, the :ter[minal] command doesn't pick up /etc/bashrc (aka /private/etc/bashrc) in my login shell (Bash installed via MacPorts), so I've created helpers to make it easier to spawn terminals. These helpers and their stubby siblings for non-Mac platforms are mapped to F1 and Shift+F1, respectively. I figure if I *really* need :help, I can just type :help. It isn't hard. Usually I trigger the :help mapping by mistake anyways. Note: ~~~~~ The helpers aren't perfect (you have to close the buffer manually after Bash exits). --- .vimrc | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.vimrc b/.vimrc index 19a9916..39b3945 100644 --- a/.vimrc +++ b/.vimrc @@ -209,11 +209,28 @@ if has("autocmd") filetype plugin indent on endif +" Mac-specific stuffs +if has('macunix') + " Hacks for MacPorts Bash to actually work. + function! Terminal() + execute 'ter bash --rcfile /etc/bashrc -i' + endfunction + function! VertTerminal() + execute 'vert ter bash --rcfile /etc/bashrc -i' + endfunction +else + function! Terminal() + execute 'ter' + endfunction + function! VertTerminal() + execute 'vert ter' + endfunction +endif " Super special mappings -" map :w!:!perl % -" map :w!:!python % -" map :w!:!bash % -map :!git blame % +map :call Terminal() +map :call VertTerminal() +map :!git grep -n '' $(git rev-parse --show-toplevel) +map :!git blame % map :w!:!xelatex % map :w!:!md-previewer % map :mksession!