fish: add edit function to use EDITOR dynamically
This commit is contained in:
parent
11be99c4a3
commit
824cac6b25
@ -27,8 +27,7 @@ function __fzf_files
|
|||||||
end
|
end
|
||||||
switch $key
|
switch $key
|
||||||
case ctrl-e
|
case ctrl-e
|
||||||
set -q EDITOR; or set EDITOR vim
|
commandline -r "edit $file"
|
||||||
commandline -r "$EDITOR $file"
|
|
||||||
case '*'
|
case '*'
|
||||||
commandline -i $file
|
commandline -i $file
|
||||||
end
|
end
|
||||||
|
@ -57,7 +57,7 @@ if not set -q __universals_initialized
|
|||||||
|
|
||||||
# Abbreviations
|
# Abbreviations
|
||||||
abbr -a -U d 'docker'
|
abbr -a -U d 'docker'
|
||||||
abbr -a -U e $EDITOR
|
abbr -a -U e 'edit'
|
||||||
abbr -a -U h 'history'
|
abbr -a -U h 'history'
|
||||||
abbr -a -U k 'kubectl'
|
abbr -a -U k 'kubectl'
|
||||||
abbr -a -U l 'less'
|
abbr -a -U l 'less'
|
||||||
|
8
.config/fish/functions/edit.fish
Normal file
8
.config/fish/functions/edit.fish
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
function edit
|
||||||
|
if set -q EDITOR
|
||||||
|
$EDITOR $argv
|
||||||
|
else
|
||||||
|
printf (set_color red)"warning: EDITOR was not set, using vim as fallback\n"(set_color normal)
|
||||||
|
vim $argv
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user