Questions tagged [vi]

Vi is a screen-oriented text editor originally created for the Unix operating system.

Vi is a screen-oriented text editor originally created for the Unix operating system.

vi is a modal editor: it operates in either insert mode (where typed text becomes part of the document) or normal mode (where keystrokes are interpreted as commands that control the edit session). For example, typing i while in normal mode switches the editor to insert mode, but typing i again at this point places an "i" character in the document. From insert mode, pressing the escape switches the editor back to normal mode. A perceived advantage of vi's separation of text entry and command modes is that both text editing and command operations can be performed without requiring the removal of the user's hands from the home row. As non-modal editors usually have to reserve all keys with letters and symbols for the printing of characters, any special commands for actions other than adding text to the buffer must be assigned to keys which do not produce characters, such as function keys, or combinations of modifier keys such as Ctrl, and Alt with regular keys. Vi has the advantage that most ordinary keys are connected to some kind of command for positioning, altering text, searching and so forth, either singly or in key combinations. Many commands can be touch typed without the use of Shift,Ctrl or Alt. Other types of editors generally require the user to move their hands from the home row when touch typing:

  • To use a mouse to select text, commands, or menu items in a GUI editor.
  • To the arrow keys or editing functions (Home / End or Function Keys).
  • To invoke commands using modifier keys in conjunction with the standard typewriter keys.

For instance, replacing a word is cwreplacement textEscape which is a combination of two independent commands (change and word-motion) together with a transition into and out of insert mode. Text between the cursor position and the end of the word is overwritten by the replacement text. The operation can be repeated at some other location by typing ., the effect being that the word starting that location will be replaced with the same replacement text.

Source: wikipedia

39 questions
4
votes
7 answers

how do I use the # key in vi?

How can I make a number sign show up???
thanksyo
  • 839
2
votes
2 answers

How to keep the top lines of a file while scrolling down the page in vi editor

I have a file opened with vim, how do I keep the top 10 header lines at the top all the time while I scroll down the page?
dav
  • 21
2
votes
1 answer

vi undo "n-th" previous change

What I've seen so far is that I can only revert to a previous state but not selectively undo, say, only a change which was done prior to the last two changes. Example, I'm editing a 50 line file and delete line 20 then insert text on line 25…
Senior Geek
  • 77
  • 1
  • 9
0
votes
1 answer

how to monitor any changes to any file by using vi command

Im looking for a tools (script) for monitoring my systems for any changes on any files by using vi command. For example: one dba open alert.log with vi and modify it and save.. i need to trace these changes. Is it possible? Thank you in advance
-2
votes
1 answer

Vi how to search for numbers

I want to search for the occurrence of 100169200 I typed /100169200 but vi says Pattern not found Edit Since the question has been downvotes, I would like to make it clear that grep can find the number in the file, but vi does not. Edit 2 For the…
Rosdi
  • 239