From 881d4a03400421e6f11140012e9350f13c7de480 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 19 Jan 2026 09:30:45 +0100 Subject: [PATCH] nvim: set EDITOR variable only if installed Since git core.editor was set in the initial commit, I suspect I wasn't aware of $EDITOR in the environment. So it's safe to delete git/gitconfig's core.editor and take it from $EDITOR by default, which actually checks if nvim is installed. for git's diff.tool and merge.tool, I don't see a possibility to have a conditional switch and fallback to vim. I don't expect to work on another workstation without neovim. --- git/gitconfig | 1 - shell/vars.sh | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/git/gitconfig b/git/gitconfig index 0df469a..9f558c0 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -11,7 +11,6 @@ tool = nvim -d conflictstyle = zdiff3 [core] - editor = nvim eol = native pager = delta || (diff-so-fancy | less --tabs=4 -RFX) quotepath = false diff --git a/shell/vars.sh b/shell/vars.sh index 9e82738..49180d9 100755 --- a/shell/vars.sh +++ b/shell/vars.sh @@ -1,5 +1,10 @@ #!/bin/sh -export EDITOR=nvim -export VISUAL=nvim +if [ -n "$(type nvim 2>/dev/null)" ]; then + export EDITOR=nvim + export VISUAL=nvim +else + export EDITOR=vim + export VISUAL=vim +fi export BROWSER=firefox