]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/ftplugin/mediawiki.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

check in mediawiki syntax/ftplugin from wikipedia
[etc/vim.git] / .vim / ftplugin / mediawiki.vim
diff --git a/.vim/ftplugin/mediawiki.vim b/.vim/ftplugin/mediawiki.vim
new file mode 100644 (file)
index 0000000..c068d71
--- /dev/null
@@ -0,0 +1,51 @@
+" Many MediaWiki wikis prefer line breaks only at the end of paragraphs
+" (like in a text processor), which results in long, wrapping lines.
+setlocal wrap linebreak
+setlocal textwidth=0
+" No auto-wrap at all.
+setlocal formatoptions-=tc formatoptions+=l
+if v:version >= 602 | setlocal formatoptions-=a | endif
+" Make navigation more amenable to the long wrapping lines. 
+noremap <buffer> k gk
+noremap <buffer> j gj
+noremap <buffer> <Up> gk
+noremap <buffer> <Down> gj
+noremap <buffer> 0 g0
+noremap <buffer> ^ g^
+noremap <buffer> $ g$
+noremap <buffer> D dg$ 
+noremap <buffer> C cg$ 
+noremap <buffer> A g$a
+inoremap <buffer> <Up> <C-O>gk
+inoremap <buffer> <Down> <C-O>gj
+
+" utf-8 should be set if not already done globally
+setlocal fileencoding=utf-8
+setlocal matchpairs+=<:>
+" Treat lists, indented text and tables as comment lines and continue with the
+" same formatting in the next line (i.e. insert the comment leader) when hitting
+" <CR> or using "o".
+setlocal comments=n:#,n:*,n:\:,s:{\|,m:\|,ex:\|} 
+setlocal formatoptions+=roq
+" match HTML tags (taken directly from $VIM/ftplugin/html.vim)
+if exists("loaded_matchit")
+    let b:match_ignorecase=0
+    let b:match_skip = 's:Comment'
+    let b:match_words = '<:>,' .
+    \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
+    \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
+    \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
+endif
+" Other useful mappings
+" Insert a matching = automatically while starting a new header.
+inoremap <buffer> <silent> = <C-R>=(getline('.')==''\|\|getline('.')=~'^=\+$')?"==\<Lt>Left>":"="<CR>
+" Enable folding based on ==sections==
+setlocal foldexpr=getline(v:lnum)=~'^\\(=\\+\\)[^=]\\+\\1\\(\\s*<!--.*-->\\)\\=\\s*$'?\">\".(len(matchstr(getline(v:lnum),'^=\\+'))-1):\"=\"
+setlocal fdm=expr