=== 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 "~/.vim/syntax" on a Unix system, and "C:\Program Files\Vim\vimfiles\syntax" on a Windows system. If any of the directories above don't exist you may create them (the Unix/Linux command is [[mkdir]]). To autodetect files ending in ".wiki", add the following lines to ".vim/filetype.vim" or "vimfiles\filetype.vim" (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 vimrc file (typically ~/.vimrc on Unix and C:\Program Files\Vim\_vimrc 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 ":setf Wikipedia" will temporarily set the syntax for the current file. The above mentioned Firefox extension Mozex creates a temporary file ending in ".txt" rather than ".wiki" 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 "~/.vim/ftplugin/Wikipedia.vim" or "vimfiles\ftplugin\Wikipedia.vim" to make it easier (you may need to put "filetype plugin on" in your vimrc). setlocal fileencoding=utf-8 setlocal textwidth=0 setlocal linebreak setlocal matchpairs+=<:> setlocal comments=n:#,n:*,n:\:,s:{\|,m:\|,ex:\|} setlocal formatoptions=rol noremap k gk noremap j gj noremap gk noremap gj noremap 0 g0 noremap ^ g^ noremap $ g$ inoremap gk inoremap 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.