I'm new to Vim. I want to change the character before commands. For example
saving is done by:

:w <enter>

Can it be made slightly easier by just pressing 'g' or some other key that's
not taken? I don't know why every command has to be pre-pended by a
difficult to reach character like colon. In an old text editor (I think one
by Borland), you could save by pressing just one key, i.e. F2.

yes, the Borland IDE used to use <F2> to save.

This isn't a flame.. I just want to do simple commands like save, quit, save
and quit, etc. with fewer than four keys. One key like 'g' or F2 or
something would be awesome. Ctrl + key would be nice too.

Most of the common letters and control-keys are occupied by existing[1]/useful[1]/non-portable commands[2]. However, the F# keys should be available. You want "mappings", so to save, you'd want something like this:

        :nnoremap <f2> :w<cr>

(with all less-than and greater-than signs).

For save+quit, there's "ZZ" in normal mode, and for abandon+quit, there's "ZQ". I don't use either of them as discussed on the list a month or two ago (I like the intentionality of building it piece-by-piece regarding whether to quit, confirm, all files, and save/overwrite in the process) but they might be easier to use. However, you _can_ do things like

        :nnoremap <f4> :wq<cr>

to save+quit.


[1] like the "g" you suggest...very useful
[2] such as control+[SQ] which is available in some versions, but is terminal flow-control or control+Z which can suspend/minimize vim


Just my $0.02 adjusted for inflation, minus taxes, social security, and medicare.

-tim


Reply via email to