In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to use the a.vim plug-in". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
A.vim
If you've been developing in languages like C and C++, you must have a feeling that I can't count how many times I've switched between header files and source code. What I want to say is, indeed, this operation is very basic and very frequent.
Although using GUI (graphical interface)-based IDE (integrated development environment) is easy to switch files with a double click of the mouse, if you are a veteran vim fan, it's a bit awkward to get used to working with commands. But don't be afraid, I have a secret book-the plug-in a.vim. It allows you to solve embarrassment and specialize in all kinds of file switching.
The steps to use are as follows:
First, you need to download two files (a.vim and alternate.txt), which you can find here. Next, create the following directories: ~ / .vim / bundle/avim, ~ / .vim/bundle/avim/doc, ~ / .vim/bundle/avim/plugin and ~ / .vim / bundle/autoload. After creating the directory, put a.vim into ~ / .vim / bundle/autoload and ~ / .vim / bundle/autoload, and put alternate.txt into ~ / .vim / bundle/avim/doc.
That's it. If the above steps are completed successfully, your system will install the plug-in.
Using this plug-in is very simple, you just need to run this command: an if the current file is a source file (such as test.c), this artifact will help you open the header file (test.h) corresponding to test.c, and vice versa.
Of course, not every file has a corresponding header file. In this case, if you run the: a command, the artifact will create a new file for you. For example, if test.h does not exist, running this command will help you create a test.h and then open it.
If you don't want the artifact to turn on this function, you can write the g:alternateNonDefaultAlternate variable in the hidden file. vimrc of your home directory and assign it a non-zero value.
It is also common that the file you need to open is not the header file of the current source code. For example, if you are currently in test.c and you want to open the header file men.h, you can enter this command: IH, needless to say, you must type the name of the file you want to open later.
So far, the functions we have discussed are limited to the fact that your current files and the files you want to manipulate are implemented in the same directory. But, you know, we have special cases. I mean, the header files in many projects are not necessarily in the same directory as the corresponding source files.
To solve this problem, you need to use the variable g:alternateSearchPath. The official document explains it as follows:
❝
This plug-in allows users to configure its search paths for source and header files. This search path can be specified by setting the value of the variable g:alternateSearchPath. The default settings are as follows:
G:alternateSearchPath = 'sfr:../source,sfr:../src,sfr:../include,sfr:../inc'
Use this code to indicate that the artifact will search for all files related to the target file under.. / source,.. / src,.. / include, and.. / inc. The value of the g:alternateSearchPath variable consists of a prefix and a path, with each unit separated by a comma. Sfr prefix means that the following path is relative to the current file, wdr prefix means that the directory is relative to the current working directory, and abs means that the path is absolute. If no prefix is specified, the default is sfr.
If the features we mentioned earlier can make you feel cool, then I have to tell you, where is it? Another useful feature is to split the Vim screen so that you can see both the header file and the corresponding source file.
Oh, and you can also choose to split vertically or horizontally. It's up to you. Use the: AS command to split horizontally and: AV to split vertically.
Use the: a command to switch among files that are already open.
This plugin also allows you to open multiple files in different tabs in the same Vim window. You type this command: AT.
Of course, you can use these commands: AV,: AS and: AT, or you can use these commands: IHV,: IHS, and: IHT.
That's all for the content of "how to use the a.vim plug-in". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.