Edit Page
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 4: | Line 4: | ||
I prefer to edit my confluence documents in Vim instead of the built-in confluence editor. |
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 < |
+ | 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 <tt>~/.vim/filetype.vim</tt> 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 |
<pre> |
<pre> |
||
{hidden-data}confluence{hidden-data} |
{hidden-data}confluence{hidden-data} |
||
Line 10: | Line 10: | ||
to the top of the doc. |
to the top of the doc. |
||
− | The following < |
+ | The following <tt>~/.vim/filetype.vim</tt> entry reads in the first line and regex searches for the word confluence and if found sets syntax type confluencewiki. |
<pre> |
<pre> |
||
au BufNewFile,BufRead * if getline(1) =~ 'confluence'| setfiletype confluencewiki | endif |
au BufNewFile,BufRead * if getline(1) =~ 'confluence'| setfiletype confluencewiki | endif |
||
Line 22: | Line 22: | ||
==Adding Confluence wiki syntax to the Vim gui menu dropdowns== |
==Adding Confluence wiki syntax to the Vim gui menu dropdowns== |
||
− | Open the appropriate Vim runtime syntax menu file for editing. For me it was < |
+ | Open the appropriate Vim runtime syntax menu file for editing. For me it was <tt>/Applications/MacVim.app/Contents/Resources/vim/runtime/synmenu.vim</tt> |
Find the in between space where your entry should go (they are incremented by 10s so you have 9 in between spaces). |
Find the in between space where your entry should go (they are incremented by 10s so you have 9 in between spaces). |
||
Line 39: | Line 39: | ||
</pre> |
</pre> |
||
− | 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 < |
+ | 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 <tt>.vim/syntax/confluencewiki.vim</tt> 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. |
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== |
==Bugs== |
||
− | Having incomplete < |
+ | 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 < |
+ | ''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+== |