I recently installed Oh My Zsh and VS code. Whenever I enter git commit
it doesn't open up code, instead it displays the following error message:
hint: Waiting for your editor to close the file... error: cannot run code: No such file or directory
error: unable to start editor 'code'
Please supply the message using either -m or -F option.
I am able to just run code by entering code
in the terminal.
Steps taken:
I've added the following line to my.zshrc
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
plugins=(... vscode)
I've run this line:
git config --global core.editor "code --wait"
I've added these lines in my settings.json in Code
"terminal.external.osxExec": "iTerm.app",
"terminal.explorerKind": "external",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.shell.linux": "/bin/zsh"
}
What am I missing? Thanks!
Based on your output, which is:
error: cannot run code: No such file or directory
code
is not available in your $PATH environment variable. That can be easily solved:
Shell Command: Install 'code' command in PATH.
And done, that should do the trick.
Specific to Zsh, my .zshrc
file also has this line:
export EDITOR="code -w"
But this might not be relevant in the context of Git, it's useful for other binaries that use VSCode as editor.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.