how to rename a vim tab?

3,196 views
Skip to first unread message

ping

unread,
Aug 24, 2011, 10:10:57 AM8/24/11
to vim...@googlegroups.com
folks:
this I can't find any good help for a while...
I want to change the default "title" of a new/existing tab , especially
when I use Conqueterm to run my own shell in each new tab -- the current
best practice I got to simulate sth like secureCRT in console.
the thing is it looks for me there is no obvious way (or rather I'm too
silly ) to change the tab title (to a remote host name for example), and
the default tab title is the command/shell that was started by Conqueterm.

thanks

regards
ping

Ben Fritz

unread,
Aug 24, 2011, 5:07:12 PM8/24/11
to vim_use
Depending on your system/use of the GUI, you can use 'guitablabel'

Otherwise, it's 'tabline'

ping

unread,
Aug 25, 2011, 9:45:34 AM8/25/11
to vim_use
thanks. but looks no luck.
set tabline=abc only generate an extra line marked with "abc" over the
entire tab line and make them invisible.
at least this is in my case.
I use vim inside gnome-terminal b.t.w

regards
ping

Ben Fritz

unread,
Aug 25, 2011, 3:35:30 PM8/25/11
to vim_use


On Aug 25, 8:45 am, ping <songpingem...@gmail.com> wrote:
> thanks. but looks no luck.
> set tabline=abc only generate an extra line marked with "abc" over the
> entire tab line and make them invisible.
> at least this is in my case.
> I use vim inside gnome-terminal b.t.w
>

That's because 'tabline' applies to the entire line of tabs, not just
the current tab. It doesn't go "over the entire tabline" and it
doesn't "make it invisible", it actually replaces the entire tabline.
This is your tabline. It doesn't draw over anything, it actually IS
the tabline.

If you're using a GUI Vim, guitablabel will apply only to one tab at a
time. But with 'tabline' you have to specify the entire line of tabs
at once.

Read the help on each of these. Also see:

http://vim.wikia.com/wiki/Show_tab_number_in_your_tab_line

There's an example of 'tabline' in the comments. The tip itself uses
'guitablabel'.

I'm not going to code it up for you, especially not without a specific
description of what you want. Check the help and give it a try.

ping

unread,
Jan 21, 2012, 7:46:40 PM1/21/12
to vim...@googlegroups.com
I'm using vim to open a lot of text files , each in a tab (a buffer), it
looks I reached the default maximum concurrent file numbers (30) and get
a warning.
I can't open more files then.
google searching doesn't bring much info.
anyone ran into similiar issue and any hint?

thanks!

regards
ping

John Beckett

unread,
Jan 22, 2012, 1:47:19 AM1/22/12
to vim...@googlegroups.com

What command do you enter?
What error message is displayed?

First few lines of :version might also be useful (I'm wondering
if you are running the Tiny version, and whether it has some
limit that I have never seen on normal Vim).

John

ping

unread,
Apr 10, 2012, 5:42:28 PM4/10/12
to vim...@googlegroups.com
I'm trying to redirect a :[range]g matches to a new buffer, then continue my work from there
here is some good examples:
http://vim.wikia.com/wiki/VimTip1063
the issue now is: it looks :g// only repeat last :global command without the range
how do I make even repeat with the same range?
this looks really useful if it can be implemented...

thanks!

regards
ping

Tim Chase

unread,
Apr 10, 2012, 8:26:07 PM4/10/12
to vim...@googlegroups.com, ping
On 04/10/12 16:42, ping wrote:
> I'm trying to redirect a :[range]g matches to a new buffer, then
> continue my work from there
> the issue now is: it looks :g// only repeat last :global command without
> the range
> how do I make even repeat with the same range?

