From 4a7a665edb0e355a19b8cee6e921f4cf28057a8f Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 22 Sep 2021 13:06:17 +0200 Subject: [PATCH] zsh: use nvim instead of vim when available --- zsh/aliases.zsh | 5 +++++ zsh/exports.zsh | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 1ba6b2b..c4df82d 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -45,6 +45,11 @@ alias grep='grep --binary-files=without-match -H -n --color=always' alias less='less -r' alias cp='cp -i' alias mv='mv -i' +# use nvim instead of vim when available +if type nvim >/dev/null 2>&1; then +alias vi='vim' +alias vim='nvim' +fi alias automake='{ while true; do inotifywait -r -e modify . && make; done; } &' # ===== sp aliases diff --git a/zsh/exports.zsh b/zsh/exports.zsh index cc36a5f..0de31ae 100644 --- a/zsh/exports.zsh +++ b/zsh/exports.zsh @@ -1,4 +1,6 @@ # set EDITOR variable -if type vim >/dev/null 2>&1; then +if type nvim >/dev/null 2>&1; then + export EDITOR="nvim" +elif type vim >/dev/null 2>&1; then export EDITOR="vim" fi