search

Home  >  Q&A  >  body text

vimrc - Because W in vim uses spaces to distinguish strings, is there any way to highlight spaces?


Like the places pointed by the arrows, these places look like there are spaces or not. The spaces are not highlighted, and the W moving position is difficult to control.

So I want to know how to configure it to highlight spaces, or use other characters such as % to replace spaces.

大家讲道理大家讲道理2778 days ago767

reply all(2)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-16 16:36:25

    Method found on stackoverflow:

    Settings:

    :set listchars+=space:␣

    Display:

    :set list

    Effect:

    Before setting up:

    After setting up:

    Similarly, you can set the display of other hidden characters:

    :set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:␣

    Note that vim is only supported after version 7.4-710! The latest version of CentOS 7 is only 7.4-160, Ubuntu 15.10 is only 7.4-712, and some versions of Raspberry Pi are only 7.3. It is currently confirmed that the latest version of Ubuntu 16.04 is 7.4-1689 (what a damn conscience!). Only this platform is available for actual testing, and other distributions cannot be used because the versions are too low.

    Reference: http://stackoverflow.com/ques...


    Addition: I just noticed that the questioner uses gvim instead of vim. gvim is not clear. Since there is a GUI, why not use other more efficient editing tools.

    reply
    0
  • 怪我咯

    怪我咯2017-05-16 16:36:25

    :/ + Enter ->(Last line mode input:/space, enter to highlight all spaces)

    reply
    0
  • Cancelreply