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

MySQL green decompression version installation and configuration steps

Steps: 1. Install MySQL database 1. Download the ...

Detailed analysis of replication in Mysql

1.MySQL replication concept It means transferring...

Examples of using provide and inject in Vue2.0/3.0

Table of contents 1. What is the use of provide/i...

A brief discussion of the interesting box model of CSS3 box-sizing property

Everyone must know the composition of the box mod...

Solving problems encountered when importing and exporting Mysql

background Since I converted all my tasks to Dock...

An example of how to implement an adaptive square using CSS

The traditional method is to write a square in a ...

JavaScript Array Methods - Systematic Summary and Detailed Explanation

Table of contents Common array methods Adding and...

Detailed explanation of the use of Vue.js render function

Vue recommends using templates to create your HTM...

Instructions for using JSON operation functions in Mysql5.7

Preface JSON is a lightweight data exchange forma...