When within a git repository, doing a tab-autocomplete on a command results with the command becoming unreadable. The command still works but this is pretty annoying visually.
Basically I
1. Navigate to a directory with a git repository in it. The prompt indicates the current branch properly
2. Next, type `git -` and hit tab
The prompt now shows only part of branch's name with the first suggestion appended.
After googling a bit I stumbled upon several pages describing a similar problem (most useful to me was http://stackoverflow.com/questions/23740862/issues-with-zsh-prompt).
The culprit seems to be the git_prompt_info function escaping the `$current_branch` variable as if it is a color. As a result zsh is confused where the cursor is. After "unescaping" the variable everything seems to work fine.
Using zsh 5.0.7 (x86_64-apple-darwin13.4.0).
The glob used a modifier, but it was modifying a directory instead of a
glob that matched all the files in the directory. Add the missing `*` to
fix this.
From the [Zsh manual](http://zsh.sourceforge.net/Intro/intro_3.html):
> '.zshenv' is sourced on all invocations of the shell, unless the -f option is
> set. It should contain commands to set the command search path, plus other
> important environment variables. `.zshenv' should not contain commands that
> produce output or assume the shell is attached to a tty.
Why is this important? [Alfred](http://www.alfredapp.com/) workflows run in
non-interactive shells. When the `$PATH` is set, or `rbenv` is initialized, in
`zshrc` instead of `zshenv`, those workflows will not use the correct Ruby
version and might not have access to certain bin files, such as those from
`$HOME/.bin/` or Homebrew.
Just before loading `~/.zshrc.local`, load:
1. `~/.zsh/configs/pre/**/*`
2. `~/.zsh/configs/**/*` # excluding pre and post
3. `~/.zsh/configs/post/**/*`
About the zsh glob:
- `.`: only produce normal files.
- `-`: follow symlinks to their final file; skip any broken links.
- `N`: do not complain about zero matches.
Big ups to Pat Brisbin for finding `N`.
This is for homebrew binaries to work.
Load `rbenv` after adding `$HOME/.bin` and `/usr/local/bin` to `PATH`, but
before adding project-specific binstubs.
* Switch order from "[git branch][pathname]" to "basename git branch %".
* Remove noisy brackets.
Example old:
[master][~/dev/thoughtbot/dotfiles]
Example new:
dotfiles dc-prompt %
* "to the $HISTFILE incrementally (as soon as they are entered), rather than
waiting until the shell exits"
* replace any duplicate in the history, not just the previous duplicate: allows
for a cleaner history
* `.zhistory` is more idiomatic than `.zsh_history`
This frequently catches false positives for aliases, particularly for
subcommands. It also takes just as long to look at the autocorrect
prompt and select "y" as it does to just retype the command yourself.
* easier when everything is just one file
* most (if not all) interactive shells are login shells and we likely want those
settings for interactive shells
* remove duplicates with zlogin
* order by functions first, then bindings, then exports
* lowercase `setopt` arguments for consistency with `setopt` output
Follows the pattern of:
* ~/.aliases.local in ce7ad49
* ~/.gitconfig.local in 8e141fe
* ~/.vimrc.local in a666267
Use consistent:
* `source`ing style.
* commenting style.
I am using ~/.zshrc.local as a home for `eval "$(rbenv init -)"`.
With arguments, g acts like git.
Without arguments, it runs `git status`.
* Source functions/* after loading ZSH completion so `compdef` is available to g
alias
Most tools look for $VISUAL before $EDITOR, and we tend to want that
anyway. This allows people to customize the two, for example using GUI
vim for $VISUAL and normal vim for $EDITOR, or more extreme: `ex -v` for
$VISUAL and `ex` for $EDITOR.
* Use a regular alias to make `s` short for `rspec`
* Use an `rspec` shell function to route to zeus when appropriate
* Removes confusion from `s` working differently than `rspec`
* Removes need to use a special alias to get zeus working