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 |
Eisuke Kawashima | fbbaa6e | 2025-04-16 18:20:59 +0200 | [diff] [blame] | 6 | " 2025 Apr 16 by Vim Project (set 'cpoptions' for line continuation, #17121) |
AvidSeeker | b584410 | 2024-07-16 21:10:50 +0200 | [diff] [blame] | 7 | " |
| 8 | |
| 9 | if exists("b:did_ftplugin") |
| 10 | finish |
| 11 | endif |
Stanislav Asunkin | dd36d6c | 2024-08-14 14:43:30 +0200 | [diff] [blame] | 12 | let b:did_ftplugin = 1 |
AvidSeeker | b584410 | 2024-07-16 21:10:50 +0200 | [diff] [blame] | 13 | |
Eisuke Kawashima | fbbaa6e | 2025-04-16 18:20:59 +0200 | [diff] [blame] | 14 | let s:cpo_save = &cpo |
| 15 | set cpo&vim |
| 16 | |
AvidSeeker | b584410 | 2024-07-16 21:10:50 +0200 | [diff] [blame] | 17 | " Many MediaWiki wikis prefer line breaks only at the end of paragraphs |
| 18 | " (like in a text processor), which results in long, wrapping lines. |
| 19 | setlocal wrap linebreak |
| 20 | setlocal textwidth=0 |
| 21 | |
| 22 | setlocal formatoptions-=tc formatoptions+=l formatoptions+=roq |
| 23 | setlocal matchpairs+=<:> |
| 24 | |
| 25 | " Treat lists, indented text and tables as comment lines and continue with the |
| 26 | " same formatting in the next line (i.e. insert the comment leader) when hitting |
| 27 | " <CR> or using "o". |
| 28 | setlocal comments=n:#,n:*,n:\:,s:{\|,m:\|,ex:\|},s:<!--,m:\ \ \ \ ,e:--> |
| 29 | setlocal commentstring=<!--\ %s\ --> |
| 30 | |
| 31 | " match HTML tags (taken directly from $VIM/ftplugin/html.vim) |
| 32 | if exists("loaded_matchit") |
| 33 | let b:match_ignorecase=0 |
| 34 | let b:match_skip = 's:Comment' |
| 35 | let b:match_words = '<:>,' . |
| 36 | \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . |
| 37 | \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . |
| 38 | \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' |
| 39 | endif |
| 40 | |
| 41 | " Enable folding based on ==sections== |
| 42 | setlocal foldexpr=getline(v:lnum)=~'^\\(=\\+\\)[^=]\\+\\1\\(\\s*<!--.*-->\\)\\=\\s*$'?\">\".(len(matchstr(getline(v:lnum),'^=\\+'))-1):\"=\" |
| 43 | setlocal foldmethod=expr |
| 44 | |
| 45 | let b:undo_ftplugin = "setl commentstring< comments< formatoptions< foldexpr< foldmethod<" |
| 46 | let b:undo_ftplugin += " matchpairs< linebreak< wrap< textwidth<" |
Eisuke Kawashima | fbbaa6e | 2025-04-16 18:20:59 +0200 | [diff] [blame] | 47 | |
| 48 | let &cpo = s:cpo_save |
| 49 | unlet s:cpo_save |