diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2024-07-16 22:23:44 +0200 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-07-17 11:11:58 +0200 |
| commit | 61ea4665916909853cf74256a6b350a680f08565 (patch) | |
| tree | 09bea1a93f8064081fc2ef0380bbefb0c811b15b /runtime/ftplugin | |
| parent | 4a7371c71486653253ae440a9a4017768ad36262 (diff) | |
| download | rneovim-61ea4665916909853cf74256a6b350a680f08565.tar.gz rneovim-61ea4665916909853cf74256a6b350a680f08565.tar.bz2 rneovim-61ea4665916909853cf74256a6b350a680f08565.zip | |
vim-patch:9.1.0592: runtime: filetype: Mediawiki files are not recognized
Problem: filetype: Mediawiki files are not recognized
Solution: detect "*.mw" and "*.wiki" as mediawiki filetype,
include basic syntax and filetype plugins.
(AvidSeeker)
closes: vim/vim#15266
https://github.com/vim/vim/commit/b5844104ab1259e061e023ea6259e4eb002e7170
Co-authored-by: AvidSeeker <avidseeker7@protonmail.com>
Diffstat (limited to 'runtime/ftplugin')
| -rw-r--r-- | runtime/ftplugin/mediawiki.vim | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/runtime/ftplugin/mediawiki.vim b/runtime/ftplugin/mediawiki.vim new file mode 100644 index 0000000000..efd2ae5c9b --- /dev/null +++ b/runtime/ftplugin/mediawiki.vim @@ -0,0 +1,42 @@ +" Language: MediaWiki +" Maintainer: Avid Seeker <avidseeker7@protonmail.com> +" Home: http://en.wikipedia.org/wiki/Wikipedia:Text_editor_support#Vim +" Last Change: 2024 Jul 14 +" Credits: chikamichi +" + +if exists("b:did_ftplugin") + finish +endif +let g:did_ftplugin = 1 + +" 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 + +setlocal formatoptions-=tc formatoptions+=l formatoptions+=roq +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:\|},s:<!--,m:\ \ \ \ ,e:--> +setlocal commentstring=<!--\ %s\ --> + +" 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 + +" Enable folding based on ==sections== +setlocal foldexpr=getline(v:lnum)=~'^\\(=\\+\\)[^=]\\+\\1\\(\\s*<!--.*-->\\)\\=\\s*$'?\">\".(len(matchstr(getline(v:lnum),'^=\\+'))-1):\"=\" +setlocal foldmethod=expr + +let b:undo_ftplugin = "setl commentstring< comments< formatoptions< foldexpr< foldmethod<" +let b:undo_ftplugin += " matchpairs< linebreak< wrap< textwidth<" |