From e0162f261307a231ab9ef2cf735c0e27d8a3597a Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Fri, 22 Mar 2024 16:29:50 -0400 Subject: [PATCH] Add nnn config --- bash/.bashrc | 3 +++ nnn/.local/bin/vim-wrapper | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100755 nnn/.local/bin/vim-wrapper diff --git a/bash/.bashrc b/bash/.bashrc index 8e1ebcb..21baabc 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -16,6 +16,9 @@ export MACHINE_START_SWAY=false # Whether to start Sway from bash alias ssh="TERM=xterm-256color ssh" +# NNN configuration +alias nnn="VISUAL=$HOME/.local/bin/vim-wrapper nnn -e" + # SSH without checking or adding host keys to known_hosts # Useful for cloud server rescue environment & installation alias sshtmp="ssh -o 'UserKnownHostsFile /dev/null' -o 'StrictHostKeyChecking no'" diff --git a/nnn/.local/bin/vim-wrapper b/nnn/.local/bin/vim-wrapper new file mode 100755 index 0000000..3ac7977 --- /dev/null +++ b/nnn/.local/bin/vim-wrapper @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +if [ "$TERM_PROGRAM" != "WezTerm" ]; then + exec vim "$@" +fi + +pane_id=$(wezterm cli get-pane-direction Right) + +if [ -z "$pane_id" ]; then + exec wezterm cli split-pane --right --percent 70 -- vim "$@" +else + exec wezterm cli spawn -- vim "$@" +fi