I just discovered Vim's conceal feature.

I've added the following to ~/.vim/after/syntax/haskell.vim:

syntax match haskOperator "->" conceal cchar=→
syntax match haskOperator "<-" conceal cchar=←

highlight! link haskOperator Normal

And this to my vimrc:

setlocal conceallevel=2

This works and replaces -> with and <- with :

concealed characters, with highlights

That's nice but I feel that the replacement arrows are visually too prominent: I want to get rid of their highlighting, the grey background.

I tried to use transparent, but this makes the arrows entirely invisible.


The looks of those replacement characters are defined by the Conceal highlight group.

Adding this to my vimrc makes any text highlighted with that group use my terminal emulator's default foreground and background:

highlight Conceal ctermbg=none ctermfg=none guibg=none guifg=none

In effect, the replacement text is not highlighted anymore:

concealed text, no highlight

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.