NERDTree : vim Plugin

 Have you ever faced an issue while working with the Vim editor on multiple files, splitting tabs, opening numerous tabs, and juggling between multiple folders and files?

After doing all this juggling, if you may forget which file you have worked on the previous time, then you are with me.

So that is where the NERDTree Plugins come into play.

The features you get with NERDTree are :

1. Project Tree Explorer   

       View your entire project directory in a tree-like structure inside GVim.

        Expand/collapse folders to keep navigation clean.

2. Quick File Opening

        Open files directly from the tree with a simple keystroke.

        No need to jump back to the terminal.

3. Toggle on Demand

         NERDTreeToggle command is used to show/hide the file explorer without closing GVim.

4. Bookmarking

        Save frequently used directories or files as bookmarks for one-command access.

5. Tab & Split Integration

        Open files in new tabs, horizontal splits, or vertical splits right from NERDTree.

6. File System Operations

        Create, delete, move, or copy files and directories directly within GVim.

7. Customizable Root

        Set any directory as the root of your NERDTree, perfect for large projects.

8. Navigation Shortcuts

        Jump up a directory, refresh the tree, or locate the current file instantly.


I know that these features look overwhelming and hard to understand, but when you're working with them day by day, it makes your life easy. 

Let's start with the Installation of the Plugin


Installation : 

1. If you have a preinstalled gvim, then let's move that installation directory. For me, I have installed my gvim in : 

    
                C:\Users\Asus\Vim
Note: If you have installed your gvim in Program Files, you need to change your permissions of that directory so that you can clone the plugins from GitHub.



2. Go into the subdirectory of Vim - Vim/vim91 and clone the plugins.

     We have to clone two plugins - vimvundle, nerdtree

     Follow these commands in the terminal:

       git clone https://github.com/preservim/nerdtree.git
       git clone https://github.com/VundleVim/Vundle.vim.git

                                              Fig: cloning repositories to the vim directory.

3. Modifying your .vimrc file, if you don't have one, create it in the parent directory of Vim.

               Add the following command to it.

                Note: Please be mindful of the path we are using for "rtp" variable, please set the path of rtp according to Vim folder from .vimrc file, if you placing the Vim folder and .vimrc file as per your alignment.

----------------------------------------------------------------------------------------------
set nocompatible

filetype off
" This is necessary to get vundle working and allow it to manage plugins
" set the runtime path to include Vundle and initialize
" set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/Vim/vim91/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle, this should go before any other plugin
Plugin 'VundleVim/Vundle.vim'

" Plugins go down here
" Keep Plugin commands between vundle#begin/end.
Plugin 'preservim/nerdtree'
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Quick help
" :PluginList       - lists configured plugins
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

------------------------------------------------------------------------------------------------------------

After that, source your .vimrc by running the "source .vimrc"  in command mode of gvim, then close gvim.




4. After all these commands if you dont face any errors in you gvim once you open it, congrats you have configured your gvim in the rigth way.

Now we have to install the plugins, here is where the vimvundle helps us.

Open the gvim and type  -"PluginInstall "in the command line mode.

After executing this command, you will see this, as shown in fig.


Congrats now you installed the NERDTree plugin.

5. To invoke the NERDTree - use " NERDTree "  in command line mode, after that you can see the tree hierarchy of folder and file lists.






Let's explore in the next article how to use NERDTree. Thanks for coming this far in the article

Please comment on your thoughts on this.

thank you






                




    



Comments

Popular posts from this blog

Bash Shell