This document serves as an informational guide on how I've customized my terminal in macOS and Linux. It includes a variety of configurations, settings, and programs that enhance my productivity and improve my overall experience within the terminal environment. The document is divided into several sections, each focusing on a different aspect of terminal customization, such as shell frameworks, themes, resource files, plugins, and more.
Disclaimer
This guide assumes you have a basic understanding of the Unix terminal and are comfortable working with configuration files. If you're new to the terminal or need clarification on any of the instructions provided, I recommend proceeding with caution and seeking additional resources or assistance.
Useful Programs
The following table consists of CLI programs that have been useful to me in my day-to-day work. These programs are divided into two categories: Third Party Package Managers (TPPM) and Native Package Managers (NPM).
The TPPM section features programs that can be installed via package managers like Homebrew, Pip, Cargo, Npm, Gem, or Git(1). For each program, I've included a brief description, the operating systems it supports, and the package managers available for installation.
While all of these programs can be installed manually with git, they will only be marked as such if it is recommended by the program's documentation, myself, or if it's the only available method.
The NPM section lists programs that can be installed using the system's default package manager. Since I primarily use Debian and Arch-based Linux distributions, all the programs in this section are confirmed to be installable via apt or pacman. For other Linux distributions, refer to Repology to see if the program is available via your distribution's package manager. Like the TPPM section, I've included additional information such as a brief description of each program and a link to its Repology page.
Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.
Use ImageMagick® to create, edit, compose, or convert digital images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, WebP, HEIC, SVG, PDF, DPX, EXR and TIFF.
Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.
Use ImageMagick® to create, edit, compose, or convert digital images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, WebP, HEIC, SVG, PDF, DPX, EXR and TIFF.
Yes magick
More info here. Recommended install method: Homebrew.
Not a command. Zsh must be installed. Recommended install method: Git.
Z Shell (Zsh)
The Z shell, or zsh, is a powerful and feature-rich shell that offers many improvements over the default shells provided by most Unix-based operating systems. It includes advanced features such as improved tab completion, spelling correction, and shared command history, making it a popular choice among developers and power users. This section covers the shell framework, theme, resource file, plugins, and aliases that I use to customize my zsh environment.
Shell Framework
A framework makes customizing the shell much more manageable, whether it be through plugins or themes. I often prefer complete control over my configurations, but the convenience provided by a framework has dramatically improved my workflow and ease of management.
Due to its popularity, reliability, and consistent updates, my framework of choice has become oh-my-zsh. As one of the leading zsh frameworks, it made its initial commit on August 23, 2009, allowing it enough time to improve and refine its features.
Shell Theme
Similar to how a shell framework enhances the shell's functionality, a shell theme improves its appearance and user experience. A well-designed theme can provide valuable information at a glance, such as the current directory, git branch, and other relevant details.
My preferred shell theme is Starship, which draws inspiration from several well-known and popular shell themes. It is written in Rust, making it fast, lightweight, and highly customizable. Starship is designed to support a wide range of shells and external tools, making it a versatile choice for users across different platforms.
Before Starship, I used Powerlevel10k, which is another excellent shell theme. However, as of May 21, 2024, Powerlevel10k has entered a "life support" mode. In the maintainer's words, "The project has very limited support", with "no new features [in the works]", "most bugs will go unfixed", and "help requests will be ignored". As a result, I searched for an alternative and found Starship to be a suitable replacement.
Zsh Resource File
The .zshrc file is where all the configurations for zsh are stored. It's the primary resource file for customizing the shell, containing settings, aliases, and other configurations that define its behavior and appearance.
Below is the content of my .zshrc file, divided into two sections: one for macOS and one for Linux. Each section is tailored to its respective operating system. You're welcome to use this resource however you like. I offer it as a guide for structuring your own .zshrc file and to present additional configurations not detailed elsewhere in this document.
####[ Oh-My-Zsh Configurations ]######################################################### Path to your oh-my-zsh installation.exportZSH="$HOME/.oh-my-zsh"# Set name of the theme to load --- if set to "random", it will# load a random theme each time oh-my-zsh is loaded, in which case,# to know which specific one was loaded, run: echo $RANDOM_THEME# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#ZSH_THEME=""# Uncomment the following line to use case-sensitive completion.# CASE_SENSITIVE="true"# Uncomment the following line to use hyphen-insensitive completion.# Case-sensitive completion must be off. _ and - will be interchangeable.# HYPHEN_INSENSITIVE="true"# Uncomment the following line if pasting URLs and other text is messed up.# DISABLE_MAGIC_FUNCTIONS=true# Uncomment the following line to enable command auto-correction.# ENABLE_CORRECTION="true"# Disable audo updates for ohmyzsh. This is taken care of by chezmoi.DISABLE_AUTO_UPDATE="true"# Uncomment the following line if you want to change the command execution time# stamp shown in the history command output.# You can set one of the optional three formats:# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"# or set a custom format using the strftime function format specifications,# see 'man strftime' for details.HIST_STAMPS="yyyy-mm-dd"# 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.# MAYBE: Add `command-not-found` plugin.plugins=(colored-man-pagescopybuffercopypathcopyfilebgnotify)####[ Pre `compinit` ]###################################################################### These are configurations that have to be set before the `compinit` function is#### called, which is done when sourcing the 'oh-my-zsh.sh' file.## Zsh plugin for completions.## This plugin is installed via chezmoi, specified in the '.chezmoiexternal.toml' file.zsh_completion="${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src"[[-d$zsh_completion]]&&fpath+=${zsh_completion}# Rustup completions.# $ rustup completions zsh > ~/.zfunc/_rustup[[-f~/.zfunc/_rustup]]&&fpath+=~/.zfunc
####[ Source Oh-My-Zsh ]################################################################source"$ZSH/oh-my-zsh.sh"####[ Aliases ]############################################################################### [ Group 1 ]##### General aliases.aliasic="cd ~/Library/Mobile\ Documents/com~apple~CloudDocs"aliasedisk="cd /Volumes && ll"aliaszls="eza"aliasrmdsstore="find . -name '*.DS_Store' -type f -delete"aliascode="open -a 'Visual Studio Code.app' ."aliasformatc="find . -name '*.cs' -type f -exec clang-format --style='file:$HOME/Programs/Mine/Formatter Configs/CSharp_clang-format/_clang-format' -i {} +"aliasupdatebrew="brew update && brew upgrade && brew autoremove && brew cleanup && brew doctor"###### [ Group 2 ]###### Due to the number of commands that I find to be useful, I've created aliases### containing some of these commands. They are specifically commands that I don't### often use, but are useful to have on hand. Having these aliases allows me to see### a list of these commands, without having to commit them to memeory.###aliaslt="echo -e \"####[ Installed Commands ]##############################################################bandwhich - Terminal bandwidth utilization tool.bat - A cat(1) clone with wings.cheat - Allows you to create and view interactive cheatsheets on the command-line.codespell - Check code for common misspellings.duf - Disk Usage/Free Utility - a better 'df' alternative.fzf - A command-line fuzzy finder.ncdu - ncdu (NCurses Disk Usage) is a curses-based version of the well-known 'du'.pstree - List processes as a tree.tmux - Terminal multiplexer.####[[ Grouped Commands ]]##############################################################lt_conversion - List of programs used for converting the formats of videos, images, etc.lt_git - List of programs used for git related commands.####[ Keyboard Combinations ]###########################################################Ctrl + O - Allows you to copy what you are currently typing, via 'Ctrl' + 'O'.\""aliaslt_conversion="echo -e \"####[ Image and Video Formatters ]######################################################ffmpeg - FFmpeg is a collection of libraries and tools to process multimedia content.magick - Convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.\""aliaslt_git="echo -e \"####[ Git Related Commands ]############################################################lazygit - Simple terminal UI for git commands.git open - Opens the GitHub page for a repo/branch in your browser.\""####[ Environmental Variables ]########################################################## 1Password auth socket.exportSSH_AUTH_SOCK="$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"# Path purpose:# /usr/local/opt/curl/bin: ...# /usr/local/sbin: ???# /usr/local/opt/openjdk@17/bin: Prefered java version.# /usr/local/opt/node@18/bin: Prefered node version.# /usr/local/opt/ruby/bin: Prefered ruby version.exportPATH="/usr/local/opt/curl/bin:/usr/local/sbin:/usr/local/opt/openjdk@17/bin:/usr/local/opt/node@18/bin:/usr/local/opt/ruby/bin:$PATH"# Modifies the colors of files and directories when using `ls`.exportLSCOLORS="exgxfxDxcxegDaabagacaD"## Version of LSCOLORS compatible with zsh and GNU based commands.## You can find more information about LS_COLORS and why it's needed in addition to## LSCOLORS, here: https://github.com/ohmyzsh/ohmyzsh/issues/6060#issuecomment-327934559exportLS_COLORS="di=34:ln=36:so=35:pi=1;33:ex=32:bd=34;46:cd=1;33;40:su=30;41:sg=30;46:tw=30;42:ow=30;1;43"## Set default editor.ifhashnvim2>/dev/null;thenexportEDITOR=nvim
exportVISUAL=$EDITORfi# Node Version Manager (NVM) configurations.exportNVM_DIR="$HOME/.nvm"####[ Sourced Files ]##################################################################### Load NVM.[-s"$NVM_DIR/nvm.sh"]&&\."$NVM_DIR/nvm.sh"# This loads nvm[-s"$NVM_DIR/bash_completion"]&&\."$NVM_DIR/bash_completion"# This loads nvm bash_completion## Zsh plugin for syntax highlighting.## This plugin is installed via chezmoi, specified in the '.chezmoiexternal.toml' file.zsh_syntax_highlighting="${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"[[-f$zsh_syntax_highlighting]]&&source"$zsh_syntax_highlighting"## Zsh plugin for autosuggestions.## This plugin is installed via chezmoi, specified in the '.chezmoiexternal.toml' file.zsh_autosuggestions="${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"[[-f$zsh_autosuggestions]]&&source"$zsh_autosuggestions"## Zsh plugin for fzf-tab.## This plugin is installed via chezmoi, specified in the '.chezmoiexternal.toml' file.fzf_tab="${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab/fzf-tab.plugin.zsh"[[-f$fzf_tab]]&&hashfzf2>/dev/null&&source"$fzf_tab"## Source the plugins.sh file for the `op` command.[[-f$HOME/.config/op/plugins.sh]]\&&source"$HOME/.config/op/plugins.sh"####[ Zsh Style Configurations ]######################################################### Disable sort when completing `git checkout`.zstyle':completion:*:git-checkout:*'sortfalse# Set descriptions format to enable group support.# NOTE: Don't use escape sequences here, fzf-tab will ignore them.zstyle':completion:*:descriptions'format'[%d]'# Set list-colors to enable filename colorizing.zstyle':completion:*'list-colors${(s.:.)LS_COLORS}## Preview directory's content with `eza` when completing `cd`.hasheza2>/dev/null\&&zstyle':fzf-tab:complete:cd:*'fzf-preview'eza -1 --color=always $realpath'# Switch group using `<` and `>`.zstyle':fzf-tab:*'switch-group'<''>'####[ End of File Configurations ]########################################################## These are configurations that are specified to be placed at the end of the file, by#### the developer/documentation.# Initialize Starship prompt, if it is installed and $ZSH_THEME is not set.hashstarship2>/dev/null\&&[[-z$ZSH_THEME]]\&&eval"$(starshipinitzsh)"####[ Others ]############################################################################## These are generally configurations set up by setup scripts or other programs.
####[ Oh-My-Zsh Configurations ]######################################################### Path to your oh-my-zsh installation.exportZSH="$HOME/.oh-my-zsh"# Set name of the theme to load --- if set to "random", it will# load a random theme each time oh-my-zsh is loaded, in which case,# to know which specific one was loaded, run: echo $RANDOM_THEME# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#ZSH_THEME=""# Uncomment the following line to use case-sensitive completion.# CASE_SENSITIVE="true"# Uncomment the following line to use hyphen-insensitive completion.# Case-sensitive completion must be off. _ and - will be interchangeable.# HYPHEN_INSENSITIVE="true"# Uncomment the following line if pasting URLs and other text is messed up.# DISABLE_MAGIC_FUNCTIONS=true# Uncomment the following line to enable command auto-correction.# ENABLE_CORRECTION="true"# Disable audo updates for ohmyzsh. This is taken care of by chezmoi.DISABLE_AUTO_UPDATE="true"# Uncomment the following line if you want to change the command execution time# stamp shown in the history command output.# You can set one of the optional three formats:# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"# or set a custom format using the strftime function format specifications,# see 'man strftime' for details.HIST_STAMPS="yyyy-mm-dd"# Which plugins would you like to load?# Standard plugins can be found in $ZSH/plugins/# Custom plugins may be added to $ZSH_CUSTOM/plugins/# Example format: plugins=(rails git textmate ruby lighthouse)# Add wisely, as too many plugins slow down shell startup.#plugins=(colored-man-pages copybuffer copypath copyfile bgnotify command-not-found) # Desktopplugins=(colored-man-pagescommand-not-found)# Server####[ Pre `compinit` ]###################################################################### These are configurations that have to be set before the `compinit` function is#### called, which is done when sourcing the 'oh-my-zsh.sh' file.## Zsh plugin for completions.## This plugin is installed via chezmoi, specified in the '.chezmoiexternal.toml' file.zsh_completion="${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src"[[-d$zsh_completion]]&&fpath+=${zsh_completion}# Rustup completions.# $ rustup completions zsh > ~/.zfunc/_rustup[[-f~/.zfunc/_rustup]]&&fpath+=~/.zfunc
####[ Source Oh-My-Zsh ]################################################################source"$ZSH/oh-my-zsh.sh"####[ Aliases ]############################################################################### [ Group 1 ]##### General aliases.aliaszls="eza"aliasformatc="find . -name '*.cs' -type f -exec clang-format --style='file:$HOME/Programs/Mine/Formatter Configs/CSharp_clang-format/_clang-format' -i {} +"aliasupdate-grub-config="sudo grub-mkconfig -o /boot/grub/grub.cfg"hashxdg-open2>/dev/null&&aliasopen="xdg-open"## Update based aliases.aliasupdateapt="sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt autoclean"aliasupdatepacman="sudo pacman -Syu && yay && yay -Yc"## Systemd aliases.aliasstart-bluetooth="sudo systemctl start bluetooth.service"aliasstop-bluetooth="sudo systemctl stop bluetooth.service"aliasstart-vmware-networking="sudo systemctl start vmware-networks.service"aliasstop-vmware-networking="sudo systemctl stop vmware-networks.service"aliasstart-firewalld="sudo systemctl start firewalld.service"aliasstop-firewalld="sudo systemctl stop firewalld.service"###### [ Group 2 ]###### Due to the number of commands that I find to be useful, I've created aliases### containing some of these commands. They are specifically commands that I don't### often use, but are useful to have on hand. Having these aliases allows me to see### a list of these commands, without having to commit them to memeory.###aliaslt="echo -e \"####[ Installed Commands ]##############################################################bandwhich - Terminal bandwidth utilization tool.bat - A cat(1) clone with wings.cheat - Allows you to create and view interactive cheatsheets on the command-line.codespell - Check code for common misspellings.duf - Disk Usage/Free Utility - a better 'df' alternative.fzf - A command-line fuzzy finder.ncdu - ncdu (NCurses Disk Usage) is a curses-based version of the well-known 'du'.pstree - List processes as a tree.tmux - Terminal multiplexer.####[[ Grouped Commands ]]##############################################################lt_conversion - List of programs used for converting the formats of videos, images, etc.lt_git - List of programs used for git related commands.####[ Keyboard Combinations ]###########################################################Ctrl + O - Allows you to copy what you are currently typing, via 'Ctrl' + 'O'.\""aliaslt_conversion="echo -e \"####[ Image and Video Formatters ]######################################################ffmpeg - FFmpeg is a collection of libraries and tools to process multimedia content.magick - Convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.\""aliaslt_git="echo -e \"####[ Git Related Commands ]############################################################lazygit - Simple terminal UI for git commands.git open - Opens the GitHub page for a repo/branch in your browser.\""####[ Environmental Variables ]########################################################### Path purpose:## $HOME/.local/bin: User installed binaries.## /opt/nvim-linux64/bin: Neovim binary.exportPATH="$HOME/.local/bin:$PATH"[[-d/opt/nvim-linux64/bin]]&&exportPATH="/opt/nvim-linux64/bin:$PATH"# Modifies the colors of files and directories in the terminal.exportLS_COLORS="di=34:ln=36:so=35:pi=1;33:ex=32:bd=34;46:cd=1;33;40:su=30;41:sg=30;46:tw=30;42:ow=30;1;43"## Set default editor.ifhashnvim2>/dev/null;thenexportEDITOR=nvim
exportVISUAL=$EDITORfi# Node Version Manager (NVM) configurations.exportNVM_DIR="$HOME/.nvm"####[ Sourced Files ]##################################################################### Load NVM.[-s"$NVM_DIR/nvm.sh"]&&\."$NVM_DIR/nvm.sh"# This loads nvm[-s"$NVM_DIR/bash_completion"]&&\."$NVM_DIR/bash_completion"# This loads nvm bash_completion## Zsh plugin for syntax highlighting.## This plugin is installed via chezmoi, specified in the '.chezmoiexternal.toml' file.zsh_syntax_highlighting="${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"[[-f$zsh_syntax_highlighting]]&&source"$zsh_syntax_highlighting"## Zsh plugin for autosuggestions.## This plugin is installed via chezmoi, specified in the '.chezmoiexternal.toml' file.zsh_autosuggestions="${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"[[-f$zsh_autosuggestions]]&&source"$zsh_autosuggestions"## Zsh plugin for fzf-tab.## This plugin is installed via chezmoi, specified in the '.chezmoiexternal.toml' file.fzf_tab="${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab/fzf-tab.plugin.zsh"[[-f$fzf_tab]]&&hashfzf2>/dev/null&&source"$fzf_tab"## Source the plugins.sh file for the `op` command.[[-f$HOME/.config/op/plugins.sh]]\&&source"$HOME/.config/op/plugins.sh"####[ Zsh Style Configurations ]######################################################### Disable sort when completing `git checkout`.zstyle':completion:*:git-checkout:*'sortfalse# Set descriptions format to enable group support.# NOTE: Don't use escape sequences here, fzf-tab will ignore them.zstyle':completion:*:descriptions'format'[%d]'# Set list-colors to enable filename colorizing.zstyle':completion:*'list-colors${(s.:.)LS_COLORS}## Preview directory's content with `eza` when completing `cd`.hasheza2>/dev/null\&&zstyle':fzf-tab:complete:cd:*'fzf-preview'eza -1 --color=always $realpath'# Switch group using `<` and `>`.zstyle':fzf-tab:*'switch-group'<''>'####[ End of File Configurations ]########################################################## These are configurations that are specified to be placed at the end of the file, by#### the developer/documentation.# Initialize Starship prompt, if it is installed and $ZSH_THEME is not set.hashstarship2>/dev/null\&&[[-z$ZSH_THEME]]\&&eval"$(starshipinitzsh)"####[ Others ]############################################################################## These are generally configurations set up by setup scripts or other programs.
Oh-my-zsh Plugins
oh-my-zsh provides more than 325 built-in plugins that are regularly updated and maintained by the community. These plugins offer a wide range of features, from syntax highlighting and auto-completion to git integration and directory navigation.
Below are all the plugins that I use, along with a brief description of their functionality:
This plugin uses the command-not-found package for zsh to provide suggested packages to be installed if a command cannot be found.
No
Aliases
Many frameworks, such as oh-my-zsh, provide their own set of aliases to simplify and improve common commands. Any CLI user will tell you that aliases are a powerful tool for increasing productivity and efficiency. They allow you to create shortcuts for frequently used commands, reducing the time and effort required to type them out.
Below are aliases I've create, organized into two groups: Group 1 and Group 2. Group 1 contains general aliases, while Group 2 includes aliases for displaying useful programs I don't frequently use and often forget about.
####[ Aliases ]############################################################################### [ Group 1 ]##### General aliases.aliasic="cd ~/Library/Mobile\ Documents/com~apple~CloudDocs"aliasedisk="cd /Volumes && ll"aliaszls="eza"aliasrmdsstore="find . -name '*.DS_Store' -type f -delete"aliascode="open -a 'Visual Studio Code.app' ."aliasformatc="find . -name '*.cs' -type f -exec clang-format --style='file:$HOME/Programs/Mine/Formatter Configs/CSharp_clang-format/_clang-format' -i {} +"aliasupdatebrew="brew update && brew upgrade && brew autoremove && brew cleanup && brew doctor"###### [ Group 2 ]###### Due to the number of commands that I find to be useful, I've created aliases### containing some of these commands. They are specifically commands that I don't### often use, but are useful to have on hand. Having these aliases allows me to see### a list of these commands, without having to commit them to memeory.###aliaslt="echo -e \"####[ Installed Commands ]##############################################################bandwhich - Terminal bandwidth utilization tool.bat - A cat(1) clone with wings.cheat - Allows you to create and view interactive cheatsheets on the command-line.codespell - Check code for common misspellings.duf - Disk Usage/Free Utility - a better 'df' alternative.fzf - A command-line fuzzy finder.ncdu - ncdu (NCurses Disk Usage) is a curses-based version of the well-known 'du'.pstree - List processes as a tree.tmux - Terminal multiplexer.####[[ Grouped Commands ]]##############################################################lt_conversion - List of programs used for converting the formats of videos, images, etc.lt_git - List of programs used for git related commands.####[ Keyboard Combinations ]###########################################################Ctrl + O - Allows you to copy what you are currently typing, via 'Ctrl' + 'O'.\""aliaslt_conversion="echo -e \"####[ Image and Video Formatters ]######################################################ffmpeg - FFmpeg is a collection of libraries and tools to process multimedia content.magick - Convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.\""aliaslt_git="echo -e \"####[ Git Related Commands ]############################################################lazygit - Simple terminal UI for git commands.git open - Opens the GitHub page for a repo/branch in your browser.\""
####[ Aliases ]############################################################################### [ Group 1 ]##### General aliases.aliaszls="eza"aliasformatc="find . -name '*.cs' -type f -exec clang-format --style='file:$HOME/Programs/Mine/Formatter Configs/CSharp_clang-format/_clang-format' -i {} +"aliasupdate-grub-config="sudo grub-mkconfig -o /boot/grub/grub.cfg"hashxdg-open2>/dev/null&&aliasopen="xdg-open"## Update based aliases.aliasupdateapt="sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt autoclean"aliasupdatepacman="sudo pacman -Syu && yay && yay -Yc"## Systemd aliases.aliasstart-bluetooth="sudo systemctl start bluetooth.service"aliasstop-bluetooth="sudo systemctl stop bluetooth.service"aliasstart-vmware-networking="sudo systemctl start vmware-networks.service"aliasstop-vmware-networking="sudo systemctl stop vmware-networks.service"aliasstart-firewalld="sudo systemctl start firewalld.service"aliasstop-firewalld="sudo systemctl stop firewalld.service"###### [ Group 2 ]###### Due to the number of commands that I find to be useful, I've created aliases### containing some of these commands. They are specifically commands that I don't### often use, but are useful to have on hand. Having these aliases allows me to see### a list of these commands, without having to commit them to memeory.###aliaslt="echo -e \"####[ Installed Commands ]##############################################################bandwhich - Terminal bandwidth utilization tool.bat - A cat(1) clone with wings.cheat - Allows you to create and view interactive cheatsheets on the command-line.codespell - Check code for common misspellings.duf - Disk Usage/Free Utility - a better 'df' alternative.fzf - A command-line fuzzy finder.ncdu - ncdu (NCurses Disk Usage) is a curses-based version of the well-known 'du'.pstree - List processes as a tree.tmux - Terminal multiplexer.####[[ Grouped Commands ]]##############################################################lt_conversion - List of programs used for converting the formats of videos, images, etc.lt_git - List of programs used for git related commands.####[ Keyboard Combinations ]###########################################################Ctrl + O - Allows you to copy what you are currently typing, via 'Ctrl' + 'O'.\""aliaslt_conversion="echo -e \"####[ Image and Video Formatters ]######################################################ffmpeg - FFmpeg is a collection of libraries and tools to process multimedia content.magick - Convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.\""aliaslt_git="echo -e \"####[ Git Related Commands ]############################################################lazygit - Simple terminal UI for git commands.git open - Opens the GitHub page for a repo/branch in your browser.\""
Modifying CLI Colors
You can customize the colors of folders, files, and other items in the terminal by setting the LS_COLORS or LSCOLORS environment variables.(1) Each variable uses a unique format to specify the colors and styles of different file types and directories. For more information regarding these variables, refer to the "CLI Colors Explained" drop-down.
Linux only requires LS_COLORS, while macOS needs both LS_COLORS and LSCOLORS to be set.
CLI Colors Explained
Between macOS and Linux, there is a slight difference in how CLI colors are configured. macOS requires both LSCOLORS and LS_COLORS to fully enable and set CLI colors within the terminal. Conversely, Linux only needs LS_COLORS to achieve the same.
This difference arises from the distinct version of the ls command on macOS and Linux. macOS employs the FreeBSD version of ls, which relies on LSCOLORS to define the color scheme for file and directory listings. In contrast, Linux uses the GNU version, which depends on LS_COLORS for the same purpose. On both systems, LS_COLORS is also used by shells like zsh to colorize other tools and utilities.
Included below is a key that explains the values of LSCOLORS and LS_COLORS in my configurations:
LSCOLORS
LS_COLORS
Type
Text Color
Foreground/Background Color
ex
di=34
Directories
blue
default
gx
ln=36
Symbolic link
cyan
default
fx
so=35
Socket
magenta
default
Dx
pi=1;33
Pipe
bold yellow
default
cx
ex=32
Executable
green
default
eg
bd=34;46
Block special
green
cyan
Da
cd=1;33;40
Character special
bold yellow
black
ab
su=30;41
Executable with setuid bit set
black
red
ag
sg=30;46
Executable with setgid bit set
black
cyan
ac
tw=30;42
Directory writeable to others (with a sticky bit)
black
green
aD
ow=30;1;43
Directory writeable to others (without sticky bit)
black
bold yellow
I recommend visiting this gist for an in-depth understanding of the LS_COLORS and LSCOLORS values.
The below configurations are my LS_COLORS and LSCOLORS settings for macOS and Linux. To use them, add the code to your .zshrc file:
# Modifies the colors of files and directories when using `ls`.exportLSCOLORS="exgxfxDxcxegDaabagacaD"## Version of LSCOLORS compatible with zsh and GNU based commands.## You can find more information about LS_COLORS and why it's needed in addition to## LSCOLORS, here: https://github.com/ohmyzsh/ohmyzsh/issues/6060#issuecomment-327934559exportLS_COLORS="di=34:ln=36:so=35:pi=1;33:ex=32:bd=34;46:cd=1;33;40:su=30;41:sg=30;46:tw=30;42:ow=30;1;43"# Set list-colors to enable filename colorizing.zstyle':completion:*'list-colors${(s.:.)LS_COLORS}
# Modifies the colors of files and directories in the terminal.exportLS_COLORS="di=34:ln=36:so=35:pi=1;33:ex=32:bd=34;46:cd=1;33;40:su=30;41:sg=30;46:tw=30;42:ow=30;1;43"# Set list-colors to enable filename colorizing.zstyle':completion:*'list-colors${(s.:.)LS_COLORS}
You can further modify the shading and appearance of CLI colors by adjusting the ANSI color scheme in your terminal profile. This can be done manually, with guides available for macOS and Linux (specific to GNOME). Alternatively, you can use my custom profile schemes, with instructions detailed in the Terminal Profile section.
Text Editor
There are many terminal-based text editors to choose from, each with unique features and capabilities. I've found that Neovim is the most powerful and versatile option for my needs.
Neovim Resource File
Like the .zshrc file for zsh, Neovim has its own resource file, located at ~/.config/nvim/init.vim, where all the configurations for the editor are stored. This file contains settings, key mappings, and other configurations that define Neovim's behavior and appearance.
Below is the content of my init.vim file, divided into two sections: with plugins and without plugins. The former includes configurations for various plugins I use, while the latter is a more streamlined setup without any plugins. You can choose the configuration that best suits your needs and add it to your ~/.config/nvim/init.vim file.
I manage all of my Neovim plugins using vim-plug, a self-described minimalist Vim plugin manager. It simplifies the process of installing, updating, and removing plugins, making it easier to manage and maintain a large number of plugins. While other Vim package managers are available, my configurations are specifically tailored to vim-plug.
To use these configurations, you'll first need to install vim-plug. Once installed, you can add the following code to your init.vim file. With init.vim open in Neovim, initiate the plugin installation by entering :source % (1) followed by :PlugInstall.
When using :source %, you can safely ignore any errors that may appear, as they are most likely caused by Neovim searching for plugins that have yet to be installed.
""""[ vim-plug Configurations ]"""""""""""""""""""""""""""""""""""""""""""""""""""""""""call plug#begin(stdpath('data') . '/plugged')" Make sure you use single quotes" Vim help for vim-plug itselfPlug 'junegunn/vim-plug'" Rainbow delimiters for Neovim with Tree-sitter.Plug 'HiPhish/rainbow-delimiters.nvim'" Lean & mean status/tabline for vim that's light as air.Plug 'vim-airline/vim-airline'" A collection of themes for vim-airline.Plug 'vim-airline/vim-airline-themes'" Retro groove color scheme for Vim.Plug 'sainnhe/gruvbox-material'" Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP)" support.Plug 'dense-analysis/ale'" Better whitespace highlighting for Vim.Plug 'ntpeters/vim-better-whitespace'" An incremental parsing system for programming tools.Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" Highlight columns in CSV and TSV files and run queries in SQL-like language.Plug 'mechatroner/rainbow_csv'" A simple and lightweight Neovim plugin that brings syntax highlighting to generic log" patterns and provides straight-forward configuration to manage the filetype detection" rules over your preferred log files.Plug 'fei6409/log-highlight.nvim'" Initialize plugin systemcall plug#end()"" Brief help:" PlugInstall - Install plugins" PlugUpdate - Install or update plugins" PlugClean - Remove unlisted plugins (bang version will clean without prompt)" PlugUpgrade - Upgrade vim-plug itself" PlugStatus - Check the status of plugins" PlugDiff - Examine changes from the previous update and the pending changes" PlugSnapshot - Generate script for restoring the current snapshot of the plugins""""[ General Configurations ]""""""""""""""""""""""""""""""""""""""""""""""""""" Overwrites specified default setting.""""" Overwrite for all file types.setexpandtab" Use spaces instead of tabs.settabstop=4" Number of spaces that a <Tab> in the file counts for.setshiftwidth=4" Number of spaces to use for each step of (auto)indent.setsofttabstop=4" Number of spaces that a <Tab> in the file counts for.setendofline" Keep the last line of a file if it has no newline.set fixendofline " Ensures a newline at the end of the file, if endofline is enabled.setcolorcolumn=88" Set a colored line at column 88 in every row."" Filetype-specific configurations.autocmd Filetype markdown,text,csv setlocalcolorcolumn=0autocmd Filetype java setlocalcolorcolumn=100autocmd Filetype cssetlocalcolorcolumn=120" As recommended by the luarocks Style Guide:" https://github.com/luarocks/lua-style-guide/blob/master/README.mdautocmd Filetype luasetlocaltabstop=3shiftwidth=3softtabstop=3autocmd Filetype html,css,vue,javascript,typescript setlocalcolorcolumn=100tabstop=2shiftwidth=2softtabstop=2""""[ vim-plug Plugin Configurations ]""""""""""""""""""""""""""""""""""""""""""""""""""" Font: Power Line Fontsetguifont=MesloLGS_NF:h12
"" Plugin: gruvbox-materialcolorscheme gruvbox-material
setbackground=darkletg:gruvbox_material_foreground ='original'letg:gruvbox_material_enable_bold =1letg:gruvbox_material_enable_italic =1"" Plugin: vim-airlineletg:airline#extensions#tabline#enabled =1letg:airline#extensions#tabline#left_sep =' 'letg:airline#extensions#tabline#left_alt_sep ='|'letg:airline#extensions#tabline#formatter ='default'letg:airline#extensions#ale#enabled =1letg:airline_powerline_fonts =1"" Plugin: better-whitespaceletg:better_whitespace_enabled =1letg:strip_whitespace_on_save =1"" Plugin: ale"let g:ale_use_neovim_diagnostics_api = 0""""[ Lua Configurations ]""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Load 'nvim-treesitter' configurations.lua dofile(vim.fn.stdpath('config') .. '/second_init.lua')""""[ Useful Commands ]"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" :NERDTree - Opens NERDTree file system explorer." :StripWhitespace - Clean extra whitespace." :ALEInfo - Show ALE information." :ALEToggle - Toggle ALE on/off." :TSInstall - Install treesitter parsers." :TSUpdate - Update treesitter parsers." :TSInstallInfo - Show treesitter information.
These configurations are designed for users who prefer a more straightforward setup without the features provided by plugins. They tweak Neovim's default settings without changing its core functionality, offering a more streamlined experience while preserving Vim's essential behavior.
""""[ General Configurations ]""""""""""""""""""""""""""""""""""""""""""""""""""" Overwrites specified default setting.""""" Overwrite for all file types.setexpandtab" Use spaces instead of tabs.settabstop=4" Number of spaces that a <Tab> in the file counts for.setshiftwidth=4" Number of spaces to use for each step of (auto)indent.setsofttabstop=4" Number of spaces that a <Tab> in the file counts for.setendofline" Keep the last line of a file if it has no newline.set fixendofline " Ensures a newline at the end of the file, if endofline is enabled.setcolorcolumn=88" Set a colored line at column 88 in every row."" Filetype-specific configurations.autocmd Filetype markdown,text,csv setlocalcolorcolumn=0autocmd Filetype java setlocalcolorcolumn=100autocmd Filetype cssetlocalcolorcolumn=120" As recommended by the luarocks Style Guide:" https://github.com/luarocks/lua-style-guide/blob/master/README.mdautocmd Filetype luasetlocaltabstop=3shiftwidth=3softtabstop=3autocmd Filetype html,css,vue,javascript,typescript setlocalcolorcolumn=100tabstop=2shiftwidth=2softtabstop=2
Syntax Highlighting
Assumptions
This section assumes you are using a plugin manager like vim-plug, or are comfortable installing plugins manually.
Neovim leverages TreeSitter to provide features such as advanced syntax highlighting, offering more precision and speed than traditional regex-based methods. However, its default installation includes a limited set of parsers for programming languages. This is where the nvim-treesitter plugin shines. Acting as an enhanced interface for TreeSitter, nvim-treesitter provides:
Parser Management: It automatically handles downloading, installing, and updating TreeSitter parsers for a wide range of languages.
Enhanced Syntax Highlighting: With custom configurations, it delivers consistent and accurate syntax highlighting tailored to each language.
Advanced Code Features: Besides highlighting, it enables and enhances features like structural code navigation, incremental selection, code folding, and extensions like rainbow parentheses.
Below are my configurations for nvim-treesitter. Currently, they ensure that the specified parsers are automatically installed and loaded. To use these settings, add the following code to ~/.config/nvim/second_init.lua (1):
nvim-treesitter configurations are written in Lua. Therefore, if your primary init file is written in Vimscript, you must(1) place these configurations in a separate Lua file; I've named mine second_init.lua. My init.vim file, provided above, sources this Lua file to load the nvim-treesitter settings.
Technically, you can place the Lua code within the init.vim file, but using a separate Lua file keeps the configurations organized and easier to manage.
-- This file is loaded after and by 'init.vim', and contains additional configurations-- that require the use of lua.-- TODO: Add more configurations here.require('nvim-treesitter.configs').setup{-- A list of parser names, or "all" (the listed parsers MUST always be installed).ensure_installed={"bash","c","comment","diff",--"disassembly", -- Good to have on standbye."dockerfile","editorconfig","git_config","git_rebase","gitattributes","gitcommit","gitignore","html","javascript","json",-- "kconfig", -- Good to have on standbye."lua","markdown","markdown_inline","php",--"printf", -- Unsure how it will interact with the C and Bash parsers."python","query","regex","requirements","rust","sql",--"strace", -- Good to have on standbye.--"tmux", -- Maybe..."typescript","vim","vimdoc","vue","xml","yaml",},highlight={enable=true,-- Setting this to true will run `:h syntax` and tree-sitter at the same time.-- Set this to `true` if you depend on 'syntax' being enabled (like for-- indentation). Using this option may slow down your editor, and you may see some-- duplicate highlights. Instead of true it can also be a list of languages.additional_vim_regex_highlighting=false,},}
If you're NOT using the init.vim file I provided, you'll want to add the following line to your version of the file:
A terminal profile is a set of configurations that define the visual appearance and behavior of the terminal window, including the color scheme, font style, and other visual elements. Customizing the terminal profile can improve the user experience, making the terminal more visually appealing and easier to work with.
My custom profile is a modified version of the "Basic" profile that comes pre-installed on macOS. To add it to your list of profiles, follow the instructions below: