-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.fex.fish
28 lines (22 loc) · 814 Bytes
/
.fex.fish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Sets up a fish widget to invoke fex on shortcut
function fex-widget -d "Invokes fex and executes commands from it"
# setting variable for fex
set -g FEX_COMMAND fex
# execute and capture output of $FEX_COMMAND in exec_cmd
set exec_cmd (eval $FEX_COMMAND)
if test -z "$exec_cmd"
commandline -f repaint
return
else
commandline -f repaint
# if the $exec_Cmd printed, it prints both the parts (command) and (argument/flag) on new line. So. So, it needs to be joint. `
set joint_cmd (string join " " $exec_cmd)
commandline $joint_cmd
commandline -f execute
end
# cleaning after execution
commandline -f repaint
end
# Ref's
# What is eval ? - https://fishshell.com/docs/current/cmds/eval.html
# https://github.com/junegunn/fzf/blob/master/shell/key-bindings.fish