![]() Several years back, when I wrote lot of C code on Linux, I used to read all available Vim editor tips and tricks. So, naturally I’m a huge fan of Vi and Vim editors. At this stage, the change-password.sql will look like the following. ![]() Note: The recording message shown in the bottom of the vi will now disappear. Jump to the next line and stop the record. Press Esc, and A to go to the end of the line, and ‘ 8. Press Esc, and then type p to paste the name that was copied in the step #4. Press Esc, and A to move the cursor to the end of the line, and then type space.Type: Esc A followed by ” IDENTIFIED BY ‘” Press Esc, and then press w to go to the next word ( name ).Which will take you to the first character of the line. Place the cursor anywhere in the first line, and then press I. Type: I (Upper case i) followed by “ALTER USER ” When you do q a, it will display the message recording at the bottom of the vi.Start the Recording and store it in register a Open the change-password.sql that has only the names. Schwartz After Recording and executing the Macro: change-password.sql $ vim change-password.sqlĪLTER USER Annette IDENTIFIED BY 'Annette' ĪLTER USER Warren IDENTIFIED BY 'Warren' ĪLTER USER Anthony IDENTIFIED BY 'Anthony ' ĪLTER USER Preston IDENTIFIED BY 'Preston' ĪLTER USER Taylor IDENTIFIED BY 'Taylor' ĪLTER USER Stiller IDENTIFIED BY 'Stiller' ĪLTER USER Dennis IDENTIFIED BY 'Dennis' ĪLTER USER Schwart IDENTIFIED BY 'Schwart' 1. Before Executing the Macro: change-password.sql $ vim change-password.sql i.e Framing the same command, with different arguments. This example explains how you can executing the same command, with different input for it. Note: Vim will still show recording at the bottom as shown below.įig: Generate Sequence Number in Vim using Macro Example 2: Repeat Vim Macro with different arguments p will paste the line that was just copied.Copy the 1st line to 2nd line to have two lines with 1. When you do q a, it will display “recording” at the bottom of the vi.Ĥ.a indicates to store the recordings in register a.Start the Recording and store it in register a. Start a sequence-test.txt file to generate the sequence. NN is a numberĮxample 1: Sequence number generation inside a file using Vim Macro 1. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |