Skip to content

Instantly share code, notes, and snippets.

@marzocchi
Last active November 26, 2019 22:47
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 marzocchi/00726fdb71d723be2e0019fd219368da to your computer and use it in GitHub Desktop.
Save marzocchi/00726fdb71d723be2e0019fd219368da to your computer and use it in GitHub Desktop.
config.fish
if status is-interactive > /dev/null
function fish_vi_cursor; end
fish_vi_key_bindings
function fish_greeting
end
function first_prompt_line --on-event fish_prompt
set_color red
printf '%s' (whoami)
set_color yellow
printf '@'
set_color magenta
printf '%s:' (hostname -s)
repo_path_or_pwd
end
function fish_prompt
set last_status $status
if test $last_status != 0
set_color white
printf '(%s) ' $last_status
end
set_color blue
switch $fish_bind_mode
case default
printf '%s' '[N]'
case insert
printf '%s' '[I]'
case visual
printf '%s' '[V]'
end
printf ' '
set_color red
printf '$ '
end
function fish_mode_prompt
end
function repo_path_or_pwd
set repo_path (git_repo_path)
if test $status -eq 0
set bn (basename (git symbolic-ref HEAD 2>/dev/null))
set_color yellow
printf $repo_path
set_color normal
printf ' on '
set_color red
git_dirty '*'
set_color yellow
printf $bn
echo
else
set_color yellow
prompt_pwd
end
end
function git_repo_path
set paths (git rev-parse --show-toplevel --show-prefix 2>&1)
set last_status $status
if test $last_status -gt 0
return $last_status
end
set bn (basename "$paths[1]")
echo "$bn"/"$paths[2]" | sed 's@/$@@'
end
function git_dirty
set out (git status -s 2>/dev/null)
if test "$out" != ""
echo -n "$argv[1]"
end
end
set -x HOMEBREW_NO_ANALYTICS 1
set -x HOMEBREW_NO_AUTO_UPDATE 1
set -x GOPATH "$HOME/projects/go"
if command -v direnv > /dev/null
direnv hook fish | source
end
if test -f ~/.iterm-notify-init.fish
source ~/.iterm-notify-init.fish
iterm-notify config-set notifications-backend terminal-notifier
iterm-notify config-set command-complete-timeout 10
iterm-notify config-set failure-icon 'https://media3.giphy.com/media/10ECejNtM1GyRy/200_s.gif'
iterm-notify config-set failure-title (hostname) ': wow such #fail ({duration_seconds:d}s)'
iterm-notify config-set success-icon 'https://s-media-cache-ak0.pinimg.com/564x/b5/5a/18/b55a1805f5650495a74202279036ecd2.jpg'
iterm-notify config-set success-title (hostname) ': very #success. wow ({duration_seconds:d}s)'
iterm-notify config-set logger-name "fish $fish_pid"
iterm-notify config-set logger-level DEBUG
uptime | iterm-notify send "welcome to "(hostname)
end
# if (tmux has 2>/dev/null)
# set sessions (tmux ls -F "#{session_name}")
# echo Tmux sessions: $sessions
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment