Re: text editors
On 27.03.19 11:07, mick crane wrote:
> On 2019-03-26 19:27, Wayne Sallee wrote:
> > I use vim.
> > Log in as user that will use vim, and run the following command:
> > cat > .vimrc << "EOF"
> > set nosi noai
> > set number
> I have line numbers as the default but copy/paste with the mouse also copies
> the numbers so I have to turn it on and off.
True, so it's handy to be able to toggle them on and off on a single
keystroke. I use F1, as it is easy to find. This vimscript in .vimrc
then implements the switch, in my case for _relative_ line numbers, as
they allow e.g. y7+ to copy current line plus the lines down to a chosen
point, without having to count the lines. That's a greater productivity
improver than just knowing you're on line 27423:
" Toggle relative line numbering.
if &rnu == 1
set nornu " For absolute, elide the 'r'.
set rnu " For absolute, elide the 'r'.
To avoid stairstepped insert when pasting that here from the clipboard,
I have F12 mapped to:
set pastetoggle=<F12> " <A-p> is easier. (See "Paste")
I tend to forget that I also have the alternative:
" Paste without needing pastetoggle to avoid staircase text, due to ai always set.
" Works with "+y<motion> in another vim instance. Also avoids wrapping.
nnoremap <A-p> "+p
inoremap <A-p> ^["+p^Mi
nnoremap <A-c> "+y
(The ^[ is entered as control-v Esc, and ^M as control-v Enter, but you
<A-p> is Alt-p. Your choice of invoking key may differ.
So, yep, Vim does allow two-key chords, and the distinction from Emacs
reduces a little when you do that. Vimscript may look a little C-like in
places, but that can't be helped. (Awk is also significantly C-like.
Perl is much more successful at voiding the benefit of common language