Personal collection of "dotfiles" (configuration files that usually reside in your home directory).
Table of Contents
- It is designed to work everywhere
- Everything you learn to operate this, works on all Linux machines
- You can install just only parts of it
- Works with any modern terminal
- You work a lot with a terminal
- You use vim whenever you can
- You love yourself some fancy terminal UI
- You use tmux
Here is what needs to be installed on your machine before you can proceed with the dotfiles setup.
Requirement | What is it |
---|---|
Nerd Fonts | fonts for developers with icons and symbols |
Starship | interactive, beautiful and fast command line prompt written in Rust |
Zsh | extended bourne shell with many improvements |
tmux | terminal multiplexer |
Ghostty | best terminal emulator |
vim | screen based text editor |
Atuin | proper shell history |
Installation instructions for macOS are provided below.
This is a set of special extended mono fonts that contain all kinds of special signs and symbols to be used for fancy graphics inside your terminal.
99% of terminals can't draw random graphics. So if you want do draw a beautiful arrow, you need to have that glyph in your font. Nerd Fonts is one of the best collection of such fonts.
# Add repository with fonts to Homebrew
brew tap homebrew/cask-fonts
# Install individual fonts (replace <FONT NAME> with actual name of the font)
brew install --cask font-<FONT NAME>-nerd-font
Here are a couple of fonts that I use:
To install hack
font, for example, execute the command above like this:
brew install --cask font-hack-nerd-font
We are using Zsh as a shell. There are two main reasons for that:
- It is fully compatible with Bash 4.0.
- It is installed by default on macOS.
Unlike with fish
shell or some other alternatives, you don't need
to learn new syntax or change your scripts. Everything you learn
with Zsh applies to Bash. Every Sh and Bash script can be executed
by Zsh without a change.
If you use Bash, you can replicate some of what is configured here
in .zshrc
in your .bashrc
config file.
Starship is the shell prompt. Instead of a boring $
sign at the start of your
prompt you can have all kinds of stuff: which git branch you are on, what version
of Node or Python you are using, which Kubernetes cluster you are connected to.
Starship is a fast and smart prompt written in Rust.
brew install starship
Even when working as a developer, you rarely need more than a few Terminal tabs. You can easily achieve that with modern terminals. As most of them provide tab functionality.
However, eventually you reach the point where your terminal won't cut it anymore:
- Have your command running in the background with terminal closed.
- Keep dozens of terminals open simultaneously and jump between them.
- All your terminals are restored automatically after restart.
- And much much more...
Tmux has a steep learning curve but it is worth it. Especially when you do DevOPS/SRE kind of work or technical support.
brew install tmux
Atuin is a shell history manager.
brew install atuin
We are using best terminal emulator available Ghostty.
Alternatives:
- iTerm2
- Standard macOS terminal
brew install --case ghostty
On macOS it makes a lot of sense to remap some of the keys to make the keyboard more suitable for terminal based workflow.
In particular, I highly recommend remapping the Caps Lock key to Ctrl in Settings.
Since many shortcuts in this config use Ctrl for navigation in the terminal it is very useful to change the meaning of the Caps Lock key to instead work like Ctrl.
In that case you don't have to look for the Ctrl with your left pinky each time you want to press it. It really speeds the workflow up, less error prone, and much more convenient.
- Go to System Settings of macOs
- Choose Keyboard
- Click "Keyboard Shortcuts..."
- Choose Modifier Keys...
- Choose
^ Control
from the dropdown for Caps Lock Key. - Click OK
Note: you will need to configure a remap for every new keyboard you connect to you macOS.
Clone this repository to the desired destination directory. For example, here we clone it into Home directory:
$ git clone https://github.com/vduseev/dotfiles.git ~/.dotfiles
To simplify the whole configuration process, you can use an interactive
install.sh
script available in this repository.
The script is very-very careful and will prompt you for confirmation at every step. It will ask whether you want to install every specific config part. And it will offer to backup, delete or ignore any existing files or symlinks, if it finds any.
$ ./install.sh
This script will install and link individual items from dotfiles
to your home directory and will prompt you at each step.
If you wish to install a single item, specify it as an argument
to this script. For example: ./install.sh zsh
Available config items to install: zsh, vim, tmux, starship
1) Would you like to set up zsh? (y/N)
The script also allows you to install a specific config individually.
$ ./install.sh vim
Creating a symlink at '~/.vimrc' pointing to '~/.dotfiles/.vimrc' ...
Can't proceed. File or directory already exists at ~/.vimrc.
Would you like to rename it (r), delete it (d), or skip (N)? (r/d/N) d
Removed existing ~/.vimrc successfully.
Symlink at ~/.vimrc has been created successfully!
You can create individual symlinks manually, of course. For example, here is one for vim
:
$ cd ~
$ ln -s ~/.dotfiles/.vimrc
Do not change linked files! Use local
customizations instead!
Configs for bash, zsh, tmux are capable of loading user defined config files with settings that will compliment or overwrite settings implemented in this repository without having to fork it.
Put your own settings into the following files and they will be automatically loaded and will overwrite settings implemented in this repository.
- Tmux:
~/.tmux.local
- Bash:
~/.bashrc.local
- Zsh:
~/.zshrc.local
This navigation is based on Emacs and is common for all terminals and computers in general. This is not a part of this config and is placed here for information.
Shortcut | Action |
---|---|
Ctrl + a | Move to the start of the command line |
Ctrl + e | Move to the end of the command line |
Ctrl + u | Delete everything to the left of cursor position |
Ctrl + w | Delete one word to the left |
Alt/Option + f | Move one word forward |
Alt/Option + b | Move one word backwards |
Ctrl + l | Clean current terminal window of all text |
These navigation shortcuts work in vim
, in man
pages, while reading output of less
or more
commands, etc.
This is not a part of this config as well and is placed here for information.
Shortcut | Action |
---|---|
G | Go to the enf of the file |
gg | Go to the beginning of the file |
/ | Search mode (enter any word and press Enter) |
Ctrl + u | Jump half page up |
Ctrl + d | Jump half page down |
h | Move one character to the left |
j | Move one line down |
k | Move one line up |
l | Move one character to the right |
{ | Jump up to next empty line |
} | Jump down to next empty line |
Tmux is a terminal multiplexer. It allows you to run multiple virtual terminal windows inside a single actual terminal. Tmux starts a process that runs in the background and then attaches to it. Thanks to this, you can close your terminal or detach from a session and it will continue to run in the background unless you turn off your computer.
Main benefits of tmux
are that you only need one actual terminal window open and that it can run sessions in the background.
However, you also navigate between virtual terminals faster and you can create preconfigured sessions for your projects
using tools like tmuxinator
or use tmux-continuum
to restore
all your terminals to last saved state after you restart tmux or computer.
- To start new untitled session:
tmux
- Start new session with a name (e.g. home):
tmux new -s home
- Attach to existing session from terminal:
tmux a -t home
- Kill session:
tmux kill-ses -t home
Combination | Meaning |
---|---|
Ctrl + a | Tmux prefix |
prefix, d | Detach from current session (it will keep running in background) |
prefix, c | Create new window |
prefix, x | Close current window |
prefix, , | Rename current window |
prefix, j | Next window |
prefix, k | Previous window |
prefix, 0/1/2/... | Jump to window with this ID |
prefix, Tab | Go to last window |
prefix, " | Split into panes horizontally (part top, part bottom) |
prefix, % | Split into panes vertically (part left, part right) |
prefix, h/j/k/l | Switch between panes |
prefix, Enter | Enter copy mode |
v | Begin selection (in copy mode) |
Navigation keys | Move around (in copy mode) |
y | Copy selection to system clipboard (in copy mode) |
Escape | Quit copy mode |
Ctrl + l | Clear screen and history |
prefix, f | Find window |
prefix, s | Overview of all open sessions |
prefix, Ctrl + f | Find another session |
prefix, Ctrl + s | Save session using tmux resurrect |
prefix, Ctrl + r | Restore session |
prefix, m | Toggle Mouse mode on/off |
prefix, r | Reload tmux configuration |
prefix, I | Install new plugins |
prefix, U | Update plugins |
prefix, Alt + u | Remove/uninstall plugins not on the plugin list |