Jump to content

Help:Text editor support

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Tim Starling (talk | contribs) at 13:26, 15 June 2003 (feel free to edit). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Many text editors have a feature called syntax highlighting, where various syntatical elements of the text are given different colours. Although this is most useful when editing source code, the method is equally applicable to editing wiki-markup. Below are instructions for installing Wikipedia syntax highlighting.

Save the target of the following link 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.

Click here for wikipedia.vim

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
au BufNewFile,BufRead *.wiki	setf wikipedia
augroup END

Alternatively, the command "set syn=wikipedia" will temporarily set the syntax for the current file.

If you are not familiar with Vim, here's some advice. Wikipedia articles often only have line-breaks at the end of each paragraph, a situation Vim is not designed for. The following lines added to your ".vimrc" or "_vimrc" file will make it much easier to edit such files:

set tw=0
set lbr
map <Up> gk
map <Down> gj
imap <Up> <ESC>gki
imap <Down> <ESC>gji

Please feel free to edit wikipedia.vim and upload an improved copy. This is a Wiki, after all.