Wikipedia:Syntax highlighting |
||
|
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.
VimClick here to see what syntax highlighting in Vim looks like. Warning — the above link takes you directly to unfiltered HTML. 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.
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 isn't 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. |
||
Take this note to be able to access this article instantly from any page |
||