vim-syntax-highlighting

how to make file extensions to syntax highlighting in vim?

独自空忆成欢 提交于 2019-12-12 05:34:27
问题 I have *.q files ( that are very similar to other SQL ) and I want to make vim syntax highlight it in the same way as SQL. 回答1: Include it in the ~/.vim/filetype.vim , as described at Vim FAQ 26.8: " my filetype file if exists("did_load_filetypes") finish endif augroup filetypedetect au! BufRead,BufNewFile *.x setfiletype c augroup END For this case it would be changed to something like this: au! BufRead,BufNewFile *.q setfiletype sql Check :help new-filetype for additional details. 回答2:

How can I customize “comment marker” in Vim

喜夏-厌秋 提交于 2019-12-12 01:53:08
问题 When setting the formatoptions to include the o flag, pressing o or O on a commented line will "inherit" the leading comment marker. However, for Stata , only \\ had been recognized as a "valid comment". The other two types of commenting had been ignored, by the set formatoptions+=o . May I name multiple leading characters/strings to be the "comment marker" in Vim? Here goes how "comment lines" had been defined in the syntax file for Stata . (From C:/vim/vimfiles/syntax/stata.vim ) " comments

How do I create Vim syntax highlighting rules that are common to all filetypes?

▼魔方 西西 提交于 2019-12-11 06:56:18
问题 I'm trying to highlight trailing whitespace in vim, regardless of filetype. I'm able to do it on a per-filetype basis. For example, for HTML: ~/.vim/ftplugin/html.vim color html ~/.vim/syntax/html.vim syn match TrailingSpace display excludenl /\s\+$/ ~/.vim/colors/html.vim hi TrailingSpace ctermbg=52 ~/.vimrc syntax on filetype on filetype plugin on These settings make it so that trailing spaces at the end of a line are highlighted with a red background. (They also override all of vim's built

Vim syntax: Spell checking between certain regions

浪尽此生 提交于 2019-12-11 03:38:29
问题 I'm trying to create a syntax file for this language called Sugar Cube 2. You can find more about it here: http://www.motoslave.net/sugarcube/2/docs/macros.html Generally, I don't want to spell check between the macros (e.g., <<if $myVariable>> ). But, you can make your own macros, and I happen to have made one that works like this: <<myDescription "This is a string that should be in english">> As you can see, "english" should be capitalized, so it would be useful to have spell checking in

Superpose two vim syntax matches on the same character [duplicate]

浪尽此生 提交于 2019-12-11 03:15:14
问题 This question already has an answer here : Vim syntax files: add to cterm (1 answer) Closed 5 years ago . I'm defining the following syntax rules in a vimscript: hi MyBold term=bold gui=bold hi MyRed ctermfg=red guifg=#ff0000 And later on, I want to apply both highlights to the same character. So basically, I tried the following: syn match MyRed /\%1c\%1l./ syn match MyBold /\%1c\%1l./ but then the second match replaces the first match. So, I further read the help on syntax match , and also

Set colors for custom syntax keywords in Vim?

血红的双手。 提交于 2019-12-11 02:42:18
问题 I'm using a syntax file in vim that defines a number of filetype-specific syntax keywords. To color files of this type I've also created a colorscheme file for the share directory that attempts to highlight these syntax keywords, however they don't take effect when I open files of that extension. My color file does however highlight normal groups such as Normal , Special , Comment , etc. As well, when I attempt to move these highlight commands to my .vimrc file, they still have no effect.

Vim syntax highlighting

妖精的绣舞 提交于 2019-12-10 23:35:58
问题 Alright, this is probably a stupid question, but.... I've got a file of source code in a proprietary language. I want to edit said file with VIM, instead of their crummy editor. I'd like basic syntax highlighting of the language, but I don't want to spend a bunch of time rolling my own syntax file. Therefore, does VIM have a basic source highlighting module? It doesn't need to be perfect, I just want it to cover simple things. Currently, my only choices are no syntax highlighting, pick a

Vim syntax highlighting for multiline fortran openmp directives

时光毁灭记忆、已成空白 提交于 2019-12-10 22:20:57
问题 I'm using modern fortran for doing parallel programming. I'm using vim and it's been really annoying me that the fortran.vim syntax files don't seem to handle compiler directives like !$omp or !dir$. These just get rendered as comments in vim so they don't stand out. In c/c++ these compiler directives are done using #pragma's so everything stands out like it were preprocessor code rather than comment code. So I want similar treatment in my fortran syntax. Here's an example of a multiline

In VIM, is there any way to define syn region for template angle brackets without clashing with less than sign?

久未见 提交于 2019-12-10 14:19:31
问题 As for { , } and [ , ] and ( , ) , I really would like to be able to define syntax region for < , > to be used for C++ template usage like the following: a<b> But, is there any way to create such a syntax region without it clashing with something like the following: if( a < b<c>::d ) The first < is clearly a "less than" operator, and should be discarded as being the beginning of a region for template parameters. I've tried to use several options but was unable to make it work. Trying to use

Excluding the pattern for vim syntax highlighting

♀尐吖头ヾ 提交于 2019-12-10 11:19:29
问题 I am trying to adjust the reStructured text syntax highlighting in vim. I have tried several vim regexes to get highlight working for below two examples, but I am unable to. If I use search/highlight function all below regexes do the job, but for highlighter (syn match) it is not working. Maybe I need to change syn match to something else? This is the text example I am looking at in rst file: .. item:: This is the title I want to highlight there is some text here which I do not care .. item