Show indentation level

7 views
Skip to first unread message

Pablo Giménez

unread,
Jul 6, 2010, 11:04:32 AM7/6/10
to vim_use
Hi
I am trying to make more clear my indent levels when programming python.
In many editors you can set to visualize indentation level in your
text, at every level a character, usually a point is shown, so you
onlu need to count the number of preceding points to know your indent
level.
I am already using cream-showinvisibles plugin:
http://vim.sourceforge.net/scripts/script.php?script_id=363
But this one don't show indentation levels visually.

Any ideas???
cheers


--
Un saludo
Best Regards
Pablo Giménez

Tony Mechelynck

unread,
Jul 6, 2010, 10:16:29 PM7/6/10
to vim...@googlegroups.com, Pablo Giménez
> Pablo Gim�nez
>

You should be able to display on the statusline the virtual column of
the first nonblank character on the current line. (This would, of
course, require a custom statusline.) The tricky part would be how to do
it without unduly disturbing editing.

See :help 'statusline'


Best regards,
Tony.
--
There was an old pirate named Bates
Who was learning to rhumba on skates.
He fell on his cutlass
Which rendered him nutless
And practically useless on dates.

Pablo Giménez

unread,
Jul 7, 2010, 7:14:48 AM7/7/10
to vim...@googlegroups.com
Thanks Tony.
I have the status line already working, but I was looking for
something more visual.
you know in many editors every level of indentation is show as points
in you text, so it is easy to see how many levels you lines have.

El día 7 de julio de 2010 03:16, Tony Mechelynck
<antoine.m...@gmail.com> escribió:


> On 06/07/10 17:04, Pablo Giménez wrote:
>>
>> Hi
>> I am trying to make more clear my indent levels when programming python.
>> In many editors you can set to visualize indentation level in your
>> text, at every level a character, usually a point is shown, so you
>> onlu need to count the number of preceding points to know your indent
>> level.
>> I am already using cream-showinvisibles plugin:
>> http://vim.sourceforge.net/scripts/script.php?script_id=363
>> But this one don't show indentation levels visually.
>>
>> Any ideas???
>> cheers
>>
>>
>> --
>> Un saludo
>> Best Regards

>> Pablo Giménez


>>
>
> You should be able to display on the statusline the virtual column of the
> first nonblank character on the current line. (This would, of course,
> require a custom statusline.) The tricky part would be how to do it without
> unduly disturbing editing.
>
> See :help 'statusline'
>
>
> Best regards,
> Tony.
> --
> There was an old pirate named Bates
> Who was learning to rhumba on skates.
>        He fell on his cutlass
>        Which rendered him nutless
> And practically useless on dates.
>

--
Un saludo
Best Regards

Pablo Giménez

Christian Brabandt

unread,
Jul 19, 2010, 5:20:07 PM7/19/10
to vim_use
Hi Pablo!

On Di, 06 Jul 2010, Pablo Giménez wrote:

> I am trying to make more clear my indent levels when programming python.
> In many editors you can set to visualize indentation level in your
> text, at every level a character, usually a point is shown, so you
> onlu need to count the number of preceding points to know your indent
> level.
> I am already using cream-showinvisibles plugin:
> http://vim.sourceforge.net/scripts/script.php?script_id=363
> But this one don't show indentation levels visually.

I am not sure I understand correctly. I think you could use the signs
feature to display the numerical indent level by calculating the
indentlevel by using indent()/&sts for each line.

<a little bit later…>

Here is a sample plugin. This is a very rough version, that was ripped
off of one of my plugins (changesPlugin:
http://www.vim.org/scripts/script.php?script_id=3052)

regards,
Christian
--
Urlaub ohne Unterlaß wäre ein gutes Training für den Aufenthalt in
der Hölle.
-- George Bernard Shaw

indentSigns.vim

Pablo Giménez

unread,
Jul 19, 2010, 8:25:29 PM7/19/10
to vim...@googlegroups.com
What I wanto to do is something like this:
def myFoolDef()
. fool = "myFoolTest"
. for letter in fool:
. . print letter + "\n"
. print "I got an amazing fool sentence in a columns"

As you can see every level of indentatin is shown by a dot.
And sometimes when coding with languages like Python this is really useful.
Cheers

2010/7/19 Christian Brabandt <cbl...@256bit.org>:

> --
> You received this message from the "vim_use" 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

Rafael Bermúdez

unread,
Jul 19, 2010, 9:06:55 PM7/19/10
to vim...@googlegroups.com
2010/7/19 Pablo Giménez <pabl...@gmail.com>

What I wanto to do is something like this:
def myFoolDef()
.   fool = "myFoolTest"
.   for letter in fool:
.   .   print letter + "\n"
.   print "I got an amazing fool sentence in a columns"

As you can see every level of indentatin is shown by a dot.
And sometimes when coding with languages like Python this is really useful.
Not sure about Python, as its indentation it's done with spaces, but for tab indents you can use listchars (:h listchars).

For example 'set listchars=tab:·\ ' would show a dot followed by three spaces at every indent, like in your example above.




--
Bermúdez Rafael

Christian Brabandt

unread,
Jul 20, 2010, 1:22:17 AM7/20/10
to vim...@googlegroups.com
Hi Pablo!

On Di, 20 Jul 2010, Pablo Gim�nez wrote:

> What I wanto to do is something like this:
> def myFoolDef()
> . fool = "myFoolTest"
> . for letter in fool:
> . . print letter + "\n"
> . print "I got an amazing fool sentence in a columns"
>
> As you can see every level of indentatin is shown by a dot.
> And sometimes when coding with languages like Python this is really useful.
> Cheers

See the recent thread that started with this message:
http://groups.google.com/group/vim_use/msg/ff4a9b37a625be12

Oh and BTW, please don't Top poste.

regards,
Christian

Mark Butler

unread,
Jul 20, 2010, 1:36:26 AM7/20/10
to vim...@googlegroups.com
Sorry to interrupt here, but I have a minor problem. In
Google groups when I subscribed this morning I selected "No
emails, I will read this group on the web", but it doesn't
seem to have any effect. Is there something critical I am
missing? Thanks in advance


John Beckett

unread,
Jul 20, 2010, 3:00:00 AM7/20/10
to vim...@googlegroups.com

I don't know how it happened, but your account was set to
"Email - send each message as it arrives". As you may not have a
Google account (which would allow you to easily change it
yourself via the web interface), I have interpreted the above as
a request, and have configured your account to:
"No Email - read this group on the web".

John

Pablo Giménez

unread,
Jul 20, 2010, 6:21:38 AM7/20/10
to vim...@googlegroups.com
2010/7/20 Christian Brabandt <cbl...@256bit.org>:
> Hi Pablo!

>
> On Di, 20 Jul 2010, Pablo Giménez wrote:
>
>> What I wanto to do is something like this:
>> def myFoolDef()
>> .   fool = "myFoolTest"
>> .   for letter in fool:
>> .   .   print letter + "\n"
>> .   print "I got an amazing fool sentence in a columns"
>>
>> As you can see every level of indentatin is shown by a dot.
>> And sometimes when coding with languages like Python this is really useful.
>> Cheers
>
> See the recent thread that started with this message:
> http://groups.google.com/group/vim_use/msg/ff4a9b37a625be12
This post is great, thanks!
I am using expandtabs so I think the hilight solution is better
because the listchars option seems to don't be able to detect spaces,
just tabs.
Cheers

>
> Oh and BTW, please don't Top poste.
Sorry about that.
>
> regards,
> Christian
Reply all
Reply to author
Forward
0 new messages