]> git.madduck.net Git - etc/vim.git/blob - .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:

fail softly if pathogen is not installed
[etc/vim.git] / .vim / ftplugin / mediawiki.vim
1 " Many MediaWiki wikis prefer line breaks only at the end of paragraphs
2 " (like in a text processor), which results in long, wrapping lines.
3 setlocal wrap linebreak
4 setlocal textwidth=0
5  
6 " No auto-wrap at all.
7 setlocal formatoptions-=tc formatoptions+=l
8 if v:version >= 602 | setlocal formatoptions-=a | endif
9  
10 " Make navigation more amenable to the long wrapping lines. 
11 noremap <buffer> k gk
12 noremap <buffer> j gj
13 noremap <buffer> <Up> gk
14 noremap <buffer> <Down> gj
15 noremap <buffer> 0 g0
16 noremap <buffer> ^ g^
17 noremap <buffer> $ g$
18 noremap <buffer> D dg$ 
19 noremap <buffer> C cg$ 
20 noremap <buffer> A g$a
21  
22 inoremap <buffer> <Up> <C-O>gk
23 inoremap <buffer> <Down> <C-O>gj
24
25 " utf-8 should be set if not already done globally
26 setlocal fileencoding=utf-8
27 setlocal matchpairs+=<:>
28  
29 " Treat lists, indented text and tables as comment lines and continue with the
30 " same formatting in the next line (i.e. insert the comment leader) when hitting
31 " <CR> or using "o".
32 setlocal comments=n:#,n:*,n:\:,s:{\|,m:\|,ex:\|} 
33 setlocal formatoptions+=roq
34  
35 " match HTML tags (taken directly from $VIM/ftplugin/html.vim)
36 if exists("loaded_matchit")
37     let b:match_ignorecase=0
38     let b:match_skip = 's:Comment'
39     let b:match_words = '<:>,' .
40     \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .
41     \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .
42     \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>'
43 endif
44  
45 " Other useful mappings
46 " Insert a matching = automatically while starting a new header.
47 inoremap <buffer> <silent> = <C-R>=(getline('.')==''\|\|getline('.')=~'^=\+$')?"==\<Lt>Left>":"="<CR>
48  
49 " Enable folding based on ==sections==
50 setlocal foldexpr=getline(v:lnum)=~'^\\(=\\+\\)[^=]\\+\\1\\(\\s*<!--.*-->\\)\\=\\s*$'?\">\".(len(matchstr(getline(v:lnum),'^=\\+'))-1):\"=\"
51 setlocal fdm=expr