PowerGod
Forum Addict!
- Joined
- Jun 20, 2011
- Messages
- 4,462
Lately I'm working on a pretty huge page for this forum, and I found very difficult to modify it with the integrated editor, so, because I like VIM, I searched around the internet for some syntax or plugins, but I found almost nothing that can be called awesome, just "something" ok...
And I found this sad, giving the powerful automations/highlighting you can do with VIM.
So, I took what I found and started to "make it better" (considering that this is my first attempt at it)
The syntax from here http://www.vim.org/scripts/script.php?script_id=2070 wasn't working at all, also it was referring to some other plugin that I still have to study.
This one http://www.vim.org/scripts/script.php?script_id=2109 instead was almost perfect.
I did these modifications:
- added to ignore the content of the \[code\] section, because it was a mess if there was some bash script in there (it was also highlighting tags in there too)
- added the code to jump from start-tag to end-tag pressing "%" if you are using matchit.vim (if you are not using it... USE IT !!!)
- added some code for version checking as I found it in many syntaxes I have seen
The file (inside the attached zip) is "syntax/bbcode.vim", and must be put in the .vim/syntax folder, then you use the following command to start it
Also, because I didn't found something to show in realtime errors about misplaced tags, I found a ftplugin http://www.vim.org/scripts/script.php?script_id=3818
that did this for HTML (essentially it highlight both the start and ending tags when the cursor is over one of them), and I just hacked it to work with bbcode tags, it is "somehow" working, but it still needs some tweaks...
there's another issue, if it's used together with the syntax, the highlight becomes a little messy
The file (inside the attached zip) is "ftplugin/bbcode.vim", and must be copied to the .vim/ftplugin folder, then use the following command to start it
If you already have something better, I'll be happy to have a look
EDIT:
The last update to the SYNTAX file can be found SOME POSTS BELOW
And I found this sad, giving the powerful automations/highlighting you can do with VIM.
So, I took what I found and started to "make it better" (considering that this is my first attempt at it)
The syntax from here http://www.vim.org/scripts/script.php?script_id=2070 wasn't working at all, also it was referring to some other plugin that I still have to study.
This one http://www.vim.org/scripts/script.php?script_id=2109 instead was almost perfect.
I did these modifications:
- added to ignore the content of the \[code\] section, because it was a mess if there was some bash script in there (it was also highlighting tags in there too)
- added the code to jump from start-tag to end-tag pressing "%" if you are using matchit.vim (if you are not using it... USE IT !!!)
- added some code for version checking as I found it in many syntaxes I have seen
The file (inside the attached zip) is "syntax/bbcode.vim", and must be put in the .vim/syntax folder, then you use the following command to start it
Code:
:set syntax=bbcode
Also, because I didn't found something to show in realtime errors about misplaced tags, I found a ftplugin http://www.vim.org/scripts/script.php?script_id=3818
that did this for HTML (essentially it highlight both the start and ending tags when the cursor is over one of them), and I just hacked it to work with bbcode tags, it is "somehow" working, but it still needs some tweaks...
there's another issue, if it's used together with the syntax, the highlight becomes a little messy
The file (inside the attached zip) is "ftplugin/bbcode.vim", and must be copied to the .vim/ftplugin folder, then use the following command to start it
Code:
:set filetype=bbcode
If you already have something better, I'll be happy to have a look
EDIT:
The last update to the SYNTAX file can be found SOME POSTS BELOW
Attachments
Last edited: