Hot answers tagged

10

You can use :help :verbose to inspect the value of an option (they are "options", not "variables") and see where it was last defined: :verbose set conceallevel? Note that you must use the question mark to inspect boolean options while it doesn't change anything for other types so… stay safe, always use the question mark.


9

You can use the conceal feature for this. Add the following to the file ~/.vim/after/syntax/qf.vim (first creating the file if necessary): syntax match ConcealedDetails /\v^[^|]*\|[^|]*\| / conceal setlocal conceallevel=2 setlocal concealcursor=nvic The first line sets up a syntax item to conceal anything that matches the regular expression. The second line ...


9

Ok, I found the plugin involved into this: is indentLine. It is reported in its README: it does not work if conceallevel is not set to 1 or 2, so it set this parameter to 2 by default. The side effect is that markdown files are terribly displayed, and you cannot edit them confortably... I found it out debugging my init.vim thanks to lsrdg link suggestion. ...


8

I don't know how to achieve exactly what you want, only a part. You want to hide some text inside ~/.vimrc (for example). First we need to know which highlight group handles the text you want to hide. Add this mapping to your ~/.vimrc : map <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' \ . synIDattr(synID(...


7

This is not due to vimtex directly, but due to the conceal feature in Vim. vimtex only adds to the syntax plugin that ships with Vim/neovim, and it adhers to the relevant option, see :help g:tex_conceal. For direct control of the conceal feature itself, see :help conceallevel, :help concealcursor and :help syn-conceal. Short answer, you can put the ...


7

So as suggested I will give the solution I found. After having set conceallevel=1 set concealcursor=ni there are two ways to achieve the result: 1) using :syntax match :syntax match Conceal /\*/ conceal cchar=∗ 2) using matchadd :call matchadd('Conceal','\*',10,-1,{'conceal': '∗'}) Note 10 is the priority (default is 10) -1 is the match ID (see ...


6

With the following: set conceallevel=2 syn match IndentWS '\v(^( {4}|\t)*)@<=( {4}|\t)' conceal cchar=▶ I get: The regex \v(^( {4}|\t)*)@<=( {4}|\t): uses very magic \v matches a sets of 4 spaces ( {4}) or a tab \t, at the beginning of the line, with zero width \@<= and then a set of 4 spaces or a tab. Of course, if you use only tabs or spaces, ...


6

Like @caneta, the indentLine plugin was the culprit for me too. I solved it by disabling it for markdown files like this: let g:indentLine_fileTypeExclude = ['markdown']


5

The problem in your case is, that the syntax highlighting script for package uses a keyword (:h syn-keyword) and that always has priority before any of the syn-match or syn-region rules. In your case, I would therefore simply use a matchadd() call like this: :call matchadd('Conceal', 'package', 10, 99, {'conceal': 'p'}) :set conceallevel=2 concealcursor=...


5

This functionality comes from the internal LaTeX plugin. See :h tex-conceal and :h g:tex_conceal. You can turn it off either by setting conceallevel=0 or by letting g:tex_conceal=''. To be more precise, you can use either of the following lines in your vimrc file: let g:tex_conceal = '' set conceallevel = 0 I propose that you read :h conceallevel before ...


5

This could be used call matchadd('Conceal', '\s\{'.&ts.'\}', 10, -1, {'conceal': '►'}) This uses the matchadd() function to conceal parts of your text, which needs a 7.4.500 release or something. This has the advantage, that the match functions can override syntax rules, the other way around might not be always possible.


5

Mathematical equations cannot be displayed in Vim in this way: Vim has no means of rendering them, as @BLayer explains in his answer. However, mathematical symbols you can indeed display using Vim's conceal feature, as you suggest in your tags. The following commands will replace various mathsy HTML entities with their corresponding Unicode characters: :...


4

While the other answers here have all the necessary pointers ever needed, I think there is lacking a comprehensive solution IMHO. Below is a ready-to-paste in your .vimrc (or equivalent) au BufReadPost quickfix :call ConcealPath() function ConcealPath() syntax match ConcealedPath /\v^\/[^|]*\// conceal cchar=& setlocal conceallevel=2 ...


4

First regarding your second example: The match Test /hi/ is not syntax highlighting, but "match highlighting". This are two different things. The hi is still highlighted after you executed :syntax off. Now the initial problem: Your initial syntax-conceal definition is deleted in the process of loading the syntax definition needed for your .vimrc. While ...


4

This is a part of standard filetype plugin, see :h tex.vim for a complete info. That particular feature is controlled by :h g:tex_conceal So it's enough to add let g:tex_conceal = '' to your vimrc (or to disable only ligatures and accents: let g:tex_conceal = 'dmgs', i.e. no 'a' in tex_conceal's value).


