vim-syntax-highlighting

Vim syntax Highlighting

若如初见. 提交于 2019-12-03 11:49:08
问题 I have installed vim in Debian 6. I am trying to change color scheme and enable syntax highlighting. But it's not working. I added set background=dark in .vimrc file. But white background is displaying. I wonder what went wrong? Here is my .vimrc file: http://pastebin.com/8k2gpWDh I installed robokai colorscheme which has dark background. But the background looks white instead dark. Other colors of colorscheme working. 回答1: Make sure you have syntax on And then call color[scheme] {name} To

Vim syntax Highlighting

白昼怎懂夜的黑 提交于 2019-12-03 02:15:45
I have installed vim in Debian 6. I am trying to change color scheme and enable syntax highlighting. But it's not working. I added set background=dark in .vimrc file. But white background is displaying. I wonder what went wrong? Here is my .vimrc file: http://pastebin.com/8k2gpWDh I installed robokai colorscheme which has dark background. But the background looks white instead dark. Other colors of colorscheme working. Make sure you have syntax on And then call color[scheme] {name} To set your desired colorscheme. These contain the set background=dark you refered, so it should be a matter of

Javascript syntax highlighting in vim

旧时模样 提交于 2019-12-02 15:24:26
Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes I need to scroll around in order to get the syntax highlighting adjusted, as sometimes it mysteriously drops all highlighting. Are there any work-arounds or ways to fix this? I'm using vim 7.1. You might like to try this improved Javascript syntax highlighter rather than the one that ships with VIMRUNTIME. Well, I've modified Yi Zhao's Javascript Syntax , and added Ajax Keywords support, also highlight DOM Methods and others. Here it is, it is far from being perfect as I'm still new to Vim,

Changing filetype based on file extention in vim

ぃ、小莉子 提交于 2019-12-02 04:33:24
问题 I want to change the filetype based on file extension in vim . I have the following code in the my .vimrc autocmd BufNew,BufNewFile,BufRead *.txt,*.text,*.md,*.markdown setlocal ft=markdown But when I open a file with the extention .md file, the filetype is not changed. I run :set ft command and it shows the output as filetype=modula2 . Am I doing anything wrong? Edit: I started to debug by renaming my old .vimrc file and created a new one with just this line. It was working properly. Then I

Changing filetype based on file extention in vim

邮差的信 提交于 2019-12-02 01:21:41
I want to change the filetype based on file extension in vim . I have the following code in the my .vimrc autocmd BufNew,BufNewFile,BufRead *.txt,*.text,*.md,*.markdown setlocal ft=markdown But when I open a file with the extention .md file, the filetype is not changed. I run :set ft command and it shows the output as filetype=modula2 . Am I doing anything wrong? Edit: I started to debug by renaming my old .vimrc file and created a new one with just this line. It was working properly. Then I replaced my old .vimrc file and everything seems to be working fine. Guess it was because of some

Vim: toggle highlighting of long lines

狂风中的少年 提交于 2019-12-01 17:37:22
In my .vimrc, I have: :au BufWinEnter * let w:m1=matchadd('Search', '\%>80v.\+', -1) to highlight lines that stray over the 80 character limit. How can I set it so that this is toggled on/off by pressing a function key? Use mappings. To activate highlight: :nnoremap <leader>1 :match Search '\%>80v.\+'<CR> To deactivate it: :nnoremap <leader>2 :match none<CR> UPDATE to use same key/key combination to toggle highlight: let s:activatedh = 0 function! ToggleH() if s:activatedh == 0 let s:activatedh = 1 match Search '\%>80v.\+' else let s:activatedh = 0 match none endif endfunction nnoremap <leader

Vim: toggle highlighting of long lines

北慕城南 提交于 2019-12-01 16:40:03
问题 In my .vimrc, I have: :au BufWinEnter * let w:m1=matchadd('Search', '\%>80v.\+', -1) to highlight lines that stray over the 80 character limit. How can I set it so that this is toggled on/off by pressing a function key? 回答1: Use mappings. To activate highlight: :nnoremap <leader>1 :match Search '\%>80v.\+'<CR> To deactivate it: :nnoremap <leader>2 :match none<CR> UPDATE to use same key/key combination to toggle highlight: let s:activatedh = 0 function! ToggleH() if s:activatedh == 0 let s

Vim syntax highlighting 'else:' for Python

可紊 提交于 2019-12-01 02:38:42
问题 I'm getting annoyed with the default python syntax highlighting in Vim. It does not highlight the else: statement correctly. Vim only highlights the else statement if I have some white space between the else and the colon : , so else : works, but else: does not. It must be easy to fix. I'm using Vim 7.2 回答1: I had below statement in my vimrc file. This made else: be tokenized as one word. After removing that else: syntax highlighting works just fine. set iskeyword+=: 回答2: It should work by

syntax highlighting in a VIM fold header

社会主义新天地 提交于 2019-12-01 00:04:33
问题 Is there any way to have VIM continue to apply formatting to the line used as the header for a fold? E.g., I have the following code: int foo(int a, int b) { int c; .... } When folded, I see: +-- 4 lines: int foo(int a, int b) {---------------------------- However, the whole line is highlighted as per the "Folded" class. Is there any way to disable this, so I continue to see the syntax highlighting? [for a simple example this is not so important, but I also use folding extensively in viewing

VIM syntax highlighting of html nested in yaml

时光总嘲笑我的痴心妄想 提交于 2019-11-30 18:22:04
Given a yaml file that contains html , like this: template : |+ <div>Hello, world</div> Is it possible in Vim (version 7.3.087) to highlight the html portion with html syntax highlighting? I found the post Different syntax highlighting within regions of a file , which seems to have exactly the concept I was looking for, but I cannot get it to work as expected with yaml . I'd expect to be able to do the following (as suggested in the link): " .vimrc " include the code from the above link call TextEnableCodeSnip('html' ,'#{{{html' ,'#html}}}', 'SpecialComment') Then have the yaml as, for example