John Orr <[EMAIL PROTECTED]> 写于 2007-03-19 21:23:59:
> 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

Hi,

I don't know how other people quits the message display but I do feel
unhappy since the first day I use vim and have no good work around unless
having a big screen (so that most messages could fit in my screen)...

The more frustrating thing is: if I continuously scroll down in the
'more-prompt' mode, the 'more-prompt' will eventually quits the display and
the message are disappeared forever, so I must be careful NOT to press any
key when the last line of message are shown. What I expect is: press
"Enter" or "space" will always do scroll ONLY, and do never quit the
message display, this is consistent with the Unix "less" command.

If you just eat the 'q' after the message display, it will work if you want
to just quit all message, but when you want to view the last lines of the
message, the 'more-prompt' is still inconsistent since it will change into
"Press Enter or type command to continue" on the last line.

So I think a better way is to change the code for the 'less' mode, (in Vim
document, it is called 'more-prompt'), the 'more-prompt' should always
require 'q' 'ESC' to exit, even if the last line of text are shown. And
there should be an option to turn the 'more-prompt' always on. i.e. All
message will show 'more-prompt' regardless of the message 'lines'.

To conclude:
1. an option to "always show" the 'more-prompt'
2. 'more-prompt' will never fall into "Press Enter or type command to
continue" state even if on the last line, so we always require 'q' or ESC
to quit the 'more-prompt'. this is consistent with the Unix 'less' command.
--
Sincerely, Pan, Shi Zhu. ext: 2606

Reply via email to