Another useful feature in vi editor is you can specify how many times you want the command to be executed and it’s applicable to almost all the commands.

For example, as we know the command yy will copy a single line, while command p will paste whatever we have copied earlier. So to copy more than 1 line all we need to do just type in the numbers of lines that we require and then followed by the command yy, eg: 15yy will copy 15 lines starting from current cursor line into the memory.

That comes to a trick to draw a line in vi. Lets say you want to draw a line of 70 dashes, you can either press+hold the dash/minus key until it reached 70 or you can try this: go to the new line, press ESC first to confirm it’s in command mode, type 70 then type i- and press ESC again… and there you have it, a good line in a second.

Try it on other commands.

Happy editing.

Tags: , , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>