Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37862679
en ru br
ALT Linux repositórios
S:0.0-alt5
5.0: 0.0-alt1

Group :: Editores
RPM: vim-plugin-mediawiki-syntax

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

=== Vim ===
To make [[Vim (text editor)|Vim]] (Amiga, Linux, Mac OS X, Windows, OpenVMS, OS/2, Unix) support the MediaWiki
markup used on Wikipedia (basically syntax highlighting; see
[[#IATgvim|It's All Text and vim/gvim]] for how to set up vim/gvim to edit wiki pages),
save [{{SERVER}}/w/index.php?title=User:Samsara/Wikipedia.vim&action=raw&ctype=text/css Wikipedia.vim]
to your "syntax" directory. By default, this directory is "<tt>~/.vim/syntax</tt>" on a Unix system, and "<tt>C:\Program Files\Vim\vimfiles\syntax</tt>" on a Windows system. If any of the directories above don't exist you may create them (the Unix/Linux command is <tt>[[mkdir]]</tt>).

To autodetect files ending in "<tt>.wiki</tt>", add the following lines to "<tt>.vim/filetype.vim</tt>" or "<tt>vimfiles\filetype.vim</tt>" (or create the file if it doesn't exist):

augroup filetypedetect
autocmd BufRead,BufNewFile *.wiki setfiletype Wikipedia
autocmd BufRead,BufNewFile *.wikipedia.org.* setfiletype Wikipedia
augroup END

Alternatively, add the following line to the <code>vimrc</code> file (typically <tt>~/.vimrc</tt> on Unix and <tt>C:\Program Files\Vim\_vimrc</tt> on Windows) (this doesn't work in Vim 7, use the above example):

autocmd BufRead,BufNewFile *.wiki setfiletype Wikipedia
autocmd BufRead,BufNewFile *.wikipedia.org.* setfiletype Wikipedia

Alternatively, the command "<tt>:setf Wikipedia</tt>" will temporarily set the syntax for the current file.

The above mentioned Firefox extension Mozex creates a temporary file ending in "<tt>.txt</tt>" rather than "<tt>.wiki</tt>" so the above autodetection will not work in combination with that plugin. One solution is to have Mozex invoke vim with these arguments:

-c "setf Wikipedia"

Wikipedia articles often only have line-breaks at the end of each paragraph, a situation Vim doesn't handle gracefully by default. Save the following lines to "<tt>~/.vim/ftplugin/Wikipedia.vim</tt>" or "<tt>vimfiles\ftplugin\Wikipedia.vim</tt>" to make it easier (you may need to put "<tt>filetype plugin on</tt>" in your <code>vimrc</code>).

setlocal fileencoding=utf-8
setlocal textwidth=0
setlocal linebreak
setlocal matchpairs+=<:>
setlocal comments=n:#,n:*,n:\:,s:{\|,m:\|,ex:\|}
setlocal formatoptions=rol
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$
inoremap <buffer> <Up> <C-O>gk
inoremap <buffer> <Down> <C-O>gj

" 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

Please feel free to edit Wikipedia.vim and [[:Image:Wikipedia.vim|upload an improved copy]], or to check on the [http://news.gmane.org/gmane.editors.vim.devel vim-devel list] if anyone has requested the upload of Wikipedia.vim, and if not, to request it. (As of [[2008]]-[[07-11]], it is not in [http://vim.svn.sourceforge.net/viewvc/vim/vim7/runtime/syntax/ Vim's "syntax/" directory].)

The above scripts are also posted in the [http://www.vim.org/scripts/script.php?script_id=1787 vim.org script collection], where they are occasionally updated with newer versions taken from community contributions on this site. Feel free to remind [[User:Mvcorks|mvc]] to upload a newer copy periodically if those become stale, since they were uploaded from his vim.org account.
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009