4

The problem is that the subscript for g doesn't exist, and those for h and i look "off." As noted, you can either turn off the conceal feature altogether (set conceallevel=0) turn off conceal in tex files just for these kinds of things (let g:tex_conceal = 'abdmg')—see :help g:tex_conceal


4

Concealing characters is just a visual representation of the physical text. Vim commands however work with the actual text, so that yanking actually yanks what is in the buffer and not what is displayed. If you want to capture what is displayed, there are a couple of ways around it. The easiest solution is, if you are using Vim in the terminal and let the ...


4

I suspect the Conceal highlighting is overriden by your colorscheme os something like that. You will see where it is defined with :verbose highlight Conceal, which should show an output similar to this: :verbose hi Conceal Conceal xxx ctermfg=4 guifg=#268bd2 Last set from ~/.vim/colors/my_colorscheme.vim line 1234 I suggest you read this ...


4

With the help from Konfekt/vim-unicode-homoglyphs and the answers here I found this solution that works quite well and has (almost?) no performance impact: augroup Hiunicode autocmd! autocmd BufEnter * \ syntax match nonascii "[^\x00-\x7F]" | \ highlight nonascii ctermfg=NONE ctermbg=red augroup END


3

My interpretation is that the OP is looking for rendering of markup into fancy, graphical depictions of equations and formulae. If instead the question is about simple substitutions of Unicode mathematical characters then @Rich has a nice answer. vim is a text editor. It can display parallel, uniformly sized and spaced rows of Unicode characters and ...


3

This is not really possible, as concealing was meant as a sole method for displaying chars instead of the actual content. In the same sense, you can't really search for what has been folded or signs. The only method I know is using screenchar() function as shown in my other answer, but that is not really ready to use.


3

The conceal feature will let you do this. Following the example here, I came up with this solution. :call matchadd('Conceal', '^-', 10, -1, {'conceal': '□'}) :set conceallevel=2 concealcursor=nv Note that the pattern is a hyphen in column 1. If you want to allow whitespace before the hyphen, change the pattern to '^\s*\zs-'.


3

Here is a possibility which uses foldexpressions: fu! FoldEmptyLines(lnum) if !empty(getline(a:lnum)) && a:lnum+1 < line('$') && empty(getline(a:lnum+1)) return 1 elseif empty(getline(a:lnum)) return '=' else return 0 endif endfu setl foldenable foldexpr=FoldEmptyLines(v:lnum) foldmethod=expr ...


3

You could: :highlight GreekHyphen guifg=green ctermfg=green :syn region GreekHyphen matchgroup=GreekHyphenMark start='\\textgreek{' end='}' concealends You need to use matchgroup for concealends to work. concealends is used to conceal only the boundaries of a match: concealends *:syn-concealends* When the "concealends" argument is ...


3

The reason removing augroup remember_folds helped was given here: https://github.com/vim/vim/issues/4175. Basically neither mkview nor loadview remember filetype nor syntax. Quick fix to that problem is modyfing those commands. The augroup remember_folds should look like this: augroup remember_folds autocmd! autocmd BufWinLeave ?* mkview | filetype ...


3

Instead of matching all duplicate "a"s in a single match, try concealing each extra "a" in its own, concealed group: syn match HideAa "a\zea" conceal Because this conceals only a single "a" with its own syntax group conceal, it will effectively apply a concealing space to each "a".


3

One approach is to overwrite the existing markdownLinkText syntax item with one that conceals the [ and ] delimiters: This item is currently defined with the following line from $VIMRUNTIME/syntax/markdown.vim (line continuations added by me for Stack Exchange formatting purposes): syn region markdownLinkText matchgroup=markdownLinkTextDelimiter \ start=&...


3

The number of marks is hard-coded in Vim, and you can't get any more without modifying the source. – Martin Tournoij However, an advanced alternative exists in form of :h textprop in Vim and :h api-extended-marks in Neovim. In Neovim, marks can be set using nvim_buf_set_extmark(*args) which returns unique id for the mark. E.g. Creating mark on line 0 and ...


2

The only way that I can figure out is to make a function which loops over all the characters in the line and checks if it's concealed with synconcealed(). This seems to work well for help files: fun! VisualCol() let l:substract = 0 for l:i in range(0, col('$')) if synconcealed('.', l:i)[0] let l:substract += 1 endif ...


Only top voted, non community-wiki answers of a minimum length are eligible