Skip to content

Instantly share code, notes, and snippets.

@ktunprasert
Last active November 19, 2023 00:46
Show Gist options
  • Save ktunprasert/1e3692c75fa9ebd95d99e1ba5fc05d98 to your computer and use it in GitHub Desktop.
Save ktunprasert/1e3692c75fa9ebd95d99e1ba5fc05d98 to your computer and use it in GitHub Desktop.
Collection of fish functions to make my life easier
# Cheat.sh function
function cheat --description ="Curl commands from cheat.sh with the format 'cheat.sh/[0]/[1]/...'"
# Arguments parsing
# from: > cheat go :learn
# to: go/:learn
set path (echo $argv | sed 's/\s/\//g')
echo $path
# curl (echo cheat.sh/$path) | bat
curl (echo cheat.sh/$path)
end
function exdoc
elixir -e "require IEx.Helpers; IEx.Helpers.h $argv"
end
function git_fd
set -l commandline (__fzf_parse_commandline)
set -l dir $commandline[1]
set -l fzf_query $commandline[2]
set -l COMMAND "fd -HI -d 3 -t directory --absolute-path -g \.git $HOME $HOME/workspace $W/go/src/github.com/ktunprasert -x echo {//}"
begin
eval "$COMMAND | "(__fzfcmd)' +m --query "'$fzf_query'"' | read -l result
if [ -n "$result" ];
cd $result
commandline -t ""
end
end
commandline -f repaint
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment