summaryrefslogtreecommitdiff
path: root/halfway
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2024-03-01 12:24:00 +0900
committerA Farzat <a@farzat.xyz>2024-10-14 15:54:04 +0900
commit7f8103f42a22adf944db616ec13d2abd36ecb0db (patch)
tree2fa709aad4e9c15048bf96c80e3c62c8852c6c1f /halfway
parent42357c10435c0358c38fe1435b0c8ec0a6b99d59 (diff)
downloadzsh-7f8103f42a22adf944db616ec13d2abd36ecb0db.tar.gz
zsh-7f8103f42a22adf944db616ec13d2abd36ecb0db.zip
Add nvim as a fullback to $EDITOR
Diffstat (limited to 'halfway')
-rw-r--r--halfway/aliases.zsh22
-rw-r--r--halfway/functions.zsh6
2 files changed, 14 insertions, 14 deletions
diff --git a/halfway/aliases.zsh b/halfway/aliases.zsh
index 9001753..691a8c5 100644
--- a/halfway/aliases.zsh
+++ b/halfway/aliases.zsh
@@ -1,21 +1,21 @@
# Edit bash history.
-alias mbashhistory='$EDITOR ~/.bash_history'
+alias mbashhistory='${EDITOR:-nvim} ~/.bash_history'
# Edit zsh history.
-alias mhistory='$EDITOR $ZDOTDIR/.zsh_history'
-# Edit and view using $EDITOR.
-alias v='$EDITOR'
-alias edit='$EDITOR'
-alias view='$EDITOR -M'
+alias mhistory='${EDITOR:-nvim} $ZDOTDIR/.zsh_history'
+# Edit and view using ${EDITOR:-nvim}.
+alias v='${EDITOR:-nvim}'
+alias edit='${EDITOR:-nvim}'
+alias view='${EDITOR:-nvim} -M'
# Edit zshrc.
-alias mzshrc='$EDITOR -S "$ZDOTDIR/Session.vim"'
-# Edit $EDITOR configuration files.
-alias mvimrc='$EDITOR -S "$XDG_CONFIG_HOME/nvim/Session.vim"'
+alias mzshrc='${EDITOR:-nvim} -S "$ZDOTDIR/Session.vim"'
+# Edit ${EDITOR:-nvim} configuration files.
+alias mvimrc='${EDITOR:-nvim} -S "$XDG_CONFIG_HOME/nvim/Session.vim"'
# List swap files
alias ls-swap='la "${XDG_STATE_HOME:-$HOME/.local/state}/nvim/swap/"'
# Edit the ledger file.
-alias mledger='$EDITOR -S $XDG_DATA_HOME/ledger/Session.vim'
+alias mledger='${EDITOR:-nvim} -S $XDG_DATA_HOME/ledger/Session.vim'
# Edit all files in git dir.
-alias vgit='git ls-files -z | xargs -0 $EDITOR'
+alias vgit='git ls-files -z | xargs -0 ${EDITOR:-nvim}'
# Suspend the machine.
alias ssuspend='systemctl suspend'
# Restore cursor to original colour and transparent behaviour before wal.
diff --git a/halfway/functions.zsh b/halfway/functions.zsh
index 54c813b..9aae54a 100644
--- a/halfway/functions.zsh
+++ b/halfway/functions.zsh
@@ -28,16 +28,16 @@ pcopy() {
}
vinfo() {
- INFOPATH="$XDG_DATA_HOME/info:$INFOPATH" $EDITOR -R -M -c "Info $@" +only
+ INFOPATH="$XDG_DATA_HOME/info:$INFOPATH" ${EDITOR:-nvim} -R -M -c "Info $@" +only
}
vn3() {
if [ "$#" -gt 0 ]; then
local direc="$(printf %q "$1")"
shift
- $EDITOR -c "NnnExplorer $direc" "$@"
+ ${EDITOR:-nvim} -c "NnnExplorer $direc" "$@"
else
- $EDITOR -c NnnExplorer
+ ${EDITOR:-nvim} -c NnnExplorer
fi
}