Skip to content

Commit

Permalink
Ability to store your own prompts in ~/.zsh.prompts [Close #152]
Browse files Browse the repository at this point in the history
We no longer pollute yadr or prezto directories with custom code!
  • Loading branch information
skwp committed Sep 26, 2012
1 parent d8e5043 commit fa357bb
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 12 deletions.
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,28 +152,39 @@ After a lifetime of bash, I am now using ZSH as my default shell because of its
and autocomplete features (the spelling fixer autocomplete is worth the money alone).

Migrating from bash to zsh is essentially pain free. The zshrc provided here
restores the only feature that I felt was 'broken' which is the Ctrl-R reverse history search.

While I am not going to support bash out of the box here, YADR _should_ work with bash if
you just source the _aliases_ file. However, you soul will sing if you install zsh. I promise.
restores a few features that I felt was 'broken' including Ctrl-R reverse history search.

Lots of things I do every day are done with two or three character
mnemonic aliases. Please feel free to edit them:

ae # alias edit
ar # alias reload

### [ZSH Customizations & Prezto](https://github.com/sorin-ionescu/prezto)
### [Prezto](https://github.com/sorin-ionescu/prezto)

For a more complete Zsh experience we use **[Prezto](http://github.com/sorin-ionescu/prezto)**.
Prezto is included as a submodule.

### Adding your own ZSH theme

If you want to add your own zsh theme, you can place it into ~/.zsh.prompts and it will automatically be picked up by the prompt loader.

Make sure you follow the naming convention of `prompt_[name]_setup`

```
touch ~/.zsh.prompts/prompt_mytheme_setup
```

Check out ~/.yadr/zsh/prezto-themes/prompt_skwp_setup for an example of how to write a prompt.
See also the [Prezto](https://github.com/sorin-ionescu/prezto) project for more info on themes.

### Customizing ZSH & Picking a theme

If you want to customize your zsh experience, yadr provides two hooks via ~/.zsh.after/ and ~/.zsh.before/ directories.
In these directories, you can place files to customize things that load before and after other zsh customizations that come from ~/.yadr/zsh/*

For example, to override the theme, you can do something like this:
```
mkdir ~/.zsh.after
echo "prompt skwp" > ~/.zsh.after/prompt.zsh
```

Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def install_prezto

puts "Installing YADR themes for Prezto..."
run %{ ln -nfs $HOME/.yadr/zsh/prezto-themes/modules/prompt/functions/* $HOME/.zprezto/modules/prompt/functions}

puts "Creating directories for your customizations"
run %{ mkdir -p $HOME/.zsh.before }
run %{ mkdir -p $HOME/.zsh.after }
run %{ mkdir -p $HOME/.zsh.prompts }
end

def want_to_install? (section)
Expand Down
5 changes: 4 additions & 1 deletion zsh/0000_before.zsh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Load any user customizations prior to load
#
if [ -d $HOME/.zsh.before/ ]; then
for config_file ($HOME/.zsh.before/*.zsh) source $config_file
if [ "$(ls -A $HOME/.zsh.before/)" ]; then
for config_file ($HOME/.zsh.before/*.zsh) source $config_file
fi
fi
3 changes: 3 additions & 0 deletions zsh/custom_prompt_path.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Load themes from yadr and from user's custom prompts (themes) in ~/.zsh.prompts
fpath=($HOME/.yadr/zsh/prezto-themes $HOME/.zsh.prompts $fpath)
promptinit
4 changes: 0 additions & 4 deletions zsh/prezto-themes/README.md

This file was deleted.

File renamed without changes.
4 changes: 3 additions & 1 deletion zsh/zzzz_after.zsh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Load any custom after code
if [ -d $HOME/.zsh.after/ ]; then
for config_file ($HOME/.zsh.after/*.zsh) source $config_file
if [ "$(ls -A $HOME/.zsh.after/)" ]; then
for config_file ($HOME/.zsh.after/*.zsh) source $config_file
fi
fi

0 comments on commit fa357bb

Please sign in to comment.