On 2014–01–26 Marco wrote:
> how can I display the current column in the status line?
>
> Having read :h statusline I found %c which looks promising, but it
> counts bytes and not characters. I'd like to have the column
> separated by characters, not bytes.
Here's a solution (thanks to benjifisher¹):
:let &statusline = "%{strlen(substitute(strpart(getline('.'), 0, col('.')), '.', 'x', 'g'))}"
It grabs the line, trims it to the cursor column, replaces all
characters with a 1-byte character, and counts the length of the
string:
Marco
¹ http://stackoverflow.com/a/21367789/1013470
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Sunday, January 26, 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment