New answers tagged

1

Building on the previous answer, with this bash function you can open vim and the required file will be displayed with colours instead of codes in a new window "a little bit later" (depending on the size of $1). ansivim () { vim -c ":term ++hidden ++open cat $1" } e.g. ansivim ...


0

As being said in comment by @ChristianBrabandt, tab needs 2 characters. Note that SPACE should be escaped when you do it in set, like this \: set listchars=tab:⭲\ ,eol:⮠,trail:· Check :h set-args: See |option-backslash| for using white space and backslashes in {value}. Alternatively, you can use let with &listchars (see :h :let-&)...


4

Try tweaking your region start pattern to match the start of the file: start=/\%^---/ See :help start-of-file.


2

Turns out it's just broke in 8.2.0100. Here's the committed fix: https://github.com/tpope/vim-markdown/commit/e875717243fbea38189f5590a25a05809f03672b The problem was with the skip="\\*". It was supposed to match the literal characters \*, so that you could display a literal * in markdown. However, \\ makes a literal \, so he was instead skipping any ...


0

Try plugin https://github.com/jaxbot/semantic-highlight.vim (see also the article). To install (with Plug plugin manager), set in .vimrc Plug 'jaxbot/semantic-highlight.vim' Default colors fight with colorscheme I use (tender), so I set in vimrc colors to: let g:semanticTermColors = [3,124,30,32,33,64,66,67,69,99,101,102,103,104,132,133,135,136,137,164,...


3

There's an alternative and arguably cleaner method of achieving your goal. By using Vim's syntax features to make xA a group that can only be found within xB, you can remove your \zs entirely, resulting in much simpler regular expressions: syntax match xA /^a\+/ containedin=xB contained syntax match xB /^a\+b\+/ containedin=XB means that xA can be found ...


2

IIRC, transparent prevents coloring the text in any ways. I would expect the following to work syntax match xA /^a\+/ conceal syntax match xB /\(^a\+\)\@<=b\+/ highlight xA ctermfg=red highlight xB ctermfg=blue


1

This won't work because Vim won't scan the same text twice trying to match a different regex. Even though the \zs makes the resulting match only include the bs, Vim needs to see all the as to be able to match that regex and it won't do so if it already matched the as to the other pattern. You can do a small experiment to see this behavior, by doing a ...


2

I ran into this once. The short answer is even though \zs causes the match to start later, it « consumes » the as before it. The workaround is to use lookahead/behind, I believe. I’m not a master of vim’s syntax for that though; see :help pattern. I think you just need /\(^a\+\)\@<=b\+/


Top 50 recent answers are included