bashからzshへ移行しようと作業中なのですが、もともと、.bash_profileや.bashrcなどもコピペで行なっていたため、エラーの勝手が分からない状態です。
現在のエラー状態としては、Visual Studio Codeのターミナルにて、source ~/.zshrc
とすると下記のようなエラーとなります。
bash
1$:~ ユーザーネーム$ source ~/.zshrc 2bash: autoload: command not found 3bash: /Users/ユーザーネーム/.oh-my-zsh/oh-my-zsh.sh: line 31: syntax error near unexpected token `(' 4bash: /Users/ユーザーネーム/.oh-my-zsh/oh-my-zsh.sh: line 31: `for config_file ($ZSH/lib/*.zsh); do' 5bash: autoload: command not found 6bash: compinit: command not found 7bash: zmodload: command not found 8bash: bindkey: command not found 9bash: bindkey: command not found 10bash: bindkey: command not found 11bash: bindkey: command not found 12bash: setopt: command not found 13bash: setopt: command not found 14bash: bindkey: command not found 15bash: autoload: command not found 16bash: compinit: command not found 17bash: /Users/ユーザーネーム/.zshrc: line 132: syntax error: unexpected end of file 18 19# ~~~~~~~.zshrcファイル ~~~~~~~ 20 21# If you come from bash you might have to change your $PATH. 22# export PATH=$HOME/bin:/usr/local/bin:$PATH 23 24# Path to your oh-my-zsh installation. 25export ZSH=/Users/ユーザーネーム/.oh-my-zsh 26 27# Set name of the theme to load. Optionally, if you set this to "random" 28# it'll load a random theme each time that oh-my-zsh is loaded. 29# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 30ZSH_THEME="wedisagree" 31 32# Set list of themes to load 33# Setting this variable when ZSH_THEME=random 34# cause zsh load theme from this variable instead of 35# looking in ~/.oh-my-zsh/themes/ 36# An empty array have no effect 37# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) 38 39# Uncomment the following line to use case-sensitive completion. 40# CASE_SENSITIVE="true" 41 42# Uncomment the following line to use hyphen-insensitive completion. Case 43# sensitive completion must be off. _ and - will be interchangeable. 44# HYPHEN_INSENSITIVE="true" 45 46# Uncomment the following line to disable bi-weekly auto-update checks. 47DISABLE_AUTO_UPDATE="true" 48 49# Uncomment the following line to change how often to auto-update (in days). 50# export UPDATE_ZSH_DAYS=13 51 52# Uncomment the following line to disable colors in ls. 53# DISABLE_LS_COLORS="true" 54 55# Uncomment the following line to disable auto-setting terminal title. 56# DISABLE_AUTO_TITLE="true" 57 58# Uncomment the following line to enable command auto-correction. 59# ENABLE_CORRECTION="true" 60 61# Uncomment the following line to display red dots whilst waiting for completion. 62# COMPLETION_WAITING_DOTS="true" 63 64# Uncomment the following line if you want to disable marking untracked files 65# under VCS as dirty. This makes repository status check for large repositories 66# much, much faster. 67# DISABLE_UNTRACKED_FILES_DIRTY="true" 68 69# Uncomment the following line if you want to change the command execution time 70# stamp shown in the history command output. 71# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 72# HIST_STAMPS="mm/dd/yyyy" 73 74# Would you like to use another custom folder than $ZSH/custom? 75# ZSH_CUSTOM=/path/to/new-custom-folder 76 77# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) 78# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 79# Example format: plugins=(rails git textmate ruby lighthouse) 80# Add wisely, as too many plugins slow down shell startup. 81export PATH="/usr/local/bin:/usr/local/sbin:$PATH" 82plugins=(git) 83 84source $ZSH/oh-my-zsh.sh 85 86# User configuration 87 88# export MANPATH="/usr/local/man:$MANPATH" 89 90# You may need to manually set your language environment 91# 日本語を使用 92export LANG=ja_JP.UTF-8 93 94# Preferred editor for local and remote sessions 95# if [[ -n $SSH_CONNECTION ]]; then 96# export EDITOR='vim' 97# else 98# export EDITOR='mvim' 99# fi 100 101# Compilation flags 102# export ARCHFLAGS="-arch x86_64" 103 104# ssh 105# export SSH_KEY_PATH="~/.ssh/rsa_id" 106 107# Set personal aliases, overriding those provided by oh-my-zsh libs, 108# plugins, and themes. Aliases can be placed here, though oh-my-zsh 109# users are encouraged to define aliases within the ZSH_CUSTOM folder. 110# For a full list of active aliases, run `alias`. 111# 112# Example aliases 113# alias zshconfig="mate ~/.zshrc" 114# alias ohmyzsh="mate ~/.oh-my-zsh" 115 116# Lines configured by zsh-newuser-install 117#文字コードをUTF-8に設定 118export EDITORP=vim 119 120# 補完 121autoload -Uz compinit 122compinit 123 124# 補完候補のメニュー選択で、矢印キーの代わりにhjklで移動出来るようにする。 125zmodload zsh/complist 126bindkey -M menuselect 'h' vi-backward-char 127bindkey -M menuselect 'j' vi-down-line-or-history 128bindkey -M menuselect 'k' vi-up-line-or-history 129bindkey -M menuselect 'l' vi-forward-char 130 131# history 132HISTFILE=~/work/dotfils/zsh/.zsh_hist 133HISTSIZE=1000 134SAVEHIST=1000 135setopt extended_history #ヒストリに実行時間も保存 136setopt hist_ignore_dups #直前と同じコマンドはヒストリに追加しない 137 138#vi ライクな操作ができる 139bindkey -v 140# End of lines configured by zsh-newuser-install 141# The following lines were added by compinstall 142 143autoload -Uz compinit 144compinit 145 146# 147# setopt 148# 149 150# cdの後にlsを実行 151chpwd() { ls -ltrG } 152 153 154# ~~~~~~~/etc/shellsファイル ~~~~~~~ 155# List of acceptable shells for chpass(1). 156# Ftpd will not allow users to connect who are not using 157# one of these shells. 158 159/bin/bash 160/bin/csh 161/bin/ksh 162/bin/sh 163/bin/tcsh 164/bin/zsh 165/usr/local/bin/zsh 166 167$ chsh -s /usr/local/bin/zsh 168
.zshrcファイルに関しては参考サイトに記載されているものに対して検索をかけ引っかかったらコメント外し記入、ない場合はファイル下の方にコメントとともに記載しております。
一応、iterm2、terminalのほうでは、oh-my-zsh
を入れているため、問題なく使えております。
質問
- エラーにbashとなっているため、zshを反映させる必要がある?そのために
chsh -s /usr/local/bin/zsh
とやったつもりではいたのですが認識間違っているでしょうか?
vscodeでもiterm2や、terminalで同じ様に使えるように設定するにはどうすればいいでしょうか?
- bashのときはキー操作の設定を
.vimrc
にて記述してありました。zshの場合では、.zshrc
にまとめて記載してしまっていいのでしょうか?
CLI操作に不慣れで至らない点が多々あるかと思いますが、アドバイスいただけると助かります。
よろしくお願いします。
参考サイト
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/23 06:11