John Orr wrote:
Hi all,

I'm a bit frustrated by a particular behaviour of vim, and today I modified the 
source code to 'fix' it.  I'd be very grateful for some opinions if you
a) agree with my thoughts, or b) have a better solution.

The problem - is when you run a command that outputs "messages" to vim - over 
multiple lines.  For example,
:!ls
or
:set

They scroll messages up the screen, and a kind of Unix 'less' function is 
effectively invoked (since it steals it's scrolling commands from vi(m)).
In Unix "less" (and also Unix "more"), a simple, close-to-the-fingers way to 
exit is to type the letter 'q'.  This works no matter whether you're at the start, middle or end of 
the file.
In vim, if only a part of the messages would fit on the screen, you get the 
prompt '-- More --' - and if you press 'q', it will exit message display.  If 
you press Enter, it will just scroll one line.
However, if all the messages would fit on the screen, you get the prompt 'Press 
ENTER or type command to continue'.  Now the 'q' and 'Enter' keys do totally 
different things - q heads you towards macro recording, and Enter exits message 
display.

Often, the line I want to see is at the top of the message output - and I don't 
care whether all the messages fitted on the screen, or whether there are more - 
I just want to exit message display.
To me, it makes perfect sense that, just as with the unix 'less' program, 
pressing 'q' should exit message display - regardless of whether there are more 
lines to display or not.
Sure, I can press Escape, but it's much harder to press than 'q'. Yes, I can press Ctrl-[ - but that's also much harder than 'q'. (Both of these options will also trigger the 'error bell' (audible or visual) - which seems rather unnecessary to me in this situation.) Otherwise - I have to look to the bottom of the screen to see whether vim wants 'q' or Enter to exit message display.
Is it just me that finds this open for improvement?

I've tried finding good mappings to solve this problem, but it's not at all 
easy.

The source code change I made today was to change line 1004 of message.c from
if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C)
to if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C && c != 'q')
It seems to work fine I think.

If I'm the only one who finds this a problem, how do all of you exit from 
message display?  Do you do different things depending on the message at the 
bottom? Use Escape?
Otherwise, would anyone else like to see this tiny change accepted into vim?

Thanks for your thoughts,
John

To exit the scrolling display ang go back to plain-vanilla Vim, hit Ctrl-C (or Ctrl-Break) at the More-prompt or Hit-Enter-prompt. On AZERTY/QWERTY/QWERTZ keyboard, the C is near enough to the left Ctrl key to allow hitting the two keys easily with the fingers of a single hand. (I don't know about the Dvorak layout.)

To go back in the scrolling display, in Vim 7 (but not in Vim 6 or earlier) you can use <Up> or <PageUp> depending on how far you want to go back.


Best regards,
Tony.
--
The assertion that "all men are created equal" was of no practical use
in effecting our separation from Great Britain and it was placed in the
Declaration not for that, but for future use.
                --  Abraham Lincoln

Reply via email to