You don't mention how your range was originally defined. If it
was with a visual range, you can continue to use the range
without re-highlighting it visually. Also, you can use the range
"*" (if "*" isn't in 'cpoptions') if you want to be lazy and not
retype "'<,'>", so you could write

:'<,'>g/foo/Frob(getline('.'))

and then type

:*g/baz/Bort(getline('.'))

which you can read about at

:help :*
:help cpo-star

Otherwise, I'm not sure Vim has a built-in way to repeat an
arbitrary range, but you do have a command history you can access
with the up-arrow if you want to scroll back; or you can use the
command-window by typing "q:" (or, if you're in the middle of
typing a command, you can use control+F)

:help c_<up>
:help q:

> this looks really useful if it can be implemented...

I'm not sure there's great utility to adding such functionality as

1) there's not great cause to reuse ranges, and

2) those cases you want to reuse a range, usually it's easiest to
pull it out of the command history and edit it accordingly, or
it's the last-highlighted range for which the "*" works as
described above.

-tim

ping

unread,
Apr 11, 2012, 11:17:46 AM4/11/12
to Tim Chase, vim...@googlegroups.com
hi Tim:
thanks for the detailed explanation and great info.
but if you look at this:
http://vim.wikia.com/wiki/VimTip1063
you will know what exactly I wanted to achieve.

basically I want to define a "generic" keybind or customer command,
to capture the matches by last :[range]g command, and do some work
based on those matched lines (split a win/buffer/tab/file and put
into it). This is really useful in the huge logs (over 300K+ lines
easily) analysis -- often you want to repeat that process based on
your demand and finally narrow down a relatively much smaller buffer/file
and really focus on that.
so you have a huge original raw file 500K, then:

1) :?pattern1?,/pattern2/g/pattern/
you finally are satisfied with the info you grabbed, then

2) with a new defined cmd like this:
"command! MyGrep execute 'normal! 0"ay0' | execute 'g//y A' | tabnew | enew | setlocal bt=nofile | put! a | nohls
now with :MyGrep, ideally if there is no range, will got last matches and put in a neighboring tab,

3) repeat 1) on this new buffer(maybe with different range and pattern)
4) finally you got the key data in the last tab

this will work great if there is no range...

regards
ping

Tim Chase

unread,
Apr 13, 2012, 2:29:56 PM4/13/12
to ping, vim...@googlegroups.com
On 04/11/12 10:17, ping wrote:
> 1) :?pattern1?,/pattern2/g/pattern/
> you finally are satisfied with the info you grabbed, then
>
> 2) with a new defined cmd like this:
> "command! MyGrep execute 'normal! 0"ay0' | execute 'g//y A' | tabnew |
> enew | setlocal bt=nofile | put! a | nohls
> now with :MyGrep, ideally if there is no *range*, will got last matches

> and put in a neighboring tab,

First, that's a hideous command definition (to the degree I went
out to the wiki and changed it to be more legible). If you're
going to use normal mode, the canonical way to clear a register
is to use "qaq" to clear register "a". I prefer the explicit
nature of setting it in Ex with ":let @a=''".

I'd be tempted to make use of the ability to pass ranges to a
command with something like

command! -range=% MyGrep let @a='' | execute
'<line1>,<line2>g//y A' | tabnew | enew | setlocal bt=nofile |
put! a | nohls

which you can read about at

:help command-range
:help <line1>

> 3) repeat 1) on this new buffer(maybe with different range and pattern)

I'd say it's highly unlikely that one would *want* the same range
in this secondary buffer, since it's already been winnowed down
to the specified range by this point. However, the same pattern
makes sense and can be done using the blank pattern as above.

-tim


ping

unread,
Apr 13, 2012, 4:53:49 PM4/13/12
to Tim Chase, vim...@googlegroups.com
hi Tim:
I tested it , with that line in my vimrc, 
a ":MyGrep" command still doesn't pick up the "previous" range I used in a g:// and still seems search the whole buffer.
maybe I'm not following, but currently I'm just using that "qaq" + "[range]g//y A" method and then manually paste reg a into next tab.
thanks for your help and time spent on it anyway!

