From e88f291929c3a8b665a65bbf99a05a74bf0382e5 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 8 Apr 2016 12:45:15 +0900 Subject: [PATCH] Fix vi aliases and EDITOR environments --- profile | 23 ++++++++++++++++------- shrc | 12 +++--------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/profile b/profile index 65cc08f..fd3d0a0 100755 --- a/profile +++ b/profile @@ -68,17 +68,26 @@ do done test -n "$_src_hilite_lp_path" && export LESSOPEN="| $_src_hilite_lp_path %s" -if which vim >/dev/null +if which nvim >/dev/null then - export EDITOR=vim -else - export EDITOR=vi + _VI_ALT=nvim +elif which vim >/dev/null +then + _VI_ALT=vim +elif which vi >/dev/null +then + _VI_ALT=vi fi -# export CDPATH=".:~" -export VISUAL="$EDITOR" +if test -n "$_VI_ALT" +then + export EDITOR="$_VI_ALT" + export GIT_EDITOR="$EDITOR" + export VISUAL="$EDITOR" +fi + +# export CDPATH=".:~" export GIT_PAGER="less -F" -export GIT_EDITOR="$EDITOR" export GIT_MERGE_AUTOEDIT=no if test -n "$TMUX" && \ diff --git a/shrc b/shrc index fe0613c..531f1e6 100755 --- a/shrc +++ b/shrc @@ -275,17 +275,11 @@ _timeformat_rfc2822="%a, %d %b %Y %T %z" _timeformat_num="%Y%m%d%H%M%S" alias datenum="date +$_timeformat_num" -if null type nvim +if test -n "$_VI_ALT" then - export EDITOR=nvim -elif null type vim -then - export EDITOR=vim -elif null type vi -then - export EDITOR=vi + alias vi=$_VI_ALT + export EDITOR=$_VI_ALT fi -test -n "$EDITOR" && alias vi=$EDITOR # export GREP_OPTIONS="" alias gr="grep -n --color=always"