Setting Up My Neovim Config with LazyVim and Tmux on macOS
As a developer, finding the right tools to streamline your workflow is crucial. Recently, I decided to dive into setting up Neovim as my primary text editor. With the powerful combination of LazyVim and Tmux, I was able to create a highly customized and efficient environment that suits my development needs. In this article, I’ll walk you through the process of setting up Neovim with LazyVim, configuring Tmux, and share the resources and GitHub repositories I used to make this happen, all tailored for macOS users.
Why Neovim?
Neovim is an extension of Vim, designed to provide a more modern, feature-rich editing experience. It offers improvements like better plugin architecture, asynchronous execution, and a built-in terminal emulator, making it a favorite among developers who appreciate the power of Vim but crave more flexibility.
Introducing LazyVim
LazyVim is a community-driven Neovim configuration framework that simplifies setting up your Neovim environment. It’s a great starting point if you want to avoid configuring everything from scratch. With LazyVim, you get a pre-configured setup that you can easily extend and customize according to your needs.
Why Tmux?
Tmux is a terminal multiplexer that allows you to manage multiple terminal sessions within a single window. It’s particularly useful when working on larger projects where you need to monitor logs, run tests, and edit code simultaneously. Integrating Tmux with Neovim enhances your productivity by allowing seamless navigation between different panes and windows.
Step 1: Setting Up Neovim with LazyVim on macOS
Install Homebrew: If you haven’t installed Homebrew yet, you can do so by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install Neovim: Install Neovim using Homebrew:
brew install neovim
Clone LazyVim: Next, clone the LazyVim configuration into your Neovim configuration directory:
git clone https://github.com/folke/lazy.nvim.git ~/.config/nvim
Open Neovim: Simply launch Neovim:
nvim
LazyVim will automatically install the necessary plugins. After the installation is complete, run a health check to ensure everything is set up correctly:
:checkhealth
This command will verify that all dependencies and configurations are in place.
This version guides the user to open Neovim directly, allowing LazyVim to handle plugin installation automatically, and then perform a health check to confirm the setup.
Step 2: Configuring Tmux on macOS
Install Tmux: Install Tmux using Homebrew:
brew install tmux
Create a Tmux Configuration File: Create a
.tmux.conf
file in your home directory:touch ~/.tmux.conf
Basic Tmux Configurations: Add basic configurations to improve your Tmux experience. For example:
# Use vim keybindings in Tmux setw -g mode-keys vi # Set prefix key to Ctrl-a instead of Ctrl-b unbind C-b set-option -g prefix C-a bind-key C-a send-prefix # Enable mouse mode set -g mouse on
Neovim and Tmux Integration: To make Neovim and Tmux work seamlessly together, you can install the
vim-tmux-navigator
plugin:git clone https://github.com/christoomey/vim-tmux-navigator ~/.config/nvim/pack/plugins/start/vim-tmux-navigator
Add the following to your
init.lua
:vim.g.tmux_navigator_no_mappings = 1
Step 3: Putting It All Together
With Neovim configured through LazyVim and Tmux up and running, you’re ready to boost your productivity. Open Tmux, start a new session, and launch Neovim inside it. You can now effortlessly switch between multiple terminal windows and panes, all while enjoying a fully customized Neovim experience.
Resources and Repositories
Here are the resources and repositories I found helpful during this setup:
LazyVim GitHub Repo: LazyVim
Tmux Cheat Sheet: Tmux Cheat Sheet
Vim Cheat Sheet: Vim Cheat Sheet
vim-tmux-navigator Plugin: vim-tmux-navigator
My Neovim Config Repo: My Neovim Config
My Tmux Config Repo: My Tmux Config
Conclusion
Setting up Neovim with LazyVim and integrating it with Tmux has significantly improved my workflow. The combination of a powerful text editor with a robust terminal multiplexer makes for a highly efficient development environment. I encourage you to try this setup and tweak it to match your needs.
If you have any questions or suggestions, feel free to reach out or check out my configuration on GitHub. Happy coding!
Subscribe to my newsletter
Read articles from Madhav Krishan Goswami directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Madhav Krishan Goswami
Madhav Krishan Goswami
Currently learning DevOps in public and documenting my journey. Sharing insights, tips, and progress as I dive into the world of automation and cloud technologies. 🚀