I've used Iterm2 with zsh everyday for the past 3 years, but I got a new computer and had to set it up again. The problem is that when I run ~/.zshrc
it works fine, but I have to do it on every new terminal window I open. Not a good experience.
I noticed that I don't have any bashrc
, bash_profile
, or profile
(dot)files on my new machine.
Here's the code in ~/.zshrc
:
export ZSH=/Users/healy/.oh-my-zsh
plugins=(
git
)
ZSH_THEME="agnoster"
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
DEFAULT_USER=healy
Again, it works perfectly (and as expected), but only after I run the source command, and that shouldn't be the case.
source evaluates or runs the content of a file. For example, if you source ~/. zshrc you apply the content of the file to the currently running Zsh process. You can source and valid Zsh code.
zshrc file is used to configure the zsh shell, you'll need to manually create one in your home directory for zsh to access. There's also a system-level zshrc file, but that is less commonly modified by users. Do note that if you install Oh My Zsh, a . zshrc file will be created automatically for you.
Enter the command ” touch ~/. zshrc“. A new file will be created in the directory. Open and edit the file with the text editor of your choice and save the changes.
Bash lacks syntax highlighting and auto-correction features. Zsh has syntax highlighting and auto-correction features. In bash keybinding is done using '. inputrc' and 'bind builtin'.
Make sure your export/source are added after the plugins in your zshrc, as stated in this post: oh-my-zsh config file not loading
On starting a new shell just run the command source ~/.zshrc
by configuring in the
Preferences -> Profiles -> Select Default Profile(default profile will be starred) -> General -> Command -> Select Login Shell -> Send text at start:
Enter the value source ~/.zshrc
.
You may add source ~/.zshrc; clear
in case you need to clear the screen contents after executing the command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With