Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Depending on your syntax rules for the current buffer, something like this could work:</p> <pre><code>:syn match WhiteSpace / / containedin=ALL conceal cchar=Æ :setl conceallevel=2 concealcursor=nv </code></pre> <p>This needs a vim 7.3 with +conceal feature </p> <p><strong>Update 10/24/2014</strong> To expand a little bit on that. It is of course possible to define some highlighting for the conealed characters.</p> <ul> <li><p>You can configure, how the concealed chars look. For highlighting, you would have to at least once configure the 'Conceal' highlighting group (See the help at <code>:h hl-Conceal</code> This can be done in your colorscheme and then you do not need to reconfigure it again. But this affects all concealed chars (e.g. if your syntax script conceals some more items, they will be displayed as your white space chars). That could look like this:</p> <p><code>:hi Conceal ctermfg=7 ctermbg=NONE guifg=LightGrey guibg=NONE</code></p></li> <li><p>There seems to be a particularity that Vim will not highlight spaces, if the syntax script uses the <code>skipwhite</code> keyword. There will be no way around (perhaps this will be fixed, I posted a <a href="https://groups.google.com/d/msg/vim_dev/sSkuUhSDX6o/fEWBkaseeoUJ" rel="noreferrer">patch</a>)</p></li> <li>There seems to be a patch floating around, that will allow to customize how spaces will look in <code>list</code> mode. The latest one at the time of writing seems to be <a href="https://groups.google.com/d/msg/vim_dev/dIQHjW1g92s/CtBo6MfNXN4J" rel="noreferrer">this one</a>. (This means, you need to built your own Vim to use this).</li> <li>The <code>conceallevel</code> and <code>concealcursor</code> are window local options. That means they can be different in different windows (and will possibly be also set by filetype plugins or other plugin scripts).</li> <li>The syntax highlighting groups need to be executed whenever a syntax definition file is reloaded. This could be done using a <code>BufWinEnter</code>or possibly also a <code>Syntax</code> or even <code>FileType</code> autocommand. (I have not tested which one actually works).</li> </ul> <p>The last two items means, you would have to setup some autocommands that reset the syntax rules and the correesponding options. For the first one, one might want to setup the highlighting using a <code>ColorScheme</code> autocommand (so that the concealed chars always look the same, independent of what a color scheme actually sets up). For a complete solution, look into romainl answer, that should give you a start. If you setup a function, you can easily setup a toggle command to switch displaying special Highlighting on or off.</p> <p><strong>Update 10/26/2014</strong> I made a <a href="https://github.com/chrisbra/vim-show-whitespace" rel="noreferrer">plugin</a> out of this question.</p> <p><strong>Update 04/22/2015</strong> A patch has been included in Vim that makes this possible using the <code>list</code> option. Simply set <code>set list listchars+=space:␣</code> This works as of <a href="https://groups.google.com/d/msg/vim_dev/Y-ATIo3du_c/LviJGkgdDGIJ" rel="noreferrer">Vim 7.4.711</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload