From 3f8c900e19c3f1397005353ea92b259c9dda5ee0 Mon Sep 17 00:00:00 2001 From: Max Bucknell Date: Tue, 5 May 2015 14:37:26 +0100 Subject: [PATCH] Add some comments to the functions --- fish/config.fish | 24 +++++++++++++++--------- fish/functions/fish_prompt.fish | 8 -------- fish/functions/git_branch.fish | 3 +++ fish/functions/nice_hostname.fish | 3 +++ fish/functions/start_agent.fish | 1 + fish/functions/test_identities.fish | 1 + 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/fish/config.fish b/fish/config.fish index 7f714f3..7afc4b0 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -1,8 +1,17 @@ # Default path -set PATH /usr/local/bin /usr/local/sbin /usr/bin /bin /usr/sbin /sbin /usr/local/MacGPG2/bin +set PATH /usr/local/bin +set PATH /usr/local/sbin $PATH +set PATH /usr/bin $PATH +set PATH /bin $PATH +set PATH /usr/sbin $PATH +set PATH /sbin $PATH -# Ruby support -set PATH /usr/local/Cellar/ruby/2.1.3/bin $PATH +# MacGPG +set PATH /usr/local/MacGPG2/bin $PATH + +# Ruby +set RUBY_VERSION (ruby --version | cut -d " " -f 2 | cut -d "p" -f 1) +set PATH "/usr/local/Cellar/ruby/$RUBY_VERSION/bin" $PATH # LaTeX! set PATH /usr/texbin $PATH @@ -19,16 +28,10 @@ set PATH $PATH /opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resourc # DYLD_LIBRARY_PATH (Rust asked for this) set DYLD_LIBRARY_PATH "/usr/local/lib" "$DYLD_LIBRARY_PATH" -# Mono asked for this: -source dnvm.sh - # For GitHub integration. # See github.com/github/hub alias git hub -# I don't want to delete things anymore. -alias rm trash - # Remove the greeting message on startup set fish_greeting @@ -43,6 +46,9 @@ alias mkdir "mkdir -p" alias sl "/usr/local/bin/sl; and ls" # SSH Agent +# +# Start SSH Agent if it's not already running, and add the +# id_(nice_hostname) identity. setenv SSH_ENV "$HOME/.ssh/environment" if [ -n "$SSH_AGENT_PID" ] ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish index b4ea640..9d1b37c 100755 --- a/fish/functions/fish_prompt.fish +++ b/fish/functions/fish_prompt.fish @@ -5,9 +5,7 @@ function fish_prompt # Reset button set_color normal - # # Username - # # Show root user as red, to remind us of danger. if test (whoami) = root @@ -24,9 +22,7 @@ function fish_prompt echo -n @ - # # Hostname - # # To remove boldness set_color normal @@ -39,9 +35,7 @@ function fish_prompt echo -n " in " - # # Current working dir - # set_color normal set_color red @@ -51,9 +45,7 @@ function fish_prompt set_color normal set_color -o black - # # Git branch - # set branch (git_branch) if not test -z $branch diff --git a/fish/functions/git_branch.fish b/fish/functions/git_branch.fish index 020d41c..8d73dbb 100644 --- a/fish/functions/git_branch.fish +++ b/fish/functions/git_branch.fish @@ -1,3 +1,6 @@ +# Get the current git branch +# +# If we are not in a git repository, we silently ruturn noting. function git_branch set __git_branch (git current-branch ^ /dev/null) diff --git a/fish/functions/nice_hostname.fish b/fish/functions/nice_hostname.fish index 68a51c5..a212e3b 100644 --- a/fish/functions/nice_hostname.fish +++ b/fish/functions/nice_hostname.fish @@ -1,3 +1,6 @@ +# nice_hostname +# +# Take the first part of the hostname. function nice_hostname hostname | cut -d . -f 1 end diff --git a/fish/functions/start_agent.fish b/fish/functions/start_agent.fish index 989fef8..dabce3b 100644 --- a/fish/functions/start_agent.fish +++ b/fish/functions/start_agent.fish @@ -1,3 +1,4 @@ +# Start SSH Agent and set relevant variables function start_agent echo "Initializing new SSH agent ..." ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV diff --git a/fish/functions/test_identities.fish b/fish/functions/test_identities.fish index 2e5fae1..b7db800 100644 --- a/fish/functions/test_identities.fish +++ b/fish/functions/test_identities.fish @@ -1,3 +1,4 @@ +# Add my SSH identity function test_identities ssh-add -l | grep "The agent has no identities" > /dev/null if [ $status -eq 0 ]