Hello,
I am pretty sure this question has been already asked many times. I
apologize if that is the case.
I have been googling the topic for a while, and the problem is that I
found too many different ways to [theoretically] do it, so I am not
sure which one is the right one.
So let's say I only want to highlight lines starting with char #
(comments) in any file with extension .myfile
I have vim 7.2
I started by adding this line in my ~/.vimrc:
au BufRead,BufNewFile *.myfile setfiletype myfile
And tried to follow this documentation (one of the many):
http://learnvimscriptthehardway.stevelosh.com/chapters/45.html
So I created directory ~/.vim/plugin/syntax/ and file
~/.vim/plugin/syntax/myfile.vim, with content
if exists("b:current_syntax")
finish
endif
echom "Our syntax highlighting code will go here."
let b:current_syntax = "myfile"
And here, to my surprise, now I see the message every time I open ANY
file. So no worth it to keep moving on. I guess my first question is:
where do I exactly set the filetype recognition, and where I should
place the syntax file in such a way it does not mess with other
filetypes?
Thanks a lot in advance.
Cheers,
Jose
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tuesday, November 10, 2015
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment