Open Source Software Shortcut, Permanently Storing Macros in Vim
Download the authoritative guide: Data Center Guide: Optimizing Your Data Center Strategy
Download the authoritative guide: Cloud Computing: Using the Cloud for Competitive Advantage
A really useful feature of the open source editor Vim is the macro command, which allows you to record and reply a series of commands. To start recording, hit "q" then "a" (or any other lowercase letter identifier). The status bar at the bottom will show recording. Enter your commands as normal, then hit "q" again to stop recording when you're done. To replay the macro, type @a.
So far, so good, but a macro saved like this will not last between sessions. However, the macro is saved into a normal register in the same way as yanked text. To save it permanently, open your ~/.vimrc file in the same session, and use "ap" to paste in the macro commands. Then edit the line to add a mapping, so it looks like this:
map ,PARA v}y}p
This maps the command, PARA to a short macro, which copies the next paragraph, then pastes it underneath. This mapping will be loaded every time you open a new Vim session.
If you find yourself doing this often, it may be worth checking out the marvim vim script, which provides hotkeys to store macros and templates. This also allows you to tab-complete macro names, which is helpful if you have a lot of them.
For occasional use, however, it's just as fast to do it by hand.
Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
Searching our resource database to find your matches...