Adding and using vim modelines in wikka sources

This article is for Developers who use Vim to edit wikka sources.

For all wikka source, put this vim modeline at the beginning or at the end of the php file:
<?php /* vim: se ft=wikka : */ ?>

The inconvenient of this is that all php source will be modified! Another solution is to modify vim settings locally for all contributors:

Then, create a file named wikka.vim in your vimfiles/syntax directory, and put these lines:
"let main_syntax = 'wikka' (Don't really know what this does mean)
runtime syntax/php.vim 
"unlet b:current_syntax

se sts=4 "softtabstop=4
se sw=4 "shiftwidth=4

syn keyword wikkaMethodNames Wakka Query LoadSingle LoadAll CheckMySQLVersion GetMicroTime IncludeBuffered ReturnSafeHTML cleanUrl htmlspecialchars_ent GeSHi_Highlight GetPageTag GetPageTime GetMethod GetConfigValue GetWakkaName GetWakkaVersion LoadPage IsLatestPage GetCachedPage CachePage SetPage LoadPageById LoadRevisions LoadPagesLinkingTo LoadRecentlyChanged LoadWantedPages IsWantedPage LoadOrphanedPages LoadPageTitles LoadAllPages FullTextSearch FullCategoryTextSearch SavePage PageTitle ExistsPage HTTPPost WikiPing GetPingParams SetSessionCookie SetPersistentCookie DeleteCookie GetCookie SetRedirectMessage GetRedirectMessage Redirect MiniHref Href Link IsWikiName TrackLinkTo GetLinkTable ClearLinkTable StartLinkTracking StopLinkTracking WriteLinkTable Header Footer FormOpen FormClose ReadInterWikiConfig AddInterWiki GetInterWikiUrl LogReferrer LoadReferrers Action Method Format LoadUser LoadUsers GetUserName GetUser SetUser LogoutUser UserWantsComments LoadComments LoadRecentComments LoadRecentlyCommented SaveComment UserIsOwner IsAdmin GetPageOwner SetPageOwner LoadACL LoadAllACLs SaveACL TrimACLs HasAccess Maintenance Run magicQuotesSuck containedin=phpRegion,phpMethodsVar

hi wikkaMethodNames		guibg=#ffccee		guifg=red

Another Example

as it is unlikely that vim modelines will make it into the code repository, one could simply put in .vimrc:

set ts=8
set sts=4
set sw=4
set tw=0

" highlight with red unneeded whitespace at end of line
highlight WhitespaceEOL ctermbg=red guibg=red
   match WhitespaceEOL /\s\+$/

" go to the last known position in the opened file
autocmd BufReadPost *
  \ if line("'\"") > 0 && line("'\"") <= line("$") |
  \   exe "normal g`\"" |
  \ endif

" smart tab function from
inoremap <tab> <c-r>=InsertTabWrapper ("forward")<cr>
inoremap <s-tab> <c-r>=InsertTabWrapper ("backward")<cr>

function! InsertTabWrapper(direction)
	let col = col('.') - 1
	if !col || getline('.')[col - 1] !~ '\k'
		return "\<tab>"
	elseif "backward" == a:direction
		return "\<c-p>"
		return "\<c-n>"

There is one comment on this page. [Display comment]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki