大佬教程收集整理的这篇文章主要介绍了macos – zsh:找不到命令($EDITOR),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
export EDITOR='open -Wn'
在他们的〜/ .zshrc文件中,但是当我尝试这样做时,我只是抱怨.
zsh: command not found: open -Wn
有什么理由可能会发生这种情况?将$EDITOR设置为’mate’,’vim’或’open’似乎工作正常,但’mate -w’和’open -Wn’不起作用.
我在Mac OS X上运行zsh屏幕,我的〜/ .zshrc如下:
# ----------------------------------------------- # Screen SetTings # ----------------------------------------------- # If screen isn't already running,turn it on. if [[ $STY == '' ]]; then # Execute screen. exec screen -aADRU fi # ----------------------------------------------- # Startup Scripts # ----------------------------------------------- cd ~/Desktop [[ -s "~/.rvm/scripts/rvm" ]] && source "~/.rvm/scripts/rvm" # ----------------------------------------------- # Environment Variables # ----------------------------------------------- export HISTFILE=~/.zsh_history export HISTSIZE=10000 export HISTCONTROL=ignoredups export SAVEHIST=10000 export PATH=.:/usr/local/bin:/usr/local/sbin:/usr/local/narwhal/bin:/bin:/sbin:/usr/bin:/usr/local/share:/usr/sbin:/usr/local/texlive/2011/bin/universal-darwin export EDITOR='open -Wn' export LC_TYPE=en_US.UTF-8 export LSCOLORS=exFxcxdxAxexbxHxGxcxBx # ----------------------------------------------- # Prompt # ----------------------------------------------- ## Root Prompt [ $UID = 0 ] && export PROMPT="%~ +=> " && export RPROMPT="%*" ## General Prompt [ $UID != 0 ] && export PROMPT="%~ => " && export RPROMPT="%*" # ----------------------------------------------- # Aliases # ----------------------------------------------- ## Command Aliases alias ..='cd ..' alias ...='cd ../..' alias internet='lsof -P -i -n | cut -f 1 -d " " | uniq' alias restart='sudo shutdown -r Now' alias ls='ls -@1AFGph' alias tree='tree -alCF --charset=UTF-8 --du --si' alias mate='mate -w' alias zshrc='$EDITOR ~/.zshrc && source ~/.zshrc' alias vimrc='$EDITOR ~/.vimrc.local' alias gvimrc='$EDITOR ~/.gvimrc.local' ## Root Aliases [ $UID = 0 ] && \ alias rm='rm -i' && \ alias mv='mv -i' && \ alias cp='cp -i' # ----------------------------------------------- # user-defined Functions # ----------------------------------------------- # Usage: extract <file> # Description: extracts archived files / mounts disk images. # Note: .dmg/hdiutil is Mac OS X-specific. extract () { if [ -f $1 ]; then case $1 in *.tar.bz2) tar -jxvf $1 ;; *.tar.gz) tar -zxvf $1 ;; *.bz2) bunzip2 $1 ;; *.dmg) hdiutul mount $1 ;; *.gz) gunzip $1 ;; *.tar) tar -xvf $1 ;; *.tbz2) tar -jxvf $1 ;; *.tgz) tar -zxvf $1 ;; *.zip) unzip $1 ;; *.z) uncompress $1 ;; *) echo "'$1' cAnnot be extracted/mounted via extract()." ;; esac else echo "'$1' is not a valid file." fi } # Usage: pman <manpage> # Description: opens up the SELEcted man page in Preview. pman () { man -t $@ | open -f -a /Applications/Preview.app } # Usage: fp <name> # Description: find and list processes matching a case-insensitive partial-match String. fp () { ps Ao pid,comm|awk '{match($0,/[^\/]+$/); print substr($0,RSTART,RLENGTH)": "$1}'|grep -i $1|grep -v grep } # Usage: fk <name> # Description: find and kill a process matching a case-insensitive partial-match String. fk () { IFS=$'\n' PS3='Kill which process? (1 to cancel): ' SELEct OPT in "Cancel" $(fp $1); do if [ $OPT != "Cancel" ]; then kill $(echo $OPT|awk '{print $NF}') fi break done unset IFS } # Usage: create <file> # Description: creates and opens a file for ediTing. create () { touch $1 && open $1 } # Usage: reset # Description: 'resets' the terminal by changing the current working directory # to the desktop and clearing the screen. reset () { cd ~/Desktop; clear } # Usage: quit # Description: exits the terminal. quit () { killall Terminal } # ----------------------------------------------- # zsh Options # ----------------------------------------------- # Directories setopt \ AUTO_CD \ AUTO_PUSHD \ CD_ABLE_VARS \ CHASE_DOTS \ CHASE_LINKS \ # Completion setopt \ AUTO_LIST \ AUTO_MENU \ AUTO_PARAM_SLASH \ COMPLETE_IN_WORD \ LIST_TYPES \ MENU_COMPLETE \ REC_EXACT \ # History setopt \ APPEND_HISTORY \ EXTENDED_HISTORY \ # Input/Output setopt \ CORRECT \ # Scripts and Functions setopt \ MULTIOS \ # Other setopt \ NO_BEEP \ ZLE # Key Bindings bindkey "^[[3~" delete-char # ----------------------------------------------- # zsh Autocompletion # ----------------------------------------------- # Turn on auto-completion. autoload -U compinit && compinit -C && autoload -U zstyle+ # Attempt to complete as much as possible. zstyle ':completion:*' completer _complete _list _oldlist _expand _ignored _match _correct zstyle ':completion:*::::' completer _expand _complete _ignored _approximate # Sort files by name. zstyle ':completion:*' file-sort name # Allow for case-insensitive completion. zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Color completions. zstyle ':completion:*' list-colors ${LSCOLORS} zstyle ':completion:*:*:kill:*:processes' command 'ps -axco pid,user,command' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' # Set the amount of completions that triggers the menu. zstyle ':completion:*' menu SELEct=long # Ignore certain patterns. zstyle ':completion:*:functions' ignored-patterns '_*' zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~' zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.(o|c~|old|pro|zwC)' # Cache completions. zstyle ':completion::complete:*' use-cache 1 zstyle ':completion::complete:*' cache-path ~/.zcompcache/$HOST # Allow errors. zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )' # Insert all expansions for expand completer (eh,don't kNow what this does). zstyle ':completion:*:expand:*' tag-order all-expansions # FormatTing and messages. zstyle ':completion:*' list-prompt '%sAt %p: Hit TAB for more,or the character to insert%s' zstyle ':completion:*' verbose yes zstyle ':completion:*:descriptions' format '%B%d%b' zstyle ':completion:*:messages' format '%d' zstyle ':completion:*:warnings' format 'No matches for: %d' zstyle ':completion:*:corrections' format '%B%d (errors: %E)%b' zstyle ':completion:*' group-name '' # Offer indexes before parameters in subscripts. zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
=
modifier on parameter expansion.
$=EDITOR $file
更便携的方法是确保EDITOR不包含任何空间.大多数应用程序将$EDITOR视为sHell片段或以空格分隔的单词列表,但我遇到过一些将其视为命令名称的问题.让EDITOR指向sHell脚本.
% cat ~/bin/EDITOR #!/bin/sh open -Wn -- "$@" % grep EDITOR ~/.profile export EDITOR=~/bin/EDITOR
以上是大佬教程为你收集整理的macos – zsh:找不到命令($EDITOR)全部内容,希望文章能够帮你解决macos – zsh:找不到命令($EDITOR)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。