In the previous tut., we have learned copying/pasting/searching within the file. Now, we are going to take a step further in the direction of Vim editor mastery.
While editing a file, we may need to number the lines with in the file, most probably in case of a program, may be a C program. We can achieve this by this command. (Note that we are in last line mode.)
option:
To temporarily display the line numbers for a set of lines, you can use the # sign. For example:
Longer words that have been used previously, can be searched using, Ctrl-p or Ctrl-n. Let's say you're typing the word searching, which you've already used once in a document. Type "ear" and then hit Ctrl-p, and Vim will either autocomplete the word if "ear" is a unique string, or show a list of words that begin with "ear". The Ctrl-p command searches for "previously" used terms and displays them in that order, and Ctrl-n searches for the "next" terms, and displays in that order. For most uses, they're pretty equivalent.
We can set abbreviation in Vi editor using ab.
So the first argument is the abbreviation, the second argument to the :ab command is the expansion. Now, when you type the characters hkm (in insert mode) you'll get hakkunnamatata. What happens if you want to unset an abbreviation? You could exit Vim, and the abbreviation will go away when the session ends.
But it sounds like fool's way of doing things. There is another sound way.
While editing a file, we may need to number the lines with in the file, most probably in case of a program, may be a C program. We can achieve this by this command. (Note that we are in last line mode.)
:set numberor its abbreviation:
:set nuLines now appear numbered, upon writing the file, the numbers will not be written in the file. It's only for your viewing. Line numbers are displayed either until you quit the vi session until you disable the set
option:
:set nonumberor
:set nonu
To temporarily display the line numbers for a set of lines, you can use the # sign. For example:
:1,10#
Longer words that have been used previously, can be searched using, Ctrl-p or Ctrl-n. Let's say you're typing the word searching, which you've already used once in a document. Type "ear" and then hit Ctrl-p, and Vim will either autocomplete the word if "ear" is a unique string, or show a list of words that begin with "ear". The Ctrl-p command searches for "previously" used terms and displays them in that order, and Ctrl-n searches for the "next" terms, and displays in that order. For most uses, they're pretty equivalent.
We can set abbreviation in Vi editor using ab.
:ab hkm hakkunnamatataOR
:ab iot Institute of Technology
So the first argument is the abbreviation, the second argument to the :ab command is the expansion. Now, when you type the characters hkm (in insert mode) you'll get hakkunnamatata. What happens if you want to unset an abbreviation? You could exit Vim, and the abbreviation will go away when the session ends.
But it sounds like fool's way of doing things. There is another sound way.
:una hkmTo disable all abbreviation -
:unab abbrTo list your currently defined abbreviations, type:
:ab
No comments:
Post a Comment