Favorite folders for Neovim
|Title:||Simple favorite folders feature for Nvim using Telescope and Neotree|
|Number of words:||198|
|Created:||16:43 on Friday, 30. December 2022|
|Modified:||16:43 on Friday, 30. December 2022|
This is a simple way to implement favorite folders in Neovim. It makes use of the Telescope plugin and Neotree. Favorites are stored in a simple text file and presented with a fuzzy-searchable Telescope picker.
Table of Contents
One feature I was missing from the old NERDTree plugin was the ability to quickly define favorite folders. Since neither Neotree nor Nvim-Tree offer such a feature, I decided to add it my own. After all, it’s easily doable with only a few dozen lines of code, because the majority of the required functionality is provided by plugins.
Neotree can be passed a
dir parameter to change its current folder. So, basically, when you type
Neotree dir = /home/foobar on the command line, the file-tree will change to this folder.
- Neovim 0.8 or later
- The Telescope plugin and all its requirements.
- The Neotree plugin, otherwise the favorites folder feature would not make much sense at all.
Create your favorites as simple text file and save it to your Neovim configuration folder under the name
init.vim is normally located. The file is a simple format, one line per favorite and must
Name|folder example: My Projects|~/Projects
Executing the lua function
Neofavs() will create a telescope picker with your favorites. Selecting one
will open the folder in Neotree. It’s best to bind the function to some key.
This is hosted as a GitLab snippet. You can put this in your
init.lua or somewhere else and
You can write a comment
Please stick to common netiquette when posting comments. Avoid any form of personal attacks, harassment, hate speech, sexism, racism or otherwise inappropriate content. Comments that violate common rules of civilized communication among humans will be deleted without further notice.