Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of VIM directory tree plug-in and file search plug-in

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Vim

Vim is a text editor developed from vi. Code completion, compilation and error jump are particularly rich in convenient programming functions, which are widely used among programmers, and Emacs has become the favorite text editor for users of Unix-like systems.

Vim's design philosophy is a combination of commands. Users have learned a variety of text-to-text move / jump commands and other normal mode editing commands, and if they are able to combine them flexibly, they can edit text more efficiently than editors without patterns. At the same time, VIM is similar to many shortcut key settings and regular expressions to aid memory. And vim is optimized for programmers.

Nerd tree

We know that vim does not have directory file management by default, which is very inconvenient for developing a slightly larger project. But with the NerdTree plug-in, you can meet this requirement.

Github address: https://github.com/scrooloose/nerdtree

After installation, open the vim editor, and there is no directory tree on the left by default. NERDTreeToggle needs to be typed out at the command line. Then the directory tree will appear on the left.

This is still a bit inconvenient, we need to go to the configuration file .vimrc to add a few lines. Use mapping to facilitate our operation.

Nnoremap v: NERDTreeFindnnoremap g: NERDTreeTogglelet NERDTreeShowHidden=1let NERDTreeIgnore = ['\ .pyc','\ ~ $','\ .swp','\ .git']

NERDTreeFind means to find the location of the directory tree where the current file is located.

NERDTreeToggle means toggle the display of the directory tree

NERDTreeShowHidden indicates whether to show hidden files

NERDTreeIgnore indicates which files are not displayed

In the directory tree, use the button j to move the file down and the key k to move the file up. The enter key toggles the opening and closing of a folder for a folder and opening a file for a file.

Ctrlp

With the file directory tree, it is really much more convenient to develop the project. But there is still one problem that has not been solved. If the level of the directory is relatively deep, it is also a very troublesome thing to find it one by one at a time. Is there a good solution? Yes, you can use the ctrlp plug-in.

Ctrlp is a plug-in to quickly find files and open it, the function is also very powerful, support fuzzy search, and the speed is very fast.

The github address of ctrlp is: https://github.com/kien/ctrlp.vim. We use vim-plug to install it. After the installation is complete, then set its shortcut key.

Let g:ctrlp_map =''

Once installed and configured, let's take a look at its use. Open the vim editor, press ctrl+p, and enter the file you want to open.

As you can see, all the matching files are displayed. Then, move the matching file up and down through ctrl+j and ctrl+k.

Here is a tip to quickly locate the location of the directory tree where the file is located.

First find the file you want to open through ctrl+p

Navigate to the file

Enter v to quickly locate the directory location of the file.

The above are the details of the VIM directory tree plug-in and file search plug-in, please pay attention to other related articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report