(Change to TipImported template + severe manual clean) |
(Move categories to tip template) |
||
Line 9: | Line 9: | ||
|version=6.0 |
|version=6.0 |
||
|rating=9/5 |
|rating=9/5 |
||
+ | |category1= |
||
+ | |category2= |
||
}} |
}} |
||
This tip requires Perl and overwrites the unnamed register. |
This tip requires Perl and overwrites the unnamed register. |
Revision as of 05:08, 25 April 2008
Tip 976 Printable Monobook Previous Next
created August 20, 2005 · complexity intermediate · author Suresh Govindachar · version 6.0
This tip requires Perl and overwrites the unnamed register.
The output of :ls is sorted by buffer number.
The following command results in a user defined command named :Ls (all user defined commands need to start with a capital letter).
The output of :Ls is the same as the output of :ls except that the output is sorted by buffer name.
Here's the command which you can place in your vimrc:
command! -bang Ls redir @" | silent ls<bang> | redir END | echo " " | \ perl { \ my $msg=VIM::Eval('@"'); \ my %list=(); \ my $key, $value; \ while($msg =~ m/(.*?line\s+\d+)/g) \ { \ $value = $1; \ $value =~ m/"([^"]+)"/; \ $key = $1; \ ($^O =~ /mswin/i) and $key = lc($key); \ $list{$key} = $value; \ } \ my $msg = ''; \ for $key (sort keys %list) \ { \ $msg .= "$list{$key}\n"; \ } \ VIM::Msg($msg); \ } \ <cr>