There has been so much trashing of vi/vim/gvim of pure ignorance, so I
have made a short list of some useful commands.

(Press the escape-key in order to get into command mode.               )
(There is actually some correlation between keystrokes - commands.     )
(q - quit, w - write, d - delete, i - insert, r - replace ... and so on)

Command          Meaning
----------------------------------------------------------------------
     Exit Commands
----------------------------------------------------------------------
ZZ               Write (save) and quit file
:x               Write (save) and quit file
:wq              Write (save) and quit file
:w               Write (save) file
:w!              Write (save) file, overriding protection
:30,60w newfile  Write from line 30 through line 60 as newfile
:30,60w>> file   Write from line 30 through line 60 and append to file
:w %.new         Write current buffer named file as file.new
:q               Quit file
:q!              Quit file, overriding protection (e.g. changes made)
----------------------------------------------------------------------
     Movement Command
----------------------------------------------------------------------
h, j, k and l    Left, down, up and right
w, W, b, B       Forward, backward by word
e, E             End of word
), (             Beginning of next, previous sentence
}, {             Beginning of next, previous paragraph
]], [[           Beginning of next, previous section
H                Top line of screen
M                Middle line of screen
L                Last line of screen
Ctrl-F Ctrl-B    Scroll forward, backward one screen
/pattern         Search forward for pattern
?pattern         Search backward for pattern
G                Move to last line in file
nG               Move to line number n
----------------------------------------------------------------------
     Editing Commands
----------------------------------------------------------------------
i, a             Insert text before, after cursor
I, A             Insert text before beginning, after end of line
o, O             Open new line for text below, above cursor
r                Replace character
R                Type over (overwrite) characters
cw               Change word
cc               Change current line
x                Delete character under cursor
X                Delete character before cursor
dw               Delete word
dd               Delete line
yw               Yank (copy) word
yy               Yank current line
p, P             Put deleted/yanked text after, before cursor

//Fredrik

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Mallard
Sent: den 15 augusti 2000 16:42
To: [EMAIL PROTECTED]; Rial Juan
Subject: Re [expert] Vi/Vim - The editor from HELL! How do I set
thedefault editor so I can TRASH IT?


Thanks, it worked!

I put that line in /etc/bashrc at the end, it seemed to make more sense
to me since it is the main bash set up file for the system. It's easier
for me to remember where it is.

I tried typing it in at a shell prompt and it worked OK till I exited
the console, so it needs to be in the bashrc file. I hope this saves
some people some time. Hint: In vi press ESC then SHIFT and Q to get out
with save. In vim, press ESC then :qw to get out with save. Just in case
someone else gets stuck.

Some people missed the points I was making and now I know why Linux is
going to have problems as long as the people who write programs for it
don't drop this geeky attitude.

1. Make it easy for non "sys admin" types to use.
2. "sys admin" types that live for this command line stuff can spend
their life away re-configuring "easy" Linux distros to be as geeky as
they want, or simply install a geeky distro (redhat 5.0 comes to mind).

You could include a shell script with every distro called
"run-this-for-a-total-geek-system.sh", make it remove X, KDE and all GUI
stuff and install the latest version of vim (so they have all the
features available, wouldn't want even one left out, it has to do
everything, include the kitchen sink too). Make sure you DONT prompt
them "this script program will remove lots of files, do you want to
continue?", because geeks seem to love it when all their work is lost.
Gives them a excuse to not have a life sitting at a old DEC VT100
terminal punching paper tape on lpt-01 (ASR teletype, 110 baud).

I may not have made it clear that Mandrake changed the default editor
from vi to vim. vi was easier to get out of, compared to :qw (whatever
planet those programmers came from is real strange) and Mandrake just
went too far with 7.1 using vim.

Pico has been around for as long as I can remember (more than 20 years),
probably as long as vi. I doubt it's very big. At least it shows the
commands (like the important EXIT one)....

and does a very *strange* thing, it asks if you want to save your work
if you made any changes. Immagine that! What a feature!

Don't worry, vim will do that in another 20 years ;)

I remember doing something in vim, trying to exit with save, and it said
something about "text modified" so it wouldn't let me out (like a bad
nightmare) and said "try q! instead", so I did, and lost my work. "q!"
means "quit now and forget you spent all that time typing because it's
gonna be lost without warning". Tell me that's not LAME!

Mandrake, it's not cool to do this to your new "converts" / customers,
please change the default editor, thanks. No "newbie" or even a "oldbie"
like me is going to use a command line editor for much else than a
emergency quick one line edit, been there, done that back in 1978 and
don't want to go back. If someone does want to live in the past, let
them change it.

No one ever said where the actual setting was for the default editor, I
am only changing it after the fact with bashrc. Where is it actually set
up?

Rial Juan wrote:
> 
> If you want another editor (let's assume pico in our example), put
> this line somewhere in /etc/profile:
>   export EDITOR="pico"
>



Reply via email to