New tab visualization

142 views
Skip to first unread message

Kip Coul

unread,
Dec 31, 2012, 4:22:58 AM12/31/12
to vim...@vim.org
Hey guys,

I'm quite news to Vim, and I enjoy using it very much.

I'd like to suggest adding a new feature, which would IMO enhance the visualization of tabs.

Currently, the visualization of a tab is represented as a first character followed by as many repetitions of a second character needed to fill the width (lcs_tab1 and lcs_tab2 in the code, if I'm not mistaken).

I'd like to do the opposite, through an option: the first character repeated plus the second character at the end. That would enable using arrows ('--->' for 4-space wide tabs).

What do you think about this? I could add an option such as 'tabview' which could take two values.

Thanks for your feedback.

Happy new year !

Kip

Andy Spencer

unread,
Dec 31, 2012, 5:47:35 AM12/31/12
to vim...@googlegroups.com, vim...@vim.org
On 2012-12-31 10:22, Kip Coul wrote:
> Currently, the visualization of a tab is represented as a first
> character followed by as many repetitions of a second character needed
> to fill the width (lcs_tab1 and lcs_tab2 in the code, if I'm not
> mistaken).
>
> I'd like to do the opposite, through an option: the first character
> repeated plus the second character at the end. That would enable using
> arrows ('--->' for 4-space wide tabs).
>
> What do you think about this? I could add an option such as 'tabview'
> which could take two values.

I've wanted this before as well.

Maybe instead of adding another option you could modify how listchars
works? You could use tab:xyz for the left character, the repeated middle
character, and the (optional) right character. Then to get an arrow you
could use:

:set listchars=tab:-->

Any existing configurations that use the two character format `tab:xy'
would just be a special case and would be equivalent to tab:xyy.

Kip Coul

unread,
Dec 31, 2012, 6:12:13 AM12/31/12
to vim...@googlegroups.com
Hello Andy,

Good suggestion.

I'll look into the internals of listchars to implement this.

I'll keep you posted.

Cheers,
Kip
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Ingo Karkat

unread,
Dec 31, 2012, 10:35:36 PM12/31/12
to vim...@googlegroups.com
On 31-Dec-12 20:12:13 +0900, Kip Coul wrote:

> Hello Andy,
>
> Good suggestion.
>
> I'll look into the internals of listchars to implement this.
>
> I'll keep you posted.
>
> Cheers,
> Kip
>
> On 31 d�c. 2012, at 11:47, Andy Spencer <andy7...@gmail.com> wrote:
>
>> On 2012-12-31 10:22, Kip Coul wrote:
>>> Currently, the visualization of a tab is represented as a first
>>> character followed by as many repetitions of a second character needed
>>> to fill the width (lcs_tab1 and lcs_tab2 in the code, if I'm not
>>> mistaken).
>>>
>>> I'd like to do the opposite, through an option: the first character
>>> repeated plus the second character at the end. That would enable using
>>> arrows ('--->' for 4-space wide tabs).
>>>
>>> What do you think about this? I could add an option such as 'tabview'
>>> which could take two values.
>>
>> I've wanted this before as well.
>>
>> Maybe instead of adding another option you could modify how listchars
>> works? You could use tab:xyz for the left character, the repeated middle
>> character, and the (optional) right character. Then to get an arrow you
>> could use:
>>
>> :set listchars=tab:-->
>>
>> Any existing configurations that use the two character format `tab:xy'
>> would just be a special case and would be equivalent to tab:xyy.

This has been proposed before, but not been accepted yet.

http://groups.google.com/group/vim_dev/browse_thread/thread/6eaf6fc82626ec25

Have a look at the patch, check whether it still works, try to improve it (tests
would be especially nice; Bram rightly wants better test coverage now), and
resubmit for consideration here.

-- regards, ingo

PS: Please don't top-post to this list.

Bram Moolenaar

unread,
Jan 2, 2013, 11:50:23 AM1/2/13
to Andy Spencer, vim...@googlegroups.com, vim...@vim.org
Instead of changing the meaning of tab: it's probably easier to add
another item, e.g. rtab:. Or bat: (although most users will miss the
hint of a reverse tab...).

--
hundred-and-one symptoms of being an internet addict:
227. You sleep next to your monitor. Or on top of it.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Pragm B

unread,
Oct 13, 2013, 5:41:10 AM10/13/13
to vim...@googlegroups.com, Andy Spencer, vim...@vim.org
Hello everyone,

I have been wanting this feature as well, so I made a patch.
The way it works is as follows:
- an option, called "ntab" (for "new tab", or "end tab") is introduced within "listchars". It can be set like this: "ntab:1" or "ntab:y" or "ntab:Y" and unset with "ntab:0" or "ntab:n" or "ntab:N".
- when "ntab" is off [default], things behave as they currently do
- when "ntab" is on, the first character of "tab" is repeated, and the last character is mandatorily put.
This means that "tab:->,ntab:1" will show a tab that takes four spaces as "--->" and a tab that taks 1 space as ">".

I attach the patch with this e-mail.

Thanks!

Nathaniel

> /// Bram Moolenaar -- XXXXXXXXXXX -- http://www.Moolenaar.net \\\

patch-ntab.diff

Bram Moolenaar

unread,
Oct 13, 2013, 5:07:39 PM10/13/13
to Pragm B, vim...@googlegroups.com, Andy Spencer, vim...@vim.org

Pragm B. wrote:

> Hello everyone,
>
> I have been wanting this feature as well, so I made a patch.
> The way it works is as follows:
> - an option, called "ntab" (for "new tab", or "end tab") is introduced within "listchars". It can be set like this: "ntab:1" or "ntab:y" or "ntab:Y" and unset with "ntab:0" or "ntab:n" or "ntab:N".
> - when "ntab" is off [default], things behave as they currently do
> - when "ntab" is on, the first character of "tab" is repeated, and the last character is mandatorily put.
> This means that "tab:->,ntab:1" will show a tab that takes four spaces as "--->" and a tab that taks 1 space as ">".
>
> I attach the patch with this e-mail.

Thanks, I'll add it in the todo list.

Is Pragm B. your full name?

--
DENNIS: Listen -- strange women lying in ponds distributing swords is no
basis for a system of government. Supreme executive power derives
from a mandate from the masses, not from some farcical aquatic
ceremony.
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\

Pragm B

unread,
Oct 13, 2013, 5:12:12 PM10/13/13
to vim...@googlegroups.com, Pragm B, Andy Spencer, vim...@vim.org
Hello,

No, that's just a nickname :)

My name is Nathaniel Braun.

Thanks for integrating the patch!


--

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to a topic in the Google Groups "vim_dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_dev/AZQWFbgnMIo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages