2

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?

1 Answer 1

4

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>
1
  • perfect, thank you!
    – fbence
    May 17, 2020 at 18:40

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.