I'm using HaskellConcealPlus to conceal certain elements of Haskell code, and haskell.vim from here to get better syntax highlighting for Haskell. Below is what it looks like :
The problem is that the div
, after being concealed, loses it's orange highlighting, which leads to inconsistency when '/' is highlighted orange, but '÷' is white, even though they're both infix operators. Is there a way to get the syntax highlighting and concealing to both work?
After opening login.sh file in vim editor, press ESC key and type ':syntax on' to enable syntax highlighting. The file will look like the following image if syntax highlighting is on. Press ESC key and type, “syntax off” to disable syntax highlighting.
You can change color schemes at anytime in vi by typing colorscheme followed by a space and the name of the color scheme. For more color schemes, you can browse this library on the vim website. You can enable or disable colors by simply typing "syntax on" or "syntax off" in vi.
If you want to select the entire line in a file, press V. Now when you press k or j to go up and down, vim will select the entire line above and below your cursor. Finally, you can select text in columns by pressing ctrl+v and moving up or down the block.
If you want to toggle this on/off (without creating a . vimrc file) simply type :syntax on while in vi/vim. Save this answer.
As soon as parts of text get concealed they get colorized as defined by the highlighting group Conceal
. :help hl-Conceal
will tell you more details about the group. :highlight
will show you all highlight groups and their color declarations. E.g. my conceal group looks like as shown below:
Conceal xxx ctermfg=4 ctermbg=0 guifg=#8fa1b3 guibg=#2b303b
In order to get more decent colors you can of course set a custom color and properties for your conceal group inside your .vimrc
. Below is an example which will use bold, underlined text, uses ANSI color 9 as the foreground color and ANSI color 0 as a background color for all files with an hs
extension:
augroup AdjustConceal
autocmd!
autocmd ColorScheme *.hs highlight Conceal cterm=bold,underline ctermfg=9 ctermbg=0
augroup END
Alternatively you could simply link to an existing highlighting group. The example below would link from Conceal
to Search
:
augroup AdjustConceal
autocmd!
autocmd ColorScheme *.hs highlight link Conceal Search
augroup END
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With