This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Why is vim drawing underlines on the place of tabs and how to avoid this?
Im getting continuous line when I write spaces or tabs at the beginning of the lines:
http://www.freeimagehosting.net/68r69
Any idea?
Javi
This isn't the result of using tabs at the beginning of a line, it's just vim's code-highlighting.
Vim underlines links, and you're still within the body of an <a> tag.It's nothing to worry about, it just shows where the content of the displayable part of the link starts and ends.
You could disable syntax highlighting for HTML, but I wouldn't recommend it.
The text inside a HTML hyperlink in underlined by Vim's syntax highlighting to show that it is a link. In this case the whitespace surrounding the tag is being highlighted.
Switching off such underlining is addressed in this question and boils down to setting
:let html_no_rendering=1
which you could put in your .vimrc.
It's a flaw in the syntax definition; I've posted a fix here; I'll send this as a patch to the maintainer now, as it seems to be a constant source of confusion.
Related
I would like to get Vim to stop highlighting list characters (-,*) and heading characters (#) in rmarkdown. You can find a screenshot here: https://imgur.com/a/0YSB8V8.
This is happening when I set the file type to either pandoc or rmd. This is also happening no matter what terminal or colortheme I use.
I have the plugins: vim-pandoc, vim-pandoc-syntax, and vim-rmarkdown installed.
I would like to know a way to make the two characters just appear normally.
I would also like to know if there is a way to make italicized text in tables and headings appear italicized. As far as modifying the appearance of italicized text, I've tried using: hi Italic ctermfg=red cterm=italic in my vimrc, but that does not seem to affect the text in between asterisks (*) in rmd files. I admit I don't know much about the way that syntax works in Vim. Do I need to modify after/ftplugin/rmd.vim or runtime/syntax/rmd.vim? What is the difference between the two?
Any help would be appreciated!
Your syntax highlighter does not seem to recognize the bullet points, but thinks that they mark the beginning of an italic span. Maybe you have a clash of plugins. You could also try another highlighter (e.g. vim-polyglot, supports italics).
vim-pandoc-syntax uses the conceal feature (:h conceal). You can recolor the highlighting group Conceal to change the appearance of the replacement characters.
You can put changes to existing syntax files in .vim/after/syntax/rmd.vim. Files in syntax are executed when they are needed for the first time, but at most once per session. Files in ftplugin are executed every time the file type is changed.
This question already has answers here:
Make Vim show ALL white spaces as a character
(23 answers)
Closed 7 years ago.
I want to highlight tabs and spaces. In sublime text I activated an "draw_white_space": "all" option. After that all tabs and spaces is highlighting.
I want to activate the same option in vim, but all what I used didn't work.
I tried set follow options:
set listchars=tab:--
set list
How is it possible to activate it, and how to make highlighting tabs and spaces the same sympols like in picture above?
As icwnd says use
set list
set listchars=tab:▸·
However you may find that you still cannot see the characters because they are the same color as the background. Adding the following will change the color of those characters
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59
As Ben mentions, this does not work for spaces.
Edit
You can now do the same for spaces, see https://stackoverflow.com/a/29787362/1427295.
There is a vim plugin called spacehi which does that with tabs.
Download the spacehi.vim file, copy that into your ~/.vim/plugin/ folder, restart vim and activate/deactivate with F3.
If you don't want to use the plugin you could use this:
set list
set listchars=tab:--,trail:.,eol:¬,extends:>,precedes:<
For even nicer indentation also take a look at the vim-indent-guides.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
VIM: Don't underline leading whitespace in HTML links
Some of my lines in vim are getting weird horizontal lines in the leading whitespace. I don't know why. Maybe a plugin I have installed?
Here's a picture
Only some lines get them. I've tried closing and opening the file.
Does anyone know how to turn this off?
Those lines are part of the underline syntax highlighting of hyperlinks. Notice that they occur inside <a> tags. Some colorschemes won't underline hyperlinked content inside <a>, but if you wanted to continue using the same colorscheme you would need to modify or override the HtmlHiLink directives in the html.vim syntax files.
This question already has answers here:
Smart Wrap in Vim
(8 answers)
Closed 3 years ago.
If there are lines in a file that are too long to be displayed on the screen, we can use the
command
:set wrap
Now long lines are split into chunks visible on the screen. Usually the code is structured and indenting is used for readability, sometimes it's part of the syntax (Python).
If a line is wrapped into two (or more) lines, only the first line has right indenting
and the other lines begin at the beginning of a row.
If you use the command
:set nowrap
the line is visible only partially.
Could this behavior be changed via vimscript so that all of the wrapped lines have the same indent level?
You are right, unfortunately there is no such feature in Vim 7.3 yet, if you fancy a patch you can find a link to it below.
However there are 2 things that might help you improve readability for long code lines:
:set nu
Line numbering is used by most people editing and debugging code. A long line will have no numbers on it's wrappings clearly disambiguating code's indentation from wrapped line.
:set sbr=>\
A fixed marker to display on all wrappings (i.e. ">\ "). It only supports a static marker string, not based on the line's indentation.
You can combine these options and if you want the marker to be displayed in-line with line numbers you can:
:set cpoptions+=n
Patch: If you really need this feature you can try this patch:
https://retracile.net/wiki/VimBreakIndent
the option is supposed to be:
:set breakindent
It would be nice indeed if someone would pick it up in the source base.
I have a HTML file which contains both HTML and JavaScript. When I folded some code snippets, the syntax highlight didn't work well. Screenshot as following:
Line79 function setColor(color) is not correctly highlighted. Is there any way to fix it?
BTW, I am using GVIM 7.2 in windows 7.
Thanks!
When Vim opens an html file it applies html highlighting throughout the file. When you have a separate language in the html file you need to define syntax regions to let Vim know that parts of the file are to be highlighted differently from the language identified by the file extension. I described how to do this in an answer to an SO question here: In VIM, how can I mix syntax/ident rules of both jinja and javascript in the same file?
Also review the docs at :h syn-include.
Indenting is similar. That is, Vim will apply html indenting rules to everything within the file unless you tell it to indent the Javascript region differently.
NOTE: Maybe since html with embedded javascript is so common the html syntax files may by default support embedded javascript. The tip linked below suggests using :set filetype htmlm4 to get proper highlighting, although a commenter says that should not be necessary:
http://vim.wikia.com/wiki/Syntax_highlighting_for_HTML_with_embedded_Javascript
:syn sync fromstart
(See also help syn-sync-first)
It may be that you have a line in the mapInit() function whose length exceeds vim's 'synmaxcol' setting Notice the highlighting is incorrect on line 77 too (the closing brace).
set synmaxcol
From vim's help:
Maximum column in which to search for
syntax items. In long lines the text
after this column is not highlighted
and following lines may not be
highlighted correctly, because the
syntax state is cleared. This helps to
avoid very slow redrawing for an XML
file that is one long line.