summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2021-07-16 01:10:13 +0000
committerbrian m. carlson <sandals@crustytoothpaste.net>2021-07-16 01:10:13 +0000
commitad1ab7ed5f4d12289a4294ea1ad350779458d26c (patch)
treed0449d0cc1207cf92a51b29087256a0e21374885
parentfbd41ca7e3e2a2e5eabb8f5c6fc82ec4b479c961 (diff)
zsh/zshenv: prefer Neovim over Vim
Neovim has support for some additional features, so let's use it in favor of Vim. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
-rw-r--r--spec/zsh_spec.rb12
-rw-r--r--zsh/zshenv8
2 files changed, 13 insertions, 7 deletions
diff --git a/spec/zsh_spec.rb b/spec/zsh_spec.rb
index 0ddd75d..2de7f60 100644
--- a/spec/zsh_spec.rb
+++ b/spec/zsh_spec.rb
@@ -6,20 +6,20 @@ describe :zsh do
end
context 'editor' do
- it 'should set EDITOR to gvim with DISPLAY' do
- expect(@dir.cmd(['zsh', '-c', 'echo $EDITOR'], 'DISPLAY' => 'something')).to eq "gvim -f\n"
+ it 'should set EDITOR to nvim-gtk with DISPLAY' do
+ expect(@dir.cmd(['zsh', '-c', 'echo $EDITOR'], 'DISPLAY' => 'something')).to eq "nvim-gtk --no-fork\n"
end
it 'should set VISUAL to gvim with DISPLAY' do
- expect(@dir.cmd(['zsh', '-c', 'echo $VISUAL'], 'DISPLAY' => 'something')).to eq "gvim -f\n"
+ expect(@dir.cmd(['zsh', '-c', 'echo $VISUAL'], 'DISPLAY' => 'something')).to eq "nvim-gtk --no-fork\n"
end
it 'should set EDITOR to ex with non-empty TERM' do
expect(@dir.cmd(['zsh', '-c', 'echo $EDITOR'], 'TERM' => 'xterm-256color')).to eq "ex\n"
end
- it 'should set VISUAL to vim with non-empty TERM' do
- expect(@dir.cmd(['zsh', '-c', 'echo $VISUAL'], 'TERM' => 'xterm-256color')).to eq "vim\n"
+ it 'should set VISUAL to nvim with non-empty TERM' do
+ expect(@dir.cmd(['zsh', '-c', 'echo $VISUAL'], 'TERM' => 'xterm-256color')).to eq "nvim\n"
end
it 'should set EDITOR to ex with SSH session and terminal multiplexor' do
@@ -33,7 +33,7 @@ describe :zsh do
expect(@dir.cmd(['zsh', '-c', 'source .zshrc; echo $VISUAL'],
'DISPLAY' => 'something',
'SSH_TTY' => 'tty',
- 'TERM' => 'screen-256color')).to eq "vim\n"
+ 'TERM' => 'screen-256color')).to eq "nvim\n"
end
it 'should set EDITOR to ex with TERM=dumb' do
diff --git a/zsh/zshenv b/zsh/zshenv
index 5b4a515..871cbdd 100644
--- a/zsh/zshenv
+++ b/zsh/zshenv
@@ -102,7 +102,10 @@ bmc_editor () {
done
- if [[ -n $DISPLAY ]] && [[ -z $console ]]
+ if [[ -n $DISPLAY ]] && [[ -z $console ]] && which nvim-gtk >/dev/null 2>&1
+ then
+ printf 'nvim-gtk --no-fork'
+ elif [[ -n $DISPLAY ]] && [[ -z $console ]]
then
printf 'gvim -f'
elif [[ -z "${OSTYPE##darwin*}" ]] && [[ -z $console ]]
@@ -111,6 +114,9 @@ bmc_editor () {
elif [[ $TERM = dumb ]] || [[ -n $dumb ]]
then
printf 'ex'
+ elif which nvim >/dev/null 2>&1
+ then
+ printf 'nvim'
elif which vimx >/dev/null 2>&1
then
printf 'vimx'