Installation

Anders Ingemann edited this page Aug 8, 2016 · 21 revisions

homeshick is installed as a managed repository (AKA castle), this way it can keep itself updated. In order to create the castle, simply clone it to the appropriate location.

git clone git://github.com/andsens/homeshick.git $HOME/.homesick/repos/homeshick

Now lets make homeshick work when we type homeshick.

printf '\nsource "$HOME/.homesick/repos/homeshick/homeshick.sh"' >> $HOME/.bashrc

This adds a line to your .bashrc which includes a script that defines the homeshick() function.

fish shell users must use the homeshick.fish file instead:

echo -en '\n. "$HOME/.homesick/repos/homeshick/homeshick.fish"' >> "$HOME/.config/fish/config.fish"

If you use csh or tcsh, you must use a different approach (C shell does not support shell functions). Update your .cshrc like this:

printf '\nalias homeshick source "$HOME/.homesick/repos/homeshick/bin/homeshick.csh"\n' >> $HOME/.cshrc

To get the function/alias working right away, you will have to rerun your .bashrc with source $HOME/.bashrc, config.fish with source $HOME/.config/fish/config.fish or your .cshrc with source $HOME/.cshrc.

Note: The reason we want to define a function/use source instead of aliasing bin/homeshick to homeshick is because of the cd command. homeshick cannot change the working directory of your current shell if it is invoked as a subprocess.

You may also want to set up automatic refreshing of your repositories, to always stay up to date with any changes. To speed up the setup process on new machines, have a look at the automatic deployment script.

To find out how homeshick works in detail you can examine how the commands work or go to the tutorials if you prefer getting to know homeshick by using it.

Homebrew

On OS X you can also install homeshick via Homebrew:

brew install homeshick

Further integration instructions are provided via the formula after installation.

Completion

homeshick comes with its own tab completion scripts. There are scripts for bash and zsh. They allow you to tab complete all available commands and supply you with possible castle names.

Bash completion

To get tab completion working in bash, simply source completions/homeshick-completion.bash somewhere in your .bashrc.

printf '\nsource "$HOME/.homesick/repos/homeshick/completions/homeshick-completion.bash"' >> $HOME/.bashrc

ZSH completion

ZSH autoloads its completion scripts. In order for ZSH to know that there exists a homeshick completion script you have to add the homeshick/completions directory to the ZSH tab completion lookup path.

printf '\nfpath=($HOME/.homesick/repos/homeshick/completions $fpath)' >> $HOME/.zshrc

NOTE: you may need to ensure that this line comes before the compinit line. If you are using oh-my-zsh, the homeshick fpath modification may need to come before sourcing oh-my-zsh. For example:

source "$HOME/.homesick/repos/homeshick/homeshick.sh"
fpath=($HOME/.homesick/repos/homeshick/completions $fpath)

source $ZSH/oh-my-zsh.sh

See Issue #89 for more details.

Fish completion

To get tab completion working in fish shell, simply source $HOME/.homesick/repos/homeshick/completions/homeshick.fish somewhere in your fish configuration (i.e. $HOME/.config/fish/config.fish), for instance like:

source "$HOME/.homesick/repos/homeshick/completions/homeshick.fish"