Vim/Neovim — Managing Multiple Projects

Managing multiple projects from Vim/Neovim.

alpha2phi

--

Photo by Sigmund on Unsplash

Overview

Normally I work on multiple projects on a daily basis. Most projects are under a common folder and I will be switching among projects from time to time. For Emacs users, projectile makes it very easy for project management and navigation. Using projectile, I can switch projects and fuzzy find files easily. For Vim/Neovim, we also have a few options available.

I will be using the dotfiles I developed in my previous article for the walk-through.

Tab and Session

The default Vim way is to use tabs for multiple projects. You can create 1 tab for each project.

And to save the session, you can use the built-in session commands (:h session) and then restore the session each time you restart Vim.

You can also use plugins, e.g. vim-startify or vim-obsession to make this process easier.

vim-startify

telescope-project.nvim

telescope-project.nvim is an extension for telescope.nvim that allows you to switch projects.

Under lua/plugins.lua, add the following line to install it.

-- Project
use { 'nvim-telescope/telescope-project.nvim' }

Run :luafile % and :PackerInstall to install it.

In plugin/telescope.vim, add the following line for the key binding.

nnoremap <silent> <leader>fp :Telescope project<CR>

Press <leader>fp now to bring out the Telescope project window.

telescope-project window

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.