Before including the autocommand group, I’d write about the reason of using it.
In my post titled Links to Good Posts, I’ve included some
custom autocompletion keyboard mappings for the automatic completion
() blocks in my VIMRC file.
Last Thursday, I extended them to blocks enclosed by single or double quotes.
1 2 3 4
How can Vim do the same type of job for angled block for HTML files only?
It is possible that you can find the
< character in $\rm \LaTeX$
source files which contains an inequality. In this case, we don’t
> character to be Automatically inserted to the right-hand
side of the
< character. Therefore, we need to enable this
completion only for the files with the right extension name(s).
From some web pages that include some autocommands that deal with some
specific type(s) of files, one can easily learn what to do, instead of
reading the long Reference Manual. The events needed are
1 2 3 4 5 6
At line 2, I initially tried using a whitespace character to separate
the two extension names. After that, I tried to edit an HTML file with
:e testing.html, but the autocompletion didn’t work. For
:e testing.htm, Vim threw me an error. It took me a
short while to figure out that commas should be used instead of
whitespaces. I know that the problem can be beautifully solved by
using regular expressions, but I’m not sure if
.htm[l] is correct,
and I lack time to test it. I’d like to insert an angled block with
empty content, but after I inserted the string
<> into my VIMRC
file, the syntax highlighter of Vim told me that Vim perceived the
empty angled block as the surrounding parts of a literal string which
represents a keystroke. To solve this problem, I inserted the literal
string that represents a
<Left> key followed by a
inside the originally empty angled block
<>. This is what you can
see at line 87. With the aid of the syntax highlighter of Vim, the new
autocommand has “revealed its colour” in my VIMRC, indicating the
success of this change.
Despite the uselessness of this autocommand, I thought I had found out
a way to switch Vim’s spell check on for $\rm \LaTeX$ source files.
However, moved to a buffer for $\rm \LaTeX$ source files to another
buffer for an HTML file, I discovered that the
spell option is
still on, which is not desired for editing an HTML file.
Fortunately, I succeeded in finding the correct autocommand
P.S. While writing HTML code in Vim, if you need to include the
character, you can record the encoded string of this character into a
l, which stands for “less than”) To use the
<C-r> in the insert mode first. Then input the name
of the register. (a lowercase alphabet) In addition, I use the
register for inserting a hyperlink which opens the target in a new
tabbed page in an HTML file.
(Last edited on FEB 3, 2014)
It seems that what I need is the
1 2 3 4 5
(Added on DEC 13, 2014)
Posted via UltraBlog.vim.