1

So when I go to the first character in a line, the first character in that line is a tab character, and I execute echo col('.'), I will get 1.

However when I type 2| I won't go to the next character, but I will stay in the current position, which is because the tab character fills 8 display spaces.

So how can I make | behave like col('.') and use characters instead of display spaces?

1 Answer 1

3

This is just barely tested. So it might still have some bugs:

func! Go(char)
    let ret = '/^.\{'. a:char. '}\%'. line('.'). "l/e\<cr>"
    return ret
endfunc
nnoremap <silent><expr> <leader><Bar>  Go(v:count1)

The idea is to search for the given number of chars in the current line. Use the \| mapping to go where you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.