質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
コマンドライン

コマンドライン(別名:Command Line Interface)は、ユーザに命令の入力を促す(プロンプト)文字列の表示を行い、すべての操作をキーボードを用いて文字列を打ち込む事でプログラムを走らせるユーザインターフェースです。

シェル

シェル(shell)はUnix や Linux 系のOSで使用されるコマンドインタプリタを指します。

zsh

zshは、UNIX系OSのシェルの1つです。 cshやksn系のコマンドライン編集機能も実装されたシェルです。

Q&A

解決済

1回答

1106閲覧

oh-my-zsh にて、「cd」コマンドを打たないとディレクトリ移動しないようにしたい

退会済みユーザー

退会済みユーザー

総合スコア0

コマンドライン

コマンドライン(別名:Command Line Interface)は、ユーザに命令の入力を促す(プロンプト)文字列の表示を行い、すべての操作をキーボードを用いて文字列を打ち込む事でプログラムを走らせるユーザインターフェースです。

シェル

シェル(shell)はUnix や Linux 系のOSで使用されるコマンドインタプリタを指します。

zsh

zshは、UNIX系OSのシェルの1つです。 cshやksn系のコマンドライン編集機能も実装されたシェルです。

0グッド

0クリップ

投稿2019/10/07 22:40

編集2019/10/08 11:57

iterm2にて、ログインシェルはzsh、oh-my-zshを導入しています。

oh-my-zsh導入の際、意味もほぼ分からずネットから拾ってきたコマンドをコピペして実行したため、「cd」コマンドを打たずにディレクトリ移動できるような設定になっています。

この設定を解除する方法が分からず、質問させていただきました。

どのファイルを見ればよいのかもわかっておりません。.zshrcがoh-my-zshの設定ファイルだというのはわかるのですが、どこを見ればよいのか分からず。。。
それとも他のファイルを見ないといけないのでしょうか?

宜しくお願い致します。

↓.zshrcファイルの中身

zshrc

1# If you come from bash you might have to change your $PATH. 2# export PATH=$HOME/bin:/usr/local/bin:$PATH 3 4# Path to your oh-my-zsh installation. 5export ZSH="/Users/ユーザ名/.oh-my-zsh" 6 7 8# Set name of the theme to load --- if set to "random", it will 9# load a random theme each time oh-my-zsh is loaded, in which case, 10# to know which specific one was loaded, run: echo $RANDOM_THEME 11# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 12ZSH_THEME="robbyrussell" 13 14# Set list of themes to pick from when loading at random 15# Setting this variable when ZSH_THEME=random will cause zsh to load 16# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ 17# If set to an empty array, this variable will have no effect. 18# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) 19 20# Uncomment the following line to use case-sensitive completion. 21# CASE_SENSITIVE="true" 22 23# Uncomment the following line to use hyphen-insensitive completion. 24# Case-sensitive completion must be off. _ and - will be interchangeable. 25# HYPHEN_INSENSITIVE="true" 26 27# Uncomment the following line to disable bi-weekly auto-update checks. 28# DISABLE_AUTO_UPDATE="true" 29 30# Uncomment the following line to automatically update without prompting. 31# DISABLE_UPDATE_PROMPT="true" 32 33# Uncomment the following line to change how often to auto-update (in days). 34# export UPDATE_ZSH_DAYS=13 35 36# Uncomment the following line if pasting URLs and other text is messed up. 37# DISABLE_MAGIC_FUNCTIONS=true 38 39# Uncomment the following line to disable colors in ls. 40# DISABLE_LS_COLORS="true" 41 42# Uncomment the following line to disable auto-setting terminal title. 43# DISABLE_AUTO_TITLE="true" 44 45# Uncomment the following line to enable command auto-correction. 46# ENABLE_CORRECTION="true" 47 48# Uncomment the following line to display red dots whilst waiting for completion. 49# COMPLETION_WAITING_DOTS="true" 50 51# Uncomment the following line if you want to disable marking untracked files 52# under VCS as dirty. This makes repository status check for large repositories 53# much, much faster. 54# DISABLE_UNTRACKED_FILES_DIRTY="true" 55 56# Uncomment the following line if you want to change the command execution time 57# stamp shown in the history command output. 58# You can set one of the optional three formats: 59# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 60# or set a custom format using the strftime function format specifications, 61# see 'man strftime' for details. 62# HIST_STAMPS="mm/dd/yyyy" 63 64# Would you like to use another custom folder than $ZSH/custom? 65# ZSH_CUSTOM=/path/to/new-custom-folder 66 67# Which plugins would you like to load? 68# Standard plugins can be found in ~/.oh-my-zsh/plugins/* 69# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 70# Example format: plugins=(rails git textmate ruby lighthouse) 71# Add wisely, as too many plugins slow down shell startup. 72plugins=(git) 73 74source $ZSH/oh-my-zsh.sh 75 76# User configuration 77 78# export MANPATH="/usr/local/man:$MANPATH" 79 80# You may need to manually set your language environment 81# export LANG=en_US.UTF-8 82 83# Preferred editor for local and remote sessions 84# if [[ -n $SSH_CONNECTION ]]; then 85# export EDITOR='vim' 86# else 87# export EDITOR='mvim' 88# fi 89 90# Compilation flags 91# export ARCHFLAGS="-arch x86_64" 92 93# Set personal aliases, overriding those provided by oh-my-zsh libs, 94# plugins, and themes. Aliases can be placed here, though oh-my-zsh 95# users are encouraged to define aliases within the ZSH_CUSTOM folder. 96# For a full list of active aliases, run `alias`. 97# 98# Example aliases 99# alias zshconfig="mate ~/.zshrc" 100# alias ohmyzsh="mate ~/.oh-my-zsh" 101

