Skip to content

Valodim/zshrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My zsh configs. If you don't know what's what, you probably shouldn't use it but get your own going. Feel free to steal, though. I try to keep it usable :)

Interesting keybindings:

editing:
    ^A go to beginning of line
    ^E go to end of line
    ^F edit command line in $EDITOR
    ^H run help for current $0
    ^P push line on stack
    ^O insert line from stack
    ^T undo
    ^U clear line
    ^V insert next character literally
    ^R incremental history search
    ^Y prepend "sudo "
    ^X^X copy $BUFFER to clipboard using xclip
    ctrl-left/right will move along argument boundaries
    repeated ... will be turned into ../.. (mikachu's rationalise-dots)

history:
    ^B accept current buffer. if there is a matching line in history, push the following one
    down on a non-empty line will push it to history without executing, irssi-style
    up/down will search history on prefix match

functional shortcuts:
    ^L display ls
    ^X^L clear screen (instead of ^L)
    ^Z do "fg %%" (allows neat toggling)

in menu-complete:
    page-up will accept and complete again (go into directory)
    page-down will undo (basically, go up directory)
    menu will accept selection but stay in menu-complete

Modules:

These provide a variety of stand-alone functionality.

20-rehash-hook.zsh

Listens for USR1 and rehashes when received. Sends USR1 to all instances of zsh after a command starting with apt-get, aptitude or pip is run (might need to expand this list?)

50-title.zsh

Sets the window and tmux tab title.

50-vicursor.zsh

Sets the cursor color to red in vicmd mode. Only in xterm, rxvt[-unicode] and tmux 1.8+

60-localhist.zsh

Enables local histories for specific directories. Use lhc to create a local history for the current pwd. Enable with lh1, disable with lh0, or toggle with localhist_toggle widget, bound to ^G by default.

72-bracket-paste.zsh

Adds support for bracketed paste mode. Supported in xterm, rxvt-unicode and tmux 1.7+

72-return.zsh

Remembers last dir cd'ed to. In a new session, if the first line is left empty and accepted, changes to that dir.

96-vcs_info-cdpath.zsh

Adds the base dir of a repository to cdpath.

96-vcs_info-githooks.zsh

Displays info about tracking branches and stacked commits in git repositories.

96-vcs_info-lofi.zsh

Displays only basic vcs info until a vcs command is run (can also be triggered using ^G^L).

97-prompt-disambiguate.zsh

Replaces the path name in prompt with a non-ambiguous prefix form.

97-prompt-exitnames.zsh

Replaces exit codes in prompt with names of the signals (usually) causing them.

Prompt:

See https://github.com/Valodim/zsh-prompt-powerline

I am at this point usually using my powerline prompt and this old one as a fallback if a powerline patched font is unavailable. Just keeping this info here for reference.

  [valodim@SteelHooves] ::1 ~/.zsh/custom master¹² 1 ±
       ^       ^        ^^^    ^     ^      ^   ^^ ^ ^
       a       b        cde    f     g      h   ij k l

a username, only displayed if it's not "valodim" (you probably wanna change that)
b hostname, colored using its hash
c pwd permissions indicator, : if owned by $uid else ., yellow if only readable, red if not even readable
d localhist indicator, : if enabled, . if disabled, colored differently if there is a localhist
e fail indicator, displays exit status if it's != 0
f path, nothing special about it
g path within repository, differently colored
h vcs branch name
i unstaged changes indicator
j staged changes indicator
k number of stashed commits, if > 0
l repository type indicator. ± for git, ☿ for hg, $name for others, » outside of repositories

So a clean prompt [[ $PWD == $HOME ]] looks like

  [SteelHooves] :: ~ »

beautiful, isn't it? :)

Tidbits:

  • the hostname color in the prompt is generated from a hash
  • cd completion will display the number of regular files in the current dir
  • using .. to go up directories will display the absolute path below the prompt

About

My zsh dotfiles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages