Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Last active November 11, 2019 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttscoff/139255fcdd31e88123385ef75e27cfea to your computer and use it in GitHub Desktop.
Save ttscoff/139255fcdd31e88123385ef75e27cfea to your computer and use it in GitHub Desktop.
Fish functions with commandline tricks
# Defined in /Users/ttscoff/.config/fish/functions/__prev_token.fish @ line 1
function __prev_token -d "repeats last token on the command line"
set -l buffer (commandline -bo)
commandline -a " "$buffer[-1]
commandline -f end-of-line
end
# Defined in /Users/ttscoff/.config/fish/functions/__re_extension.fish @ line 1
function __re_extension --description 'remove extension from word under/before cursor'
commandline -f forward-word
commandline -f backward-word
set -l token (commandline -t)
set token (echo "$token" | sed -E 's/\.[^.]*\.?$/./')
commandline -t ""
commandline -i $token
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment