Tab-behavior and emacs-scrolling

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Tab-behavior and emacs-scrolling

Göran Gustafsson
I've been wondering for a while now how to change the behavior of <tab> while
doing :edit, i want the tab-completion to work like the default in Bash. Right
now it's more like in Zsh which i really don't like at all.

And another thing I've been looking for is how i can make VIM scroll like the
default in Emacs. Like when you have the cursor on the bottom of the screen it
will scroll down the half of the screen and put the cursor in the middle
instead of the one-line-scrolling which is default in VIM.

Any tips would be appreciated!

- Göran Gustafsson
Reply | Threaded
Open this post in threaded view
|

Tab-behavior and emacs-scrolling

Göran Gustafsson
I've been wondering for a while now how to change the behavior of <tab> while
doing :edit, i want the tab-completion to work like the default in Bash. Right
now it's more like in Zsh which i really don't like at all.

And another thing I've been looking for is how i can make VIM scroll like the
default in Emacs. Like when you have the cursor on the bottom of the screen it
will scroll down the half of the screen and put the cursor in the middle
instead of the one-line-scrolling which is default in VIM.

Any tips would be appreciated!

- Göran Gustafsson
Reply | Threaded
Open this post in threaded view
|

Re: Tab-behavior and emacs-scrolling

A.J.Mechelynck
----- Original Message -----
From: "G?ran Gustafsson" <[hidden email]>
To: <[hidden email]>
Sent: Saturday, September 17, 2005 12:19 PM
Subject: Tab-behavior and emacs-scrolling


> I've been wondering for a while now how to change the behavior of <tab>
> while
> doing :edit, i want the tab-completion to work like the default in Bash.
> Right
> now it's more like in Zsh which i really don't like at all.
>
> And another thing I've been looking for is how i can make VIM scroll like
> the
> default in Emacs. Like when you have the cursor on the bottom of the
> screen it
> will scroll down the half of the screen and put the cursor in the middle
> instead of the one-line-scrolling which is default in VIM.
>
> Any tips would be appreciated!
>
> - G?ran Gustafsson

I don't know very well how bash and zsh do their completion, but see

    :help 'wildmode'
    :help 'wildmenu'

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: Tab-behavior and emacs-scrolling

Göran Gustafsson
Tony Mechelynck <[hidden email]> wrote:

> I don't know very well how bash and zsh do their completion, but see
>
>     :help 'wildmode'
>     :help 'wildmenu'

set wildmode=longest,list is what i was looking for. Thanks for the tip.

- Göran Gustafsson
Reply | Threaded
Open this post in threaded view
|

Re: Tab-behavior and emacs-scrolling

Chris Allen
In reply to this post by Göran Gustafsson
On 17/09/05, Göran Gustafsson <[hidden email]> wrote:
> And another thing I've been looking for is how i can make VIM scroll like the
> default in Emacs. Like when you have the cursor on the bottom of the screen it
> will scroll down the half of the screen and put the cursor in the middle
> instead of the one-line-scrolling which is default in VIM.

I do not think there is a builtin solution for this.  Vim does have a
setting called 'scrolljump' which controls the number of lines
scrolled when the edge of the window is reached, but it is a fixed
number, rather than a percentage of the window.  This setting is also
global, which means you would need to change it every time you switch
windows, as well as when you resize.  The former can be done with a
winenter event, I do not *think* the latter can be done.  You could
manage it pretty well using a WinEnter autocommand, though, and the
functions winheight() and winline().

Rather surprisingly, I can not find a script or tip on vim.org which
already provides this functionality -- perhaps you'd like to
contribute any solution you devise.  Another throught might be to
petition Bram (or submit a patch) to allow a percentage value to be
used for this option, which would seem intuitive and a bit more
flexible to me, since people could then say they wanted a 30% scroll
or a 50% scroll, and get relatively consistent proportional scrolling
on their various windows.

HTH,
Chris Allen
Reply | Threaded
Open this post in threaded view
|

Re: Tab-behavior and emacs-scrolling

Göran Gustafsson
On 9/17/05, Chris Allen <[hidden email]> wrote:
> I do not think there is a builtin solution for this.  Vim does have a
> setting called 'scrolljump' which controls the number of lines
> scrolled when the edge of the window is reached, but it is a fixed
> number, rather than a percentage of the window.

This is exactly what i want. It's a shame that there's not percentage option
but i guess scrolljump=5 or something will do just fine at the moment.

I've gotten all the answers i want and it works more or less like i want it.
set wildmode=longest,list and set scrolljump=5

Thanks for all the tips.

- Göran Gustafsson
Reply | Threaded
Open this post in threaded view
|

Re: Tab-behavior and emacs-scrolling

Göran Gustafsson
I've been talking on the vim-dev mailinglist and got a tip about
"let &scrolljump = &lines / 2 - 1" which kind of does the thing i want. It's
not perfect but it's the best way unless they implement a percentage option in
vim. The only issue with it is you have to run it again if you have resized
the window. I hope someone else will find this as useful as i did.

- Göran Gustafsson