Hot answers tagged

18

To help answer your original question, you can check where a setting was last set with the :verbose command. :verbose set conceallevel This will display a message similar to: conceallevel=2 Last set from ~/.vim/plugged/indentLine/after/plugin/indentLine.vim Note that :verbose simply runs a command with a specified verbosity, so if you wish to check ...


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

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(...


6

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 ...


6

You can use the conceal feature for this. :syntax match ConcealedDetails /\v^[^|]*\|[^|]*\| / conceal :set conceallevel=2 :set concealcursor=nvic The first line sets up a syntax item to conceal anything that matches the regular expression. The second line informs Vim that you want to hide any concealed items that don't have a replacement cchar set. The ...


6

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, ...


5

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.


4

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

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

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


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

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

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

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).


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 ...


2

Based on the discussion I've started in the comments section of the Christian Brabandt answer, I'll leave here this alternative solution for anyone interested in a filetype specific approach: set conceallevel=2 au FileType purescript set concealcursor=vin au WinEnter,BufEnter,BufRead,FileType,Colorscheme * \ if exists('w:lambda_conceal') ...


2

You can do this with a feature called "Folds". Try adding this to your .vimrc: syn match MyEmptyLines "\(^$\)\+" fold syn sync fromstart setlocal foldmethod=syntax This tell's vim to create folds based off of the syntax of your file, and then adds a new syntax, e.g. any number of lines that match ^$. Then, you can fold all of these matches at once with zM, ...


2

There is no solution for that and Bram even stated, he does not consider that to be a bug. Concealing is only about the visual appearance and won't change the underlying text property. Besides being hard to get right (and possibly even slow), one would probably have many unwanted side effects, that are not wanted.


2

How to disable horizontal scrolling I've written a solution that disables horizontal scrolling, (by riffing off of @ЯрославРахматуллин's suggestion), but I don't think you're going to like it: augroup NoScrollPlease autocmd! autocmd CursorMoved * norm!99zH augroup END This prevents scrolling to the right by the incredibly precise method of just ...


2

It is possible to abuse folds to hide extra empty lines. Here is how one could do it: function! SkipNewlineFoldExpr() let l:curline = getline(v:lnum) " fold begins at {$ or one line before }$ if l:curline[-1:] == '{' || getline(v:lnum + 1)[-1:] == '}' return '>1' endif " fold ends one line after {$ or at }$ if getline(v:...


2

No it is not possible. Wrapping occurs on the real characters on the line and not on the concealed characters. Note, that if this would be possible, this would cause kind of "wobbling" effect just by moving/scrolling the cursor, which would be most likely unwanted and it possibly would also affect performance. There is also a issue 260 about it that was ...


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