Neovim + Tmux + Zsh + Lazygit
We discovered that Neovim could be a powerful IDE with NvChad. It was great. I already set Neovim as my primary text editor. It could increase our productivity. But, that was not enough. You should try this combo.
Tmux
Tmux can have multiple sessions, windows, and panes. We can have them without making our computers heavy because they all run on the terminal.
I rarely use sessions and panels. Mostly windows. For example, here are my windows when I work for a library:
- zsh. The default window. Maybe to run apps or Dockers or view logs.
- go. Running Neovim to code the library in Go.
- nodejs. Running Neovim to code the library in (TypeScript) NodeJS.
- php. Running Neovim to code the library in PHP.
- lazygit. Running Lazygit to see changes for the active directory.
For information, the window start at 0. Run tmux
on the terminal to start Tmux. Ctrl / Control
+ b
to start a command. Here are basic usages.
Key | Description |
---|---|
c | Create a window |
, | Rename the window |
0 to 9 | Switch the window |
% | Split the window horizontally |
" | Split the window vertically |
← / ↑ / → / ↓ | Switch the pane |
d | Detach the session |
You can do other stuff while the session is detached such as SSH to a server, configure some files, etc. Run tmux -a
to get back to the last session. You can see Tmux Cheat Sheet for other commands.
Installing Tmux is quite easy. But, maybe you don't like the default UI. You can theme it with the Catppuccin. It is not only a theme. It has some useful modules such as showing Git active branch, battery, weather, and calendar. But, you need TPM (Tmux Plugin Manager) to install Tmux plugins to activate those modules.
I made it easy to configure Tmux with Catppuccin by providing my ~/.tmux.conf
.
|
|
Make sure you have already installed the Tmux with TPM. Then, run this command to install them, ~/.tmux/plugins/tpm/bin/install_plugins
.
The script above worked on any OS. On line 23, you might notice I commented on a line. You can activate it to replace your default Bash shell with Zsh, only on Tmux. Remember, that only works if your default shell is Bash and you already installed Zsh.
You can try other awesome Tmux plugins from Awesome Tmux.
Zsh
Zsh (Z shell) is an extended or improved version of Bash. It is a default shell for macOS. There are two things I like from Zsh:
- It doesn't show a full path like Bash.
- It shows Git active branch and a sign for tracked files.
It might not show Git stuff by default. Then, we need to install Oh My Zsh. It brought a theme for your Zsh too. Remember to install Zsh first.
You can set your theme to the environment variable, ZSH_THEME
. But I think the default, robbyrussell
, is fine.
Lazygit
I always use Git commands without UI, even to see Git logs. But, when I need UI, I use Lazygit.
The only Git UI that works on the terminal I know is Lazygit. Git UI is important for reviewing changes, especially a lot of changes. Run lazygit
to launch Lazygit. Here are basic usages.
Key | Description |
---|---|
Tab | Go to the next tab |
Shift + Tab | Go to the previous tab |
j | Go to the next item |
k | Go to the previous item |
p | Pull |
Shift + p | Push |
Enter / Return | Enter the item |
Esc | Escape from the item |
q | Quit |