In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is to share with you about how to use Vimscript. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
If there is one feature of Vimscript that allows you to customize Vim according to your wishes, it is keyboard mapping. You can tell Vim through keyboard mapping:
When I press this button, I need you to give up the default action and do what I want.
Let's start with the keyboard mapping in normal mode. We will discuss keyboard mapping in insert mode and other modes in the next section.
Type a few lines in the text at will, and then run the command:
: map-x
Place the cursor somewhere in the text and press -. Notice that Vim deletes the characters under the current cursor as if you had pressed x.
We already have a button to "delete characters under the current cursor", so we remap-to something slightly useful. Execute the command:
: map-dd
Now move the cursor to any line and press-- this time Vim deletes the entire line of text, because the function of dd is to delete the entire line.
Special character
You can use a special button to tell Vim. Try the following command:
: map viw
Move the cursor over a word and press the spacebar. Vim highlights the entire word.
You can also map modifiers by typing Ctrl and Alt. Execute:
: map dd
Pressing Ctrl+d on the keyboard now executes the dd command.
Annotation
Remember the notes we discussed in the first chapter? Comments cannot be used for keyboard mapping. Try the following command:
: map viw "Select word
Now you press the spacebar again, and something terrible will happen. Think about why this is happening.
When you press the spacebar, Vim thinks you are trying to execute the command viw "Selectword. Obviously, this is not your intention.
If you take a closer look at the results of this mapping, you may find something strange. Take a few minutes to figure out what happened when using this mapping and why it turned out that way.
Thank you for reading! This is the end of the article on "how to use Vimscript". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.