追記しました。

<oh-my-zsh.sh>の中身 # Set ZSH_CACHE_DIR to the path where cache files should be created # or else we will use the default cache/ if [[ -z "$ZSH_CACHE_DIR" ]]; then ZSH_CACHE_DIR="$ZSH/cache" fi # Migrate .zsh-update file to $ZSH_CACHE_DIR if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update fi # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh fi # Initializes Oh My Zsh # add a function path fpath=($ZSH/functions $ZSH/completions $fpath) # Load all stock functions (from $fpath files) called below. autoload -U compaudit compinit # Set ZSH_CUSTOM to the path where your custom config files # and plugins exists, or else we will use the default custom/ if [[ -z "$ZSH_CUSTOM" ]]; then ZSH_CUSTOM="$ZSH/custom" fi is_plugin() { local base_dir=$1 local name=$2 test -f $base_dir/plugins/$name/$name.plugin.zsh \ || test -f $base_dir/plugins/$name/_$name } # Add all defined plugins to fpath. This must be done # before running compinit. for plugin ($plugins); do if is_plugin $ZSH_CUSTOM $plugin; then fpath=($ZSH_CUSTOM/plugins/$plugin $fpath) elif is_plugin $ZSH $plugin; then fpath=($ZSH/plugins/$plugin $fpath) else echo "[oh-my-zsh] plugin '$plugin' not found" fi done # Figure out the SHORT hostname if [[ "$OSTYPE" = darwin* ]]; then # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible. SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/} else SHORT_HOST=${HOST/.*/} fi # Save the location of the current completion dump file. if [ -z "$ZSH_COMPDUMP" ]; then ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" fi if [[ $ZSH_DISABLE_COMPFIX != true ]]; then source $ZSH/lib/compfix.zsh # If completion insecurities exist, warn the user handle_completion_insecurities # Load only from secure directories compinit -i -C -d "${ZSH_COMPDUMP}" else # If the user wants it, load from all found directories compinit -u -C -d "${ZSH_COMPDUMP}" fi # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore for config_file ($ZSH/lib/*.zsh); do custom_config_file="${ZSH_CUSTOM}/lib/${config_file:t}" [ -f "${custom_config_file}" ] && config_file=${custom_config_file} source $config_file done # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do if [ -f $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH_CUSTOM/plugins/$plugin/$plugin.plugin.zsh elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH/plugins/$plugin/$plugin.plugin.zsh fi done # Load all of your custom configurations from custom/ for config_file ($ZSH_CUSTOM/*.zsh(N)); do source $config_file done unset config_file # Load the theme if [[ "$ZSH_THEME" == "random" ]]; then if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = "array" ]] && [[ "${#ZSH_THEME_RANDOM_CANDIDATES[@]}" -gt 0 ]]; then themes=($ZSH/themes/${^ZSH_THEME_RANDOM_CANDIDATES}.zsh-theme) else themes=($ZSH/themes/*zsh-theme) fi N=${#themes[@]} ((N=(RANDOM%N)+1)) RANDOM_THEME=${themes[$N]} source "$RANDOM_THEME" echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." else if [ ! "$ZSH_THEME" = "" ]; then if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ]; then source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ]; then source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" else source "$ZSH/themes/$ZSH_THEME.zsh-theme" fi fi fi

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

"/Users/ユーザ名/.oh-my-zsh/oh-my-zsh.sh"ですね。
1行ずつ、意味を調べていけばいいかと思います。

投稿2019/10/07 23:06

編集2019/10/08 04:42
otn

総合スコア84505

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2019/10/08 12:02

oh-my-zsh.shファイルの中身を見てみましたが、わかりませんでした。。 質問欄に追記しておりますので、もしお分かりになるようでしたら教えていただけますと幸いでございます。
otn

2019/10/08 12:43

/tmp とだけ打つと cd /tmp と同じ動きになるということであれば、 setopt AUTO_CD ですが、含まれてないですね。 いろいろsourceしているので、sourceしているどれかのファイルに書いてあるのでしょう。 それらのファイルを調べるか、 .zshrcの最後に、 unsetopt AUTO_CD と書けばとりあえずは無効にできます。
退会済みユーザー

退会済みユーザー

2019/10/31 20:49

お返事遅くなりました汗汗 解決致しました!ありがとうございました!^^
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問