Vim Tips Wiki
Register
(standard format and add "<CR>" which I think was accidentally omitted; text moved from Script:1994 - tips and bugs)
 
Line 45: Line 45:
 
==Bugs==
 
==Bugs==
 
Having incomplete <tt>{note:title}</tt> some notes here <tt>{info}</tt> blocks can cause your Vim buffer to seem hung. I haven't investigated why, but opening the doc in another text editor and properly closing the block seems to enable Vim to go back to functioning properly. I have to kill the process for the hung buffer though. I can also kill the process, open Vim again, turn off syntax highlighting, edit the document with the malformed note block to fix it, and then turn syntax highlighting back on.
 
Having incomplete <tt>{note:title}</tt> some notes here <tt>{info}</tt> blocks can cause your Vim buffer to seem hung. I haven't investigated why, but opening the doc in another text editor and properly closing the block seems to enable Vim to go back to functioning properly. I have to kill the process for the hung buffer though. I can also kill the process, open Vim again, turn off syntax highlighting, edit the document with the malformed note block to fix it, and then turn syntax highlighting back on.
  +
  +
''Marnix Klooster says:'' At least in version 0.1.0, I have the same problem using <tt>{mockup:Some nice dialog mock-up|1}</tt>, which is generated by the Confluence plugin for Balsamiq (see http://support.balsamiq.com/customer/portal/articles/113837 for details). Vim doesn't hang for me, but it becomes very slow every time this piece of text scrolls into view. As a workaround, I've hacked the <tt>syntax match confluenceTag</tt> line to use the simpler <tt>"{\%(\w\|-\)\+\([:|]\([^:|}]*\)\)*}"</tt> regex. Everything seems to still work. However, this is my first vim syntax file experience. :-)
   
 
==Wiki syntax editor deprecated in version 4.0+==
 
==Wiki syntax editor deprecated in version 4.0+==

Revision as of 10:15, 4 May 2012

Use this page to discuss script 1994 confluencewiki: syntax highlighting for Atlassian Confluence wiki

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Making Vim automatically recognize Confluence docs

I prefer to edit my confluence documents in Vim instead of the built-in confluence editor.

Sometimes instead of posting half completed documents back to confluence I save them on my local machine. To have Vim automatically recognize them I add an entry to ~/.vim/filetype.vim to automatically handle them. Instead of creating a custom file extension for Vim to recognize, I have it parse the file for the word confluence in the document. Instead of having to have all my confluence pages show the word confluence in the rendered version, the hack is to add hidden text to the top of your confluence files that won't show up when you are in viewing mode on confluence but does when you edit. Just add

{hidden-data}confluence{hidden-data}

to the top of the doc.

The following ~/.vim/filetype.vim entry reads in the first line and regex searches for the word confluence and if found sets syntax type confluencewiki.

au BufNewFile,BufRead * if getline(1) =~ 'confluence'| setfiletype confluencewiki | endif

You can always set the filetype while you are editing with the command

:set filetype=confluencewiki

to syntax highlight the current buffer.

Adding Confluence wiki syntax to the Vim gui menu dropdowns

Open the appropriate Vim runtime syntax menu file for editing. For me it was /Applications/MacVim.app/Contents/Resources/vim/runtime/synmenu.vim

Find the in between space where your entry should go (they are incremented by 10s so you have 9 in between spaces).

This applies generally to any syntax that isn't bundled with Vim, but if you wanted to add support for the confluencewiki syntax you downloaded from here, the alphabetic-orderingly appropriate space is:

an 50.20.370 &Syntax.C.Config.Generic\ Config\ file :cal SetSyn("conf")<CR>
an 50.20.380 &Syntax.C.CRM114 :cal SetSyn("crm")<CR>

and you would add a line with numbering in between so that it now looks like:

an 50.20.370 &Syntax.C.Config.Generic\ Config\ file :cal SetSyn("conf")<CR>
an 50.20.375 &Syntax.C.Confluence :cal SetSyn("confluencewiki")<CR>
an 50.20.380 &Syntax.C.CRM114 :cal SetSyn("crm")<CR>

Save the file. Restart Vim in GUI mode – this applies to MacVim as well. It should now show up in the Syntax filetypes listing and presuming you added the .vim/syntax/confluencewiki.vim file correctly, you can now select that syntax type for the current document.

Since these files are owned by the installation package, you'll have to redo this if you reinstall or add a new version as it will overwrite all this.

Bugs

Having incomplete {note:title} some notes here {info} blocks can cause your Vim buffer to seem hung. I haven't investigated why, but opening the doc in another text editor and properly closing the block seems to enable Vim to go back to functioning properly. I have to kill the process for the hung buffer though. I can also kill the process, open Vim again, turn off syntax highlighting, edit the document with the malformed note block to fix it, and then turn syntax highlighting back on.

Marnix Klooster says: At least in version 0.1.0, I have the same problem using {mockup:Some nice dialog mock-up|1}, which is generated by the Confluence plugin for Balsamiq (see http://support.balsamiq.com/customer/portal/articles/113837 for details). Vim doesn't hang for me, but it becomes very slow every time this piece of text scrolls into view. As a workaround, I've hacked the syntax match confluenceTag line to use the simpler "{\%(\w\|-\)\+\([:|]\([^:|}]*\)\)*}" regex. Everything seems to still work. However, this is my first vim syntax file experience. :-)

Wiki syntax editor deprecated in version 4.0+

According to Atlassian, the wiki syntax editing is not a gui feature, but they do allow you to paste in wiki syntax and have it autoconvert it to Rich Text so this plugin should still be useful for local editing.

Comments

I've been using this for about a year now and love it. --March 8, 2012