mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-24 02:34:52 +00:00
speed up fish start with individual function files
This commit is contained in:
parent
1c79530fb1
commit
ec64f2a0f4
@ -8,6 +8,8 @@ if status --is-interactive
|
||||
set PATH $PATH /usr/local/bin ~/.local/bin $DOTS/bin ~/.cargo/bin
|
||||
set CDPATH . $HOME
|
||||
set EDITOR nvim
|
||||
set PROJ $HOME/dev/work
|
||||
set NOTES_PATH $HOME/notes
|
||||
|
||||
# Use `vi` in the shell with cursor shapes
|
||||
fish_vi_key_bindings
|
||||
@ -33,11 +35,6 @@ if status --is-interactive
|
||||
|
||||
# Individual features
|
||||
aliases
|
||||
notes
|
||||
awstools
|
||||
mactools
|
||||
gittools
|
||||
projects
|
||||
|
||||
# Fuzzy finder
|
||||
fzf_key_bindings
|
||||
|
@ -8,6 +8,8 @@ function aliases --description 'All aliases'
|
||||
abbr -a lh 'ls -lh' # Pretty vertical list
|
||||
abbr -a ll 'ls -alhF' # Include hidden files
|
||||
abbr -a c 'cd'
|
||||
abbr -a .. 'cd ..'
|
||||
alias proj='cd $PROJ'
|
||||
|
||||
# Tmux
|
||||
abbr -a ta 'tmux attach-session'
|
||||
@ -36,6 +38,7 @@ function aliases --description 'All aliases'
|
||||
abbr -a gbD 'git branch -D'
|
||||
abbr -a gr 'git reset'
|
||||
abbr -a grh 'git reset --hard'
|
||||
abbr -a grm 'git reset --mixed'
|
||||
abbr -a gm 'git merge'
|
||||
abbr -a gmf 'git-merge-fuzzy'
|
||||
abbr -a gcp 'git cherry-pick'
|
||||
@ -48,6 +51,10 @@ function aliases --description 'All aliases'
|
||||
abbr -a vimrc 'vim $HOME/.config/nvim/init.vim' # Edit ".vimrc" file
|
||||
end
|
||||
|
||||
# Notes
|
||||
abbr -a qn 'quicknote'
|
||||
abbr -a sn 'syncnotes'
|
||||
|
||||
# Improved CLI Tools
|
||||
alias ping='prettyping --nolegend'
|
||||
abbr -a cat 'bat' # Swap cat with bat
|
||||
@ -121,7 +128,10 @@ function aliases --description 'All aliases'
|
||||
# Rust
|
||||
abbr -a ca 'cargo'
|
||||
|
||||
# Non-MacOS
|
||||
# macOS
|
||||
abbr -a casks 'vim $DOTS/homebrew/Caskfile'
|
||||
|
||||
# Non-macOS
|
||||
if [ (uname) = "Linux" ]
|
||||
alias pbcopy='xclip -selection clipboard -in'
|
||||
alias pbpaste='xclip -selection clipboard -out'
|
||||
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/local/fish
|
||||
|
||||
function awstools --description "AWS bindings"
|
||||
function unsetaws --description "Clear AWS credentials environment variables"
|
||||
set -e AWS_ACCESS_KEY_ID
|
||||
set -e AWS_SECRET_ACCESS_KEY
|
||||
end
|
||||
end
|
9
fish.configlink/functions/brewinfo.fish
Normal file
9
fish.configlink/functions/brewinfo.fish
Normal file
@ -0,0 +1,9 @@
|
||||
function brewinfo --description "Lookup brew plugins"
|
||||
set -l inst (brew search | eval "fzf $FZF_DEFAULT_OPTS -m --header='[brew:info]'")
|
||||
|
||||
if not test (count $inst) = 0
|
||||
for prog in $inst
|
||||
brew info "$prog"
|
||||
end
|
||||
end
|
||||
end
|
10
fish.configlink/functions/brews.fish
Normal file
10
fish.configlink/functions/brews.fish
Normal file
@ -0,0 +1,10 @@
|
||||
function brews --description "Open Homebrew bundles file"
|
||||
set -lx brewdir $DOTS/homebrew
|
||||
set -l brewfile (basename $brewdir/*.Brewfile \
|
||||
| fzf \
|
||||
--height 70% \
|
||||
--preview-window right:70% \
|
||||
--preview 'bat --color=always $brewdir/{}' \
|
||||
)
|
||||
and vim $brewdir/$brewfile
|
||||
end
|
9
fish.configlink/functions/brewsearch.fish
Normal file
9
fish.configlink/functions/brewsearch.fish
Normal file
@ -0,0 +1,9 @@
|
||||
function brewsearch --description "Install brew plugins"
|
||||
set -l inst (brew search | eval "fzf $FZF_DEFAULT_OPTS -m --header='[brew:install]'")
|
||||
|
||||
if not test (count $inst) = 0
|
||||
for prog in $inst
|
||||
brew install "$prog"
|
||||
end
|
||||
end
|
||||
end
|
3
fish.configlink/functions/copy.fish
Normal file
3
fish.configlink/functions/copy.fish
Normal file
@ -0,0 +1,3 @@
|
||||
function copy --description 'Copy file contents into clipboard'
|
||||
cat $argv | pbcopy
|
||||
end
|
9
fish.configlink/functions/fuck.fish
Normal file
9
fish.configlink/functions/fuck.fish
Normal file
@ -0,0 +1,9 @@
|
||||
function fuck -d "Correct your previous console command"
|
||||
set -l fucked_up_command $history[1]
|
||||
env TF_SHELL=fish TF_ALIAS=fuck PYTHONIOENCODING=utf-8 thefuck $fucked_up_command THEFUCK_ARGUMENT_PLACEHOLDER $argv | read -l unfucked_command
|
||||
if [ "$unfucked_command" != "" ]
|
||||
eval $unfucked_command
|
||||
builtin history delete --exact --case-sensitive -- $fucked_up_command
|
||||
builtin history merge ^ /dev/null
|
||||
end
|
||||
end
|
15
fish.configlink/functions/git-add-fuzzy.fish
Normal file
15
fish.configlink/functions/git-add-fuzzy.fish
Normal file
@ -0,0 +1,15 @@
|
||||
function git-add-fuzzy
|
||||
set gitfile (git status -s \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
-m \
|
||||
--preview-window right:70% \
|
||||
--preview 'set -l IFS; set gd (git diff --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2)); if test "$gd"; echo "$gd"; else; bat --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2); end')
|
||||
and for gf in $gitfile
|
||||
set gf (echo $gf \
|
||||
| awk '{$1=$1};1' \
|
||||
| cut -d' ' -f2 \
|
||||
)
|
||||
and git add $gf
|
||||
end
|
||||
end
|
4
fish.configlink/functions/git-checkout-fuzzy.fish
Normal file
4
fish.configlink/functions/git-checkout-fuzzy.fish
Normal file
@ -0,0 +1,4 @@
|
||||
function git-checkout-fuzzy
|
||||
set branch (git-fuzzy-branch "checkout branch...")
|
||||
and git checkout $branch
|
||||
end
|
10
fish.configlink/functions/git-commits.fish
Normal file
10
fish.configlink/functions/git-commits.fish
Normal file
@ -0,0 +1,10 @@
|
||||
function git-commits
|
||||
set commitline (git log \
|
||||
--pretty="format:%C(auto)%ar %h%d %s" \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
--preview 'git show --color=always (echo {} | cut -d" " -f4)' \
|
||||
)
|
||||
and set commit (echo $commitline | cut -d" " -f4)
|
||||
and echo $commit
|
||||
end
|
4
fish.configlink/functions/git-delete-fuzzy.fish
Normal file
4
fish.configlink/functions/git-delete-fuzzy.fish
Normal file
@ -0,0 +1,4 @@
|
||||
function git-delete-fuzzy
|
||||
set branch (git-fuzzy-branch "delete branch...")
|
||||
and git branch -d $branch
|
||||
end
|
4
fish.configlink/functions/git-force-delete-fuzzy.fish
Normal file
4
fish.configlink/functions/git-force-delete-fuzzy.fish
Normal file
@ -0,0 +1,4 @@
|
||||
function git-force-delete-fuzzy
|
||||
set branch (git-fuzzy-branch "force delete branch...")
|
||||
and git branch -D $branch
|
||||
end
|
12
fish.configlink/functions/git-fuzzy-branch.fish
Normal file
12
fish.configlink/functions/git-fuzzy-branch.fish
Normal file
@ -0,0 +1,12 @@
|
||||
function git-fuzzy-branch -a header
|
||||
set -l current (git rev-parse --abbrev-ref HEAD | tr -d '\n')
|
||||
set -l branch (git branch \
|
||||
--format "%(refname:short)" \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
--header="On $current, $header" \
|
||||
--preview-window right:70% \
|
||||
--preview 'git log {} --color=always --pretty="format:%C(auto)%ar %h%d %s"' \
|
||||
)
|
||||
and echo $branch
|
||||
end
|
4
fish.configlink/functions/git-merge-fuzzy.fish
Normal file
4
fish.configlink/functions/git-merge-fuzzy.fish
Normal file
@ -0,0 +1,4 @@
|
||||
function git-merge-fuzzy
|
||||
set branch (git-fuzzy-branch "merge from...")
|
||||
and git merge $branch
|
||||
end
|
4
fish.configlink/functions/git-show-fuzzy.fish
Normal file
4
fish.configlink/functions/git-show-fuzzy.fish
Normal file
@ -0,0 +1,4 @@
|
||||
function git-show-fuzzy
|
||||
set commit (git log --pretty=oneline | fzf | cut -d' ' -f1)
|
||||
and git show $commit
|
||||
end
|
39
fish.configlink/functions/git.fish
Normal file
39
fish.configlink/functions/git.fish
Normal file
@ -0,0 +1,39 @@
|
||||
function git
|
||||
if contains f $argv
|
||||
switch $argv[1]
|
||||
case "checkout"
|
||||
git-checkout-fuzzy
|
||||
case "add"
|
||||
git-add-fuzzy
|
||||
case "show"
|
||||
git-show-fuzzy
|
||||
case "merge"
|
||||
git-merge-fuzzy
|
||||
case "branch"
|
||||
if test "$argv[2]" = "-d"
|
||||
git-delete-fuzzy
|
||||
else if test "$argv[2]" = "-D"
|
||||
git-force-delete-fuzzy
|
||||
else
|
||||
echo "Not a fuzzy option."
|
||||
return 1
|
||||
end
|
||||
case "reset"
|
||||
set commit (git-commits)
|
||||
and if test "$argv[2]" = "--hard"
|
||||
git reset --hard $commit
|
||||
else
|
||||
git reset $commit
|
||||
end
|
||||
case "*"
|
||||
echo "No fuzzy option."
|
||||
return 1
|
||||
end
|
||||
else
|
||||
if count $argv > /dev/null
|
||||
command git $argv
|
||||
else
|
||||
command git status -sb
|
||||
end
|
||||
end
|
||||
end
|
@ -1,110 +0,0 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function gittools
|
||||
|
||||
function git-fuzzy-branch -a header
|
||||
set -l current (git rev-parse --abbrev-ref HEAD | tr -d '\n')
|
||||
set -l branch (git branch \
|
||||
--format "%(refname:short)" \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
--header="On $current, $header" \
|
||||
--preview-window right:70% \
|
||||
--preview 'git log {} --color=always --pretty="format:%C(auto)%ar %h%d %s"' \
|
||||
)
|
||||
and echo $branch
|
||||
end
|
||||
|
||||
function git-commits
|
||||
set commitline (git log \
|
||||
--pretty="format:%C(auto)%ar %h%d %s" \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
--preview 'git show --color=always (echo {} | cut -d" " -f4)' \
|
||||
)
|
||||
and set commit (echo $commitline | cut -d" " -f4)
|
||||
and echo $commit
|
||||
end
|
||||
|
||||
function git-checkout-fuzzy
|
||||
set branch (git-fuzzy-branch "checkout branch...")
|
||||
and git checkout $branch
|
||||
end
|
||||
|
||||
function git-show-fuzzy
|
||||
set commit (git log --pretty=oneline | fzf | cut -d' ' -f1)
|
||||
and git show $commit
|
||||
end
|
||||
|
||||
function git-add-fuzzy
|
||||
set gitfile (git status -s \
|
||||
| fzf \
|
||||
--height 50% \
|
||||
-m \
|
||||
--preview-window right:70% \
|
||||
--preview 'set -l IFS; set gd (git diff --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2)); if test "$gd"; echo "$gd"; else; bat --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2); end')
|
||||
and for gf in $gitfile
|
||||
set gf (echo $gf \
|
||||
| awk '{$1=$1};1' \
|
||||
| cut -d' ' -f2 \
|
||||
)
|
||||
and git add $gf
|
||||
end
|
||||
end
|
||||
|
||||
function git-merge-fuzzy
|
||||
set branch (git-fuzzy-branch "merge from...")
|
||||
and git merge $branch
|
||||
end
|
||||
|
||||
function git-delete-fuzzy
|
||||
set branch (git-fuzzy-branch "delete branch...")
|
||||
and git branch -d $branch
|
||||
end
|
||||
|
||||
function git-force-delete-fuzzy
|
||||
set branch (git-fuzzy-branch "force delete branch...")
|
||||
and git branch -D $branch
|
||||
end
|
||||
|
||||
function git
|
||||
if contains f $argv
|
||||
switch $argv[1]
|
||||
case "checkout"
|
||||
git-checkout-fuzzy
|
||||
case "add"
|
||||
git-add-fuzzy
|
||||
case "show"
|
||||
git-show-fuzzy
|
||||
case "merge"
|
||||
git-merge-fuzzy
|
||||
case "branch"
|
||||
if test "$argv[2]" = "-d"
|
||||
git-delete-fuzzy
|
||||
else if test "$argv[2]" = "-D"
|
||||
git-force-delete-fuzzy
|
||||
else
|
||||
echo "Not a fuzzy option."
|
||||
return 1
|
||||
end
|
||||
case "reset"
|
||||
set commit (git-commits)
|
||||
and if test "$argv[2]" = "--hard"
|
||||
git reset --hard $commit
|
||||
else
|
||||
git reset $commit
|
||||
end
|
||||
case "*"
|
||||
echo "No fuzzy option."
|
||||
return 1
|
||||
end
|
||||
else
|
||||
if count $argv > /dev/null
|
||||
command git $argv
|
||||
else
|
||||
command git status -sb
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
10
fish.configlink/functions/journal.fish
Normal file
10
fish.configlink/functions/journal.fish
Normal file
@ -0,0 +1,10 @@
|
||||
function journal --description "Create today's journal"
|
||||
note-dates
|
||||
if [ -f $TODAY_NOTE_FILE ]
|
||||
echo "Already exists."
|
||||
else
|
||||
note-header
|
||||
printf $JOURNAL_HEADER > $TODAY_NOTE_FILE
|
||||
echo "New journal added."
|
||||
end
|
||||
end
|
@ -1,42 +0,0 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function mactools
|
||||
|
||||
function copy --description 'Copy file contents into clipboard'
|
||||
cat $argv | pbcopy
|
||||
end
|
||||
|
||||
abbr -a casks 'vim $DOTS/homebrew/Caskfile'
|
||||
|
||||
function brews --description "Open Homebrew bundles file"
|
||||
set -lx brewdir $DOTS/homebrew
|
||||
set -l brewfile (basename $brewdir/*.Brewfile \
|
||||
| fzf \
|
||||
--height 70% \
|
||||
--preview-window right:70% \
|
||||
--preview 'bat --color=always $brewdir/{}' \
|
||||
)
|
||||
and vim $brewdir/$brewfile
|
||||
end
|
||||
|
||||
function brewinfo --description "Lookup brew plugins"
|
||||
set -l inst (brew search | eval "fzf $FZF_DEFAULT_OPTS -m --header='[brew:info]'")
|
||||
|
||||
if not test (count $inst) = 0
|
||||
for prog in $inst
|
||||
brew info "$prog"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function brewsearch --description "Install brew plugins"
|
||||
set -l inst (brew search | eval "fzf $FZF_DEFAULT_OPTS -m --header='[brew:install]'")
|
||||
|
||||
if not test (count $inst) = 0
|
||||
for prog in $inst
|
||||
brew install "$prog"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
10
fish.configlink/functions/meeting.fish
Normal file
10
fish.configlink/functions/meeting.fish
Normal file
@ -0,0 +1,10 @@
|
||||
function meeting --description "Describe a meeting" -a "name"
|
||||
note-dates
|
||||
set today_date (date -j +"%Y-%m-%d")
|
||||
set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]')
|
||||
set meeting_name (echo $name | tr ' ' '-' | tr '[:upper:]' '[:lower:]')
|
||||
set meeting_note $today_date-$meeting_name
|
||||
printf "[$TODAY_NOTE](journal/$TODAY_NOTE.md) | #meeting\n\n# $name\n\n---\n\n" > $NOTES_PATH/$meeting_note.md
|
||||
printf "\n\n---\n\n$time - [$name](../$meeting_note.md)\n\n---\n\n" >> $TODAY_NOTE_FILE
|
||||
open "obsidian://open?vault=notes&file=$meeting_note"
|
||||
end
|
7
fish.configlink/functions/note-dates.fish
Normal file
7
fish.configlink/functions/note-dates.fish
Normal file
@ -0,0 +1,7 @@
|
||||
function note-dates
|
||||
set -g TODAY_NOTE (date +"%Y-%m-%d_%a")
|
||||
set -g YESTERDAY_NOTE (date -jv "-1d" +"%Y-%m-%d_%a")
|
||||
set -g TOMORROW_NOTE (date -jv "+1d" +"%Y-%m-%d_%a")
|
||||
set -g LONG_DATE (date +"%A, %B %e, %Y" | sed 's/ */ /g')
|
||||
set -g TODAY_NOTE_FILE $NOTES_PATH/journal/$TODAY_NOTE.md
|
||||
end
|
4
fish.configlink/functions/note-header.fish
Normal file
4
fish.configlink/functions/note-header.fish
Normal file
@ -0,0 +1,4 @@
|
||||
function note-header
|
||||
set -g CURRENT_WEATHER (curl -s "https://wttr.in/?format=1")
|
||||
set -g JOURNAL_HEADER "[Yesterday]($YESTERDAY_NOTE.md) | [Home](home.md) | [Tomorrow]($TOMORROW_NOTE.md)\n\n$LONG_DATE\n$CURRENT_WEATHER\n#journal\n\n---\n\n# Today's Goals\n\n\n# Journal\n\n"
|
||||
end
|
10
fish.configlink/functions/note.fish
Normal file
10
fish.configlink/functions/note.fish
Normal file
@ -0,0 +1,10 @@
|
||||
function note --description "Edit or create a note" -a "filename"
|
||||
if test -n "$filename"
|
||||
vim $NOTES_PATH/$filename.md
|
||||
else
|
||||
set file (ls $NOTES_PATH | fzf)
|
||||
if [ $status -eq 0 ]
|
||||
vim $NOTES_PATH/$file
|
||||
end
|
||||
end
|
||||
end
|
@ -1,83 +1,5 @@
|
||||
#!/usr/local/bin/fish
|
||||
|
||||
function notes --description "Notes functions"
|
||||
|
||||
set -gx NOTES_PATH $HOME/notes
|
||||
|
||||
function note_dates
|
||||
set -g TODAY_NOTE (date +"%Y-%m-%d_%a")
|
||||
set -g YESTERDAY_NOTE (date -jv "-1d" +"%Y-%m-%d_%a")
|
||||
set -g TOMORROW_NOTE (date -jv "+1d" +"%Y-%m-%d_%a")
|
||||
set -g LONG_DATE (date +"%A, %B %e, %Y" | sed 's/ */ /g')
|
||||
set -g TODAY_NOTE_FILE $NOTES_PATH/journal/$TODAY_NOTE.md
|
||||
end
|
||||
|
||||
function note_header
|
||||
set -g CURRENT_WEATHER (curl -s "https://wttr.in/?format=1")
|
||||
set -g JOURNAL_HEADER "[Yesterday]($YESTERDAY_NOTE.md) | [Home](home.md) | [Tomorrow]($TOMORROW_NOTE.md)\n\n$LONG_DATE\n$CURRENT_WEATHER\n#journal\n\n---\n\n# Today's Goals\n\n\n# Journal\n\n"
|
||||
end
|
||||
|
||||
function journal --description "Create today's journal"
|
||||
note_dates
|
||||
if [ -f $TODAY_NOTE_FILE ]
|
||||
echo "Already exists."
|
||||
else
|
||||
note_header
|
||||
printf $JOURNAL_HEADER > $TODAY_NOTE_FILE
|
||||
echo "New journal added."
|
||||
end
|
||||
end
|
||||
|
||||
function today --description "Open today's journal"
|
||||
note_dates
|
||||
if [ -f $TODAY_NOTE_FILE ]
|
||||
vim $TODAY_NOTE_FILE
|
||||
else
|
||||
note_header
|
||||
printf $JOURNAL_HEADER > $TODAY_NOTE_FILE
|
||||
echo "New journal added."
|
||||
vim $TODAY_NOTE_FILE
|
||||
end
|
||||
end
|
||||
|
||||
function meeting --description "Describe a meeting" -a "name"
|
||||
note_dates
|
||||
set today_date (date -j +"%Y-%m-%d")
|
||||
set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]')
|
||||
set meeting_name (echo $name | tr ' ' '-' | tr '[:upper:]' '[:lower:]')
|
||||
set meeting_note $today_date-$meeting_name
|
||||
printf "[$TODAY_NOTE](journal/$TODAY_NOTE.md) | #meeting\n\n# $name\n\n---\n\n" > $NOTES_PATH/$meeting_note.md
|
||||
printf "\n\n---\n\n$time - [$name](../$meeting_note.md)\n\n---\n\n" >> $TODAY_NOTE_FILE
|
||||
open "obsidian://open?vault=notes&file=$meeting_note"
|
||||
end
|
||||
|
||||
function note --description "Edit or create a note" -a "filename"
|
||||
if test -n "$filename"
|
||||
vim $NOTES_PATH/$filename.md
|
||||
else
|
||||
set file (ls $NOTES_PATH | fzf)
|
||||
if [ $status -eq 0 ]
|
||||
vim $NOTES_PATH/$file
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
abbr -a qn 'quicknote'
|
||||
function quicknote --description "Write a quick note" -a "note"
|
||||
note_dates
|
||||
set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]')
|
||||
printf "\n\n---\n\n#### $time\n$note\n" >> $TODAY_NOTE_FILE
|
||||
end
|
||||
|
||||
abbr -a sn 'syncnotes'
|
||||
function syncnotes --description "Full git commit on notes"
|
||||
set current_dir $PWD
|
||||
cd $NOTES_PATH
|
||||
git pull
|
||||
git add -A
|
||||
git commit -m "autosync"
|
||||
git push
|
||||
cd $current_dir
|
||||
end
|
||||
|
||||
end
|
||||
|
4
fish.configlink/functions/prj.fish
Normal file
4
fish.configlink/functions/prj.fish
Normal file
@ -0,0 +1,4 @@
|
||||
function prj --description "cd to a project"
|
||||
set projdir (ls $PROJ | fzf)
|
||||
and cd $PROJ/$projdir
|
||||
end
|
@ -1,13 +0,0 @@
|
||||
#!/usr/bin/local/fish
|
||||
|
||||
function projects --description "Projects tools"
|
||||
|
||||
set PROJ $HOME/dev/work
|
||||
alias proj='cd $PROJ'
|
||||
|
||||
function prj --description "cd to a project"
|
||||
set projdir (ls $PROJ | fzf)
|
||||
and cd $PROJ/$projdir
|
||||
end
|
||||
|
||||
end
|
5
fish.configlink/functions/quicknote.fish
Normal file
5
fish.configlink/functions/quicknote.fish
Normal file
@ -0,0 +1,5 @@
|
||||
function quicknote --description "Write a quick note" -a "note"
|
||||
note-dates
|
||||
set time (date +"%I:%M%p" | tr '[:upper:]' '[:lower:]')
|
||||
printf "\n\n---\n\n#### $time\n$note\n" >> $TODAY_NOTE_FILE
|
||||
end
|
9
fish.configlink/functions/syncnotes.fish
Normal file
9
fish.configlink/functions/syncnotes.fish
Normal file
@ -0,0 +1,9 @@
|
||||
function syncnotes --description "Full git commit on notes"
|
||||
set current_dir $PWD
|
||||
cd $NOTES_PATH
|
||||
git pull
|
||||
git add -A
|
||||
git commit -m "autosync"
|
||||
git push
|
||||
cd $current_dir
|
||||
end
|
11
fish.configlink/functions/today.fish
Normal file
11
fish.configlink/functions/today.fish
Normal file
@ -0,0 +1,11 @@
|
||||
function today --description "Open today's journal"
|
||||
note-dates
|
||||
if [ -f $TODAY_NOTE_FILE ]
|
||||
vim $TODAY_NOTE_FILE
|
||||
else
|
||||
note-header
|
||||
printf $JOURNAL_HEADER > $TODAY_NOTE_FILE
|
||||
echo "New journal added."
|
||||
vim $TODAY_NOTE_FILE
|
||||
end
|
||||
end
|
6
fish.configlink/functions/unsetaws.fish
Normal file
6
fish.configlink/functions/unsetaws.fish
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/local/fish
|
||||
|
||||
function unsetaws --description "Clear AWS credentials environment variables"
|
||||
set -e AWS_ACCESS_KEY_ID
|
||||
set -e AWS_SECRET_ACCESS_KEY
|
||||
end
|
Loading…
Reference in New Issue
Block a user