:ls with range

18 views
Skip to first unread message

Sven Guckes

unread,
Dec 9, 2020, 10:06:11 AM12/9/20
to VIM Users List
my list of buffers is ever so long..
but it is quite practical to have it
since i can switch to buffers quickly.
still.. the recent buffers are at the
end of the list, and when listing them
with ":ls" i have to page down a bit.
and when i do it too fast then i miss
the end quite easily - and start over.

and i keep thinking: wasnt there some
patch already to add a range to ":ls"?
then i could probably list the last page
directly with a range like this:

:$-23,$ls

and i'd map it, too, of course. :)

have i missed that patch?

Sven

Dominique Pellé

unread,
Dec 9, 2020, 10:25:31 AM12/9/20
to Vim List, VIM Users List
Sven Guckes wrote:

> my list of buffers is ever so long..
> but it is quite practical to have it
> since i can switch to buffers quickly.
> still.. the recent buffers are at the
> end of the list, and when listing them
> with ":ls" i have to page down a bit.
> and when i do it too fast then i miss
> the end quite easily - and start over.

You don't have to start over. If you use
the f and b keys to page *f*orward or
*b*ackward, you won't need to start over.
Perhaps you instead page by pressing space
which indeed closes the list of buffers when
it goes beyond the end. Unlike space, the
f key won't close the list at the end.

You can also press G to go to the end and g
to go back to the beginning.

If you have many buffers, you may consider
using this plugin: https://github.com/junegunn/fzf.vim
and its :Buffer command to quickly jump to a buffer.

> and i keep thinking: wasnt there some
> patch already to add a range to ":ls"?
> then i could probably list the last page
> directly with a range like this:
>
> :$-23,$ls

I'm not aware of that.

Yegappan Lakshmanan

unread,
Dec 9, 2020, 10:44:32 AM12/9/20
to vim...@googlegroups.com, VIM Users List
Hi,

On Wed, Dec 9, 2020 at 7:06 AM Sven Guckes <guc...@guckes.net> wrote:
my list of buffers is ever so long..
but it is quite practical to have it
since i can switch to buffers quickly.
still.. the recent buffers are at the
end of the list, and when listing them
with ":ls" i have to page down a bit.
and when i do it too fast then i miss
the end quite easily - and start over.


After running the ":ls" command, you can use g< to
display the last page of the command output.

- Yegappan

Yegappan Lakshmanan

unread,
Dec 9, 2020, 10:49:31 AM12/9/20
to vim...@googlegroups.com, VIM Users List
On Wed, Dec 9, 2020 at 7:44 AM Yegappan Lakshmanan <yega...@gmail.com> wrote:
Hi,

On Wed, Dec 9, 2020 at 7:06 AM Sven Guckes <guc...@guckes.net> wrote:
my list of buffers is ever so long..
but it is quite practical to have it
since i can switch to buffers quickly.
still.. the recent buffers are at the
end of the list, and when listing them
with ":ls" i have to page down a bit.
and when i do it too fast then i miss
the end quite easily - and start over.


After running the ":ls" command, you can use g< to
display the last page of the command output.


Another option is to use the "t" flag to sort the buffers
by the last used time.

    :ls t

Sven Guckes

unread,
Dec 9, 2020, 11:27:58 AM12/9/20
to Vim List, VIM Users List
i always just used space+quit. o_O
now that i know there are more commands
i typed 'w' and get this prompt:

"-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit"

summary: ":ls" paging commands:
b+f back/forth one full page
d+u down/up one half page
g+G goto/Goto beginning/end

nice - very helpful! thanks, guys!

i obviously havent read the list of flags before. ":ls t" is great!

is there aby way to make vim show the list with the
date+time *before* the kraut-lang long filename?

example:

buf flags date time filename
23 a+ 2020-12-06 23:42:05 "/home/www/guckes/public_html/bash/bash.readline.txt"

oh.. and abbreviating prefixes like "/home/www/guckes/public_html" would be useful, too. :)
(hmm.. symlinks? hardlinks?)

Sven

Sven Guckes:
> my list of buffers is ever so long.. but it is quite practical
> to have it since i can switch to buffers quickly. still.. the
> recent buffers are at the end of the list, and when listing them
> with ":ls" i have to page down a bit. and when i do it too fast
> then i miss the end quite easily - and start over.

* Dominique Pellé <dominiq...@gmail.com> [2020-12-09 16:42]:
> You don't have to start over. If you use the f and b keys to
> page *f*orward or *b*ackward, you won't need to start over.
> Perhaps you instead page by pressing space which indeed
> closes the list of buffers when it goes beyond the end.
> Unlike space, the f key won't close the list at the end.
> You can also press G to go to the end
> and g to go back to the beginning.
>
> If you have many buffers, you may consider
> using this plugin: https://github.com/junegunn/fzf.vim
> and its :Buffer command to quickly jump to a buffer.

* Yegappan Lakshmanan <yega...@gmail.com> [2020-12-09 17:00]:
> After running the ":ls" command, you can use g<
> to display the last page of the command output.

* Yegappan Lakshmanan <yega...@gmail.com> [2020-12-09 17:00]:
Reply all
Reply to author
Forward
0 new messages