1

I have a listchars setting in my .vimrc, which shows some characters, but not all. Sometimes I would like to see it differently. I could map two key combos to the two settings and change between them that way, but it would be better if I could toggle between the two with only one combo. How would that be possible?

2

Something like this:

let lc1='tab:»-,trail:·,nbsp:×,eol:$'
let lc2='tab:<->,trail:X,nbsp:_,eol:/'

function ChgListchars()
    if &listchars == g:lc1
        let &listchars = g:lc2
    else
        let &listchars = g:lc1
    endif
endfunction

nnoremap <F9> :call ChgListchars()<CR>
| improve this answer | |
  • perfect, thank you! – fbence May 17 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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