Time to Tweak the Terminal#

Having played around with and gotten some comfort level with Vim with VS Code, I feel it’s time to start exploring using Vim from the terminal. Dun, Dun, Dun! I’ve very little experience with this apart from git and running the occassional hugo or gulp basic commands, also from within the VS Code environment.

In order to setup Vim properly and to make the most of the experience of writing Python, it’s the next logical step for me to get comfortable with the terminal. Already I’ve found a multitude of plugins, hacks and possibilities to alter the terminal experience, but let’s go step by step.

I want to have an idea of where I am in the terminal, in terms of location, but at present my terminal shows an enormous string on the command prompt line. Here’s an example"

(base) Communitymanager-work@David-Nevins-MacBook-Pro ~ %

This as you can imagine offers a high level of distraction and once I delve deeper into folders it becomes a mess. And yes, I know my computer name is a mess, I set it some years ago when I only ever considered the experience from inside the MacOS environment. Subsequent migrations with using full backups have carried over this mistake many times.

To change the command prompt text for a single use I found the following command on stackoverflow.


Warning: Rabbit hole!

Z-Shell Customizing#

Following the advise of these two videos by Corey Schafer:

  1. Customizing Your Terminal: .bash_profile and .bashrc files
  2. Customizing Your Terminal: Adding Color and Information to Your Prompt

I went through the process of exploring both video’s and in doing so stumbled across the depreciation warning in my MacOS bash shell. After a little reading of this excellent series Scripting OX and then switched my setup to zsh or z-shell, as the preferred/recommended MacOS terminal default.

I also discovered Oh-my-zsh but that is taking it too far for me at the moment.

I just want a few tweaks to offer a few handrails while I get into terminal usage.

For anyone interested, the zsh manual is here. zsh options

I choose to use the ~/.zshrc for my personal configurations.

This zsh/Misc/vcs_info-examples github was the basis for the git functionality in the command line.

This is what I ended up with: (edited to remove anaconda and other config details)

autoload -Uz vcs_info

precmd() {
    if [[ -z ${vcs_info_msg_0_} ]]; then
        PS1="%5~%# "
        PS1="%2~${vcs_info_msg_0_}%# "
setopt prompt_subst

# Enable wildcard search and tab through options

# Auto change to directory if directory name is used
setopt AUTO_CD

# Remember history from previous sessions

# Add additional info to shell history


# share history across multiple zsh sessions
# append to history

# adds commands as they are typed, not at shell exit

# expire duplicates first
# do not store duplications
#ignore duplicates when searching
# removes blank lines from history
# When you mistype a command or path, the shell is usually unforgiving. In zsh you can enable correction.
setopt CORRECT

alias ll='ls -al'


Vim Config#

This it seems is a whole entire universe. In nuce, I went with a combination of these two configurations. It will evolve as my understanding of my needs evolve.

  1. https://github.com/oidz1234/vimrc/blob/main/.vimrc
  2. https://vim.fandom.com/wiki/Example_vimrc

I installed the Vim Plug following instructions from here: Linux Devices which lead me to simply go with the automatic installation guide from Junegunn Choi here.

So, I’m set up in Vim, feeling smooth but still don’t know how to use tabs, filetree or everything else beyond basic commands.