Detailed steps to install the NERDTree plugin in Vim on Ubuntu

Detailed steps to install the NERDTree plugin in Vim on Ubuntu

NERDTree is a file system browser for Vim. With this plugin, users can intuitively navigate complex directory hierarchies, quickly open files for reading or editing, and perform basic file system operations. The NERDTree source code is at https://github.com/preservim/nerdtree.

Here NERDTree is installed through Vundle. Vundle is the abbreviation of Vim software package and is the Vim plug-in manager. The Vundle source code is at https://github.com/VundleVim/Vundle.vim.

Install Vundle:

(1) Execute the following command:

mkdir -p ~/.vim/bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

(2). Open ~/.vimrc and add the following content to this file:

set nocompatible " be iMproved, required
filetype off "required
 
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
 
" Keep Plugin commands between vundle#begin/end.
"Install other plugins" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required

Install NERDTree:

(1) Execute the following command:

git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle/nerdtree

(2). Open ~/.vimrc and add the following content before the call vundle#end() statement:

Plugin 'preservim/nerdtree'

Common shortcut keys for NERDTree: If not specified, it is in command line mode by default. If there is a ":" before the command, it is in bottom line mode.

1. After opening a file through vim, enter "NERDTree" in the bottom line mode and press Enter to enter NERDTree;

2. ctrl+w+h: cursor focuses on the tree structure on the left;

3. ctrl+w+l: focus the file display window on the right;

4. ctrl+w+w: the cursor automatically switches between the left and right windows;

5. ctrl+w+r: move the layout position of the current window;

6. o/go: open the file in an existing window, jump to/not jump to the window;

7. o: If the cursor is on a directory, clicking "o" will expand or collapse the directory;

8. t/T: open the file in a new Tab, jump to/not jump to a new Tab;

9. :tabc/:tabo: close the current tab/close all other tabs;

10. :tabp/:tabn: jump to the previous/next Tab;

12. i/gi: split a new window and open the selected file, jump to/not jump to the window;

13. s/gs: vsplit a new window and open the selected file, jump to/not jump to the window;

14. x: collapse the parent directory of the current file or directory;

15. P/p: jump to the root node/parent node;

16. C: Set the parent directory of the selected directory or file as the root node;

17. u/U: Set the parent directory of the current root node as the root node, and collapse/expand the original root node;

18. r/R: recursively refresh the selected directory/root node;

19. I: Switch whether to display hidden files;

20. q: Close the NERDTree window.

After opening NERDTree, the interface is as follows:

The complete ~/.vimrc file content is as follows:

"Install Vundle: Reference: https://github.com/VundleVim/Vundle.vim
" $ mkdir -p ~/.vim/bundle
" $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set nocompatible " be iMproved, required
filetype off "required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
 
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Keep Plugin commands between vundle#begin/end.
 
" Install NERDTree
" $ git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle/nerdtree
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
"Syntax highlighting syntax on
"Indent setting set tabstop=8
set softtabstop=8
set shiftwidth=8
" C code indent set cindent
"Search results are highlighted set hlsearch
"Solve the problem of garbled Chinese characters set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8

Summarize

This is the end of this article about the steps to install the NERDTree plugin for Vim on Ubuntu. For more information about installing the NERDTree plugin for Vim, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Analysis of the installation process of the vim automatic completion plug-in YouCompleteMe (YCM)
  • How to install vim editor in Linux (Ubuntu 18.04)
  • Analysis and solution of vim installation failure under ubuntu16.04

<<:  Native JS to implement hover drop-down menu

>>:  MySQL 8.0.20 compressed version installation tutorial with pictures and text

Recommend

Summary of common tool functions necessary for front-end development

1. Time formatting and other methods It is recomm...

Install .NET 6.0 in CentOS system using cloud server

.NET SDK Download Link https://dotnet.microsoft.c...

How to implement mobile web page size adaptation

I finally finished the project at hand, and the m...

Configure Java development environment in Ubuntu 20.04 LTS

Download the Java Development Kit jdk The downloa...

HTML basic syntax is convenient for those who are just starting to learn HTML

1.1 General marking A general tag consists of an ...

MySQL data operation-use of DML statements

illustrate DML (Data Manipulation Language) refer...

Practical example of nested routes in vue.js Router

Table of contents Preface Setting up with Vue CLI...

Restart all stopped Docker containers with one command

Restart all stopped Docker containers with one co...

How to limit the input box to only input pure numbers in HTML

Limit input box to only pure numbers 1、onkeyup = ...

Introduction to Royal Blue Color Matching for Web Design

Classical color combinations convey power and auth...

How does MySQL ensure data integrity?

The importance of data consistency and integrity ...

Basic use of javascript array includes and reduce

Table of contents Preface Array.prototype.include...

Generate OpenSSL certificates in Linux environment

1. Environment: CentOS7, Openssl1.1.1k. 2. Concep...

A detailed analysis of the murder caused by a misplaced double quote in MySQL

1. Introduction Recently, I often encounter devel...