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

38 questions
2
votes
3 answers

VI Editor on Ubuntu using VIM Short Cuts?

I installed Ubuntu and I tried to use the terminal's vi editor. The editor is using a different set of short cut keys that I'm not familiar with. Someone told me it's probably using the VIM short cut keys. How do I make it use the normal vi short…
John
  • 7,153
  • 22
  • 61
  • 86
2
votes
1 answer

Linode Lish Shell Vim and Nano rendering troubles: lines not appearing / cursor positions wrong

I'm using a linode VPS and I just cloned one of my servers to my development server as I've done many times before. As usual SSH is inaccessible until /etc/network/interfaces is correctly updated. I log into the linode lish shell via ssh AND the…
Yuji Tomita
  • 453
  • 1
  • 3
  • 15
2
votes
5 answers

Textmate alternative with vim?

Is there a way to use the vim editor like the mac textmate editor ? I am searching a easy configuration or plugin. a split screen or a panel for directorys currently opend files or many cool stuff like textmate. is there any plugin for the vi -…
bulleric
  • 239
  • 1
  • 2
  • 8
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
  • 1
2
votes
3 answers

alias to replace a text in file

here is a practical situation.I facing some of my files where there is a common string in these files.I usually will open vi and do some thing like :%s/text/replacement/g and I have to do it in many files many many times. Is there some easy way…
Registered User
  • 1,453
  • 5
  • 18
  • 37
2
votes
2 answers

ctrl-v key on AIX

I'm new to AIX and I miss some tricks that work well on other *nix flavors. I need a CTRL sequence in a ksh scripts, like ^[ (CTRL-[) and to do that I'm habit to use the ctrl-v [ , but here it doesn't work. At the moment I'm obliged to use a windows…
tmow
  • 1,187
  • 8
  • 20
1
vote
1 answer

Solaris "crontab -e" locking via vi

I ran into an issue yesterday with locking on Solaris and crontab editing that has me wondering what the best way to protect multiple concurrent edits of the same crontab are on Solaris. I've confirmed that the behaviour exists in Solaris through…
Ric F
  • 116
  • 4
1
vote
1 answer

Modifying xml definition of a running KVM domain via script

How can I modify the xml definition of a VM over ssh? I know that I can do this interactively by logging into the host and using: virsh edit But I want to automate this modification of xml using a script that runs on a remote host and…
1
vote
6 answers

How to set up "vi" shell environment as default

I'd like to use vi (set -o vi can do the trick) as default in my shell instead of emacs, but I do not want to put it into bash startup scripts. Why? Because I work as verification engineer and I am using several user accounts, which are also quite…
Ency
  • 1,201
  • 1
  • 19
  • 26
1
vote
4 answers

Is linux VI editor different from vim editor

I want to use one editor which is available across all the system. Someone told me VIM is best and i tried on ubuntu and VIM was not there but vi is there. SO which one should i use
John
1
vote
1 answer

Home and End keys not working in vi on Ubuntu 16.04

In Insert mode, when I press End I get an F where the cursor is and Insert mode is canceled. This works on one system and not another. I have checked what is installed (vim, vim-common, vim-runtime,vim-tiny) and the version (both are…
0
votes
1 answer

nano/vi open write protected file as a unauthorized user- Can I escalate to save?

More times than I want to admit I will open a config as a non-super user and will go about making the changes I need. As soon as I save in nano, or vi I am met with permissions errors. At this point I c/p foo my way around so I can close and reopen…
user101613
0
votes
7 answers

vi syntax to comment out non-commented lines (cron)

Anyone know if it's possible in vi to replace only uncommented/non-blank lines with comments? If I want to replace a commented line with something I know I can use :%s/^#/##foo##/g -- but I am looking for the opposite of this. Example file: # Some…
sitnam
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
AlBouazizi
  • 159
  • 2
  • 8
0
votes
2 answers

cat or vi a file, hangs

we're having some issue on a SUN 5.8 machine. first of all, the server is on his network (i.e. 10.x.x.x) and we can login using an ssh server which is on another network (196.x.x.x), so there're firewalls openings, in the middle, which allow us to…
rpiga
  • 3
  • 2