DEV Community

Discussion on: What is the best .zshrc config you have seen?

Collapse
 
vonheikemen profile image
Heiker • Edited

I think most people just install oh-my-zsh and forget about .zshrc. Is what I did at first. So I think the first place to look is the oh-my-zsh repository, they have some really useful stuff in the plugins folder.

This are my favorite.

# Use - to go back to previous directory
alias -- -='cd -'

# Taken from the tmux plugin
alias ta="tmux attach -t"
alias ts="tmux new-session -s"
alias tl="tmux list-sessions"

# Keybindings

autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search

# [Space] - do history expansion
bindkey ' ' magic-space

# start typing + [Up-Arrow] - fuzzy find history forward
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search

# start typing + [Down-Arrow] - fuzzy find history backward
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
Enter fullscreen mode Exit fullscreen mode

They do a little bit of magic in another file to make sure terminfo has a value.

I actually uninstalled oh-my-zsh and kept what I needed. The zsh specific stuff is here. And what is (mostly) POSIX compliant is here.

Collapse
 
manan30 profile image
Manan Joshi

I 100% agree with this I think most people just install oh-my-zsh and forget about .zshrc.

Collapse
 
sikloidz profile image
José Landero

I was one of those until today, I'd never thought about how handy could be to have some aliases here and there

Thread Thread
 
manan30 profile image
Manan Joshi

I am not 100% certain if aliasing actually saves some time but it sure does save you some keyboard clicks.