Skip to content

Instantly share code, notes, and snippets.

@celadevra
Last active January 21, 2022 01:08
Show Gist options
  • Select an option

  • Save celadevra/641f179e7519c3dc2546fa4104e165ad to your computer and use it in GitHub Desktop.

Select an option

Save celadevra/641f179e7519c3dc2546fa4104e165ad to your computer and use it in GitHub Desktop.
Fish shell customizations
function fish_prompt -d "Write out the prompt"
set -g last_status $status
printf '[%s@%s %s%s%s]\n(%s%s/%s%s) %s%s%s > ' $USER $hostname \
(set_color cyan) (prompt_date) (set_color normal) \
(set_color yellow) $SHLVL (prompt_status) (set_color normal) \
(set_color $fish_color_cwd) $PWD (set_color normal)
end
function prompt_date -d "Show date and time in prompt"
date "+%Y.%m.%d %H:%M"
end
function prompt_status -d "Show exit status"
set -l red (set_color -o red)
set -l green (set_color -o green)
if test $last_status = 0
echo "$greenโ—†"
else
echo $red$last_status
end
end
function na;
task log +memo $argv;
end
function nl;
task +memo comp end:today;
end
function nls; # note list and search
task +memo comp $argv;
end
function ns; # note show
task $argv;
end
function nid; # get note uuids
task +memo uuids $argv;
end
function nlk -a src dst; # link notes
task $src annotate "๐Ÿ‘‰ $dst" && task $dst annotate "๐Ÿ‘ˆ $src";
end
function nfu -a src; # follow up notes
set -l new_note $argv[2..-1];
task log +memo $new_note;
set -l last_id (task +memo entry:today all 2>/dev/null | grep -E '(^[0-9]{1,2} | - )[A-Z]' | awk '{print $3}' | head -n1)
echo "Modifying $src and $last_id"
task $src annotate "๐Ÿ‘‰ $last_id" && task $last_id annotate "๐Ÿ‘ˆ $src";
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment