15 lines
341 B
Fish
Executable File
15 lines
341 B
Fish
Executable File
function try_subst
|
|
# Use s/word/replacement<tab> to replace word with replacement
|
|
# in last command
|
|
commandline | read -l saved_commandline
|
|
|
|
set -l pattern '^s/..*/.*$'
|
|
|
|
if commandline -t | grep -E -q "$pattern"
|
|
commandline -tr (echo -n "$history[1]" | sed -e (commandline -t)/g)
|
|
else
|
|
commandline -f complete
|
|
end
|
|
end
|
|
|