Saturday, January 26, 2013

Re: Possible to stretch cursor on tab character?

On 27/01/13 02:25, neolus wrote:
> I think it would be extremely useful to have the cursor stretch itself on
> every tab character, versus being placed at the beginning or end as if it
> were on a space, because the way it is right now is very ambiguos with space
> characters and one generally doesnt now if the curor is on a tab untill
> trying to move it, but with the cursor stretched to cover the whole tab
> character there would be no ambiguity where the curor was. In anticipation
> of what someone might suggest no Im not interested in highlighting all tabs
> on page.
> So, does anyone have any idea how to achieve this functionality on vim?
>

Short answer: You can't. The cursor is always exactly one screen cell
wide, even if the underlying character uses two (as with CJK) or eight
(as is often the case with hard tabs).

Long answer: If you want to see the difference between spaces and tabs,
it is possible by means of the 'list' and 'listchars' options. Here is
what I use:

" set 'list' and 'listchars' options
set list listchars=eol:$ " $ should work on all 8-byte encodings
if has('multi_byte')
set listchars=eol:ś " on multibyte Vim (where 'encoding' is UTF-8)
" we can use the prettier Pilcrow mark
endif
set listchars+=tab:\|_ " show tabs as "|_______|_______"
silent! set listchars+=nbsp:~ " show no-break space as tilde if supported
if has('conceal')
set listchars+=conceal:* " use asterisk, not dash, for visible-conceal
endif


Notice the "tab:" part, and remember that vertical bars (and spaces, and
backslashes) in the argument of ":set" need to be backslash-escaped.


Best regards,
Tony.
--
Bagdikian's Observation:
Trying to be a first-rate reporter on the average American
newspaper is like trying to play Bach's "St. Matthew Passion" on a
ukelele.

--
--
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

No comments: