AvidSeeker | b584410 | 2024-07-16 21:10:50 +0200 | [diff] [blame] | 1 | " Language: MediaWiki |
| 2 | " Maintainer: Avid Seeker <avidseeker7@protonmail.com> |
| 3 | " Home: http://en.wikipedia.org/wiki/Wikipedia:Text_editor_support#Vim |
| 4 | " Last Change: 2024 Jul 14 |
| 5 | " Credits: chikamichi |
| 6 | " |
| 7 | |
| 8 | if exists("b:did_ftplugin") |
| 9 | finish |
| 10 | endif |
Stanislav Asunkin | dd36d6c | 2024-08-14 14:43:30 +0200 | [diff] [blame] | 11 | let b:did_ftplugin = 1 |
AvidSeeker | b584410 | 2024-07-16 21:10:50 +0200 | [diff] [blame] | 12 | |
| 13 | " Many MediaWiki wikis prefer line breaks only at the end of paragraphs |
| 14 | " (like in a text processor), which results in long, wrapping lines. |
| 15 | setlocal wrap linebreak |
| 16 | setlocal textwidth=0 |
| 17 | |
| 18 | setlocal formatoptions-=tc formatoptions+=l formatoptions+=roq |
| 19 | setlocal matchpairs+=<:> |
| 20 | |
| 21 | " Treat lists, indented text and tables as comment lines and continue with the |
| 22 | " same formatting in the next line (i.e. insert the comment leader) when hitting |
| 23 | " <CR> or using "o". |
| 24 | setlocal comments=n:#,n:*,n:\:,s:{\|,m:\|,ex:\|},s:<!--,m:\ \ \ \ ,e:--> |
| 25 | setlocal commentstring=<!--\ %s\ --> |
| 26 | |
| 27 | " match HTML tags (taken directly from $VIM/ftplugin/html.vim) |
| 28 | if exists("loaded_matchit") |
| 29 | let b:match_ignorecase=0 |
| 30 | let b:match_skip = 's:Comment' |
| 31 | let b:match_words = '<:>,' . |
| 32 | \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . |
| 33 | \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . |
| 34 | \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' |
| 35 | endif |
| 36 | |
| 37 | " Enable folding based on ==sections== |
| 38 | setlocal foldexpr=getline(v:lnum)=~'^\\(=\\+\\)[^=]\\+\\1\\(\\s*<!--.*-->\\)\\=\\s*$'?\">\".(len(matchstr(getline(v:lnum),'^=\\+'))-1):\"=\" |
| 39 | setlocal foldmethod=expr |
| 40 | |
| 41 | let b:undo_ftplugin = "setl commentstring< comments< formatoptions< foldexpr< foldmethod<" |
| 42 | let b:undo_ftplugin += " matchpairs< linebreak< wrap< textwidth<" |