.zshrcの設定、順序は重要ですか?

.zshrcの設定、順序は重要ですか?

これでzshはMacのデフォルト端末なので、.bashrcのデフォルト設定を.zshrcにコピーすることにしました。

必要なものはすでにほとんどありますが、追加する必要があるものがいくつかあります。私は.zshrcファイルを作成することについて何も知らなかったので、Googleでたくさんの検索をしました。

私はこれを見つけましたが、それをよりきれいに整理する前に順序が重要ですか?

申し訳ありません。本当に台無しです。

#################
# Output Prompt #
#################
NEWLINE=$'\n'
PROMPT="%F{cyan}%n%f@%F{green}%m%f %F{011}%~%f \$vcs_info_msg_0_ ${NEWLINE}%% "
# RPROMPT=\$vcs_info_msg_0_

###########
# ALIASES #
###########
alias ls='ls -GFh'

# TODO: DO MORE RESEARCH ON THESE
# alias l='colorls --group-directories-first --almost-all'
# alias ll='colorls --group-directories-first --almost-all --long' # detailed list view

# case insensitive path-completion from - https://scriptingosx.com/2019/07/moving-to-zsh-part-5-completions/
# zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'

# partial completion suggestions - from https://scriptingosx.com/2019/07/moving-to-zsh-part-5-completions/
# zstyle ':completion:*' list-suffixes
# zstyle ':completion:*' expand prefix suffix
# E-TODO

export LSCOLORS=gxfxbxdxcxegedabagacad


# The following lines were added by compinstall

zstyle ':completion:*' completer _complete _ignored _approximate
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}'



zstyle :compinstall filename '/Users/ryan/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs

zstyle ':completion:*:*:cdr:*:*' menu selection

autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
setopt HIST_IGNORE_DUPS # Prevents duplicate commands from being saved the command line history
setopt HIST_IGNORE_SPACE # Remove command lines from the history when the first character is a space
setopt HIST_REDUCE_BLANKS # Remove superfolus blanks from each command being added to the history list

zstyle ':vcs_info:git:*' formats '%F{196}(%b)%f'
zstyle ':vcs_info:*' enable git

ベストアンサー1

状況によって異なり、時には上記のDevonが好きですが、互いに関係がなければ重要ではありません。たとえば、.zshrcで使用されていない、または.zshrcのどのエントリにも依存しない一連のエイリアスを定義したい場合は、任意の場所に配置できます。端末に何らかの出力を提供する場合、出力は .zshrc ファイルに置かれた順序で表示されます。

おすすめ記事