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 -aADRUfi# -----------------------------------------------# Startup Scripts# -----------------------------------------------cd ~/Desktop[[ -s "~/.rvm/scripts/rvm" ]] && source "~/.rvm/scripts/rvm"# -----------------------------------------------# Environment Variables# -----------------------------------------------export HISTfile=~/.zsh_historyexport HISTSIZE=10000export HISTCONTRol=ignoredupsexport SAVEHIST=10000export 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-darwinexport EDITOR='open -Wn'export LC_TYPE=en_US.UTF-8export LScolorS=exFxcxdxAxexbxHxGxcxBx# -----------------------------------------------# Prompt# -----------------------------------------------## Root Prompt[ $UID = 0 ] && export PROMPT="%~ +=> " && export RPROMPT="%*"## General Prompt[ $UID != 0 ] && export PROMPT="%~ => " && export RPROMPT="%*"# -----------------------------------------------# Aliases# -----------------------------------------------## Command Aliasesalias ..='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 ]; then case in *.tar.bz2) tar -jxvf ;; *.tar.gz) tar -zxvf ;; *.bz2) bunzip2 ;; *.dmg) hdiutul mount ;; *.gz) gunzip ;; *.tar) tar -xvf ;; *.tbz2) tar -jxvf ;; *.tgz) tar -zxvf ;; *.zip) unzip ;; *.Z) uncompress ;; *) echo "'' cannot be extracted/mounted via extract()." ;; esac else echo "'' 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(解决方法 在zsh中,当你编写$EDITOR时,它会扩展为单个单词.与其他Bourne样式的shell不同,zsh在扩展未引用的扩展时不会拆分单词.你可以用它来实现它=
,/[^\/]+$/); print substr($=EDITOR $file,RSTART,RLENGTH)": "}'|grep -i |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 ); 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 && open }# 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# -----------------------------------------------# DirectorIEssetopt \ auto_CD \ auto_PUSHD \ CD_ABLE_VARS \ CHASE_DOTS \ CHASE_linkS \# Completionsetopt \ auto_List \ auto_MENU \ auto_ParaM_SLASH \ COMPLETE_IN_WORD \ List_TYPES \ MENU_COMPLETE \ REC_EXACT \# Historysetopt \ APPEND_HISTORY \ EXTENDED_HISTORY \# input/Outputsetopt \ CORRECT \# Scripts and Functionssetopt \ MulTIOS \# Othersetopt \ NO_BEEP \ ZLE# Key Bindingsbindkey "^[[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 _correctzstyle ':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 1zstyle ':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 yeszstyle ':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
% cat ~/bin/EDITOR#!/bin/shopen -Wn -- "$@"% grep EDITOR ~/.profileexport EDITOR=~/bin/EDITORmodifier on parameter expansion.
更便携的方法是确保EDITOR不包含任何空间.大多数应用程序将$EDITOR视为shell片段或以空格分隔的单词列表,但我遇到过一些将其视为命令名称的问题.让EDITOR指向shell脚本.
总结以上是内存溢出为你收集整理的macos – zsh:找不到命令($EDITOR)全部内容,希望文章能够帮你解决macos – zsh:找不到命令($EDITOR)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)