zsh 独门秘笈 3

保存/查询/快速切换目录 (>= 4.1) 编辑~/.zshrc文件,添加以下内容: # 保存30个目录 DIRSTACKSIZE=30 # 只支持4.1版本以上的zsh if [[ -f ~/.zdirs ]] && [[ ${#dirstack[*]} -eq 0 ]]; then dirstack=( ${(uf)"$(< ~/.zdirs)"} ) #echo "Loaded the dirstack from disk" fi chpwd() { dirs -pl >! ~/.zdirs } # 定义ds函数 ds() { dirs -v | head -30 | sort -nr } 保存后退出,重新加载配置文件 $ . ~/.zshrc $ cd /some/dir1/aaa $ cd /some/dir2/bbb $ cd /some/dir3/ccc $ ds ds会列出以...

2007-08-15 · wuan

zsh 独门秘笈

查询并快速切换历史目录 编辑~/.zshrc,添加以下两行 setopt PUSHD_MINUS alias dir="dirs -v | head -30 | sort -nr" 保存退出,重新加载配置文件 $ . ~/.zshrc $ dir 列出历史目录和编号 $ cd -编号 即可进入目录(留意cd后面的减号) 让别名可以作为后缀使用 编辑~/.zshrc,添加一行 alias -g L="| less" 保存退出,重新加载配置文件 $ . ~/.zshrc $ lspci -v L 进入...

2007-08-14 · wuan

解决在 zsh 中使用 root 帐号遇到的麻烦

mlterm + zsh 普通用户的 Home、End 和 Ctrl+R 功能都正常,一旦切换到 root 账户就有问题。 解决办法是在~/.zshrc中添加: bindkey "^[OF" end-of-line bindkey "^[OH" beginning-of-line bindkey "^R"&nbsp;&nbsp; history-incremental-search-backward 注意引号中间字符的输入方法: Ctrl+V End Ctrl+V Home Ctrl+V Ctrl+R

2007-08-14 · wuan

解决zsh在mlterm下用screen时homeend键功能异常的问题

FROM: http://lfod.us/dotfiles/zshrc # Make HOME and END work reasonably case $TERM in xterm*) bindkey "^[[F" end-of-line bindkey "^[[H" beginning-of-line ;; esac bindkey '\e[1~' beginning-of-line # Home bindkey '\e[4~' end-of-line # End bindkey '\e[3~' delete-char # Del bindkey '\e[2~' overwrite-mode # Insert bindkey -v

2007-03-16 · wuan