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

Distinguishing between Linux hard links and soft links

In Linux, there are two types of file connections...

How to use TypeScript in Vue

introduction In recent years, the call for TypeSc...

React internationalization react-intl usage

How to achieve internationalization in React? The...

Solution to the problem that Docker cannot stop or delete container services

Preface Today, a developer gave me feedback that ...

How to write HTML head in mobile device web development

Copy code The code is as follows: <head> &l...

WeChat Mini Program User Authorization Best Practices Guide

Preface When developing WeChat applets, you often...

Details on how to write react in a vue project

We can create jsx/tsx files directly The project ...

HTML6 implements folding menu and accordion menu example code

The main part of the page: <body> <ul id...

Solve the scroll-view line break problem of WeChat applet

Today, when I was writing a small program, I used...

How to write transparent CSS for images using filters

How to write transparent CSS for images using filt...

Detailed explanation of Navicat's slow remote connection to MySQL

The final solution is in the last picture If you ...

JavaScript exquisite snake implementation process

Table of contents 1. Create HTML structure 2. Cre...