-
jabirali
-
RE: vi - anyway to jump line while in insert mode?
-
[b]asedt wrote:[/b]
[quote]I think Ctrl-O enters normal mode for only the next command.[/quote]That should work fine in Vim, but I don't believe it works in the original Vi.
[b]marc wrote:[/b]
[quote]I didn't understand what you need but... MACRO POWAH!!![/quote]Macros only work in normal mode, he's explicitly asking for a way to stay in insert mode ;)
The power of Vi(m) really comes from all the commands available at a fingertip in normal mode. If you intend to really learn to use Vi effectively, you should get used to always returning to normal mode by pressing [i]Esc[/i] or [i]Ctrl-C[/i] after an input sequence, so that you have the full navigational power of the normal mode available between inputs. If you have the choice between Vi and Vim, you should in my opinion choose Vim, as it's more modern (syntax highlighting, text objects, built-in help) and more customizable. If you're curious about learning Vi(m), some reasons to consider learning it can be found [url=http://www.viemu.com/a-why-vi-vim.html]here[/url], and the top answer [url=http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim]here[/url] should be quite clarifying about how things work.
If you don't intend to master these editors, but need text editors available from a terminal, there are several options. First of all, you might want to try [i]pico[/i] or it's more recent brother [i]nano[/i], as they are quite intuitive and are available almost everywhere. Newer versions of nano even has features like syntax highlighting and multiple file buffers.
If you have Vim available, as opposed to it's ancestor Vi, you can create the file [i].vimrc[/i] in your homefolder and add the line [i]set nocompatible[/i] to it in order to disable Vi emulation. Then arrow keys should work in insert mode by default. If not, Vim also supports defining your own commands in input mode using the [i]inoremap[/i] command. In Vim, the [i]Ctrl-O[/i] trick mentioned above should also work.
If the only editor available is Vi, which is a rare situation these days, I don't know of any way to make the arrow keys do what you want. You might want to install vim or nano if you have administrative privileges. If the machines have an [i]ssh[/i] server running, you could install an editor that supports editing remote files over ssh (e.g. Emacs with TRAMP) on your personal computer.
-
03 May 11
asedt wrote:
I think Ctrl-O enters normal mode for only the next command.
That should work fine in Vim, but I don't believe it works in the original Vi.
marc wrote:
I didn't understand what you need but... MACRO POWAH!!!
Macros only work in normal mode, he's explicitly asking for a way to stay in insert mode ;)
The power of Vi(m) really comes from all the commands available at a fingertip in normal mode. If you intend to really learn to use Vi effectively, you should get used to always returning to normal mode by pressing Esc or Ctrl-C after an input sequence, so that you have the full navigational power of the normal mode available between inputs. If you have the choice between Vi and Vim, you should in my opinion choose Vim, as it's more modern (syntax highlighting, text objects, built-in help) and more customizable. If you're curious about learning Vi(m), some reasons to consider learning it can be found here, and the top answer here should be quite clarifying about how things work.
If you don't intend to master these editors, but need text editors available from a terminal, there are several options. First of all, you might want to try pico or it's more recent brother nano, as they are quite intuitive and are available almost everywhere. Newer versions of nano even has features like syntax highlighting and multiple file buffers.
If you have Vim available, as opposed to it's ancestor Vi, you can create the file .vimrc in your homefolder and add the line set nocompatible to it in order to disable Vi emulation. Then arrow keys should work in insert mode by default. If not, Vim also supports defining your own commands in input mode using the inoremap command. In Vim, the Ctrl-O trick mentioned above should also work.
If the only editor available is Vi, which is a rare situation these days, I don't know of any way to make the arrow keys do what you want. You might want to install vim or nano if you have administrative privileges. If the machines have an ssh server running, you could install an editor that supports editing remote files over ssh (e.g. Emacs with TRAMP) on your personal computer.