Zsh

install

brew install zsh

oh-my-zsh

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

themes

clone到 ~/.oh-my-zsh/themes 修改~/.zshrc ZSH_THEME=" "

plugin

  • autojump
    • brew install autojump
  • zsh-autosuggestions
    • git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
  • zsh-syntax-highlighting
  • bat
    • add syntax in cat
  • sudo
    • type esc esc twice to add sudo

tip

  • 在当前目录下输入 .. 或 ... ,或直接输入当前目录名都可以跳转,你甚至不再需要输入 cd 命令了。
  • 目录浏览和跳转:输入 d,即可列出你在这个会话里访问的目录列表,输入列表前的序号,即可直接跳转。
  • 命令参数补全。键入 kill 就会列出所有的进程名和对应的进程号
  • 通配符搜索:ls -l /*.sh,可以递归显示当前目录下的 shell 文件,文件少时可以代替 find。使用 / 来递归搜索
  • zsh_stats: Get a list of the top 20 commands and how many times they have been run.
  • take: Create a new directory and change to it, will create intermediate directories as required.
  • x / extract: Extract an archive (supported types: tar.{bz2,gz,xz,lzma}, bz2, rar, gz, tar, tbz2, tgz, zip, Z, 7z).
  • osx

alias

FlagDescription
Lprint each alias in the form of calls to alias
glist or define global aliases
mprint aliases matching specified pattern
rlist or define regular aliases
slist or define suffix aliases

Directory

FlagDescription
..cd ..
...cd ../..
....cd ../../..
.....cd ../../../..
/cd /
~cd ~
mdmkdir -p
rdrmdir
ddirs -v (lists last used directories)

osx

FlagDescription
tabOpen the current directory in a new tab
split_tabSplit the current terminal tab horizontally
vsplit_tabSplit the current terminal tab vertically
ofdOpen the current directory in a Finder window
pfdReturn the path of the frontmost Finder window
pfsReturn the current Finder selection
cdfcd to the current Finder directory
pushdfpushd to the current Finder directory
pxdReturn the current Xcode project directory
cdxcd to the current Xcode project directory
quick-lookQuick-Look a specified file
man-previewOpen a specified man page in Preview app
showfilesShow hidden files in Finder
hidefilesHide the hidden files in Finder
itunesDEPRECATED. Use music from macOS Catalina on
musicControl Apple Music. Use music -h for usage details
spotifyControl Spotify and search by artist, album, track…
rmdsstoreRemove .DS_Store files recursively in a directory