Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213set this_shell_should_notify 1
# promptfunction get_hostname if test (uname) = Linux || test (uname) = Darwin has_command hostname && hostname | cut -d. -f1 || cat /etc/hostname else # assume bsd hostname | head -n 1 | cut -d. -f1 endend
function fish_greeting _prompt_prefix printf "%s\n" (date)
# warn about broken dotfile symlinks if test -L "$XDG_CONFIG_HOME/atuin/config.toml" && not test -e "$XDG_CONFIG_HOME/atuin/config.toml" set_color yellow echo "warning: broken config symlink: atuin/config.toml" echo " dotfile symlinks are broken — check lyte.flakePath or lyte.dotfilesInStore" set_color normal endend
function preprocess_pwd test (pwd) = / && echo / && return 1 test (pwd) = $NICE_HOME && echo "~" && return 0 pwd \ | cut -c2- \ | gawk '{n=split($0,p,"/");for(i=1;i<=n;i++){if(i==n){printf "/%s",p[i]}else{printf "/%.3s",p[i]}}}'end
function _maybe_elevated_access_prefix if set -q SUDO_USER set_color -b yellow black printf " SUDO " set_color -b normal normal printf " " else if test $USER = root set_color -b red black printf " ROOT " set_color -b normal normal printf " " endend
function _maybe_aws_profile if set -q AWS_PROFILE && test $AWS_PROFILE = prd printf " " set_color -b yellow black printf " AWS_PROFILE=prd " set_color -b normal normal endend
function _user_and_host if test $argv[1] -eq 0 set_color -b normal blue else set_color -b normal red end printf "%s@%s" $USER (get_hostname)end
function _cur_work_dir set_color -b normal magenta printf " %s" (preprocess_pwd)end
function _last_cmd_duration set_color -b normal green set -q CMD_DURATION && printf " %dms" $CMD_DURATION if test $CMD_DURATION -gt 5000 && test $this_shell_should_notify = 1 printf "\e]777;notify;%s;%s\e\\" "Terminal Command Finished" (history --max 1) set this_shell_should_notify 0 endend
function _maybe_jobs_summary if jobs -q set_color -b normal cyan printf " &%d" (jobs -p | wc -l) endend
function _user_prompt printf "\n" set_color brblack if test (id -u) -eq 0 printf '# ' else printf '$ ' end set_color -b normal normalend
function _maybe_vcs_summary _maybe_jujutsu_summary || _maybe_git_summaryend
function _maybe_jujutsu_summary set jujutsu_text (jj log --limit 1 --revisions @ --no-graph --no-pager --color=never --template 'if(self.local_bookmarks().len() < 1, "", self.local_bookmarks().map(|n| n.name()).join(",") ++ ">") ++ self.change_id().shortest() ++ ":" ++ self.commit_id().shortest() ++ "(+" ++ self.diff().stat().total_added() ++ ",-" ++ self.diff().stat().total_removed() ++ ")"' 2>/dev/null) if test $status -ne 0 return 1 end set_color -b normal yellow printf " %s" $jujutsu_textend
function _maybe_git_summary set cur_sha (command git rev-parse --short HEAD 2>/dev/null) if test $status -ne 0 return 1 end set_color -b normal yellow set num_changes (command git status --porcelain | wc -l | string trim) if test $num_changes = 0 set num_changes "✔" else set num_changes "+$num_changes" end printf " %s %s %s" (command git branch --show-current) $cur_sha $num_changesend
function _prompt_marker # printf "%b133;A%b" "\x1b\x5d" "\x1b\x5c"end
function _prompt_continuation_marker # printf "%b133;A;k=s%b" "\x1b\x5d" "\x1b\x5c"end
function cmd_marker --on-variable _ # printf "%b133;C%b" "\x1b\x5d" "\x1b\x5c"end
function _prompt_prefix set_color -b normal brblack printf "# "end
function preexec --on-event fish_preexec set this_shell_should_notify 1end
function fish_prompt set last_cmd_status $status _prompt_marker _prompt_prefix _maybe_elevated_access_prefix _user_and_host $last_cmd_status _cur_work_dir _maybe_vcs_summary _maybe_aws_profile _last_cmd_duration _maybe_jobs_summary _user_promptend
function fish_mode_promptendfunction fish_right_promptend
# key bindingsfish_vi_key_bindings
set --universal fish_cursor_default blockset --universal fish_cursor_insert lineset --universal fish_cursor_block blockfish_vi_cursorset --universal fish_vi_force_cursor 1
bind --mode insert --sets-mode default jk repaintbind --mode insert --sets-mode default jK repaintbind --mode insert --sets-mode default Jk repaintbind --mode insert --sets-mode default JK repaint# bind --mode insert --sets-mode default jj repaint# bind --mode insert --sets-mode default jJ repaint# bind --mode insert --sets-mode default Jj repaint# bind --mode insert --sets-mode default JJ repaint
if has_command skim bind -M insert \cg skim-cd-widgetend
if has_command fzf bind -M insert \cg fzf-cd-widgetend
bind -M insert \cp up-or-searchbind -M insert \cn down-or-searchbind -M insert \ce end-of-linebind -M insert \ca beginning-of-line
bind -M insert \cv edit_command_bufferbind -M default \cv edit_command_buffer
test $PWD = $HOME && begin cd $NICE_HOME || cdend
# tmux has issues when pasting sometimes where it seems to interpret a newline# as C-j and jumps a pane and screws up the previous pane somehow# I think a tput reset can fix it, but it's just annoying and I don't think I# currently make heavy enough use of sessions and detaching and tmux-resurrect for# it to be worth it
# if has_command tmux && ! set -q DO_NOT_AUTOSTART_TMUX && ! set -q TMUX# tmux new-session -D -s "default" &>/dev/null || tmux attach -t "default"# end