On 3/19/07, John Orr <[EMAIL PROTECTED]> 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.
I wish we had special mapping mode for the More-response.
Then you could map 'q' in this mode as you wish.
Yakov