title | author | date |
---|---|---|
Tales of a Shell Dweller |
N. G. Scheurich |
2010-04-06 |
Zsh is a shell designed for interactive use, although it is also a powerful scripting language.
Improve the history experience:
setopt EXTENDED_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
HISTFILE=$ZDOTDIR/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
Easy access to shell configuration:
alias zshconfig='$EDITOR $ZDOTDIR/.zshrc'
alias zshsource='source $ZDOTDIR/.zshrc'
Better backspacing:
autoload -U select-word-style
select-word-style bash
exa is a modern replacement for ls.
$ exa dir
$ exa -la dir
$ exa --icons --git dir
$ exa -T dir
$ exa -I .git
Configure some handy aliases:
alias l='exa'
alias la='exa --long --all'
alias lg='lazygit'
alias ll='exa --long'
A cat(1) clone with syntax highlighting and Git integration.
https://github.com/sharkdp/bat
$ bat file
$ bat -A file
$ bat dir/*
$ bat file -l json
A simple, fast and user-friendly alternative to 'find'
$ fd name
$ fd -H name
$ fd '^startswith.*'
$ fd name -x vim
$ fd name -X bat
Command-line productivity booster, offers quick access to files and directories, inspired by autojump, z and v.
$ z dirpart
$ zz
$ f
$ sf
fzf is a general-purpose command-line fuzzy finder.
https://github.com/junegunn/fzf
$ lines | fzf
$ lines | fzf --multi
$ $EDITOR `fd '^startswith.*' | fzf`
Use the shortcuts created by the FZF install script:
CTRL-T
- Pick files in current directoryCTRL-R
- Pick shell historyALT-C
- Pick directory, thencd
Use a ' (straight quote) to match entire input string:
spine
will match "spine" and "spindle"'spine
will match "spine" but not "spindle"
Pick from filesystem auto-completion:
$ command dir/**<TAB>
Configure default options to render previews:
export FZF_CTRL_T_OPTS="--preview \
'bat --color=always --style=numbers \
--line-range=:500 {}'"
export FZF_ALT_C_OPTS="--preview 'tree -C {}'"
Steal stuff from the FZF wiki:
https://github.com/junegunn/fzf/wiki/Examples
Collaborative cheatsheats for console commands
https://github.com/tldr-pages/tldr
$ tldr tar
$ tldr --update
The Fuck is a magnificent app, inspired by a @liamosaur tweet, that corrects errors in previous console commands.
https://github.com/nvbn/thefuck
$ fuck