Show whitespace characters in gvim

前端 未结 4 1766
孤街浪徒
孤街浪徒 2020-12-23 10:05

Is there an easy way to display whitespace characters such as space and tab in gvim? Something like what is implemented in Gedit, Geany, Komodo, and other GUI editors where

4条回答
  •  一个人的身影
    2020-12-23 10:28

    Here are some of my settings pertaining whitespace.

    Use F11 to toggle between displaying whitespace characters or not:

    noremap  :set list!
    

    How to show whitespace characters when list is set:

    set listchars=eol:$,tab:>-,trail:.,extends:>,precedes:<,nbsp:_
    

    Highlight special characters in yellow:

    highlight SpecialKey term=standout ctermbg=yellow guibg=yellow
    

    Highlight redundant spaces (spaces at the end of the line, spaces before or after tabs):

    highlight RedundantSpaces term=standout ctermbg=Grey guibg=#ffddcc    
    call matchadd('RedundantSpaces', '\(\s\+$\| \+\ze\t\|\t\zs \+\)\(\%#\)\@!')
    

    Hope these help!

提交回复
热议问题