Skip to content

Latest commit

 

History

History
94 lines (68 loc) · 3.29 KB

zsh.md

File metadata and controls

94 lines (68 loc) · 3.29 KB

Zsh

I chose Zsh over fish because of its large community, plugins, themes and widgets (also because of past knowledge). However, I have found Zsh code to be a bit hacky as it always has been. I may consider Fish in the future or a shell like nushell if it makes things like that easier.

Usage

Note

This document is a note for my future self. Confirm that the purpose of this shell still makes sense in the functions it provides and its ux.

fzf1

  • ctrl+t. Paste the selected file path(s) into the command line.
  • alt+c. cd into the selected directory.
  • ctrl+r. Paste the selected command from history into the command line.
  • kill -9 **<TAB>. List all processes for select and kill.

zoxide2

  • cd. Full replacement of shell cd builtin command.
  • cdi. Open interactive selection (fzf).
  • cd foo<SPACE><TAB>. Interactive completions (fzf).
  • cd foo<TAB>. Interactive selection (fzf) or auto-completion.

fzf-tab3

It will show zsh completions using fzf when pressing tab. It must be the last plugin to bin ^I in order to keep the compatibility with others. You can use bindkey -M main | grep 'fzf-tab-complete' to check that it is properly seated.

  • ctrl+space. Multi-selection in fzf.

fzf-git4

Provides a lot of fzf function bindings for git repositories.

navi5

  • ctrl+g. Find string in Navi cheat sheets. Replace with the snippet.

Commands

Debug shell load time

# .zshrc
zmodload zsh/zprof # first line
zprof              # end
# how much time takes to load all configs?
for i in {1..10}; do time zsh -i -c exit; done
#zsh -i -c exit  0.04s user 0.02s system 99% cpu 0.054 total
#...
# https://github.com/sharkdp/hyperfine
hyperfine --warmup 1 'zsh -i -c exit'
hyperfine --warmup 2 'fish -i -c exit' 'zsh -i -c exit'

Resources

Plugins

Completions

Footnotes

  1. https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh

  2. https://github.com/ajeetdsouza/zoxide/blob/main/templates/zsh.txt

  3. https://github.com/Aloxaf/fzf-tab

  4. https://github.com/junegunn/fzf-git.sh#usage

  5. https://github.com/denisidoro/navi/blob/master/docs/installation.md#installing-the-shell-widget