regards
ping

John Beckett

unread,
Apr 13, 2012, 7:45:19 PM4/13/12
to vim...@googlegroups.com
Tim Chase wrote:
> First, that's a hideous command definition (to the degree I
> went out to the wiki and changed it to be more legible).
> you're going to use normal mode, the canonical way to clear a
> register is to use "qaq" to clear register "a". I prefer the
> explicit nature of setting it in Ex with ":let @a=''".
>
> I'd be tempted to make use of the ability to pass ranges to a
> command with something like
>
> command! -range=% MyGrep let @a='' | execute
> '<line1>,<line2>g//y A' | tabnew | enew | setlocal bt=nofile
> | put! a | nohls

What is 'enew' for?

I changed the command at:
http://vim.wikia.com/wiki/Redirect_g_search_output

from:
command! Filter let @a='' | execute 'g//y A' | split | enew | setlocal bt=nofile | put! a

to:
command! -nargs=? Filter let @a='' | execute 'g/<args>/y A' | new | setlocal bt=nofile | put! a

which included replacing 'split | enew' with just 'new'.

Is there some point I am missing?

I guess the range stuff should be added on the wiki as it's
pretty nice.

John

ping

unread,
Apr 18, 2012, 1:22:17 PM4/18/12
to vim...@googlegroups.com
1st retry...

On 01/21/2012 07:46 PM, ping wrote:
> I'm using vim to open a lot of text files , each in a tab (so also a

> buffer), it looks I reached the default maximum concurrent file

> numbers (exact 30) and get a warning.

Christian Brabandt

unread,
Apr 18, 2012, 1:28:37 PM4/18/12
to vim...@googlegroups.com
Hi ping!

:h 'tabpagemax

regards,
Christian
--
Unordnung: wo nichts am rechten Platz ist.
Ordnung: wo am rechten Platz nicht ist.

ping

unread,
Apr 18, 2012, 1:26:35 PM4/18/12
to vim...@googlegroups.com
I'm using fold a lot and wondering if there is a way to yank ONLY the
displayed texts?
that is , say I have following folding:

30 hostname "WASHDC core"
31 +-- 34 lines: aaa new-model
65 +-- 2 lines: !
67 service password-encryption
68 baseline show-delta-counts
69 !
70 +-- 3 lines: controller sonet 12/0
73 !
74 +-- 3 lines: controller sonet 13/0
77 !
78 +-- 23 lines: controller sonet 4/0
101 +-- 31 lines: !

normally when you yank a folded line, it actually yank the whole texts
that line folded, not only the displayed title.
but I want to also have the option to do the other way -- just yank the
texts that is getting displayed.

this is kind of another good usage of folding -- generate an overview
that can be passed to other places.


regards
ping

Christian Brabandt

unread,
Apr 18, 2012, 1:38:55 PM4/18/12
to vim...@googlegroups.com
Hi ping!

On Mi, 18 Apr 2012, ping wrote:

I once posted a similar function here.
Look here:
http://groups.google.com/group/vim_use/msg/571f070987ee35ce

regards,
Christian
--

Charles Campbell

unread,
Apr 18, 2012, 3:48:56 PM4/18/12
to vim...@googlegroups.com
Hello, ping:

You've "replied" twice on a thread (albeit one that you yourself
started) that has nothing to do with your subsequent questions. This
means that your questions have been placed in the thread on many (most?)
email readers, which in turn means that those who might have something
to say about your questions but aren't interested in the original ("how
to repeat the last :[range]g with the same range?") won't even see them.

I use seamonkey, myself; with it, I can right click on the "From:" field
and get an option to "compose mail to". Perhaps whatever you use has
something similar. The advantage is that it starts up a new thread, but
will still go to the group without your having to type it in.

Also: please bottom post on this group (its group-approved etiquette,
besides making sensible replies to replies to replies).

Regards,
Chip Campbell

Reply all
Reply to author
Forward
0 new messages