adding vim

This commit is contained in:
Hunter Haugen 2009-09-04 14:08:46 -07:00
parent 1b1e9fb734
commit 357b651f15
24 changed files with 14313 additions and 0 deletions

4378
.vim/autoload/rails.vim Normal file

File diff suppressed because it is too large Load diff

212
.vim/colors/inkpot.vim Normal file
View file

@ -0,0 +1,212 @@
" Vim color file
" Name: inkpot.vim
" Maintainer: Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
" This should work in the GUI, rxvt-unicode (88 colour mode) and xterm (256
" colour mode). It won't work in 8/16 colour terminals.
"
" To use a black background, :let g:inkpot_black_background = 1
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "inkpot"
" map a urxvt cube number to an xterm-256 cube number
fun! <SID>M(a)
return strpart("0135", a:a, 1) + 0
endfun
" map a urxvt colour to an xterm-256 colour
fun! <SID>X(a)
if &t_Co == 88
return a:a
else
if a:a == 8
return 237
elseif a:a < 16
return a:a
elseif a:a > 79
return 232 + (3 * (a:a - 80))
else
let l:b = a:a - 16
let l:x = l:b % 4
let l:y = (l:b / 4) % 4
let l:z = (l:b / 16)
return 16 + <SID>M(l:x) + (6 * <SID>M(l:y)) + (36 * <SID>M(l:z))
endif
endif
endfun
if ! exists("g:inkpot_black_background")
let g:inkpot_black_background = 0
endif
if has("gui_running")
if ! g:inkpot_black_background
hi Normal gui=NONE guifg=#cfbfad guibg=#1e1e27
else
hi Normal gui=NONE guifg=#cfbfad guibg=#000000
endif
hi IncSearch gui=BOLD guifg=#303030 guibg=#cd8b60
hi Search gui=NONE guifg=#303030 guibg=#cd8b60
hi ErrorMsg gui=BOLD guifg=#ffffff guibg=#ce4e4e
hi WarningMsg gui=BOLD guifg=#ffffff guibg=#ce8e4e
hi ModeMsg gui=BOLD guifg=#7e7eae guibg=NONE
hi MoreMsg gui=BOLD guifg=#7e7eae guibg=NONE
hi Question gui=BOLD guifg=#ffcd00 guibg=NONE
hi StatusLine gui=BOLD guifg=#b9b9b9 guibg=#3e3e5e
hi User1 gui=BOLD guifg=#00ff8b guibg=#3e3e5e
hi User2 gui=BOLD guifg=#7070a0 guibg=#3e3e5e
hi StatusLineNC gui=NONE guifg=#b9b9b9 guibg=#3e3e5e
hi VertSplit gui=NONE guifg=#b9b9b9 guibg=#3e3e5e
hi WildMenu gui=BOLD guifg=#eeeeee guibg=#6e6eaf
hi MBENormal guifg=#cfbfad guibg=#2e2e3f
hi MBEChanged guifg=#eeeeee guibg=#2e2e3f
hi MBEVisibleNormal guifg=#cfcfcd guibg=#4e4e8f
hi MBEVisibleChanged guifg=#eeeeee guibg=#4e4e8f
hi DiffText gui=NONE guifg=#ffffcd guibg=#4a2a4a
hi DiffChange gui=NONE guifg=#ffffcd guibg=#306b8f
hi DiffDelete gui=NONE guifg=#ffffcd guibg=#6d3030
hi DiffAdd gui=NONE guifg=#ffffcd guibg=#306d30
hi Cursor gui=NONE guifg=#404040 guibg=#8b8bff
hi lCursor gui=NONE guifg=#404040 guibg=#8fff8b
hi CursorIM gui=NONE guifg=#404040 guibg=#8b8bff
hi Folded gui=NONE guifg=#cfcfcd guibg=#4b208f
hi FoldColumn gui=NONE guifg=#8b8bcd guibg=#2e2e2e
hi Directory gui=NONE guifg=#00ff8b guibg=NONE
hi LineNr gui=NONE guifg=#8b8bcd guibg=#2e2e2e
hi NonText gui=BOLD guifg=#8b8bcd guibg=NONE
hi SpecialKey gui=BOLD guifg=#ab60ed guibg=NONE
hi Title gui=BOLD guifg=#af4f4b guibg=NONE
hi Visual gui=NONE guifg=#eeeeee guibg=#4e4e8f
hi Comment gui=NONE guifg=#cd8b00 guibg=NONE
hi Constant gui=NONE guifg=#ffcd8b guibg=NONE
hi String gui=NONE guifg=#ffcd8b guibg=#404040
hi Error gui=NONE guifg=#ffffff guibg=#6e2e2e
hi Identifier gui=NONE guifg=#ff8bff guibg=NONE
hi Ignore gui=NONE
hi Number gui=NONE guifg=#f0ad6d guibg=NONE
hi PreProc gui=NONE guifg=#409090 guibg=NONE
hi Special gui=NONE guifg=#c080d0 guibg=NONE
hi SpecialChar gui=NONE guifg=#c080d0 guibg=#404040
hi Statement gui=NONE guifg=#808bed guibg=NONE
hi Todo gui=BOLD guifg=#303030 guibg=#d0a060
hi Type gui=NONE guifg=#ff8bff guibg=NONE
hi Underlined gui=BOLD guifg=#df9f2d guibg=NONE
hi TaglistTagName gui=BOLD guifg=#808bed guibg=NONE
hi perlSpecialMatch gui=NONE guifg=#c080d0 guibg=#404040
hi perlSpecialString gui=NONE guifg=#c080d0 guibg=#404040
hi cSpecialCharacter gui=NONE guifg=#c080d0 guibg=#404040
hi cFormat gui=NONE guifg=#c080d0 guibg=#404040
hi doxygenBrief gui=NONE guifg=#fdab60 guibg=NONE
hi doxygenParam gui=NONE guifg=#fdd090 guibg=NONE
hi doxygenPrev gui=NONE guifg=#fdd090 guibg=NONE
hi doxygenSmallSpecial gui=NONE guifg=#fdd090 guibg=NONE
hi doxygenSpecial gui=NONE guifg=#fdd090 guibg=NONE
hi doxygenComment gui=NONE guifg=#ad7b20 guibg=NONE
hi doxygenSpecial gui=NONE guifg=#fdab60 guibg=NONE
hi doxygenSpecialMultilineDesc gui=NONE guifg=#ad600b guibg=NONE
hi doxygenSpecialOnelineDesc gui=NONE guifg=#ad600b guibg=NONE
if v:version >= 700
hi Pmenu gui=NONE guifg=#eeeeee guibg=#4e4e8f
hi PmenuSel gui=BOLD guifg=#eeeeee guibg=#2e2e3f
hi PmenuSbar gui=BOLD guifg=#eeeeee guibg=#6e6eaf
hi PmenuThumb gui=BOLD guifg=#eeeeee guibg=#6e6eaf
hi SpellBad gui=undercurl guisp=#cc6666
hi SpellRare gui=undercurl guisp=#cc66cc
hi SpellLocal gui=undercurl guisp=#cccc66
hi SpellCap gui=undercurl guisp=#66cccc
hi MatchParen gui=NONE guifg=#404040 guibg=#8fff8b
endif
else
if ! g:inkpot_black_background
exec "hi Normal cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(80)
else
exec "hi Normal cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(16)
endif
exec "hi IncSearch cterm=BOLD ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(73)
exec "hi Search cterm=NONE ctermfg=" . <SID>X(80) . " ctermbg=" . <SID>X(73)
exec "hi ErrorMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(48)
exec "hi WarningMsg cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(68)
exec "hi ModeMsg cterm=BOLD ctermfg=" . <SID>X(38) . " ctermbg=" . "NONE"
exec "hi MoreMsg cterm=BOLD ctermfg=" . <SID>X(38) . " ctermbg=" . "NONE"
exec "hi Question cterm=BOLD ctermfg=" . <SID>X(52) . " ctermbg=" . "NONE"
exec "hi StatusLine cterm=BOLD ctermfg=" . <SID>X(85) . " ctermbg=" . <SID>X(81)
exec "hi User1 cterm=BOLD ctermfg=" . <SID>X(28) . " ctermbg=" . <SID>X(81)
exec "hi User2 cterm=BOLD ctermfg=" . <SID>X(39) . " ctermbg=" . <SID>X(81)
exec "hi StatusLineNC cterm=NONE ctermfg=" . <SID>X(84) . " ctermbg=" . <SID>X(81)
exec "hi VertSplit cterm=NONE ctermfg=" . <SID>X(84) . " ctermbg=" . <SID>X(81)
exec "hi WildMenu cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(38)
exec "hi MBENormal ctermfg=" . <SID>X(85) . " ctermbg=" . <SID>X(81)
exec "hi MBEChanged ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(81)
exec "hi MBEVisibleNormal ctermfg=" . <SID>X(85) . " ctermbg=" . <SID>X(82)
exec "hi MBEVisibleChanged ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(82)
exec "hi DiffText cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(34)
exec "hi DiffChange cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(17)
exec "hi DiffDelete cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(32)
exec "hi DiffAdd cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(20)
exec "hi Folded cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(35)
exec "hi FoldColumn cterm=NONE ctermfg=" . <SID>X(39) . " ctermbg=" . <SID>X(80)
exec "hi Directory cterm=NONE ctermfg=" . <SID>X(28) . " ctermbg=" . "NONE"
exec "hi LineNr cterm=NONE ctermfg=" . <SID>X(39) . " ctermbg=" . <SID>X(80)
exec "hi NonText cterm=BOLD ctermfg=" . <SID>X(39) . " ctermbg=" . "NONE"
exec "hi SpecialKey cterm=BOLD ctermfg=" . <SID>X(55) . " ctermbg=" . "NONE"
exec "hi Title cterm=BOLD ctermfg=" . <SID>X(48) . " ctermbg=" . "NONE"
exec "hi Visual cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(38)
exec "hi Comment cterm=NONE ctermfg=" . <SID>X(52) . " ctermbg=" . "NONE"
exec "hi Constant cterm=NONE ctermfg=" . <SID>X(73) . " ctermbg=" . "NONE"
exec "hi String cterm=NONE ctermfg=" . <SID>X(73) . " ctermbg=" . <SID>X(81)
exec "hi Error cterm=NONE ctermfg=" . <SID>X(79) . " ctermbg=" . <SID>X(32)
exec "hi Identifier cterm=NONE ctermfg=" . <SID>X(53) . " ctermbg=" . "NONE"
exec "hi Ignore cterm=NONE"
exec "hi Number cterm=NONE ctermfg=" . <SID>X(69) . " ctermbg=" . "NONE"
exec "hi PreProc cterm=NONE ctermfg=" . <SID>X(25) . " ctermbg=" . "NONE"
exec "hi Special cterm=NONE ctermfg=" . <SID>X(55) . " ctermbg=" . "NONE"
exec "hi SpecialChar cterm=NONE ctermfg=" . <SID>X(55) . " ctermbg=" . <SID>X(81)
exec "hi Statement cterm=NONE ctermfg=" . <SID>X(27) . " ctermbg=" . "NONE"
exec "hi Todo cterm=BOLD ctermfg=" . <SID>X(16) . " ctermbg=" . <SID>X(57)
exec "hi Type cterm=NONE ctermfg=" . <SID>X(71) . " ctermbg=" . "NONE"
exec "hi Underlined cterm=BOLD ctermfg=" . <SID>X(77) . " ctermbg=" . "NONE"
exec "hi TaglistTagName cterm=BOLD ctermfg=" . <SID>X(39) . " ctermbg=" . "NONE"
if v:version >= 700
exec "hi Pmenu cterm=NONE ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(82)
exec "hi PmenuSel cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(38)
exec "hi PmenuSbar cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(39)
exec "hi PmenuThumb cterm=BOLD ctermfg=" . <SID>X(87) . " ctermbg=" . <SID>X(39)
exec "hi SpellBad cterm=NONE ctermbg=" . <SID>X(32)
exec "hi SpellRare cterm=NONE ctermbg=" . <SID>X(33)
exec "hi SpellLocal cterm=NONE ctermbg=" . <SID>X(36)
exec "hi SpellCap cterm=NONE ctermbg=" . <SID>X(21)
exec "hi MatchParen cterm=NONE ctermbg=" . <SID>X(14) . "ctermfg=" . <SID>X(25)
endif
endif
" vim: set et :

View file

@ -0,0 +1,112 @@
" ----------------------------------------------------------------------------------------------------------------------------------
" Filename: relaxedgreen.vim
" Last Modified: 13 Feb 2007 09:57:24 PM by Dave V
" Maintainer: Dave Vehrs (dvehrs at gmail.com)
" Copyright: 2002,2003,2004,2005,2006,2007 Dave Vehrs
" This script is free software; you can redistribute it and/or
" modify it under the terms of the GNU General Public License as
" published by the Free Software Foundation; either version 2 of
" the License, or (at your option) any later version.
" Description: Vim colorscheme file.
" Install: Place this file in the users colors directory (~/.vim/colors) or
" in the shared colors directory (/usr/shared/vim/vim<version>/colors/),
" then load it with :colorscheme relaxedgreen
" ----------------------------------------------------------------------------------------------------------------------------------
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "relaxedgreen"
highlight Cursor term=reverse ctermfg=green ctermbg=blue guifg=#000000 guibg=#559955
highlight CursorIM term=reverse ctermfg=black ctermbg=darkgreen guifg=#000000 guibg=#336633
highlight CursorColumn term=none ctermbg=darkred guibg=#663333
highlight CursorLine term=none ctermbg=darkblue guibg=#333366
highlight Comment term=italic ctermfg=darkcyan ctermbg=black guifg=#00a594
highlight Constant term=underline ctermfg=blue guifg=#0099dd
highlight Debug term=bold ctermfg=red ctermbg=black guifg=#dc0000 guibg=#000000
highlight DiffAdd term=reverse ctermfg=black ctermbg=cyan guifg=#000000 guibg=#007200
highlight DiffChange term=underline cterm=reverse ctermfg=darkgreen ctermbg=black guifg=#000000 guibg=#006700
highlight DiffDelete term=standout ctermfg=black ctermbg=cyan guifg=#000000 guibg=#007200
highlight DiffText term=bold ctermfg=green ctermbg=black guifg=#00ac00 guibg=#000000
highlight Directory term=underline ctermfg=green ctermbg=black guifg=#336633 guibg=#000000
highlight Error term=reverse,bold ctermfg=black ctermbg=red guifg=#000000 guibg=#dc0000
highlight ErrorMsg term=reverse,bold ctermfg=white ctermbg=red guifg=#ffffff guibg=#dc0000
highlight Folded ctermfg=darkgreen ctermbg=black guifg=#20de20 guibg=#000000
highlight FoldColumn ctermfg=darkgreen ctermbg=black guifg=#20de20 guibg=#000000
highlight Function term=standout ctermfg=darkgreen guifg=#22bb22
highlight Identifier term=underline ctermfg=darkcyan gui=underline guifg=#008800
highlight Ignore ctermfg=lightgreen guifg=#33bb33
highlight IncSearch term=reverse ctermfg=black ctermbg=darkgreen guifg=#000000 guibg=#336633
highlight LineNr term=bold ctermfg=green guifg=#00ff00
highlight MatchParen term=bold ctermbg=green guifg=#009900
highlight ModeMsg term=bold cterm=bold gui=bold
highlight MoreMsg term=bold cterm=bold gui=bold
highlight NonText ctermfg=brown guifg=#b26818
highlight Normal ctermfg=gray ctermbg=black guifg=#aaaaaa guibg=#000000
highlight Pmenu term=reverse ctermfg=black ctermbg=green guifg=#000000 guibg=#337733
highlight PmenuSel term=bold ctermfg=black ctermbg=gray guifg=#000000 guibg=#999999
highlight PmenuSbar term=reverse ctermfg=black ctermbg=green guifg=#000000 guibg=#337733
highlight PmenuThumb term=reverse ctermfg=gray ctermbg=black guifg=#999999 guibg=#000000
highlight PreProc term=standout ctermfg=darkgreen guifg=#22bb22
highlight Question term=standout ctermfg=red guifg=#ff0000
highlight Search term=reverse ctermfg=black ctermbg=darkgreen guifg=#000000 guibg=#228822
highlight SignColumn ctermfg=darkgreen guifg=#20de20 guibg=#000000
highlight Special term=bold ctermfg=green guifg=#00ff00
highlight SpecialKey term=bold ctermfg=green guifg=#00ff00
highlight SpellBad term=reverse cterm=underline ctermfg=red ctermbg=black gui=undercurl guisp=#ff0000
highlight SpellCap term=reverse cterm=underline ctermfg=yellow ctermbg=black gui=undercurl guisp=#00ffff
highlight SpellLocal term=reverse cterm=underline ctermfg=blue ctermbg=black gui=undercurl guisp=#0000ff
highlight SpellRare term=reverse cterm=underline ctermfg=darkgreen ctermbg=black gui=undercurl guisp=#00ff00
highlight Statement term=standout ctermfg=darkred guifg=#ac0000
highlight StatusLine term=reverse ctermfg=darkgreen ctermbg=black gui=none guibg=#228822 guifg=#000000
highlight StatusLineNC term=reverse ctermfg=darkgreen ctermbg=blue gui=none guibg=#336633 guifg=#000000
highlight TabLine term=reverse cterm=reverse ctermfg=black ctermbg=green guibg=#222222 guifg=#228822
highlight TabLineFill term=reverse cterm=reverse ctermfg=green ctermbg=black guibg=#222222 guifg=#226622
highlight TabLineSel ctermfg=black ctermbg=green guibg=#228822 guifg=#222222
highlight Title term=reverse ctermfg=black ctermbg=green guifg=#000000 guibg=#00ff00
highlight Todo term=reverse cterm=reverse ctermfg=darkgreen ctermbg=black guibg=#336633 guifg=#000000
highlight Type term=standout ctermfg=green guifg=#559955
highlight Visual term=reverse cterm=reverse ctermfg=darkgreen guifg=#000000 guibg=#336633
highlight VisualNOS term=reverse,bold cterm=reverse ctermbg=darkgreen guifg=#000000 guibg=#228822
highlight VertSplit term=reverse ctermfg=darkgreen guifg=#336633
highlight User1 term=standout cterm=bold ctermbg=darkgreen ctermfg=red gui=bold guibg=#228822 guifg=#FF0000
highlight WarningMsg term=reverse ctermfg=black ctermbg=yellow guifg=#000000 guibg=#007a7a
highlight WildMenu term=reverse ctermfg=blue ctermbg=darkgreen guifg=#000099 guibg=#00ac00
" ----------------------------------------------------------------------------------------------------------------------------------
" Common groups that link to other highlight definitions.
highlight link Character Constant
highlight link Number Constant
highlight link Boolean Constant
highlight link String Constant
highlight link Operator LineNr
highlight link Float Number
highlight link Define PreProc
highlight link Include PreProc
highlight link Macro PreProc
highlight link PreCondit PreProc
highlight link Repeat Question
highlight link Conditional Repeat
highlight link Delimiter Special
highlight link SpecialChar Special
highlight link SpecialComment Special
highlight link Tag Special
highlight link Exception Statement
highlight link Keyword Statement
highlight link Label Statement
highlight link StorageClass Type
highlight link Structure Type
highlight link Typedef Type
" ----------------------------------------------------------------------------------------------------------------------------------
" vim:tw=132:ts=4:sw=4

406
.vim/doc/matchit.txt Normal file
View file

@ -0,0 +1,406 @@
*matchit.txt* Extended "%" matching
For instructions on installing this file, type
:help matchit-install
inside Vim.
For Vim version 6.3. Last change: 2007 Aug 29
VIM REFERENCE MANUAL by Benji Fisher
*matchit* *matchit.vim*
1. Extended matching with "%" |matchit-intro|
2. Activation |matchit-activate|
3. Configuration |matchit-configure|
4. Supporting a New Language |matchit-newlang|
5. Known Bugs and Limitations |matchit-bugs|
The functionality mentioned here is a plugin, see |add-plugin|.
This plugin is only available if 'compatible' is not set.
You can avoid loading this plugin by setting the "loaded_matchit" variable
in your |vimrc| file: >
:let loaded_matchit = 1
{Vi does not have any of this}
==============================================================================
1. Extended matching with "%" *matchit-intro*
*matchit-%*
% Cycle forward through matching groups, such as "if", "else", "endif",
as specified by |b:match_words|.
*g%* *v_g%* *o_g%*
g% Cycle backwards through matching groups, as specified by
|b:match_words|. For example, go from "if" to "endif" to "else".
*[%* *v_[%* *o_[%*
[% Go to [count] previous unmatched group, as specified by
|b:match_words|. Similar to |[{|.
*]%* *v_]%* *o_]%*
]% Go to [count] next unmatched group, as specified by
|b:match_words|. Similar to |]}|.
*v_a%*
a% In Visual mode, select the matching group, as specified by
|b:match_words|, containing the cursor. Similar to |v_a[|.
A [count] is ignored, and only the first character of the closing
pattern is selected.
In Vim, as in plain vi, the percent key, |%|, jumps the cursor from a brace,
bracket, or paren to its match. This can be configured with the 'matchpairs'
option. The matchit plugin extends this in several ways:
You can match whole words, such as "if" and "endif", not just
single characters. You can also specify a |regular-expression|.
You can define groups with more than two words, such as "if",
"else", "endif". Banging on the "%" key will cycle from the "if" to
the first "else", the next "else", ..., the closing "endif", and back
to the opening "if". Nested structures are skipped. Using |g%| goes
in the reverse direction.
By default, words inside comments and strings are ignored, unless
the cursor is inside a comment or string when you type "%". If the
only thing you want to do is modify the behavior of "%" so that it
behaves this way, you do not have to define |b:match_words|, since the
script uses the 'matchpairs' option as well as this variable.
See |matchit-details| for details on what the script does, and |b:match_words|
for how to specify matching patterns.
MODES: *matchit-modes* *matchit-v_%* *matchit-o_%*
Mostly, % and related motions (|g%| and |[%| and |]%|) work just like built-in
|motion| commands in |Operator-pending| and |Visual| modes. However, you
cannot make these motions |linewise| or |characterwise|, since the |:omap|s
that define them start with "v" in order to make the default behavior
inclusive. (See |o_v|.) In other words, "dV%" will not work. The
work-around is to go through Visual mode: "V%d" will work.
LANGUAGES: *matchit-languages*
Currently, the following languages are supported: Ada, ASP with VBS, Csh,
DTD, Entity, Essbase, Fortran, HTML, JSP (same as HTML), LaTeX, Lua, Pascal,
SGML, Shell, Tcsh, Vim, XML. Other languages may already have support via
the default |filetype-plugin|s in the standard vim distribution.
To support a new language, see |matchit-newlang| below.
DETAILS: *matchit-details* *matchit-parse*
Here is an outline of what matchit.vim does each time you hit the "%" key. If
there are |backref|s in |b:match_words| then the first step is to produce a
version in which these back references have been eliminated; if there are no
|backref|s then this step is skipped. This step is called parsing. For
example, "\(foo\|bar\):end\1" is parsed to yield
"\(foo\|bar\):end\(foo\|bar\)". This can get tricky, especially if there are
nested groups. If debugging is turned on, the parsed version is saved as
|b:match_pat|.
*matchit-choose*
Next, the script looks for a word on the current line that matches the pattern
just constructed. It includes the patterns from the 'matchpairs' option.
The goal is to do what you expect, which turns out to be a little complicated.
The script follows these rules:
Insist on a match that ends on or after the cursor.
Prefer a match that includes the cursor position (that is, one that
starts on or before the cursor).
Prefer a match that starts as close to the cursor as possible.
If more than one pattern in |b:match_words| matches, choose the one
that is listed first.
Examples:
Suppose you >
:let b:match_words = '<:>,<tag>:</tag>'
< and hit "%" with the cursor on or before the "<" in "a <tag> is born".
The pattern '<' comes first, so it is preferred over '<tag>', which
also matches. If the cursor is on the "t", however, then '<tag>' is
preferred, because this matches a bit of text containing the cursor.
If the two groups of patterns were reversed then '<' would never be
preferred.
Suppose you >
:let b:match_words = 'if:end if'
< (Note the space!) and hit "%" with the cursor at the end of "end if".
Then "if" matches, which is probably not what you want, but if the
cursor starts on the "end " then "end if" is chosen. (You can avoid
this problem by using a more complicated pattern.)
If there is no match, the cursor does not move. (Before version 1.13 of the
script, it would fall back on the usual behavior of |%|). If debugging is
turned on, the matched bit of text is saved as |b:match_match| and the cursor
column of the start of the match is saved as |b:match_col|.
Next, the script looks through |b:match_words| (original and parsed versions)
for the group and pattern that match. If debugging is turned on, the group is
saved as |b:match_ini| (the first pattern) and |b:match_tail| (the rest). If
there are |backref|s then, in addition, the matching pattern is saved as
|b:match_word| and a table of translations is saved as |b:match_table|. If
there are |backref|s, these are determined from the matching pattern and
|b:match_match| and substituted into each pattern in the matching group.
The script decides whether to search forwards or backwards and chooses
arguments for the |searchpair()| function. Then, the cursor is moved to the
start of the match, and |searchpair()| is called. By default, matching
structures inside strings and comments are ignored. This can be changed by
setting |b:match_skip|.
==============================================================================
2. Activation *matchit-activate*
You can use this script as a plugin, by copying it to your plugin directory.
See |add-global-plugin| for instructions. You can also add a line to your
|vimrc| file, such as >
:source $VIMRUNTIME/macros/matchit.vim
or >
:runtime macros/matchit.vim
Either way, the script should start working the next time you start up Vim.
(Earlier versions of the script did nothing unless a |buffer-variable| named
|b:match_words| was defined. Even earlier versions contained autocommands
that set this variable for various file types. Now, |b:match_words| is
defined in many of the default |filetype-plugin|s instead.)
For a new language, you can add autocommands to the script or to your vimrc
file, but the recommended method is to add a line such as >
let b:match_words = '\<foo\>:\<bar\>'
to the |filetype-plugin| for your language. See |b:match_words| below for how
this variable is interpreted.
TROUBLESHOOTING *matchit-troubleshoot*
The script should work in most installations of Vim. It may not work if Vim
was compiled with a minimal feature set, for example if the |+syntax| option
was not enabled. If your Vim has support for syntax compiled in, but you do
not have |syntax| highlighting turned on, matchit.vim should work, but it may
fail to skip matching groups in comments and strings. If the |filetype|
mechanism is turned off, the |b:match_words| variable will probably not be
defined automatically.
==============================================================================
3. Configuration *matchit-configure*
There are several variables that govern the behavior of matchit.vim. Note
that these are variables local to the buffer, not options, so use |:let| to
define them, not |:set|. Some of these variables have values that matter; for
others, it only matters whether the variable has been defined. All of these
can be defined in the |filetype-plugin| or autocommand that defines
|b:match_words| or "on the fly."
The main variable is |b:match_words|. It is described in the section below on
supporting a new language.
*MatchError* *matchit-hl* *matchit-highlight*
MatchError is the highlight group for error messages from the script. By
default, it is linked to WarningMsg. If you do not want to be bothered by
error messages, you can define this to be something invisible. For example,
if you use the GUI version of Vim and your command line is normally white, you
can do >
:hi MatchError guifg=white guibg=white
<
*b:match_ignorecase*
If you >
:let b:match_ignorecase = 1
then matchit.vim acts as if 'ignorecase' is set: for example, "end" and "END"
are equivalent. If you >
:let b:match_ignorecase = 0
then matchit.vim treats "end" and "END" differently. (There will be no
b:match_infercase option unless someone requests it.)
*b:match_debug*
Define b:match_debug if you want debugging information to be saved. See
|matchit-debug|, below.
*b:match_skip*
If b:match_skip is defined, it is passed as the skip argument to
|searchpair()|. This controls when matching structures are skipped, or
ignored. By default, they are ignored inside comments and strings, as
determined by the |syntax| mechanism. (If syntax highlighting is turned off,
nothing is skipped.) You can set b:match_skip to a string, which evaluates to
a non-zero, numerical value if the match is to be skipped or zero if the match
should not be skipped. In addition, the following special values are
supported by matchit.vim:
s:foo becomes (current syntax item) =~ foo
S:foo becomes (current syntax item) !~ foo
r:foo becomes (line before cursor) =~ foo
R:foo becomes (line before cursor) !~ foo
(The "s" is meant to suggest "syntax", and the "r" is meant to suggest
"regular expression".)
Examples:
You can get the default behavior with >
:let b:match_skip = 's:comment\|string'
<
If you want to skip matching structures unless they are at the start
of the line (ignoring whitespace) then you can >
:let b:match_skip = 'R:^\s*'
< Do not do this if strings or comments can span several lines, since
the normal syntax checking will not be done if you set b:match_skip.
In LaTeX, since "%" is used as the comment character, you can >
:let b:match_skip = 'r:%'
< Unfortunately, this will skip anything after "\%", an escaped "%". To
allow for this, and also "\\%" (an excaped backslash followed by the
comment character) you can >
:let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%'
<
See the $VIMRUNTIME/ftplugin/vim.vim for an example that uses both
syntax and a regular expression.
==============================================================================
4. Supporting a New Language *matchit-newlang*
*b:match_words*
In order for matchit.vim to support a new language, you must define a suitable
pattern for |b:match_words|. You may also want to set some of the
|matchit-configure| variables, as described above. If your language has a
complicated syntax, or many keywords, you will need to know something about
Vim's |regular-expression|s.
The format for |b:match_words| is similar to that of the 'matchpairs' option:
it is a comma (,)-separated list of groups; each group is a colon(:)-separated
list of patterns (regular expressions). Commas and backslashes that are part
of a pattern should be escaped with backslashes ('\:' and '\,'). It is OK to
have only one group; the effect is undefined if a group has only one pattern.
A simple example is >
:let b:match_words = '\<if\>:\<endif\>,'
\ . '\<while\>:\<continue\>:\<break\>:\<endwhile\>'
(In Vim regular expressions, |\<| and |\>| denote word boundaries. Thus "if"
matches the end of "endif" but "\<if\>" does not.) Then banging on the "%"
key will bounce the cursor between "if" and the matching "endif"; and from
"while" to any matching "continue" or "break", then to the matching "endwhile"
and back to the "while". It is almost always easier to use |literal-string|s
(single quotes) as above: '\<if\>' rather than "\\<if\\>" and so on.
Exception: If the ":" character does not appear in b:match_words, then it is
treated as an expression to be evaluated. For example, >
:let b:match_words = 'GetMatchWords()'
allows you to define a function. This can return a different string depending
on the current syntax, for example.
Once you have defined the appropriate value of |b:match_words|, you will
probably want to have this set automatically each time you edit the
appropriate file type. The recommended way to do this is by adding the
definition to a |filetype-plugin| file.
Tips: Be careful that your initial pattern does not match your final pattern.
See the example above for the use of word-boundary expressions. It is usually
better to use ".\{-}" (as many as necessary) instead of ".*" (as many as
possible). See |\{-|. For example, in the string "<tag>label</tag>", "<.*>"
matches the whole string whereas "<.\{-}>" and "<[^>]*>" match "<tag>" and
"</tag>".
*matchit-spaces* *matchit-s:notend*
If "if" is to be paired with "end if" (Note the space!) then word boundaries
are not enough. Instead, define a regular expression s:notend that will match
anything but "end" and use it as follows: >
:let s:notend = '\%(\<end\s\+\)\@<!'
:let b:match_words = s:notend . '\<if\>:\<end\s\+if\>'
< *matchit-s:sol*
This is a simplified version of what is done for Ada. The s:notend is a
|script-variable|. Similarly, you may want to define a start-of-line regular
expression >
:let s:sol = '\%(^\|;\)\s*'
if keywords are only recognized after the start of a line or after a
semicolon (;), with optional white space.
*matchit-backref* *matchit-\1*
In any group, the expressions |\1|, |\2|, ..., |\9| refer to parts of the
INITIAL pattern enclosed in |\(|escaped parentheses|\)|. These are referred
to as back references, or backrefs. For example, >
:let b:match_words = '\<b\(o\+\)\>:\(h\)\1\>'
means that "bo" pairs with "ho" and "boo" pairs with "hoo" and so on. Note
that "\1" does not refer to the "\(h\)" in this example. If you have
"\(nested \(parentheses\)\) then "\d" refers to the d-th "\(" and everything
up to and including the matching "\)": in "\(nested\(parentheses\)\)", "\1"
refers to everything and "\2" refers to "\(parentheses\)". If you use a
variable such as |s:notend| or |s:sol| in the previous paragraph then remember
to count any "\(" patterns in this variable. You do not have to count groups
defined by |\%(\)|.
It should be possible to resolve back references from any pattern in the
group. For example, >
:let b:match_words = '\(foo\)\(bar\):more\1:and\2:end\1\2'
would not work because "\2" cannot be determined from "morefoo" and "\1"
cannot be determined from "andbar". On the other hand, >
:let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1'
should work (and have the same effect as "foobar:barfoo:endfoobar"), although
this has not been thoroughly tested.
You can use |zero-width| patterns such as |\@<=| and |\zs|. (The latter has
not been thouroughly tested in matchit.vim.) For example, if the keyword "if"
must occur at the start of the line, with optional white space, you might use
the pattern "\(^\s*\)\@<=if" so that the cursor will end on the "i" instead of
at the start of the line. For another example, if HTML had only one tag then
one could >
:let b:match_words = '<:>,<\@<=tag>:<\@<=/tag>'
so that "%" can bounce between matching "<" and ">" pairs or (starting on
"tag" or "/tag") between matching tags. Without the |\@<=|, the script would
bounce from "tag" to the "<" in "</tag>", and another "%" would not take you
back to where you started.
DEBUGGING *matchit-debug* *:MatchDebug*
If you are having trouble figuring out the appropriate definition of
|b:match_words| then you can take advantage of the same information I use when
debugging the script. This is especially true if you are not sure whether
your patterns or my script are at fault! To make this more convenient, I have
made the command :MatchDebug, which defines the variable |b:match_debug| and
creates a Matchit menu. This menu makes it convenient to check the values of
the variables described below. You will probably also want to read
|matchit-details| above.
Defining the variable |b:match_debug| causes the script to set the following
variables, each time you hit the "%" key. Several of these are only defined
if |b:match_words| includes |backref|s.
*b:match_pat*
The b:match_pat variable is set to |b:match_words| with |backref|s parsed.
*b:match_match*
The b:match_match variable is set to the bit of text that is recognized as a
match.
*b:match_col*
The b:match_col variable is set to the cursor column of the start of the
matching text.
*b:match_wholeBR*
The b:match_wholeBR variable is set to the comma-separated group of patterns
that matches, with |backref|s unparsed.
*b:match_iniBR*
The b:match_iniBR variable is set to the first pattern in |b:match_wholeBR|.
*b:match_ini*
The b:match_ini variable is set to the first pattern in |b:match_wholeBR|,
with |backref|s resolved from |b:match_match|.
*b:match_tail*
The b:match_tail variable is set to the remaining patterns in
|b:match_wholeBR|, with |backref|s resolved from |b:match_match|.
*b:match_word*
The b:match_word variable is set to the pattern from |b:match_wholeBR| that
matches |b:match_match|.
*b:match_table*
The back reference '\'.d refers to the same thing as '\'.b:match_table[d] in
|b:match_word|.
==============================================================================
5. Known Bugs and Limitations *matchit-bugs*
Just because I know about a bug does not mean that it is on my todo list. I
try to respond to reports of bugs that cause real problems. If it does not
cause serious problems, or if there is a work-around, a bug may sit there for
a while. Moral: if a bug (known or not) bothers you, let me know.
The various |:vmap|s defined in the script (%, |g%|, |[%|, |]%|, |a%|) may
have undesired effects in Select mode |Select-mode-mapping|. At least, if you
want to replace the selection with any character in "ag%[]" there will be a
pause of |'updatetime'| first.
It would be nice if "\0" were recognized as the entire pattern. That is, it
would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1". I may
try to implement this in a future version. (This is not so easy to arrange as
you might think!)
==============================================================================
vim:tw=78:fo=tcq2:

710
.vim/doc/project.txt Normal file
View file

@ -0,0 +1,710 @@
*project.txt* Plugin for managing multiple projects with multiple sources
For Vim version 6.x and Vim version 7.x.
Last Change: Fri 13 Oct 2006 10:20:13 AM EDT
By Aric Blumer
aricvim email-at-sign charter.net
*project* *project-plugin*
Contents:
Commands...................|project-invoking|
Inheritance.............|project-inheritance|
Mappings...................|project-mappings|
Adding Mappings.....|project-adding-mappings|
Settings...................|project-settings|
Example File................|project-example|
Tips...........................|project-tips|
You can use this plugin's basic functionality to set up a list of
frequently-accessed files for easy navigation. The list of files will be
displayed in a window on the left side of the Vim window, and you can press
<Return> or double-click on filenames in the list to open the files. I find
this easier to use than having to navigate a directory hierarchy with the
|file-explorer|.
You can also instruct the Plugin to change to a directory and to run Vim
scripts when you select a file. These scripts can, for example, modify the
environment to include compilers in $PATH. This makes it very easy to use
quickfix with multiple projects that use different environments.
Other features include:
o Loading/Unloading all the files in a Project (\l, \L, \w, and \W)
o Grepping all the files in a Project (\g and \G)
o Running a user-specified script on a file (can be used to launch an
external program on the file) (\1 through \9)
o Running a user-specified script on all the files in a Project
(\f1-\f9 and \F1-\F9)
o High degree of user-configurability
o Also works with |netrw| using the XXXX://... notation where XXXX is
ftp, rcp, scp, or http.
All of this is specified within a simple text file and a few global variables
in your vimrc file.
You must set 'nocompatible' in your |vimrc| file to use this plugin. You can
stop the plugin from being loaded by setting the "loaded_project" variable: >
:let loaded_project = 1
==============================================================================
COMMANDS *project-invoking*
You can use the plugin by placing it in your plugin directory (e.g.,
~/.vim/plugin). See |add-global-plugin|. When you start vim the next time, you
then enter the command >
:Project
or >
:Project {file}
If you do not specify the filename, $HOME/.vimprojects is used.
To have Vim come up with the Project Window enabled automatically (say, from a
GUI launcher), run Vim like this: [g]vim +Project
Note that you can invoke :Project on only one file at a time. If you wish to
change the Project File, do a :bwipe in the Project Buffer, then re-invoke the
Plugin as described above.
Several Projects can be kept and displayed in the same file, each in a fold
delimited by { and } (see |fold.txt|). There can be any number of nested
folds to provide you with a Project hierarchy. Any line without a { or a } in
the file is considered to be a filename. Blank lines are ignored, and any
text after a # is ignored.
Because the plugin uses standard Vim folds, you can use any of the
|fold-commands|. You can double-click on the first line of a fold to open and
close it. You can select a file to open by putting the cursor on its name and
pressing <Return> or by double-clicking on it. The plugin will create a new
window to the right or use the |CTRL-W_p| equivalent if it exists.
*project-syntax*
Each Project Entry has this form:
project_entry ::=
<Description>={projpath} [{options}] {
[ filename ]
[ project_entry ]
}
{options} is one or more of the following (on the same line):
CD={path}
in={filename}
out={filename}
filter="{pat}"
flags={flag}
Note that a project_entry can reside within a project_entry. This allows you
to set up a hierarchy within your Project.
The <Description> will be displayed in the foldtext and cannot contain "=".
There can be no space character directly on either side of the =.
The {projpath} is the path in which the files listed in the Project's fold
will be found, and it may contain environment variables. If the path is a
relative path, then the plugin constructs the whole path from the Project's
parent, grandparent, etc., all the way up the hierarchy. An outermost
project_entry must have an absolute path. See the |project-inheritance|
example below. {projpath} may contain spaces, but they must be escaped like
normal Vim escapes. Here are two examples of the same directory:
>
Example=/my/directory/with\ spaces {
}
Example="/my/directory/with spaces" {
}
I recommend this for Windows®: >
Example="c:\My Documents" {
}
But Vim is smart enough to do this, too: >
Example=c:\My\ Documents {
}
CD= provides the directory that Vim will change to when you select a file in
that fold (using |:cd|). This allows you, for example, to enter |:make| to use
the local Makefile. A CD=. means that Vim will make {projpath} or its
inherited equivalent the current working directory. When CD is omitted, the
directory is not changed. There can be no space on either side of the =. The
value of CD can also be a relative path from a parent's CD. See the
|project-inheritance| example below. This directive is ignored for |netrw|
projects. Spaces are allowed in the path as for {projpath}.
in= and out= provide the means to run arbitrary Vim scripts whenever you enter
or leave a file's buffer (see the |BufEnter| and |BufLeave| autocommand
events). The idea is to have a Vim script that sets up or tears down the
environment for the Project like this:
in.vim: >
let $PROJECT_HOME='~/my_project'
" Put the compiler in $PATH
if $PATH !~ '/path/to/my/compiler'
let $PATH=$PATH.':/path/to/my/compiler'
endif
out.vim: >
" Remove compiler from $PATH
if $PATH =~ '/path/to/my/compiler'
let $PATH=substitute($PATH, ':/path/to/my/compiler', '', 'g')
endif
Then you can use :make with the proper environment depending on what file you
are currently editing. If the path to the script is relative, then it is
relative from {projpath}. These directives are inherited by Subprojects
unless the Subproject specifies its own. For use with |netrw| projects, the
paths specified for in= and out= must be absolute and local.
filter= specifies a |glob()| file pattern. It is used to regenerate the list
of files in a Project fold when using the \r (<LocalLeader>r) map in the
Project Window. The filter value must be in quotes because it can contain
multiple file patterns. If filter is omitted, then the * pattern is used.
There can be no space on either side of the =. A Subproject will inherit the
filter of its parent unless it specifies its own filter.
flags= provides the means to enable/disable features for a particular fold.
The general mnemonic scheme is for lower case to turn something off and upper
case to turn something on. {flag} can contain any of the following
characters:
flag Description ~
l Turn off recursion for this fold for \L. Subfolds are also
blocked from the recursion.
r Turn off refresh. When present, do not refresh this fold when
\r or \R is used. This does not affect subfold recursion.
S Turn on sorting for refresh and create.
s Turn off sorting for refresh and create.
T Turn on top gravity. Forces folds to the top of the current
fold when refreshing. It has the same affect as the 'T' flag
in g:proj_flags, but controls the feature on a per-fold basis.
t Turn off top gravity. Forces folds to the bottom of the
current fold when refreshing.
w Turn off recursion for this fold for \W. Subfolds are also
blocked from the recursion.
Flags are not inherited by Subprojects.
Any text outside a fold is ignored.
==============================================================================
INHERITANCE *project-inheritance*
It's best to show inheritance by comparing these two Project Files:
>
Parent=~/my_project CD=. filter="Make* *.mk" flags=r {
Child1=c_code {
}
Child2=include CD=. filter="*.h" {
}
}
Child1's path is "~/my_project/c_code" because ~/my_project is inherited. It
also inherits the CD from Parent. Since Parent has CD=., the Parent's cwd is
"~/my_project". Child1 therefore inherits a CD of "~/my_project". Finally,
Child1 inherits the filter from Parent. The flags are not inherited.
Child2 only inherits the "~/my_project" from Parent.
Thus, the example above is exactly equivalent to this:
>
Parent=~/my_project CD=. filter="Make* *.mk" flags=r {
Child1=~/my_project/c_code CD=~/my_project filter="Make* *.mk" {
}
Child2=~/my_project/include CD=~/my_project/include filter="*.h" {
}
}
(For a real Project, Child1 would not want to inherit its parent's filter, but
this example shows the concept.) You can always enter \i to display what the
cursor's project inherits.
==============================================================================
MAPPINGS *project-mappings*
Map Action ~
\r Refreshes the Project fold that the cursor is in by placing in the
fold all the files that match the filter. The Project is refreshed
using an indent of one space for every foldlevel in the hierarchy.
You may place a "# pragma keep" (without the quotes) at the end of a
line, and the file entry on that line will not be removed when you
refresh. This is useful, for example, when you have . as an entry so
you can easily browse the directory.
Note that this mapping is actually <LocalLeader>r, and the default of
|<LocalLeader>| is \.
This does not work for Projects using |netrw|.
\R Executes \r recursively in the current fold and all folds below.
This does not work for Projects using |netrw|.
\c Creates a Project fold entry. It asks for the description, the path
to the files, the CD parameter, and the filename |glob()| pattern.
From this information, it will create the Project Entry below the
cursor.
This does not work for Projects using |netrw|.
\C Creates a Project fold entry like \c, but recursively includes all the
subdirectories.
<Return>
Select a file to open in the |CTRL-W_p| window or in a new window. If
the cursor is on a fold, open or close it.
<S-Return>
\s
Same as <Return> but horizontally split the target window.
<LocalLeader>s is provided for those terminals that don't recognize
<S-Return>.
\S
Load all files in a project by doing horizontal splits.
<C-Return>
\o
Same as <Return> but ensure that the opened file is the only other
window. <LocalLeader>o is provided for those terminals that don't
recognize <C-Return>.
<M-Return>
\v
Same as <Return> but only display the file--the cursor stays in the
Project Window.
<2-LeftMouse>
(Double-click) If on a closed fold, open it. If on an open fold
boundary, close it. If on a filename, open the file in the |CTRL-W_p|
window or in a new window.
<S-2-LeftMouse>
Same as <S-Return>.
<C-2-LeftMouse>
Same as <C-Return>.
<RightMouse>
Increase the width of the Project Window by g:proj_window_increment or
toggle between a width of
g:proj_window_width + g:proj_window_increment
and
g:proj_window_width.
Whether you toggle or monotonically increase the width is determined
by the 't' flag of the g:proj_flags variable (see |project-flags|).
Note that a Right Mouse click will not automatically place the cursor
in the Project Window if it is in a different window. The window will
go back to the g:proj_window_width width when you leave the window.
<space> Same as <RightMouse>
<CTRL-Up>
\<Up>
Move the text or fold under the cursor up one row. This may not work
in a terminal because the terminal is unaware of this key combination.
<LocalLeader><Up> is provided for those terminals that don't recognize
<C-Up>.
<CTRL-Down>
\<Down>
Move the text or fold under the cursor down one row. This may not work
in a terminal because the terminal is unaware of this key combination.
<LocalLeader><Down> is provided for those terminals that don't
recognize <C-Down>.
\i Show in the status line the completely resolved and inherited
parameters for the fold the cursor is in. This is intended for
debugging your relative path and inherited parameters for manually
entered Projects.
\I Show in the status line the completely resolved filename. Uses the
Project_GetFname(line('.')) function.
\1 - \9
Run the command specified in g:proj_run{x} where {x} is the number
of the key. See the documentation of g:proj_run1 below.
\f1-\f9
Run the command specified in g:proj_run_fold{x} where {x} is the
number of the key. The command is run on the files at the current
Project level. See the |project-settings| below.
\F1-\F9
Run the command specified in g:proj_run_fold{x} where {x} is the
number of the key. The command is run on the files at the current
Project level and all Subprojects. See the |project-settings| below.
\0 Display the commands that are defined for \1 through \9.
\f0 Display the commands that are defined for \f1 through \f9 and \F1
through \F0. Same as \F0.
\l Load all the files in the current Project level into Vim. While files
are being loaded, you may press any key to stop.
\L Load all the files in the current Project and all Subprojects into
Vim. Use this mapping with caution--I wouldn't suggest using \L to
load a Project with thousands of files. (BTW, my Project file has more
than 5,300 files in it!) While files are being loaded, you may press
any key to stop.
\w Wipe all the files in the current Project level from Vim. (If files
are modified, they will be saved first.) While files are being wiped,
you may press any key to stop.
\W Wipe all the files in the current Project and all Subprojects from
Vim. (If files are modified, they will be saved first.) While files
are being wiped, you may press any key to stop.
\g Grep all the files in the current Project level.
\G Grep all the files in the current Project level and all Subprojects.
\e Set up the Environment for the Project File as though you had selected
it with <Return>. This allows you to do a \e and a :make without
having to open any files in the project.
\E Explore (using |file-explorer|) the directory of the project the
cursor is in. Does not work with netrw.
<F12> When the 'g' flag is present in g:proj_flags (see |project-flags|)
this key toggles the Project Window open and closed. You may remap
this toggle function by putting the following in your vimrc and
replacing <Leader>P with whatever key combination you wish:
nmap <silent> <Leader>P <Plug>ToggleProject
Note that the Project Plugin remaps :help because the Help Window and the
Project Window get into a fight over placement. The mapping avoids the
problem.
==============================================================================
ADDING MAPPINGS *project-adding-mappings*
You can add your own mappings or change the mappings of the plugin by placing
them in the file $HOME/.vimproject_mappings. This file, if it exists, will be
sourced when the plugin in loaded. Here is an example that will count the
number of entries in a project when you press \K (Kount, C is taken :-): >
function! s:Wc()
let b:loadcount=0
function! SpawnExec(infoline, fname, lineno, data)
let b:loadcount = b:loadcount + 1
if getchar(0) != 0 | let b:stop_everything=1 | endif
endfunction
call Project_ForEach(1, line('.'), "*SpawnExec", 0, '')
delfunction SpawnExec
echon b:loadcount." Files\r"
unlet b:loadcount
if exists("b:stop_everything")
unlet b:stop_everything
echon "Aborted.\r"
endif
endfunction
nnoremap <buffer> <silent> <LocalLeader>K :call <SID>Wc()<CR>
Here's another example of how I integrated the use of perforce with the plugin
in my $HOME/.vimproject_mappings:
>
function! s:DoP4(cmd)
let name=Project_GetFname(line('.'))
let dir=substitute(name, '\(.*\)/.*', '\1', 'g')
exec 'cd '.dir
exec "!".a:cmd.' '.Project_GetFname(line('.'))
cd -
endfunction
nmap <buffer> <silent> \pa :call <SID>DoP4("p4add")<CR>
nmap <buffer> <silent> \pe :call <SID>DoP4("p4edit")<CR>
<
(Note that I CD to the directory the file is in so I can pick of the $P4CONFIG
file. See the perforce documentation.)
This creates the mappings \pe to check out the file for edit and \pa to add
the file to the depot.
Here is another example where I remap the <Return> mapping to use an external
program to launch a special kind of file (in this case, it launches ee to view
a jpg file). It is a bit contrived, but it works.
>
let s:sid = substitute(maparg('<Return>', 'n'), '.*\(<SNR>.\{-}\)_.*', '\1', '')
function! s:LaunchOrWhat()
let fname=Project_GetFname(line('.'))
if fname =~ '\.jpg$'
exec 'silent! !ee "'.fname.'"&'
else
call {s:sid}_DoFoldOrOpenEntry('', 'e')
endif
endfunction
nnoremap <buffer> <silent> <Return> \|:call <SID>LaunchOrWhat()<CR>
<
If the file ends in .jpg, the external program is launched, otherwise the
original mapping of <Return> is run.
==============================================================================
SETTINGS *project-settings*
You can set these variables in your vimrc file before the plugin is loaded to
change its default behavior
g:proj_window_width
The width of the Project Window that the plugin attempts to maintain.
Default: 24
The Project Plugin is not always successful in keeping the window
where I want it with the size specified here, but it does a decent
job.
g:proj_window_increment
The increment by which to increase the width of the Project Window
when pressing <space> or clicking the <LeftMouse>. Default: 100
(See |project-mappings|.)
*project-flags*
g:proj_flags
Default: "imst"
Various flags to control the behavior of the Project Plugin. This
variable can contain any of the following character flags.
flag Description ~
b When present, use the |browse()| when selecting directories
for \c and \C. This is off by default for Windows, because
the windows browser does not allow you to select directories.
c When present, the Project Window will automatically close when
you select a file.
F Float the Project Window. That is, turn off automatic
resizing and placement. This allows placement between other
windows that wish to share similar placement at the side of
the screen. It is also particularly helpful for external
window managers.
g When present, the mapping for <F12> will be created to toggle
the Project Window open and closed.
i When present, display the filename and the current working
directory in the command line when a file is selected for
opening.
l When present, the Project Plugin will use the |:lcd| command
rather than |:cd| to change directories when you select a file
to open. This flag is really obsolete and not of much use
because of L below.
L Similar to l, but install a BufEnter/Leave |:autocommand| to
ensure that the current working directory is changed to the
one specified in the fold CD specification whenever that
buffer is active. (|:lcd| only changes the CWD for a window,
not a buffer.)
m Turn on mapping of the |CTRL-W_o| and |CTRL-W_CTRL_O| normal
mode commands to make the current buffer the only visible
buffer, but keep the Project Window visible, too.
n When present, numbers will be turned on for the project
window.
s When present, the Project Plugin will use syntax highlighting
in the Project Window.
S Turn on sorting for refresh and create.
t When present, toggle the size of the window rather than just
increase the size when pressing <space> or right-clicking.
See the entry for <RightMouse> in |project-mappings|.
T When present, put Subproject folds at the top of the fold when
refreshing.
v When present, use :vimgrep rather than :grep when using \G.
g:proj_run1 ... g:proj_run9
Contains a Vim command to execute on the file. See the
mappings of \1 to \9 above.
%f is replaced with the full path and filename
%F is replaced with the full path and filename with spaces
quoted
%n is replaced with the filename alone
%N is replaced with the filename alone with spaces quoted
%h is replaced with the home directory
%H is replaced with the home directory with spaces quoted
%r is replaced with the directory relative to the CD path
%R is replaced with the directory relative to the CD path
with spaces quoted
%d is replaced with the CD directory.
%D is replaced with the CD directory.with spaces quoted
%% is replaced with a single % that is not used in
expansion.
(Deprecated: %s is also replaced with the full path and
filename for backward compatibility.)
For example, gvim will be launched on the file under the
cursor when you enter \3 if the following is in your vimrc
file: >
let g:proj_run3='silent !gvim %f'
< Here are a few other examples: >
let g:proj_run1='!p4 edit %f'
let g:proj_run2='!p4 add %f'
let g:proj_run4="echo 'Viewing %f'|sil !xterm -e less %f &"
<
On Windows systems you will want to put the %f, %h, and %d in
single quotes to avoid \ escaping.
g:proj_run_fold1 ... g:proj_run_fold9
Contains a Vim command to execute on the files in a fold. See
the mappings of \f1 to \f9 and \F1 to \F9 above.
%f is the filename, %h is replaced with the project home
directory, and %d is replaced with the CD directory. Multiple
filenames can be handled in two ways:
The first (default) way is to have %f replaced with all the
absolute filenames, and the command is run once. The second
is to have the command run for each of the non-absolute
filenames (%f is replaced with one filename at a time). To
select the second behavior, put an '*' character at the
beginning of the g:proj_run_fold{x} variable. (The '*' is
stripped before the command is run.)
For example, note the difference between the following: >
let g:proj_run_fold3="*echo '%h/%f'"
let g:proj_run_fold4="echo '%f'"
<
Note that on Windows systems, you will want the %f, %h, and %c
within single quotes, or the \ in the paths will cause
problems. The alternative is to put them in |escape()|.
==============================================================================
PROJECT EXAMPLE FILE *project-example*
Here is an example ~/.vimprojects file: >
1 My Project=~/c/project CD=. in=in.vim out=out.vim flags=r {
2 Makefile
3 in.vim
4 out.vim
5 GUI Files=. filter="gui*.c gui*.h" {
6 gui_window.c
7 gui_dialog.c
8 gui_list.c
9 gui.h # Header file
10 }
11 Database Files=. filter="data*.c data*.h" {
12 data_read.c
13 data_write.c
14 data.h
15 }
16 OS-Specific Files {
17 Win32=. filter="os_win32*.c os_win32*.h" {
18 os_win32_gui.c
19 os_win32_io.c
20 }
21 Unix=. filter="os_unix*.c os_unix*.h" {
22 os_unix_gui.c
23 os_unix_io.c
24 }
25 }
26 }
(Don't type in the line numbers, of course.)
==============================================================================
TIPS ON USING PROJECT PLUGIN *project-tips*
1. You can create a Project Entry by entering this: >
Label=~/wherever CD=. filter="*.c *.h" {
}
<
Then you can put the cursor in the fold and press \r. The script will fill
in the files (C files in this case) from this directory for you. This is
equivalent to \c without any dialogs.
2. You can edit the Project File at any time to add, remove, or reorder files
in the Project list.
3. If the Project Window ever gets closed, you can just enter >
:Project
< to bring it back again. (You don't need to give it the filename; the
plugin remembers.)
If you have the 'm' flag set in g:proj_flags, then you get the Project
Window to show up again by pressing |CTRL-W_o|. This, of course, will
close any other windows that may be open that the cursor is not in.
4. Adding files to a Project is very easy. To add, for example, the 'more.c'
file to the Project, just insert the filename in the Project Entry then
hit <Return> on it.
5. When |quickfix| loads files, it is not equivalent to pressing <Return> on
a filename, so the directory will not be changed and the scripts will not
be run. (If I could make this otherwise, I would.) The solution is to use
the \L key to load all of the files in the Project before running
quickfix.
6. If the Project window gets a bit cluttered with folds partially
open/closed, you can press |zM| to close everything and tidy it up.
7. For advanced users, I am exporting the function Project_GetAllFnames()
which returns all the filenames within a fold and optionally all its
Subprojects. Also, I export Project_ForEach() for running a function for
each filename in the project. See the code for examples on how to use
these. Finally, I export Project_GetFname(line_number) so that you can
write your own mappings and get the filename for it.
8. Some people have asked how to do a global mapping to take the cursor to
the Project window. One of my goals for the plugin is for it to be as
self-contained as possible, so I'm not going to add it by default. But you
can put this in your vimrc:
>
nmap <silent> <Leader>P :Project<CR>
<
9. You can put the . entry in a project, and it will launch the
|file-explorer| plugin on the directory. To avoid removal when you
refresh, make the entry look like this:
>
. # pragma keep
<
==============================================================================
THANKS
The following people have sent me patches to help with the Project
Plugin development:
Tomas Zellerin
Lawrence Kesteloot
Dave Eggum
A Harrison
Thomas Link
Richard Bair
Eric Arnold
Peter Jones
Eric Van Dewoestine
vim:ts=8 sw=8 noexpandtab tw=78 ft=help:

1122
.vim/doc/rails.txt Normal file

File diff suppressed because it is too large Load diff

14
.vim/filetype.vim Normal file
View file

@ -0,0 +1,14 @@
" detect puppet filetypes
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.pp setfiletype puppet
"au! BufNewFile,BufRead *.rhtml set syn=eruby
"au! BufNewFile,BufRead *.haml setfiletype haml
"au! BufNewFile,BufRead *.rhtml setfiletype rhtml
au! BufNewFile,BufRead *.rhtml setfiletype eruby
au! BufNewFile,BufRead *.s setfiletype asmx86
augroup END

View file

@ -0,0 +1,110 @@
" Mapping the unified APL keyboard to emit the apl385 unicode characters
" Original Author: Peter Keller <psilord@cs.wisc.edu>
" Maintainer: Peter Keller <psilord@cs.wisc.edu>
" Last Changed: 2008 Oct 23
" This file is under the BSD license.
let b:keymap_name = "uniapl385"
loadkeymap
" row 1 of keyboard, lowercase and uppercase
<M-`> <char-0x22c4> " {diamond}
<M-~> <char-0x235e> " {quotequad}
<M-1> <char-0x00a8> " {each}
<M-!> <char-0x2336> " {ibeam}
<M-2> <char-0x00af> " {negative}
<M-@> <char-0x236b> " {deltilde}
<M-3> <char-0x003c> " {lessthan}
<M-#> <char-0x2352> " {gradedown}
<M-4> <char-0x2264> " {lessthanequal}
<M-$> <char-0x234b> " {gradeup}
<M-5> <char-0x003d> " {equal}
<M-%> <char-0x233d> " {reverse}
<M-6> <char-0x2265> " {greaterorequal}
<M-^> <char-0x2349> " {transpose}
<M-7> <char-0x003e> " {morethan}
<M-&> <char-0x2296> " {rotatefirstaxis}
<M-8> <char-0x2260> " {notequalto}
<M-*> <char-0x235f> " {log}
<M-9> <char-0x2228> " {logicalor}
<M-(> <char-0x2371> " {aplnor}
<M-0> <char-0x005e> " {logicaland}
<M-)> <char-0x2372> " {aplnand}
<M--> <char-0x00d7> " {multiply}
<M-_> <char-0x0021> " {factorial}
<M-+> <char-0x2339> " {domino}
<M-=> <char-0x00f7> " {divide}
" row 2 of keyboard, lowercase and uppercase
<M-q> <char-0x003f> " {random}
<M-Q> <char-0x0051> " letter Q
<M-w> <char-0x2375> " {omega}
<M-W> <char-0x2364> " {hoot}
<M-e> <char-0x220a> " {membership}
<M-E> <char-0x2377> " {find}
<M-r> <char-0x2374> " {rho}
<M-R> <char-0x0052> " letter R
<M-t> <char-0x007e> " {tilde}
<M-T> <char-0x0054> " letter T
<M-y> <char-0x2191> " {take}
<M-Y> <char-0x2350> " {quadup}
<M-u> <char-0x2193> " {drop}
<M-U> <char-0x2357> " {quaddown}
<M-i> <char-0x2373> " {iota}
<M-I> <char-0x2378> " {iotaunderbar}
<M-o> <char-0x25cb> " {circle}
<M-O> <char-0x2337> " {squad}
<M-p> <char-0x002a> " {power}
<M-P> <char-0x0050> " letter P
<M-[> <char-0x2190> " {assign}
<M-{> <char-0x2347> " {quadleft}
<M-]> <char-0x2192> " {goto}
<M-}> <char-0x2348> " {quadright}
<M-\> <char-0x22a2> " {right tack}
<M-|> <char-0x22a3> " {left tack}
" row 3 of keyboard, lowercase and uppercase
<M-a> <char-0x237a> " {alpha}
<M-A> <char-0x0041> " letter A
<M-s> <char-0x2308> " {max}
<M-S> <char-0x0053> " letter S
<M-d> <char-0x230A> " {min}
<M-D> <char-0x0044> " letter D
<M-f> <char-0x005f> " {underbar}
<M-F> <char-0x0046> " letter F
<M-g> <char-0x2207> " {del}
<M-G> <char-0x0047> " letter G
<M-h> <char-0x2206> " {delta}
<M-H> <char-0x2359> " {deltaunderbar}
<M-j> <char-0x2218> " {jot}
<M-J> <char-0x233b> " {quadjot}
<M-k> <char-0x0027> " {quote}
<M-K> <char-0x2337> " {squad}
<M-l> <char-0x25af> " {quad}
<M-L> <char-0x2342> " {sandwich}
<M-;> <char-0x234e> " {execute}
<M-:> <char-0x2261> " {match}
<M-'> <char-0x2355> " {format}
<M-"> <char-0x2262> " {notmatch}
" row 4 of keyboard, lowercase and uppercase
<M-z> <char-0x2282> " {enclose}
<M-Z> <char-0x005a> " letter Z
<M-x> <char-0x2283> " {disclose}
<M-X> <char-0x0058> " letter X
<M-c> <char-0x2229> " {intersect}
<M-C> <char-0x0043> " letter C
<M-v> <char-0x222a> " {union}
<M-V> <char-0x0056> " letter V
<M-b> <char-0x22a5> " {decode}
<M-B> <char-0x0042> " letter B
<M-n> <char-0x22a4> " {encode}
<M-N> <char-0x004e> " letter N
<M-m> <char-0x007c> " {remainder}
<M-M> <char-0x004d> " letter M
<M-,> <char-0x235d> " {lamp}
<M-<> <char-0x236a> " {commabar}
<M-.> <char-0x2340> " {slopebar}
<M->> <char-0x2235> " {paw}
<M-/> <char-0x233f> " {slashbar}
<M-?> <char-0x003f> " {random}

967
.vim/plugin/gnupg.vim Normal file
View file

@ -0,0 +1,967 @@
" Name: gnupg.vim
" Version: $Id: gnupg.vim 1933 2008-01-23 09:49:33Z mbr $
" Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files.
" Licence: This program is free software; you can redistribute it and/or
" modify it under the terms of the GNU General Public License.
" See http://www.gnu.org/copyleft/gpl.txt
" Section: Documentation {{{1
" Description:
"
" This script implements transparent editing of gpg encrypted files. The
" filename must have a ".gpg", ".pgp" or ".asc" suffix. When opening such
" a file the content is decrypted, when opening a new file the script will
" ask for the recipients of the encrypted file. The file content will be
" encrypted to all recipients before it is written. The script turns off
" viminfo and swapfile to increase security.
"
" Installation:
"
" Copy the gnupg.vim file to the $HOME/.vim/plugin directory.
" Refer to ':help add-plugin', ':help add-global-plugin' and ':help
" runtimepath' for more details about Vim plugins.
"
" Commands:
"
" :GPGEditRecipients
" Opens a scratch buffer to change the list of recipients. Recipients that
" are unknown (not in your public key) are highlighted and have
" a prepended "!". Closing the buffer makes the changes permanent.
"
" :GPGViewRecipients
" Prints the list of recipients.
"
" :GPGEditOptions
" Opens a scratch buffer to change the options for encryption (symmetric,
" asymmetric, signing). Closing the buffer makes the changes permanent.
" WARNING: There is no check of the entered options, so you need to know
" what you are doing.
"
" :GPGViewOptions
" Prints the list of options.
"
" Variables:
"
" g:GPGUseAgent
" If set to 0 a possible available gpg-agent won't be used. Defaults to 1.
"
" g:GPGPreferSymmetric
" If set to 1 symmetric encryption is preferred for new files. Defaults to 0.
"
" g:GPGPreferArmor
" If set to 1 armored data is preferred for new files. Defaults to 0.
"
" Credits:
" Mathieu Clabaut for inspirations through his vimspell.vim script.
" Richard Bronosky for patch to enable ".pgp" suffix.
" Erik Remmelzwaal for patch to enable windows support and patient beta
" testing.
" Lars Becker for patch to make gpg2 working.
"
" Section: Plugin header {{{1
if (exists("g:loaded_gnupg") || &cp || exists("#BufReadPre#*.\(gpg\|asc\|pgp\)"))
finish
endi
let g:loaded_gnupg = "$Revision: 1933 $"
" Section: Autocmd setup {{{1
augroup GnuPG
autocmd!
" initialize the internal variables
autocmd BufNewFile,BufReadPre,FileReadPre *.\(gpg\|asc\|pgp\) call s:GPGInit()
" force the user to edit the recipient list if he opens a new file and public
" keys are preferred
autocmd BufNewFile *.\(gpg\|asc\|pgp\) if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 0) | call s:GPGEditRecipients() | endi
" do the decryption
autocmd BufReadPost,FileReadPost *.\(gpg\|asc\|pgp\) call s:GPGDecrypt()
" convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.\(gpg\|asc\|pgp\) call s:GPGEncrypt()
" undo the encryption so we are back in the normal text, directly
" after the file has been written.
autocmd BufWritePost,FileWritePost *.\(gpg\|asc\|pgp\) call s:GPGEncryptPost()
augroup END
" Section: Highlight setup {{{1
highlight default link GPGWarning WarningMsg
highlight default link GPGError ErrorMsg
highlight default link GPGHighlightUnknownRecipient ErrorMsg
" Section: Functions {{{1
" Function: s:GPGInit() {{{2
"
" initialize the plugin
"
fun s:GPGInit()
" first make sure nothing is written to ~/.viminfo while editing
" an encrypted file.
set viminfo=
" we don't want a swap file, as it writes unencrypted data to disk
set noswapfile
" check if gpg-agent is allowed
if (!exists("g:GPGUseAgent"))
let g:GPGUseAgent = 1
endif
" check if symmetric encryption is preferred
if (!exists("g:GPGPreferSymmetric"))
let g:GPGPreferSymmetric = 0
endif
" check if armored files are preferred
if (!exists("g:GPGPreferArmor"))
let g:GPGPreferArmor = 0
endif
" check if debugging is turned on
if (!exists("g:GPGDebugLevel"))
let g:GPGDebugLevel = 0
endif
" print version
call s:GPGDebug(1, "gnupg.vim ". g:loaded_gnupg)
" determine if gnupg can use the gpg-agent
if (exists("$GPG_AGENT_INFO") && g:GPGUseAgent == 1)
if (!exists("$GPG_TTY"))
echohl GPGError
echo "The GPG_TTY is not set!"
echo "gpg-agent might not work."
echohl None
endif
let s:GPGCommand="gpg --use-agent"
else
let s:GPGCommand="gpg --no-use-agent"
endif
" don't use tty in gvim
" FIXME find a better way to avoid an error.
" with this solution only --use-agent will work
if has("gui_running")
let s:GPGCommand=s:GPGCommand . " --no-tty"
endif
" setup shell environment for unix and windows
let s:shellredirsave=&shellredir
let s:shellsave=&shell
if (match(&shell,"\\(cmd\\|command\\).exe") >= 0)
" windows specific settings
let s:shellredir = '>%s'
let s:shell = &shell
let s:stderrredirnull = '2>nul'
else
" unix specific settings
let s:shellredir = &shellredir
let s:shell = 'sh'
let s:stderrredirnull ='2>/dev/null'
let s:GPGCommand="LANG=C LC_ALL=C " . s:GPGCommand
endi
" find the supported algorithms
let &shellredir=s:shellredir
let &shell=s:shell
let output=system(s:GPGCommand . " --version")
let &shellredir=s:shellredirsave
let &shell=s:shellsave
let s:GPGPubkey=substitute(output, ".*Pubkey: \\(.\\{-}\\)\n.*", "\\1", "")
let s:GPGCipher=substitute(output, ".*Cipher: \\(.\\{-}\\)\n.*", "\\1", "")
let s:GPGHash=substitute(output, ".*Hash: \\(.\\{-}\\)\n.*", "\\1", "")
let s:GPGCompress=substitute(output, ".*Compress: \\(.\\{-}\\)\n.*", "\\1", "")
endf
" Function: s:GPGDecrypt() {{{2
"
" decrypt the buffer and find all recipients of the encrypted file
"
fun s:GPGDecrypt()
" switch to binary mode to read the encrypted file
set bin
" get the filename of the current buffer
let filename=escape(expand("%:p"), '\"')
" clear GPGEncrypted, GPGRecipients, GPGUnknownRecipients and GPGOptions
let b:GPGEncrypted=0
let b:GPGRecipients=""
let b:GPGUnknownRecipients=""
let b:GPGOptions=""
" find the recipients of the file
let &shellredir=s:shellredir
let &shell=s:shell
let output=system(s:GPGCommand . " --verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 \"" . filename . "\"")
let &shellredir=s:shellredirsave
let &shell=s:shellsave
call s:GPGDebug(1, "output of command '" . s:GPGCommand . " --verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 \"" . filename . "\"' is:")
call s:GPGDebug(1, ">>>>> " . output . " <<<<<")
" check if the file is symmetric/asymmetric encrypted
if (match(output, "gpg: encrypted with [[:digit:]]\\+ passphrase") >= 0)
" file is symmetric encrypted
let b:GPGEncrypted=1
call s:GPGDebug(1, "this file is symmetric encrypted")
let b:GPGOptions=b:GPGOptions . "symmetric:"
let cipher=substitute(output, ".*gpg: \\([^ ]\\+\\) encrypted data.*", "\\1", "")
if (match(s:GPGCipher, "\\<" . cipher . "\\>") >= 0)
let b:GPGOptions=b:GPGOptions . "cipher-algo " . cipher . ":"
call s:GPGDebug(1, "cipher-algo is " . cipher)
else
echohl GPGWarning
echo "The cipher " . cipher . " is not known by the local gpg command. Using default!"
echo
echohl None
endi
elseif (match(output, "gpg: public key is [[:xdigit:]]\\{8}") >= 0)
" file is asymmetric encrypted
let b:GPGEncrypted=1
call s:GPGDebug(1, "this file is asymmetric encrypted")
let b:GPGOptions=b:GPGOptions . "encrypt:"
let start=match(output, "gpg: public key is [[:xdigit:]]\\{8}")
while (start >= 0)
let start=start + strlen("gpg: public key is ")
let recipient=strpart(output, start, 8)
call s:GPGDebug(1, "recipient is " . recipient)
let name=s:GPGNameToID(recipient)
if (strlen(name) > 0)
let b:GPGRecipients=b:GPGRecipients . name . ":"
call s:GPGDebug(1, "name of recipient is " . name)
else
let b:GPGUnknownRecipients=b:GPGUnknownRecipients . recipient . ":"
echohl GPGWarning
echo "The recipient " . recipient . " is not in your public keyring!"
echohl None
end
let start=match(output, "gpg: public key is [[:xdigit:]]\\{8}", start)
endw
else
" file is not encrypted
let b:GPGEncrypted=0
call s:GPGDebug(1, "this file is not encrypted")
echohl GPGWarning
echo "File is not encrypted, all GPG functions disabled!"
echohl None
set nobin
return
endi
" check if the message is armored
if (match(output, "gpg: armor header") >= 0)
call s:GPGDebug(1, "this file is armored")
let b:GPGOptions=b:GPGOptions . "armor:"
endi
" finally decrypt the buffer content
" since even with the --quiet option passphrase typos will be reported,
" we must redirect stderr (using shell temporarily)
let &shellredir=s:shellredir
let &shell=s:shell
exec "'[,']!" . s:GPGCommand . " --quiet --decrypt " . s:stderrredirnull
let &shellredir=s:shellredirsave
let &shell=s:shellsave
if (v:shell_error) " message could not be decrypted
silent u
echohl GPGError
let asd=input("Message could not be decrypted! (Press ENTER)")
echohl None
bwipeout
set nobin
return
endi
" turn off binary mode
set nobin
" call the autocommand for the file minus .gpg$
execute ":doautocmd BufReadPost " . escape(expand("%:r"), ' *?\"'."'")
call s:GPGDebug(2, "called autocommand for " . escape(expand("%:r"), ' *?\"'."'"))
" refresh screen
redraw!
endf
" Function: s:GPGEncrypt() {{{2
"
" encrypts the buffer to all previous recipients
"
fun s:GPGEncrypt()
" save window view
let s:GPGWindowView = winsaveview()
call s:GPGDebug(2, "saved window view " . string(s:GPGWindowView))
" store encoding and switch to a safe one
if &fileencoding != &encoding
let s:GPGEncoding = &encoding
let &encoding = &fileencoding
call s:GPGDebug(2, "encoding was \"" . s:GPGEncoding . "\", switched to \"" . &encoding . "\"")
else
let s:GPGEncoding = ""
call s:GPGDebug(2, "encoding and fileencoding are the same (\"" . &encoding . "\"), not switching")
endi
" switch buffer to binary mode
set bin
" guard for unencrypted files
if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
echohl GPGWarning
echo "File is not encrypted, all GPG functions disabled!"
echohl None
return
endi
let options=""
let recipients=""
let field=0
" built list of options
if (!exists("b:GPGOptions") || strlen(b:GPGOptions) == 0)
if (exists("g:GPGPreferSymmetric") && g:GPGPreferSymmetric == 1)
let b:GPGOptions="symmetric:"
else
let b:GPGOptions="encrypt:"
endi
if (exists("g:GPGPreferArmor") && g:GPGPreferArmor == 1)
let b:GPGOptions=b:GPGOptions . "armor:"
endi
call s:GPGDebug(1, "no options set, so using default options: " . b:GPGOptions)
endi
let field=0
let option=s:GetField(b:GPGOptions, ":", field)
while (strlen(option))
let options=options . " --" . option . " "
let field=field+1
let option=s:GetField(b:GPGOptions, ":", field)
endw
" check if there are unknown recipients and warn
if (exists("b:GPGUnknownRecipients") && strlen(b:GPGUnknownRecipients) > 0)
echohl GPGWarning
echo "There are unknown recipients!!"
echo "Please use GPGEditRecipients to correct!!"
echo
echohl None
call s:GPGDebug(1, "unknown recipients are: " . b:GPGUnknownRecipients)
endi
" built list of recipients
if (exists("b:GPGRecipients") && strlen(b:GPGRecipients) > 0)
call s:GPGDebug(1, "recipients are: " . b:GPGRecipients)
let field=0
let gpgid=s:GetField(b:GPGRecipients, ":", field)
while (strlen(gpgid))
let recipients=recipients . " -r " . gpgid
let field=field+1
let gpgid=s:GetField(b:GPGRecipients, ":", field)
endw
else
if (match(b:GPGOptions, "encrypt:") >= 0)
echohl GPGError
echo "There are no recipients!!"
echo "Please use GPGEditRecipients to correct!!"
echo
echohl None
endi
endi
" encrypt the buffer
let &shellredir=s:shellredir
let &shell=s:shell
silent exec "'[,']!" . s:GPGCommand . " --quiet --no-encrypt-to " . options . recipients . " " . s:stderrredirnull
let &shellredir=s:shellredirsave
let &shell=s:shellsave
call s:GPGDebug(1, "called gpg command is: " . "'[,']!" . s:GPGCommand . " --quiet --no-encrypt-to " . options . recipients . " " . s:stderrredirnull)
if (v:shell_error) " message could not be encrypted
silent u
echohl GPGError
let asd=input("Message could not be encrypted! File might be empty! (Press ENTER)")
echohl None
bwipeout
return
endi
endf
" Function: s:GPGEncryptPost() {{{2
"
" undo changes don by encrypt, after writing
"
fun s:GPGEncryptPost()
if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
return
endi
" undo encryption of buffer content
silent u
" switch back from binary mode
set nobin
" restore encoding
if s:GPGEncoding != ""
let &encoding = s:GPGEncoding
call s:GPGDebug(2, "restored encoding \"" . &encoding . "\"")
endi
" restore window view
call winrestview(s:GPGWindowView)
call s:GPGDebug(2, "restored window view" . string(s:GPGWindowView))
" refresh screen
redraw!
endf
" Function: s:GPGViewRecipients() {{{2
"
" echo the recipients
"
fun s:GPGViewRecipients()
" guard for unencrypted files
if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
echohl GPGWarning
echo "File is not encrypted, all GPG functions disabled!"
echohl None
return
endi
if (exists("b:GPGRecipients"))
echo 'This file has following recipients (Unknown recipients have a prepended "!"):'
" echo the recipients
let field=0
let name=s:GetField(b:GPGRecipients, ":", field)
while (strlen(name) > 0)
let name=s:GPGIDToName(name)
echo name
let field=field+1
let name=s:GetField(b:GPGRecipients, ":", field)
endw
" put the unknown recipients in the scratch buffer
let field=0
echohl GPGWarning
let name=s:GetField(b:GPGUnknownRecipients, ":", field)
while (strlen(name) > 0)
let name="!" . name
echo name
let field=field+1
let name=s:GetField(b:GPGUnknownRecipients, ":", field)
endw
echohl None
" check if there is any known recipient
if (strlen(s:GetField(b:GPGRecipients, ":", 0)) == 0)
echohl GPGError
echo 'There are no known recipients!'
echohl None
endi
endi
endf
" Function: s:GPGEditRecipients() {{{2
"
" create a scratch buffer with all recipients to add/remove recipients
"
fun s:GPGEditRecipients()
" guard for unencrypted files
if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
echohl GPGWarning
echo "File is not encrypted, all GPG functions disabled!"
echohl None
return
endi
" only do this if it isn't already a GPGRecipients_* buffer
if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0)
" save buffer name
let buffername=bufname("%")
let editbuffername="GPGRecipients_" . buffername
" check if this buffer exists
if (!bufexists(editbuffername))
" create scratch buffer
exe 'silent! split ' . escape(editbuffername, ' *?\"'."'")
" add a autocommand to regenerate the recipients after a write
autocmd BufHidden,BufUnload <buffer> call s:GPGFinishRecipientsBuffer()
else
if (bufwinnr(editbuffername) >= 0)
" switch to scratch buffer window
exe 'silent! ' . bufwinnr(editbuffername) . "wincmd w"
else
" split scratch buffer window
exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
" add a autocommand to regenerate the recipients after a write
autocmd BufHidden,BufUnload <buffer> call s:GPGFinishRecipientsBuffer()
endi
" empty the buffer
silent normal! 1GdG
endi
" Mark the buffer as a scratch buffer
setlocal buftype=nofile
setlocal noswapfile
setlocal nowrap
setlocal nobuflisted
setlocal nonumber
" so we know for which other buffer this edit buffer is
let b:corresponding_to=buffername
" put some comments to the scratch buffer
silent put ='GPG: ----------------------------------------------------------------------'
silent put ='GPG: Please edit the list of recipients, one recipient per line'
silent put ='GPG: Unknown recipients have a prepended \"!\"'
silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically'
silent put ='GPG: Closing this buffer commits changes'
silent put ='GPG: ----------------------------------------------------------------------'
" put the recipients in the scratch buffer
let recipients=getbufvar(b:corresponding_to, "GPGRecipients")
let field=0
let name=s:GetField(recipients, ":", field)
while (strlen(name) > 0)
let name=s:GPGIDToName(name)
silent put =name
let field=field+1
let name=s:GetField(recipients, ":", field)
endw
" put the unknown recipients in the scratch buffer
let unknownRecipients=getbufvar(b:corresponding_to, "GPGUnknownRecipients")
let field=0
let syntaxPattern="\\(nonexistingwordinthisbuffer"
let name=s:GetField(unknownRecipients, ":", field)
while (strlen(name) > 0)
let name="!" . name
let syntaxPattern=syntaxPattern . "\\|" . name
silent put =name
let field=field+1
let name=s:GetField(unknownRecipients, ":", field)
endw
let syntaxPattern=syntaxPattern . "\\)"
" define highlight
if (has("syntax") && exists("g:syntax_on"))
exec('syntax match GPGUnknownRecipient "' . syntaxPattern . '"')
highlight clear GPGUnknownRecipient
highlight link GPGUnknownRecipient GPGHighlightUnknownRecipient
syntax match GPGComment "^GPG:.*$"
highlight clear GPGComment
highlight link GPGComment Comment
endi
" delete the empty first line
silent normal! 1Gdd
" jump to the first recipient
silent normal! G
endi
endf
" Function: s:GPGFinishRecipientsBuffer() {{{2
"
" create a new recipient list from RecipientsBuffer
fun s:GPGFinishRecipientsBuffer()
" guard for unencrypted files
if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
echohl GPGWarning
echo "File is not encrypted, all GPG functions disabled!"
echohl None
return
endi
" go to buffer before doing work
if (bufnr("%") != expand("<abuf>"))
" switch to scratch buffer window
exe 'silent! ' . bufwinnr(expand("<afile>")) . "wincmd w"
endi
" clear GPGRecipients and GPGUnknownRecipients
let GPGRecipients=""
let GPGUnknownRecipients=""
" delete the autocommand
autocmd! * <buffer>
let currentline=1
let recipient=getline(currentline)
" get the recipients from the scratch buffer
while (currentline <= line("$"))
" delete all spaces at beginning and end of the line
" also delete a '!' at the beginning of the line
let recipient=substitute(recipient, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "")
" delete comment lines
let recipient=substitute(recipient, "^GPG:.*$", "", "")
" only do this if the line is not empty
if (strlen(recipient) > 0)
let gpgid=s:GPGNameToID(recipient)
if (strlen(gpgid) > 0)
let GPGRecipients=GPGRecipients . gpgid . ":"
else
let GPGUnknownRecipients=GPGUnknownRecipients . recipient . ":"
echohl GPGWarning
echo "The recipient " . recipient . " is not in your public keyring!"
echohl None
end
endi
let currentline=currentline+1
let recipient=getline(currentline)
endw
" write back the new recipient list to the corresponding buffer and mark it
" as modified. Buffer is now for sure a encrypted buffer.
call setbufvar(b:corresponding_to, "GPGRecipients", GPGRecipients)
call setbufvar(b:corresponding_to, "GPGUnknownRecipients", GPGUnknownRecipients)
call setbufvar(b:corresponding_to, "&mod", 1)
call setbufvar(b:corresponding_to, "GPGEncrypted", 1)
" check if there is any known recipient
if (strlen(s:GetField(GPGRecipients, ":", 0)) == 0)
echohl GPGError
echo 'There are no known recipients!'
echohl None
endi
endf
" Function: s:GPGViewOptions() {{{2
"
" echo the recipients
"
fun s:GPGViewOptions()
" guard for unencrypted files
if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
echohl GPGWarning
echo "File is not encrypted, all GPG functions disabled!"
echohl None
return
endi
if (exists("b:GPGOptions"))
echo 'This file has following options:'
" echo the options
let field=0
let option=s:GetField(b:GPGOptions, ":", field)
while (strlen(option) > 0)
echo option
let field=field+1
let option=s:GetField(b:GPGOptions, ":", field)
endw
endi
endf
" Function: s:GPGEditOptions() {{{2
"
" create a scratch buffer with all recipients to add/remove recipients
"
fun s:GPGEditOptions()
" guard for unencrypted files
if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
echohl GPGWarning
echo "File is not encrypted, all GPG functions disabled!"
echohl None
return
endi
" only do this if it isn't already a GPGOptions_* buffer
if (match(bufname("%"), "^\\(GPGRecipients_\\|GPGOptions_\\)") != 0 && match(bufname("%"), "\.\\(gpg\\|asc\\|pgp\\)$") >= 0)
" save buffer name
let buffername=bufname("%")
let editbuffername="GPGOptions_" . buffername
" check if this buffer exists
if (!bufexists(editbuffername))
" create scratch buffer
exe 'silent! split ' . escape(editbuffername, ' *?\"'."'")
" add a autocommand to regenerate the options after a write
autocmd BufHidden,BufUnload <buffer> call s:GPGFinishOptionsBuffer()
else
if (bufwinnr(editbuffername) >= 0)
" switch to scratch buffer window
exe 'silent! ' . bufwinnr(editbuffername) . "wincmd w"
else
" split scratch buffer window
exe 'silent! sbuffer ' . escape(editbuffername, ' *?\"'."'")
" add a autocommand to regenerate the options after a write
autocmd BufHidden,BufUnload <buffer> call s:GPGFinishOptionsBuffer()
endi
" empty the buffer
silent normal! 1GdG
endi
" Mark the buffer as a scratch buffer
setlocal buftype=nofile
setlocal noswapfile
setlocal nowrap
setlocal nobuflisted
setlocal nonumber
" so we know for which other buffer this edit buffer is
let b:corresponding_to=buffername
" put some comments to the scratch buffer
silent put ='GPG: ----------------------------------------------------------------------'
silent put ='GPG: THERE IS NO CHECK OF THE ENTERED OPTIONS!'
silent put ='GPG: YOU NEED TO KNOW WHAT YOU ARE DOING!'
silent put ='GPG: IF IN DOUBT, QUICKLY EXIT USING :x OR :bd'
silent put ='GPG: Please edit the list of options, one option per line'
silent put ='GPG: Please refer to the gpg documentation for valid options'
silent put ='GPG: Lines beginning with \"GPG:\" are removed automatically'
silent put ='GPG: Closing this buffer commits changes'
silent put ='GPG: ----------------------------------------------------------------------'
" put the options in the scratch buffer
let options=getbufvar(b:corresponding_to, "GPGOptions")
let field=0
let option=s:GetField(options, ":", field)
while (strlen(option) > 0)
silent put =option
let field=field+1
let option=s:GetField(options, ":", field)
endw
" delete the empty first line
silent normal! 1Gdd
" jump to the first option
silent normal! G
" define highlight
if (has("syntax") && exists("g:syntax_on"))
syntax match GPGComment "^GPG:.*$"
highlight clear GPGComment
highlight link GPGComment Comment
endi
endi
endf
" Function: s:GPGFinishOptionsBuffer() {{{2
"
" create a new option list from OptionsBuffer
fun s:GPGFinishOptionsBuffer()
" guard for unencrypted files
if (exists("b:GPGEncrypted") && b:GPGEncrypted == 0)
echohl GPGWarning
echo "File is not encrypted, all GPG functions disabled!"
echohl None
return
endi
" go to buffer before doing work
if (bufnr("%") != expand("<abuf>"))
" switch to scratch buffer window
exe 'silent! ' . bufwinnr(expand("<afile>")) . "wincmd w"
endi
" clear GPGOptions and GPGUnknownOptions
let GPGOptions=""
let GPGUnknownOptions=""
" delete the autocommand
autocmd! * <buffer>
let currentline=1
let option=getline(currentline)
" get the options from the scratch buffer
while (currentline <= line("$"))
" delete all spaces at beginning and end of the line
" also delete a '!' at the beginning of the line
let option=substitute(option, "^[[:space:]!]*\\(.\\{-}\\)[[:space:]]*$", "\\1", "")
" delete comment lines
let option=substitute(option, "^GPG:.*$", "", "")
" only do this if the line is not empty
if (strlen(option) > 0)
let GPGOptions=GPGOptions . option . ":"
endi
let currentline=currentline+1
let option=getline(currentline)
endw
" write back the new option list to the corresponding buffer and mark it
" as modified
call setbufvar(b:corresponding_to, "GPGOptions", GPGOptions)
call setbufvar(b:corresponding_to, "&mod", 1)
endf
" Function: s:GPGNameToID(name) {{{2
"
" find GPG key ID corresponding to a name
" Returns: ID for the given name
fun s:GPGNameToID(name)
" ask gpg for the id for a name
let &shellredir=s:shellredir
let &shell=s:shell
let output=system(s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys \"" . a:name . "\"")
let &shellredir=s:shellredirsave
let &shell=s:shellsave
" parse the output of gpg
let pub_seen=0
let uid_seen=0
let line=0
let counter=0
let gpgids=""
let choices="The name \"" . a:name . "\" is ambiguous. Please select the correct key:\n"
let linecontent=s:GetField(output, "\n", line)
while (strlen(linecontent))
" search for the next uid
if (pub_seen == 1)
if (s:GetField(linecontent, ":", 0) == "uid")
if (uid_seen == 0)
let choices=choices . counter . ": " . s:GetField(linecontent, ":", 9) . "\n"
let counter=counter+1
let uid_seen=1
else
let choices=choices . " " . s:GetField(linecontent, ":", 9) . "\n"
endi
else
let uid_seen=0
let pub_seen=0
endi
endi
" search for the next pub
if (pub_seen == 0)
if (s:GetField(linecontent, ":", 0) == "pub")
let gpgids=gpgids . s:GetField(linecontent, ":", 4) . ":"
let pub_seen=1
endi
endi
let line=line+1
let linecontent=s:GetField(output, "\n", line)
endw
" counter > 1 means we have more than one results
let answer=0
if (counter > 1)
let choices=choices . "Enter number: "
let answer=input(choices, "0")
while (answer == "")
let answer=input("Enter number: ", "0")
endw
endi
return s:GetField(gpgids, ":", answer)
endf
" Function: s:GPGIDToName(identity) {{{2
"
" find name corresponding to a GPG key ID
" Returns: Name for the given ID
fun s:GPGIDToName(identity)
" TODO is the encryption subkey really unique?
" ask gpg for the id for a name
let &shellredir=s:shellredir
let &shell=s:shell
let output=system(s:GPGCommand . " --quiet --with-colons --fixed-list-mode --list-keys " . a:identity )
let &shellredir=s:shellredirsave
let &shell=s:shellsave
" parse the output of gpg
let pub_seen=0
let finish=0
let line=0
let linecontent=s:GetField(output, "\n", line)
while (strlen(linecontent) && !finish)
if (pub_seen == 0) " search for the next pub
if (s:GetField(linecontent, ":", 0) == "pub")
let pub_seen=1
endi
else " search for the next uid
if (s:GetField(linecontent, ":", 0) == "uid")
let pub_seen=0
let finish=1
let uid=s:GetField(linecontent, ":", 9)
endi
endi
let line=line+1
let linecontent=s:GetField(output, "\n", line)
endw
return uid
endf
" Function: s:GetField(line, separator, field) {{{2
"
" find field of 'separator' separated string, counting starts with 0
" Returns: content of the field, if field doesn't exist it returns an empty
" string
fun s:GetField(line, separator, field)
let counter=a:field
let separatorLength=strlen(a:separator)
let start=0
let end=match(a:line, a:separator)
if (end < 0)
let end=strlen(a:line)
endi
" search for requested field
while (start < strlen(a:line) && counter > 0)
let counter=counter-separatorLength
let start=end+separatorLength
let end=match(a:line, a:separator, start)
if (end < 0)
let end=strlen(a:line)
endi
endw
if (start < strlen(a:line))
return strpart(a:line, start, end-start)
else
return ""
endi
endf
" Function: s:GPGDebug(level, text) {{{2
"
" output debug message, if this message has high enough importance
fun s:GPGDebug(level, text)
if (g:GPGDebugLevel >= a:level)
echom a:text
endi
endf
" Section: Command definitions {{{1
com! GPGViewRecipients call s:GPGViewRecipients()
com! GPGEditRecipients call s:GPGEditRecipients()
com! GPGViewOptions call s:GPGViewOptions()
com! GPGEditOptions call s:GPGEditOptions()
" vim600: foldmethod=marker:foldlevel=0

812
.vim/plugin/matchit.vim Executable file
View file

@ -0,0 +1,812 @@
" matchit.vim: (global plugin) Extended "%" matching
" Last Change: Fri Jan 25 10:00 AM 2008 EST
" Maintainer: Benji Fisher PhD <benji@member.AMS.org>
" Version: 1.13.2, for Vim 6.3+
" URL: http://www.vim.org/script.php?script_id=39
" Documentation:
" The documentation is in a separate file, matchit.txt .
" Credits:
" Vim editor by Bram Moolenaar (Thanks, Bram!)
" Original script and design by Raul Segura Acevedo
" Support for comments by Douglas Potts
" Support for back references and other improvements by Benji Fisher
" Support for many languages by Johannes Zellner
" Suggestions for improvement, bug reports, and support for additional
" languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark
" Collett, Stephen Wall, Dany St-Amant, Yuheng Xie, and Johannes Zellner.
" Debugging:
" If you'd like to try the built-in debugging commands...
" :MatchDebug to activate debugging for the current buffer
" This saves the values of several key script variables as buffer-local
" variables. See the MatchDebug() function, below, for details.
" TODO: I should think about multi-line patterns for b:match_words.
" This would require an option: how many lines to scan (default 1).
" This would be useful for Python, maybe also for *ML.
" TODO: Maybe I should add a menu so that people will actually use some of
" the features that I have implemented.
" TODO: Eliminate the MultiMatch function. Add yet another argument to
" Match_wrapper() instead.
" TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1'
" TODO: Make backrefs safer by using '\V' (very no-magic).
" TODO: Add a level of indirection, so that custom % scripts can use my
" work but extend it.
" allow user to prevent loading
" and prevent duplicate loading
if exists("loaded_matchit") || &cp
finish
endif
let loaded_matchit = 1
let s:last_mps = ""
let s:last_words = ":"
let s:save_cpo = &cpo
set cpo&vim
nnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'n') <CR>
nnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'n') <CR>
vnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'v') <CR>m'gv``
vnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'v') <CR>m'gv``
onoremap <silent> % v:<C-U>call <SID>Match_wrapper('',1,'o') <CR>
onoremap <silent> g% v:<C-U>call <SID>Match_wrapper('',0,'o') <CR>
" Analogues of [{ and ]} using matching patterns:
nnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "n") <CR>
nnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "n") <CR>
vmap [% <Esc>[%m'gv``
vmap ]% <Esc>]%m'gv``
" vnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "v") <CR>m'gv``
" vnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "v") <CR>m'gv``
onoremap <silent> [% v:<C-U>call <SID>MultiMatch("bW", "o") <CR>
onoremap <silent> ]% v:<C-U>call <SID>MultiMatch("W", "o") <CR>
" text object:
vmap a% <Esc>[%v]%
" Auto-complete mappings: (not yet "ready for prime time")
" TODO Read :help write-plugin for the "right" way to let the user
" specify a key binding.
" let g:match_auto = '<C-]>'
" let g:match_autoCR = '<C-CR>'
" if exists("g:match_auto")
" execute "inoremap " . g:match_auto . ' x<Esc>"=<SID>Autocomplete()<CR>Pls'
" endif
" if exists("g:match_autoCR")
" execute "inoremap " . g:match_autoCR . ' <CR><C-R>=<SID>Autocomplete()<CR>'
" endif
" if exists("g:match_gthhoh")
" execute "inoremap " . g:match_gthhoh . ' <C-O>:call <SID>Gthhoh()<CR>'
" endif " gthhoh = "Get the heck out of here!"
let s:notslash = '\\\@<!\%(\\\\\)*'
function! s:Match_wrapper(word, forward, mode) range
" In s:CleanUp(), :execute "set" restore_options .
let restore_options = (&ic ? " " : " no") . "ignorecase"
if exists("b:match_ignorecase")
let &ignorecase = b:match_ignorecase
endif
let restore_options = " ve=" . &ve . restore_options
set ve=
" If this function was called from Visual mode, make sure that the cursor
" is at the correct end of the Visual range:
if a:mode == "v"
execute "normal! gv\<Esc>"
endif
" In s:CleanUp(), we may need to check whether the cursor moved forward.
let startline = line(".")
let startcol = col(".")
" Use default behavior if called with a count.
if v:count
exe "normal! " . v:count . "%"
return s:CleanUp(restore_options, a:mode, startline, startcol)
end
" First step: if not already done, set the script variables
" s:do_BR flag for whether there are backrefs
" s:pat parsed version of b:match_words
" s:all regexp based on s:pat and the default groups
"
if !exists("b:match_words") || b:match_words == ""
let match_words = ""
" Allow b:match_words = "GetVimMatchWords()" .
elseif b:match_words =~ ":"
let match_words = b:match_words
else
execute "let match_words =" b:match_words
endif
" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion!
if (match_words != s:last_words) || (&mps != s:last_mps) ||
\ exists("b:match_debug")
let s:last_words = match_words
let s:last_mps = &mps
" The next several lines were here before
" BF started messing with this script.
" quote the special chars in 'matchpairs', replace [,:] with \| and then
" append the builtin pairs (/*, */, #if, #ifdef, #else, #elif, #endif)
" let default = substitute(escape(&mps, '[$^.*~\\/?]'), '[,:]\+',
" \ '\\|', 'g').'\|\/\*\|\*\/\|#if\>\|#ifdef\>\|#else\>\|#elif\>\|#endif\>'
let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") .
\ '\/\*:\*\/,#if\%(def\)\=:#else\>:#elif\>:#endif\>'
" s:all = pattern with all the keywords
let match_words = match_words . (strlen(match_words) ? "," : "") . default
if match_words !~ s:notslash . '\\\d'
let s:do_BR = 0
let s:pat = match_words
else
let s:do_BR = 1
let s:pat = s:ParseWords(match_words)
endif
let s:all = substitute(s:pat, s:notslash . '\zs[,:]\+', '\\|', 'g')
let s:all = '\%(' . s:all . '\)'
" let s:all = '\%(' . substitute(s:all, '\\\ze[,:]', '', 'g') . '\)'
if exists("b:match_debug")
let b:match_pat = s:pat
endif
endif
" Second step: set the following local variables:
" matchline = line on which the cursor started
" curcol = number of characters before match
" prefix = regexp for start of line to start of match
" suffix = regexp for end of match to end of line
" Require match to end on or after the cursor and prefer it to
" start on or before the cursor.
let matchline = getline(startline)
if a:word != ''
" word given
if a:word !~ s:all
echohl WarningMsg|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE
return s:CleanUp(restore_options, a:mode, startline, startcol)
endif
let matchline = a:word
let curcol = 0
let prefix = '^\%('
let suffix = '\)$'
" Now the case when "word" is not given
else " Find the match that ends on or after the cursor and set curcol.
let regexp = s:Wholematch(matchline, s:all, startcol-1)
let curcol = match(matchline, regexp)
" If there is no match, give up.
if curcol == -1
return s:CleanUp(restore_options, a:mode, startline, startcol)
endif
let endcol = matchend(matchline, regexp)
let suf = strlen(matchline) - endcol
let prefix = (curcol ? '^.*\%' . (curcol + 1) . 'c\%(' : '^\%(')
let suffix = (suf ? '\)\%' . (endcol + 1) . 'c.*$' : '\)$')
endif
if exists("b:match_debug")
let b:match_match = matchstr(matchline, regexp)
let b:match_col = curcol+1
endif
" Third step: Find the group and single word that match, and the original
" (backref) versions of these. Then, resolve the backrefs.
" Set the following local variable:
" group = colon-separated list of patterns, one of which matches
" = ini:mid:fin or ini:fin
"
" Reconstruct the version with unresolved backrefs.
let patBR = substitute(match_words.',',
\ s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
let patBR = substitute(patBR, s:notslash.'\zs:\{2,}', ':', 'g')
" Now, set group and groupBR to the matching group: 'if:endif' or
" 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns
" group . "," . groupBR, and we pick it apart.
let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR)
let i = matchend(group, s:notslash . ",")
let groupBR = strpart(group, i)
let group = strpart(group, 0, i-1)
" Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix
if s:do_BR " Do the hard part: resolve those backrefs!
let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline)
endif
if exists("b:match_debug")
let b:match_wholeBR = groupBR
let i = matchend(groupBR, s:notslash . ":")
let b:match_iniBR = strpart(groupBR, 0, i-1)
endif
" Fourth step: Set the arguments for searchpair().
let i = matchend(group, s:notslash . ":")
let j = matchend(group, '.*' . s:notslash . ":")
let ini = strpart(group, 0, i-1)
let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g')
let fin = strpart(group, j)
"Un-escape the remaining , and : characters.
let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
" searchpair() requires that these patterns avoid \(\) groups.
let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g')
let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g')
let fin = substitute(fin, s:notslash . '\zs\\(', '\\%(', 'g')
" Set mid. This is optimized for readability, not micro-efficiency!
if a:forward && matchline =~ prefix . fin . suffix
\ || !a:forward && matchline =~ prefix . ini . suffix
let mid = ""
endif
" Set flag. This is optimized for readability, not micro-efficiency!
if a:forward && matchline =~ prefix . fin . suffix
\ || !a:forward && matchline !~ prefix . ini . suffix
let flag = "bW"
else
let flag = "W"
endif
" Set skip.
if exists("b:match_skip")
let skip = b:match_skip
elseif exists("b:match_comment") " backwards compatibility and testing!
let skip = "r:" . b:match_comment
else
let skip = 's:comment\|string'
endif
let skip = s:ParseSkip(skip)
if exists("b:match_debug")
let b:match_ini = ini
let b:match_tail = (strlen(mid) ? mid.'\|' : '') . fin
endif
" Fifth step: actually start moving the cursor and call searchpair().
" Later, :execute restore_cursor to get to the original screen.
let restore_cursor = virtcol(".") . "|"
normal! g0
let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor
normal! H
let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor
execute restore_cursor
call cursor(0, curcol + 1)
" normal! 0
" if curcol
" execute "normal!" . curcol . "l"
" endif
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
let skip = "0"
else
execute "if " . skip . "| let skip = '0' | endif"
endif
let sp_return = searchpair(ini, mid, fin, flag, skip)
let final_position = "call cursor(" . line(".") . "," . col(".") . ")"
" Restore cursor position and original screen.
execute restore_cursor
normal! m'
if sp_return > 0
execute final_position
endif
return s:CleanUp(restore_options, a:mode, startline, startcol, mid.'\|'.fin)
endfun
" Restore options and do some special handling for Operator-pending mode.
" The optional argument is the tail of the matching group.
fun! s:CleanUp(options, mode, startline, startcol, ...)
execute "set" a:options
" Open folds, if appropriate.
if a:mode != "o"
if &foldopen =~ "percent"
normal! zv
endif
" In Operator-pending mode, we want to include the whole match
" (for example, d%).
" This is only a problem if we end up moving in the forward direction.
elseif (a:startline < line(".")) ||
\ (a:startline == line(".") && a:startcol < col("."))
if a:0
" Check whether the match is a single character. If not, move to the
" end of the match.
let matchline = getline(".")
let currcol = col(".")
let regexp = s:Wholematch(matchline, a:1, currcol-1)
let endcol = matchend(matchline, regexp)
if endcol > currcol " This is NOT off by one!
execute "normal!" . (endcol - currcol) . "l"
endif
endif " a:0
endif " a:mode != "o" && etc.
return 0
endfun
" Example (simplified HTML patterns): if
" a:groupBR = '<\(\k\+\)>:</\1>'
" a:prefix = '^.\{3}\('
" a:group = '<\(\k\+\)>:</\(\k\+\)>'
" a:suffix = '\).\{2}$'
" a:matchline = "123<tag>12" or "123</tag>12"
" then extract "tag" from a:matchline and return "<tag>:</tag>" .
fun! s:InsertRefs(groupBR, prefix, group, suffix, matchline)
if a:matchline !~ a:prefix .
\ substitute(a:group, s:notslash . '\zs:', '\\|', 'g') . a:suffix
return a:group
endif
let i = matchend(a:groupBR, s:notslash . ':')
let ini = strpart(a:groupBR, 0, i-1)
let tailBR = strpart(a:groupBR, i)
let word = s:Choose(a:group, a:matchline, ":", "", a:prefix, a:suffix,
\ a:groupBR)
let i = matchend(word, s:notslash . ":")
let wordBR = strpart(word, i)
let word = strpart(word, 0, i-1)
" Now, a:matchline =~ a:prefix . word . a:suffix
if wordBR != ini
let table = s:Resolve(ini, wordBR, "table")
else
" let table = "----------"
let table = ""
let d = 0
while d < 10
if tailBR =~ s:notslash . '\\' . d
" let table[d] = d
let table = table . d
else
let table = table . "-"
endif
let d = d + 1
endwhile
endif
let d = 9
while d
if table[d] != "-"
let backref = substitute(a:matchline, a:prefix.word.a:suffix,
\ '\'.table[d], "")
" Are there any other characters that should be escaped?
let backref = escape(backref, '*,:')
execute s:Ref(ini, d, "start", "len")
let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len)
let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d,
\ escape(backref, '\\'), 'g')
endif
let d = d-1
endwhile
if exists("b:match_debug")
if s:do_BR
let b:match_table = table
let b:match_word = word
else
let b:match_table = ""
let b:match_word = ""
endif
endif
return ini . ":" . tailBR
endfun
" Input a comma-separated list of groups with backrefs, such as
" a:groups = '\(foo\):end\1,\(bar\):end\1'
" and return a comma-separated list of groups with backrefs replaced:
" return '\(foo\):end\(foo\),\(bar\):end\(bar\)'
fun! s:ParseWords(groups)
let groups = substitute(a:groups.",", s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
let groups = substitute(groups, s:notslash . '\zs:\{2,}', ':', 'g')
let parsed = ""
while groups =~ '[^,:]'
let i = matchend(groups, s:notslash . ':')
let j = matchend(groups, s:notslash . ',')
let ini = strpart(groups, 0, i-1)
let tail = strpart(groups, i, j-i-1) . ":"
let groups = strpart(groups, j)
let parsed = parsed . ini
let i = matchend(tail, s:notslash . ':')
while i != -1
" In 'if:else:endif', ini='if' and word='else' and then word='endif'.
let word = strpart(tail, 0, i-1)
let tail = strpart(tail, i)
let i = matchend(tail, s:notslash . ':')
let parsed = parsed . ":" . s:Resolve(ini, word, "word")
endwhile " Now, tail has been used up.
let parsed = parsed . ","
endwhile " groups =~ '[^,:]'
let parsed = substitute(parsed, ',$', '', '')
return parsed
endfun
" TODO I think this can be simplified and/or made more efficient.
" TODO What should I do if a:start is out of range?
" Return a regexp that matches all of a:string, such that
" matchstr(a:string, regexp) represents the match for a:pat that starts
" as close to a:start as possible, before being preferred to after, and
" ends after a:start .
" Usage:
" let regexp = s:Wholematch(getline("."), 'foo\|bar', col(".")-1)
" let i = match(getline("."), regexp)
" let j = matchend(getline("."), regexp)
" let match = matchstr(getline("."), regexp)
fun! s:Wholematch(string, pat, start)
let group = '\%(' . a:pat . '\)'
let prefix = (a:start ? '\(^.*\%<' . (a:start + 2) . 'c\)\zs' : '^')
let len = strlen(a:string)
let suffix = (a:start+1 < len ? '\(\%>'.(a:start+1).'c.*$\)\@=' : '$')
if a:string !~ prefix . group . suffix
let prefix = ''
endif
return prefix . group . suffix
endfun
" No extra arguments: s:Ref(string, d) will
" find the d'th occurrence of '\(' and return it, along with everything up
" to and including the matching '\)'.
" One argument: s:Ref(string, d, "start") returns the index of the start
" of the d'th '\(' and any other argument returns the length of the group.
" Two arguments: s:Ref(string, d, "foo", "bar") returns a string to be
" executed, having the effect of
" :let foo = s:Ref(string, d, "start")
" :let bar = s:Ref(string, d, "len")
fun! s:Ref(string, d, ...)
let len = strlen(a:string)
if a:d == 0
let start = 0
else
let cnt = a:d
let match = a:string
while cnt
let cnt = cnt - 1
let index = matchend(match, s:notslash . '\\(')
if index == -1
return ""
endif
let match = strpart(match, index)
endwhile
let start = len - strlen(match)
if a:0 == 1 && a:1 == "start"
return start - 2
endif
let cnt = 1
while cnt
let index = matchend(match, s:notslash . '\\(\|\\)') - 1
if index == -2
return ""
endif
" Increment if an open, decrement if a ')':
let cnt = cnt + (match[index]=="(" ? 1 : -1) " ')'
" let cnt = stridx('0(', match[index]) + cnt
let match = strpart(match, index+1)
endwhile
let start = start - 2
let len = len - start - strlen(match)
endif
if a:0 == 1
return len
elseif a:0 == 2
return "let " . a:1 . "=" . start . "| let " . a:2 . "=" . len
else
return strpart(a:string, start, len)
endif
endfun
" Count the number of disjoint copies of pattern in string.
" If the pattern is a literal string and contains no '0' or '1' characters
" then s:Count(string, pattern, '0', '1') should be faster than
" s:Count(string, pattern).
fun! s:Count(string, pattern, ...)
let pat = escape(a:pattern, '\\')
if a:0 > 1
let foo = substitute(a:string, '[^'.a:pattern.']', "a:1", "g")
let foo = substitute(a:string, pat, a:2, "g")
let foo = substitute(foo, '[^' . a:2 . ']', "", "g")
return strlen(foo)
endif
let result = 0
let foo = a:string
let index = matchend(foo, pat)
while index != -1
let result = result + 1
let foo = strpart(foo, index)
let index = matchend(foo, pat)
endwhile
return result
endfun
" s:Resolve('\(a\)\(b\)', '\(c\)\2\1\1\2') should return table.word, where
" word = '\(c\)\(b\)\(a\)\3\2' and table = '-32-------'. That is, the first
" '\1' in target is replaced by '\(a\)' in word, table[1] = 3, and this
" indicates that all other instances of '\1' in target are to be replaced
" by '\3'. The hard part is dealing with nesting...
" Note that ":" is an illegal character for source and target,
" unless it is preceded by "\".
fun! s:Resolve(source, target, output)
let word = a:target
let i = matchend(word, s:notslash . '\\\d') - 1
let table = "----------"
while i != -2 " There are back references to be replaced.
let d = word[i]
let backref = s:Ref(a:source, d)
" The idea is to replace '\d' with backref. Before we do this,
" replace any \(\) groups in backref with :1, :2, ... if they
" correspond to the first, second, ... group already inserted
" into backref. Later, replace :1 with \1 and so on. The group
" number w+b within backref corresponds to the group number
" s within a:source.
" w = number of '\(' in word before the current one
let w = s:Count(
\ substitute(strpart(word, 0, i-1), '\\\\', '', 'g'), '\(', '1')
let b = 1 " number of the current '\(' in backref
let s = d " number of the current '\(' in a:source
while b <= s:Count(substitute(backref, '\\\\', '', 'g'), '\(', '1')
\ && s < 10
if table[s] == "-"
if w + b < 10
" let table[s] = w + b
let table = strpart(table, 0, s) . (w+b) . strpart(table, s+1)
endif
let b = b + 1
let s = s + 1
else
execute s:Ref(backref, b, "start", "len")
let ref = strpart(backref, start, len)
let backref = strpart(backref, 0, start) . ":". table[s]
\ . strpart(backref, start+len)
let s = s + s:Count(substitute(ref, '\\\\', '', 'g'), '\(', '1')
endif
endwhile
let word = strpart(word, 0, i-1) . backref . strpart(word, i+1)
let i = matchend(word, s:notslash . '\\\d') - 1
endwhile
let word = substitute(word, s:notslash . '\zs:', '\\', 'g')
if a:output == "table"
return table
elseif a:output == "word"
return word
else
return table . word
endif
endfun
" Assume a:comma = ",". Then the format for a:patterns and a:1 is
" a:patterns = "<pat1>,<pat2>,..."
" a:1 = "<alt1>,<alt2>,..."
" If <patn> is the first pattern that matches a:string then return <patn>
" if no optional arguments are given; return <patn>,<altn> if a:1 is given.
fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...)
let tail = (a:patterns =~ a:comma."$" ? a:patterns : a:patterns . a:comma)
let i = matchend(tail, s:notslash . a:comma)
if a:0
let alttail = (a:1 =~ a:comma."$" ? a:1 : a:1 . a:comma)
let j = matchend(alttail, s:notslash . a:comma)
endif
let current = strpart(tail, 0, i-1)
if a:branch == ""
let currpat = current
else
let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
endif
while a:string !~ a:prefix . currpat . a:suffix
let tail = strpart(tail, i)
let i = matchend(tail, s:notslash . a:comma)
if i == -1
return -1
endif
let current = strpart(tail, 0, i-1)
if a:branch == ""
let currpat = current
else
let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
endif
if a:0
let alttail = strpart(alttail, j)
let j = matchend(alttail, s:notslash . a:comma)
endif
endwhile
if a:0
let current = current . a:comma . strpart(alttail, 0, j-1)
endif
return current
endfun
" Call this function to turn on debugging information. Every time the main
" script is run, buffer variables will be saved. These can be used directly
" or viewed using the menu items below.
if !exists(":MatchDebug")
command! -nargs=0 MatchDebug call s:Match_debug()
endif
fun! s:Match_debug()
let b:match_debug = 1 " Save debugging information.
" pat = all of b:match_words with backrefs parsed
amenu &Matchit.&pat :echo b:match_pat<CR>
" match = bit of text that is recognized as a match
amenu &Matchit.&match :echo b:match_match<CR>
" curcol = cursor column of the start of the matching text
amenu &Matchit.&curcol :echo b:match_col<CR>
" wholeBR = matching group, original version
amenu &Matchit.wh&oleBR :echo b:match_wholeBR<CR>
" iniBR = 'if' piece, original version
amenu &Matchit.ini&BR :echo b:match_iniBR<CR>
" ini = 'if' piece, with all backrefs resolved from match
amenu &Matchit.&ini :echo b:match_ini<CR>
" tail = 'else\|endif' piece, with all backrefs resolved from match
amenu &Matchit.&tail :echo b:match_tail<CR>
" fin = 'endif' piece, with all backrefs resolved from match
amenu &Matchit.&word :echo b:match_word<CR>
" '\'.d in ini refers to the same thing as '\'.table[d] in word.
amenu &Matchit.t&able :echo '0:' . b:match_table . ':9'<CR>
endfun
" Jump to the nearest unmatched "(" or "if" or "<tag>" if a:spflag == "bW"
" or the nearest unmatched "</tag>" or "endif" or ")" if a:spflag == "W".
" Return a "mark" for the original position, so that
" let m = MultiMatch("bW", "n") ... execute m
" will return to the original position. If there is a problem, do not
" move the cursor and return "", unless a count is given, in which case
" go up or down as many levels as possible and again return "".
" TODO This relies on the same patterns as % matching. It might be a good
" idea to give it its own matching patterns.
fun! s:MultiMatch(spflag, mode)
if !exists("b:match_words") || b:match_words == ""
return ""
end
let restore_options = (&ic ? "" : "no") . "ignorecase"
if exists("b:match_ignorecase")
let &ignorecase = b:match_ignorecase
endif
let startline = line(".")
let startcol = col(".")
" First step: if not already done, set the script variables
" s:do_BR flag for whether there are backrefs
" s:pat parsed version of b:match_words
" s:all regexp based on s:pat and the default groups
" This part is copied and slightly modified from s:Match_wrapper().
let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") .
\ '\/\*:\*\/,#if\%(def\)\=:#else\>:#elif\>:#endif\>'
" Allow b:match_words = "GetVimMatchWords()" .
if b:match_words =~ ":"
let match_words = b:match_words
else
execute "let match_words =" b:match_words
endif
if (match_words != s:last_words) || (&mps != s:last_mps) ||
\ exists("b:match_debug")
let s:last_words = match_words
let s:last_mps = &mps
if match_words !~ s:notslash . '\\\d'
let s:do_BR = 0
let s:pat = match_words
else
let s:do_BR = 1
let s:pat = s:ParseWords(match_words)
endif
let s:all = '\%(' . substitute(s:pat . (strlen(s:pat)?",":"") . default,
\ '[,:]\+','\\|','g') . '\)'
if exists("b:match_debug")
let b:match_pat = s:pat
endif
endif
" Second step: figure out the patterns for searchpair()
" and save the screen, cursor position, and 'ignorecase'.
" - TODO: A lot of this is copied from s:Match_wrapper().
" - maybe even more functionality should be split off
" - into separate functions!
let cdefault = (s:pat =~ '[^,]$' ? "," : "") . default
let open = substitute(s:pat . cdefault,
\ s:notslash . '\zs:.\{-}' . s:notslash . ',', '\\),\\(', 'g')
let open = '\(' . substitute(open, s:notslash . '\zs:.*$', '\\)', '')
let close = substitute(s:pat . cdefault,
\ s:notslash . '\zs,.\{-}' . s:notslash . ':', '\\),\\(', 'g')
let close = substitute(close, '^.\{-}' . s:notslash . ':', '\\(', '') . '\)'
if exists("b:match_skip")
let skip = b:match_skip
elseif exists("b:match_comment") " backwards compatibility and testing!
let skip = "r:" . b:match_comment
else
let skip = 's:comment\|string'
endif
let skip = s:ParseSkip(skip)
" let restore_cursor = line(".") . "G" . virtcol(".") . "|"
" normal! H
" let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor
let restore_cursor = virtcol(".") . "|"
normal! g0
let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor
normal! H
let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor
execute restore_cursor
" Third step: call searchpair().
" Replace '\('--but not '\\('--with '\%(' and ',' with '\|'.
let openpat = substitute(open, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
let openpat = substitute(openpat, ',', '\\|', 'g')
let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
let closepat = substitute(closepat, ',', '\\|', 'g')
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
let skip = '0'
else
execute "if " . skip . "| let skip = '0' | endif"
endif
mark '
let level = v:count1
while level
if searchpair(openpat, '', closepat, a:spflag, skip) < 1
call s:CleanUp(restore_options, a:mode, startline, startcol)
return ""
endif
let level = level - 1
endwhile
" Restore options and return a string to restore the original position.
call s:CleanUp(restore_options, a:mode, startline, startcol)
return restore_cursor
endfun
" Search backwards for "if" or "while" or "<tag>" or ...
" and return "endif" or "endwhile" or "</tag>" or ... .
" For now, this uses b:match_words and the same script variables
" as s:Match_wrapper() . Later, it may get its own patterns,
" either from a buffer variable or passed as arguments.
" fun! s:Autocomplete()
" echo "autocomplete not yet implemented :-("
" if !exists("b:match_words") || b:match_words == ""
" return ""
" end
" let startpos = s:MultiMatch("bW")
"
" if startpos == ""
" return ""
" endif
" " - TODO: figure out whether 'if' or '<tag>' matched, and construct
" " - the appropriate closing.
" let matchline = getline(".")
" let curcol = col(".") - 1
" " - TODO: Change the s:all argument if there is a new set of match pats.
" let regexp = s:Wholematch(matchline, s:all, curcol)
" let suf = strlen(matchline) - matchend(matchline, regexp)
" let prefix = (curcol ? '^.\{' . curcol . '}\%(' : '^\%(')
" let suffix = (suf ? '\).\{' . suf . '}$' : '\)$')
" " Reconstruct the version with unresolved backrefs.
" let patBR = substitute(b:match_words.',', '[,:]*,[,:]*', ',', 'g')
" let patBR = substitute(patBR, ':\{2,}', ':', "g")
" " Now, set group and groupBR to the matching group: 'if:endif' or
" " 'while:endwhile' or whatever.
" let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR)
" let i = matchend(group, s:notslash . ",")
" let groupBR = strpart(group, i)
" let group = strpart(group, 0, i-1)
" " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix
" if s:do_BR
" let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline)
" endif
" " let g:group = group
"
" " - TODO: Construct the closing from group.
" let fake = "end" . expand("<cword>")
" execute startpos
" return fake
" endfun
" Close all open structures. "Get the heck out of here!"
" fun! s:Gthhoh()
" let close = s:Autocomplete()
" while strlen(close)
" put=close
" let close = s:Autocomplete()
" endwhile
" endfun
" Parse special strings as typical skip arguments for searchpair():
" s:foo becomes (current syntax item) =~ foo
" S:foo becomes (current syntax item) !~ foo
" r:foo becomes (line before cursor) =~ foo
" R:foo becomes (line before cursor) !~ foo
fun! s:ParseSkip(str)
let skip = a:str
if skip[1] == ":"
if skip[0] == "s"
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" .
\ strpart(skip,2) . "'"
elseif skip[0] == "S"
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" .
\ strpart(skip,2) . "'"
elseif skip[0] == "r"
let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'"
elseif skip[0] == "R"
let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'"
endif
endif
return skip
endfun
let &cpo = s:save_cpo
" vim:sts=2:sw=2:

1838
.vim/plugin/minibufexpl.vim Normal file

File diff suppressed because it is too large Load diff

1293
.vim/plugin/project.vim Normal file

File diff suppressed because it is too large Load diff

310
.vim/plugin/rails.vim Normal file
View file

@ -0,0 +1,310 @@
" rails.vim - Detect a rails application
" Author: Tim Pope <vimNOSPAM@tpope.info>
" GetLatestVimScripts: 1567 1 :AutoInstall: rails.vim
" URL: http://rails.vim.tpope.net/
" Install this file as plugin/rails.vim. See doc/rails.txt for details. (Grab
" it from the URL above if you don't have it.) To access it from Vim, see
" :help add-local-help (hint: :helptags ~/.vim/doc) Afterwards, you should be
" able to do :help rails
" ============================================================================
" Exit quickly when:
" - this plugin was already loaded (or disabled)
" - when 'compatible' is set
if &cp || (exists("g:loaded_rails") && g:loaded_rails) && !(exists("g:rails_debug") && g:rails_debug)
finish
endif
let g:loaded_rails = 1
" Apparently, the nesting level within Vim when the Ruby interface is
" initialized determines how much stack space Ruby gets. In previous
" versions of rails.vim, sporadic stack overflows occured when omnicomplete
" was used. This was apparently due to rails.vim having first initialized
" ruby deep in a nested function call.
if has("ruby")
silent! ruby nil
endif
" Utility Functions {{{1
function! s:error(str)
echohl ErrorMsg
echomsg a:str
echohl None
let v:errmsg = a:str
endfunction
function! s:autoload(...)
if !exists("g:autoloaded_rails")
runtime! autoload/rails.vim
endif
if exists("g:autoloaded_rails")
if a:0
exe a:1
endif
return 1
endif
if !exists("g:rails_no_autoload_warning")
let g:rails_no_autoload_warning = 1
call s:error("Disabling rails.vim: autoload/rails.vim is missing")
endif
return ""
endfunction
" }}}1
" Configuration {{{
function! s:SetOptDefault(opt,val)
if !exists("g:".a:opt)
let g:{a:opt} = a:val
endif
endfunction
call s:SetOptDefault("rails_level",3)
call s:SetOptDefault("rails_statusline",1)
call s:SetOptDefault("rails_syntax",1)
call s:SetOptDefault("rails_mappings",1)
call s:SetOptDefault("rails_abbreviations",1)
call s:SetOptDefault("rails_expensive",1+0*(has("win32")||has("win32unix")))
call s:SetOptDefault("rails_dbext",g:rails_expensive)
call s:SetOptDefault("rails_subversion",0)
call s:SetOptDefault("rails_default_file","README")
call s:SetOptDefault("rails_default_database","")
call s:SetOptDefault("rails_root_url",'http://localhost:3000/')
call s:SetOptDefault("rails_modelines",1)
call s:SetOptDefault("rails_menu",1)
call s:SetOptDefault("rails_gnu_screen",1)
call s:SetOptDefault("rails_history_size",5)
call s:SetOptDefault("rails_debug",0)
call s:SetOptDefault("rails_generators","controller\nintegration_test\nmailer\nmigration\nmodel\nobserver\nplugin\nresource\nscaffold\nsession_migration")
call s:SetOptDefault("rails_rake_tasks","db:charset\ndb:collation\ndb:create\ndb:create:all\ndb:drop\ndb:drop:all\ndb:fixtures:identify\ndb:fixtures:load\ndb:migrate\ndb:reset\ndb:rollback\ndb:schema:dump\ndb:schema:load\ndb:sessions:clear\ndb:sessions:create\ndb:structure:dump\ndb:test:clone\ndb:test:clone_structure\ndb:test:prepare\ndb:test:purge\ndb:version\ndoc:app\ndoc:clobber_app\ndoc:clobber_plugins\ndoc:clobber_rails\ndoc:plugins\ndoc:rails\ndoc:reapp\ndoc:rerails\nlog:clear\nnotes\nnotes:fixme\nnotes:optimize\nnotes:todo\nrails:freeze:edge\nrails:freeze:gems\nrails:unfreeze\nrails:update\nrails:update:configs\nrails:update:javascripts\nrails:update:scripts\nroutes\nstats\ntest\ntest:functionals\ntest:integration\ntest:plugins\ntest:recent\ntest:uncommitted\ntest:units\ntmp:cache:clear\ntmp:clear\ntmp:create\ntmp:pids:clear\ntmp:sessions:clear\ntmp:sockets:clear")
if g:rails_dbext
if exists("g:loaded_dbext") && executable("sqlite3") && ! executable("sqlite")
" Since dbext can't find it by itself
call s:SetOptDefault("dbext_default_SQLITE_bin","sqlite3")
endif
endif
" }}}1
" Detection {{{1
function! s:escvar(r)
let r = fnamemodify(a:r,':~')
let r = substitute(r,'\W','\="_".char2nr(submatch(0))."_"','g')
let r = substitute(r,'^\d','_&','')
return r
endfunction
function! s:Detect(filename)
let fn = substitute(fnamemodify(a:filename,":p"),'\c^file://','','')
if fn =~ '[\/]config[\/]environment\.rb$'
return s:BufInit(strpart(fn,0,strlen(fn)-22))
endif
if isdirectory(fn)
let fn = fnamemodify(fn,":s?[\/]$??")
else
let fn = fnamemodify(fn,':s?\(.*\)[\/][^\/]*$?\1?')
endif
let ofn = ""
let nfn = fn
while nfn != ofn && nfn != ""
if exists("s:_".s:escvar(nfn))
return s:BufInit(nfn)
endif
let ofn = nfn
let nfn = fnamemodify(nfn,':h')
endwhile
let ofn = ""
while fn != ofn
if filereadable(fn . "/config/environment.rb")
return s:BufInit(fn)
endif
let ofn = fn
let fn = fnamemodify(ofn,':s?\(.*\)[\/]\(app\|config\|db\|doc\|lib\|log\|public\|script\|spec\|test\|tmp\|vendor\)\($\|[\/].*$\)?\1?')
endwhile
return 0
endfunction
function! s:BufInit(path)
let s:_{s:escvar(a:path)} = 1
if s:autoload()
return RailsBufInit(a:path)
endif
endfunction
" }}}1
" Initialization {{{1
augroup railsPluginDetect
autocmd!
autocmd BufNewFile,BufRead * call s:Detect(expand("<afile>:p"))
autocmd VimEnter * if expand("<amatch>") == "" && !exists("b:rails_root") | call s:Detect(getcwd()) | endif | if exists("b:rails_root") | silent doau User BufEnterRails | endif
autocmd FileType netrw if !exists("b:rails_root") | call s:Detect(expand("<afile>:p")) | endif | if exists("b:rails_root") | silent doau User BufEnterRails | endif
autocmd BufEnter * if exists("b:rails_root")|silent doau User BufEnterRails|endif
autocmd BufLeave * if exists("b:rails_root")|silent doau User BufLeaveRails|endif
autocmd FileType railslog if s:autoload()|call RailslogSyntax()|endif
augroup END
command! -bar -bang -nargs=* -complete=dir Rails :if s:autoload()|call RailsNewApp(<bang>0,<f-args>)|endif
" }}}1
" Menus {{{1
if !(g:rails_menu && has("menu"))
finish
endif
function! s:sub(str,pat,rep)
return substitute(a:str,'\v\C'.a:pat,a:rep,'')
endfunction
function! s:gsub(str,pat,rep)
return substitute(a:str,'\v\C'.a:pat,a:rep,'g')
endfunction
function! s:CreateMenus() abort
if exists("g:rails_installed_menu") && g:rails_installed_menu != ""
exe "aunmenu ".s:gsub(g:rails_installed_menu,'\&','')
unlet g:rails_installed_menu
endif
if has("menu") && (exists("g:did_install_default_menus") || exists("$CREAM")) && g:rails_menu
if g:rails_menu > 1
let g:rails_installed_menu = '&Rails'
else
let g:rails_installed_menu = '&Plugin.&Rails'
endif
if exists("$CREAM")
let menucmd = '87anoremenu <script> '
exe menucmd.g:rails_installed_menu.'.-PSep- :'
exe menucmd.g:rails_installed_menu.'.&Related\ file\ :R\ /\ Alt+] :R<CR>'
exe menucmd.g:rails_installed_menu.'.&Alternate\ file\ :A\ /\ Alt+[ :A<CR>'
exe menucmd.g:rails_installed_menu.'.&File\ under\ cursor\ Ctrl+Enter :Rfind<CR>'
else
let menucmd = 'anoremenu <script> '
exe menucmd.g:rails_installed_menu.'.-PSep- :'
exe menucmd.g:rails_installed_menu.'.&Related\ file\ :R\ /\ ]f :R<CR>'
exe menucmd.g:rails_installed_menu.'.&Alternate\ file\ :A\ /\ [f :A<CR>'
exe menucmd.g:rails_installed_menu.'.&File\ under\ cursor\ gf :Rfind<CR>'
endif
exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Controller :find app/controllers/application.rb<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Helper :find app/helpers/application_helper.rb<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Javascript :find public/javascripts/application.js<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Layout :Rlayout application<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &README :find doc/README_FOR_APP<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.&Environment :find config/environment.rb<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.&Database\ Configuration :find config/database.yml<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Database\ &Schema :call <SID>findschema()<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.R&outes :find config/routes.rb<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.&Test\ Helper :find test/test_helper.rb<CR>'
exe menucmd.g:rails_installed_menu.'.-FSep- :'
exe menucmd.g:rails_installed_menu.'.Ra&ke\ :Rake :Rake<CR>'
let tasks = g:rails_rake_tasks
while tasks != ''
let task = matchstr(tasks,'.\{-\}\ze\%(\n\|$\)')
let tasks = s:sub(tasks,'.{-}%(\n|$)','')
exe menucmd.g:rails_installed_menu.'.Rake\ &tasks\ :Rake.'.s:sub(s:sub(task,'^[^:]*$','&:all'),':','.').' :Rake '.task.'<CR>'
endwhile
let tasks = g:rails_generators
while tasks != ''
let task = matchstr(tasks,'.\{-\}\ze\%(\n\|$\)')
let tasks = s:sub(tasks,'.{-}%(\n|$)','')
exe menucmd.'<silent> '.g:rails_installed_menu.'.&Generate\ :Rgen.'.s:gsub(task,'_','\\ ').' :call <SID>menuprompt("Rgenerate '.task.'","Arguments for script/generate '.task.': ")<CR>'
exe menucmd.'<silent> '.g:rails_installed_menu.'.&Destroy\ :Rdestroy.'.s:gsub(task,'_','\\ ').' :call <SID>menuprompt("Rdestroy '.task.'","Arguments for script/destroy '.task.': ")<CR>'
endwhile
exe menucmd.g:rails_installed_menu.'.&Server\ :Rserver.&Start\ :Rserver :Rserver<CR>'
exe menucmd.g:rails_installed_menu.'.&Server\ :Rserver.&Force\ start\ :Rserver! :Rserver!<CR>'
exe menucmd.g:rails_installed_menu.'.&Server\ :Rserver.&Kill\ :Rserver!\ - :Rserver! -<CR>'
exe menucmd.'<silent> '.g:rails_installed_menu.'.&Evaluate\ Ruby\.\.\.\ :Rp :call <SID>menuprompt("Rp","Code to execute and output: ")<CR>'
exe menucmd.g:rails_installed_menu.'.&Console\ :Rconsole :Rconsole<CR>'
exe menucmd.g:rails_installed_menu.'.&Preview\ :Rpreview :Rpreview<CR>'
exe menucmd.g:rails_installed_menu.'.&Log\ file\ :Rlog :Rlog<CR>'
exe s:sub(menucmd,'anoremenu','vnoremenu').' <silent> '.g:rails_installed_menu.'.E&xtract\ as\ partial\ :Rextract :call <SID>menuprompt("'."'".'<,'."'".'>Rextract","Partial name (e.g., template or /controller/template): ")<CR>'
exe menucmd.g:rails_installed_menu.'.&Migration\ writer\ :Rinvert :Rinvert<CR>'
exe menucmd.' '.g:rails_installed_menu.'.-HSep- :'
exe menucmd.'<silent> '.g:rails_installed_menu.'.&Help\ :help\ rails :if <SID>autoload()<Bar>exe RailsHelpCommand("")<Bar>endif<CR>'
exe menucmd.'<silent> '.g:rails_installed_menu.'.Abo&ut\ :if <SID>autoload()<Bar>exe RailsHelpCommand("about")<Bar>endif<CR>'
let g:rails_did_menus = 1
call s:ProjectMenu()
call s:menuBufLeave()
if exists("b:rails_root")
call s:menuBufEnter()
endif
endif
endfunction
function! s:ProjectMenu()
if exists("g:rails_did_menus") && g:rails_history_size > 0
if !exists("g:RAILS_HISTORY")
let g:RAILS_HISTORY = ""
endif
let history = g:RAILS_HISTORY
let menu = s:gsub(g:rails_installed_menu,'\&','')
silent! exe "aunmenu <script> ".menu.".Projects"
let dots = s:gsub(menu,'[^.]','')
exe 'anoremenu <script> <silent> '.(exists("$CREAM") ? '87' : '').dots.'.100 '.menu.'.Pro&jects.&New\.\.\.\ :Rails :call <SID>menuprompt("Rails","New application path and additional arguments: ")<CR>'
exe 'anoremenu <script> '.menu.'.Pro&jects.-FSep- :'
while history =~ '\n'
let proj = matchstr(history,'^.\{-\}\ze\n')
let history = s:sub(history,'^.{-}\n','')
exe 'anoremenu <script> '.menu.'.Pro&jects.'.s:gsub(proj,'[.\\ ]','\\&').' :e '.s:gsub(proj."/".g:rails_default_file,'[ !%#]','\\&')."<CR>"
endwhile
endif
endfunction
function! s:menuBufEnter()
if exists("g:rails_installed_menu") && g:rails_installed_menu != ""
let menu = s:gsub(g:rails_installed_menu,'\&','')
exe 'amenu enable '.menu.'.*'
if RailsFileType() !~ '^view\>'
exe 'vmenu disable '.menu.'.Extract\ as\ partial'
endif
if RailsFileType() !~ '^\%(db-\)\=migration$' || RailsFilePath() =~ '\<db/schema\.rb$'
exe 'amenu disable '.menu.'.Migration\ writer'
endif
call s:ProjectMenu()
endif
endfunction
function! s:menuBufLeave()
if exists("g:rails_installed_menu") && g:rails_installed_menu != ""
let menu = s:gsub(g:rails_installed_menu,'\&','')
exe 'amenu disable '.menu.'.*'
exe 'amenu enable '.menu.'.Help\ '
exe 'amenu enable '.menu.'.About\ '
exe 'amenu enable '.menu.'.Projects'
endif
endfunction
function! s:menuprompt(vimcmd,prompt)
let res = inputdialog(a:prompt,'','!!!')
if res == '!!!'
return ""
endif
exe a:vimcmd." ".res
endfunction
function! s:findschema()
let env = exists('$RAILS_ENV') ? $RAILS_ENV : "development"
if filereadable(b:rails_root."/db/schema.rb")
edit `=b:rails_root.'/db/schema.rb'`
elseif filereadable(b:rails_root.'/db/'.env.'_structure.sql')
edit `=b:rails_root.'/db/'.env.'_structure.sql'`
else
return s:error("Schema not found: try :Rake db:schema:dump")
endif
endfunction
call s:CreateMenus()
augroup railsPluginMenu
autocmd!
autocmd User BufEnterRails call s:menuBufEnter()
autocmd User BufLeaveRails call s:menuBufLeave()
" g:RAILS_HISTORY hasn't been set when s:InitPlugin() is called.
autocmd VimEnter * call s:ProjectMenu()
augroup END
" }}}1
" vim:set sw=2 sts=2:

595
.vim/syntax/asmx86.vim Normal file
View file

@ -0,0 +1,595 @@
" Vim syntax file
" Hacked by Adam, from the 68000 asm syntax....
" x Language: Motorola 68000 Assembler
" x Maintainer: Steve Wall
" Last change: 2001 May 01
"
" This is incomplete. In particular, support for 68020 and
" up and 68851/68881 co-processors is partial or non-existant.
" Feel free to contribute...
"
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case ignore
" syn region asmx86Comment start="#\(\(\(include\)\|\(define\)\|\(if\)\|\(ifndef\)\|\(endif\)\|\(end\)\|\(ifdef\)\)\s\)\!" end="$"
syn region asmx86Commenthash start="#\(\(define\)\|\(if\(n\=\(def\)\)\=\)\|\(include\)\|\(error\)\|\(end\(if\)\=\)\)\!" end="$" contains=asmx86Todo
syn region asmx86Commenthash start="#" end="$" contains=asmx86Todo
syn match asmx86Operator "[-+*/]" " Must occur before Comments
syn match asmx86PreProc "^\s*#\s*\(\(if\(n\=\(def\)\)\=\)\|\(end\(if\)\=\)\|\(define\)\|\(error\)\|\(else\)\)\>"
syn region asmx86Commentcpp start="\s*#\s*if\s\+0\+\>" end="\s*#\s*endif\>" contains=asmx86Todo
syn region asmx86Commentcxx start="//" end="$" contains=asmx86Todo
syn region asmx86Commentc start="/\*" end="\*/" contains=asmx86Todo
" Preprocessor, basics:
" First make ALL things that are behind #'s and the endline as comments. Then
" boil out the stuff that is vaild, like #defines, and such.... It's
" kinda tough, since we're allowing two conflicting syntaxes. But when we
" consider that the "#" mechanism in the pre-processor isn't ever seen by the
" underlying language, it begins to show itself, on why it is so weird.
" There's going to be "#"'es left behind by the cpp, so we need to remember
" that the assembler will see those as commments. We provide this commenting
" Segment Registers --
syn match asmx86Reg "%[cdefgs]s"
" Partial list of register symbols
" General Purpose Registers --
"syn keyword asmx86Reg eax ax al ah
syn match asmx86Reg "%[abcd][xhl]"
syn match asmx86Reg "%e[abcd]x"
" syn keyword asmx86Reg ebx bx bl bh
" syn keyword asmx86Reg ecx cx cl ch
" syn keyword asmx86Reg edx dx dl dh
" "Special" Registers --
"syn keyword asmx86Reg ebp bp edi di esi si esp sp
syn match asmx86Reg "%[bs]p"
syn match asmx86Reg "%e[bs]p"
syn match asmx86Reg "%[ds]i"
syn match asmx86Reg "%e[ds]i"
" Protection, extra, and magic registers for all the OS-type fun stuff --
syn match asmx86Reg "%[cd]r[0-3]"
syn match asmx86Reg "%[td]r[3-7]"
" syn keyword asmx86Reg cr0 cr1 cr2 cr3
" syn keyword asmx86Reg tr3 tr4 tr5 tr6 tr7
" syn keyword asmx86Reg dr0 dr1 dr2 dr3 dr4 dr5 dr6 dr7
syn keyword asmx86Reg gdtr ldtr idtr tr msw pdbr pfla
" Page descriptor base register and page fault linear address
" MC68010
"syn keyword asmx86Reg vbr sfc sfcr dfc dfcr
" MC68020
"syn keyword asmx86Reg msp isp zpc cacr caar
"syn keyword asmx86Reg za0 za1 za2 za3 za4 za5 za6 za7
"syn keyword asmx86Reg zd0 zd1 zd2 zd3 zd4 zd5 zd6 zd7
" MC68030
"syn keyword asmx86Reg crp srp tc ac0 ac1 acusr tt0 tt1 mmusr
" MC68040
"syn keyword asmx86Reg dtt0 dtt1 itt0 itt1 urp
" MC68851 registers
"syn keyword asmx86Reg cal val scc crp srp drp tc ac psr pcsr
"syn keyword asmx86Reg bac0 bac1 bac2 bac3 bac4 bac5 bac6 bac7
"syn keyword asmx86Reg bad0 bad1 bad2 bad3 bad4 bad5 bad6 bad7
" MC68881/82 registers
"syn keyword asmx86Reg fp0 fp1 fp2 fp3 fp4 fp5 fp6 fp7
"syn keyword asmx86Reg control status iaddr fpcr fpsr fpiar
"Not sure if this is the case for x86......
" M68000 opcodes - order is important!
syn match asmx86Opcode "\<aa[asdm][bwl]\=\s"
syn match asmx86Opcode "\<ad[cd][bwl]\=\s"
syn match asmx86Opcode "\<and[bwl]\=\s"
syn match asmx86Opcode "\<arpl\s"
syn match asmx86Opcode_br "\<bound[lw]\=\s"
syn match asmx86Opcode "\<bs[rf][lw]\=\s"
syn match asmx86Opcode "\<bswap[lw]\=\s"
syn match asmx86Opcode "\<bt[rcs]\=[lw]\=\s"
syn match asmx86Opcode_br "\<call[f]\=\s"
syn match asmx86Opcode "\<cbw\s"
syn match asmx86Opcode "\<cwde\s"
syn match asmx86Opcode "\<cl\([cdi]\|\(ts\)\)\>"
syn match asmx86Opcode "\<cmc\s"
syn match asmx86Opcode "\<cmp\(xchg\)\=[bwl]\=\s"
syn match asmx86Opcode "\<cmps[bwdl]\=\>"
syn match asmx86Opcode "\<c\(\(wd\)\|\(dq\)\)\s"
syn match asmx86Opcode "\<da[sd]\=\s"
syn match asmx86Opcode "\<dec[bwl]\=\s"
syn match asmx86Opcode "\<div[bwl]\=\s"
syn match asmx86Opcode "\<enter[bwl]\=\s"
" Skipping all FPU instructions.....
syn match asmx86Opcode_br "\<hlt\>"
syn match asmx86Opcode "\<idiv[bwl]\=\s"
syn match asmx86Opcode "\<imul[bwl]\=\s"
syn match asmx86Opcode_io "\<in[bwl]\=\s"
syn match asmx86Opcode_io "\<ins[bwdl]\=\>"
syn match asmx86Opcode "\<inc[bwl]\=\s"
syn match asmx86Opcode_br "\<int\s"
syn match asmx86Opcode_br "\<int[o3]\>"
syn match asmx86Opcode "\<inv\(\(d\)\|\(lpg\)\)\s"
syn match asmx86Opcode_br "\<iretd\=\>"
"" Main x86 branch instructions...
syn match asmx86Opcode_br "\<j.\{,4}\s"
" This is, above, the hack. It will not show valid/invalid jcc opcodes, now...
" This will be fixed later, this is just to have working j???? working now....
syn match asmx86Opcode_br "\<l\=jmp[fblwd]\=\s"
syn match asmx86Opcode "\<lahf\s"
syn match asmx86Opcode "\<lar\s"
syn match asmx86Opcode_mv "\<lea[lw]\=\s"
syn match asmx86Opcode "\<leave\>"
syn match asmx86Opcode_mv "\<l[gil]dtl\=\s"
syn match asmx86Opcode_mv "\<l[defgs]s\s"
syn match asmx86Opcode_mv "\<lmsw\s"
syn match asmx86Opcode "\<lock\>"
syn match asmx86Opcode_mv "\<lods[lwdb]\=\>"
syn match asmx86Opcode_br "\<loopn\=[ez]\=\s"
syn match asmx86Opcode_mv "\<lsl\s"
syn match asmx86Opcode_mv "\<ltr\s"
syn match asmx86Opcode_mv "\<mov[bwl]\=\s"
syn match asmx86Opcode_mv "\<movs[lwdb]\=\>"
syn match asmx86Opcode_mv "\<movsx[bwl]\=\s"
syn match asmx86Opcode_mv "\<movzx[bwl]\=\s"
syn match asmx86Opcode "\<mul[bwl]\=\s"
syn match asmx86Opcode "\<neg[bwl]\=\s"
syn match asmx86Opcode "\<nop\>"
syn match asmx86Opcode "\<not[bwl]\=\s"
syn match asmx86Opcode "\<or[bwl]\=\s"
syn match asmx86Opcode_io "\<out[bwl]\=\s"
syn match asmx86Opcode_io "\<outs[dbwl]\=\>"
syn match asmx86Opcode_mv "\<pop[bwl]\=\s"
syn match asmx86Opcode_mv "\<pop[af][wld]\=\>"
syn match asmx86Opcode_mv "\<push[bwl]\=\s"
syn match asmx86Opcode_mv "\<push[af][wld]\=\>"
syn match asmx86Opcode "\<r[co][rl][bwl]\=\s"
syn match asmx86Opcode_pre "\<repn\=[ez]\=\s"
syn match asmx86Opcode_br "\<retf\=\>"
syn match asmx86Opcode "\<sahf\>"
syn match asmx86Opcode "\<s[ah][rl][bwl]\=\s"
syn match asmx86Opcode "\<sbb[bwl]\=\s"
syn match asmx86Opcode "\<scas[bwld]\=\s"
syn match asmx86Opcode "\<set.\{,3}\s"
" We do the same hack as a jmp here. We'll only allow the valid ones, later.
syn match asmx86Opcode_mv "\<s[gil]dtl\=\s"
syn match asmx86Opcode "\<sh[lr][dbwl]\=\s"
syn match asmx86Opcode_mv "\<smsw\s"
syn match asmx86Opcode "\<st[cdi]\>"
syn match asmx86Opcode_mv "\<stos[bwld]\=\>"
syn match asmx86Opcode_mv "\<str\s"
syn match asmx86Opcode "\<sub[bwl]\=\s"
syn match asmx86Opcode "\<test[bwl]\=\s"
syn match asmx86Opcode "\<ver[rw]\s"
syn match asmx86Opcode "\<wait\>"
syn match asmx86Opcode "\<wbinvd\>"
syn match asmx86Opcode_mv "\<xadd[bwl]\=\s"
syn match asmx86Opcode_mv "\<xchg[bwl]\=\s"
syn match asmx86Opcode_mv "\<xlatb\=\>"
syn match asmx86Opcode "\<xor[bwl]\=\s"
" 68k instructions... here, because they are sometimes matching, and we haven't
" gotten the x86 ones up to speed yet....
" syn match asmx86Opcode "\<abcd\(\.b\)\=\s"
" syn match asmx86Opcode "\<adda\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<addi\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<addq\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<addx\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<add\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<andi\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<and\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<as[lr]\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<b[vc][cs]\(\.[bwls]\)\=\s"
" syn match asmx86Opcode "\<beq\(\.[bwls]\)\=\s"
" syn match asmx86Opcode "\<bg[et]\(\.[bwls]\)\=\s"
" syn match asmx86Opcode "\<b[hm]i\(\.[bwls]\)\=\s"
" syn match asmx86Opcode "\<bl[est]\(\.[bwls]\)\=\s"
" syn match asmx86Opcode "\<bne\(\.[bwls]\)\=\s"
" syn match asmx86Opcode "\<bpl\(\.[bwls]\)\=\s"
" syn match asmx86Opcode "\<bchg\(\.[bl]\)\=\s"
" syn match asmx86Opcode "\<bclr\(\.[bl]\)\=\s"
" syn match asmx86Opcode "\<bfchg\s"
" syn match asmx86Opcode "\<bfclr\s"
" syn match asmx86Opcode "\<bfexts\s"
" syn match asmx86Opcode "\<bfextu\s"
" syn match asmx86Opcode "\<bfffo\s"
" syn match asmx86Opcode "\<bfins\s"
" syn match asmx86Opcode "\<bfset\s"
" syn match asmx86Opcode "\<bftst\s"
" syn match asmx86Opcode "\<bkpt\s"
" syn match asmx86Opcode "\<bra\(\.[bwls]\)\=\s"
" syn match asmx86Opcode "\<bset\(\.[bl]\)\=\s"
" syn match asmx86Opcode "\<bsr\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<btst\(\.[bl]\)\=\s"
" syn match asmx86Opcode "\<callm\s"
" syn match asmx86Opcode "\<cas2\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<cas\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<chk2\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<chk\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<clr\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<cmpa\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<cmpi\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<cmpm\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<cmp2\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<cmp\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<db[cv][cs]\(\.w\)\=\s"
" syn match asmx86Opcode "\<dbeq\(\.w\)\=\s"
" syn match asmx86Opcode "\<db[ft]\(\.w\)\=\s"
" syn match asmx86Opcode "\<dbg[et]\(\.w\)\=\s"
" syn match asmx86Opcode "\<db[hm]i\(\.w\)\=\s"
" syn match asmx86Opcode "\<dbl[est]\(\.w\)\=\s"
" syn match asmx86Opcode "\<dbne\(\.w\)\=\s"
" syn match asmx86Opcode "\<dbpl\(\.w\)\=\s"
" syn match asmx86Opcode "\<dbra\(\.w\)\=\s"
" syn match asmx86Opcode "\<div[su]\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<div[su]l\(\.l\)\=\s"
" syn match asmx86Opcode "\<eori\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<eor\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<exg\(\.l\)\=\s"
" syn match asmx86Opcode "\<extb\(\.l\)\=\s"
" syn match asmx86Opcode "\<ext\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<illegal\>"
" syn match asmx86Opcode "\<jmp\(\.[ls]\)\=\s"
" syn match asmx86Opcode "\<jsr\(\.[ls]\)\=\s"
" syn match asmx86Opcode "\<lea\(\.l\)\=\s"
" syn match asmx86Opcode "\<link\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<ls[lr]\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<movea\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<movec\(\.l\)\=\s"
" syn match asmx86Opcode "\<movem\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<movep\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<moveq\(\.l\)\=\s"
" syn match asmx86Opcode "\<moves\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<move\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<mul[su]\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<nbcd\(\.b\)\=\s"
" syn match asmx86Opcode "\<negx\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<neg\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<nop\>"
" syn match asmx86Opcode "\<not\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<ori\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<or\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<pack\s"
" syn match asmx86Opcode "\<pea\(\.l\)\=\s"
" syn match asmx86Opcode "\<reset\>"
" syn match asmx86Opcode "\<ro[lr]\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<rox[lr]\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<rt[dm]\s"
" syn match asmx86Opcode "\<rt[ers]\>"
" syn match asmx86Opcode "\<sbcd\(\.b\)\=\s"
" syn match asmx86Opcode "\<s[cv][cs]\(\.b\)\=\s"
" syn match asmx86Opcode "\<seq\(\.b\)\=\s"
" syn match asmx86Opcode "\<s[ft]\(\.b\)\=\s"
" syn match asmx86Opcode "\<sg[et]\(\.b\)\=\s"
" syn match asmx86Opcode "\<s[hm]i\(\.b\)\=\s"
" syn match asmx86Opcode "\<sl[est]\(\.b\)\=\s"
" syn match asmx86Opcode "\<sne\(\.b\)\=\s"
" syn match asmx86Opcode "\<spl\(\.b\)\=\s"
" syn match asmx86Opcode "\<suba\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<subi\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<subq\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<subx\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<sub\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<swap\(\.w\)\=\s"
" syn match asmx86Opcode "\<tas\(\.b\)\=\s"
" syn match asmx86Opcode "\<tdiv[su]\(\.l\)\=\s"
" syn match asmx86Opcode "\<t\(rap\)\=[cv][cs]\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<t\(rap\)\=eq\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<t\(rap\)\=[ft]\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<t\(rap\)\=g[et]\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<t\(rap\)\=[hm]i\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<t\(rap\)\=l[est]\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<t\(rap\)\=ne\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<t\(rap\)\=pl\(\.[wl]\)\=\s"
" syn match asmx86Opcode "\<t\(rap\)\=v\>"
" syn match asmx86Opcode "\<t\(rap\)\=[cv][cs]\>"
" syn match asmx86Opcode "\<t\(rap\)\=eq\>"
" syn match asmx86Opcode "\<t\(rap\)\=[ft]\>"
" syn match asmx86Opcode "\<t\(rap\)\=g[et]\>"
" syn match asmx86Opcode "\<t\(rap\)\=[hm]i\>"
" syn match asmx86Opcode "\<t\(rap\)\=l[est]\>"
" syn match asmx86Opcode "\<t\(rap\)\=ne\>"
" syn match asmx86Opcode "\<t\(rap\)\=pl\>"
" syn match asmx86Opcode "\<trap\s"
" syn match asmx86Opcode "\<tst\(\.[bwl]\)\=\s"
" syn match asmx86Opcode "\<unlk\s"
" syn match asmx86Opcode "\<unpk\s"
" Valid labels
syn match asmx86Label "^[a-z_?.][a-z0-9_?.$]*$"
syn match asmx86Label "^[a-z_?.][a-z0-9_?.$]*\s"he=e-1
syn match asmx86Label "^\s*[a-z_?.][a-z0-9_?.$]*:"he=e-1
" Various number formats
syn match hexNumber "\$[0-9a-fA-F]\+\>"
syn match hexNumber "$0x[0-9a-fA-F]\+\>"
syn match hexNumber "0x[0-9a-fA-F]\+\>"
syn match hexNumber "\<[0-9][0-9a-fA-F]*H\>"
syn match octNumber "@[0-7]\+\>"
syn match octNumber "\<[0-7]\+[QO]\>"
syn match binNumber "%[01]\+\>"
syn match binNumber "\<[01]\+B\>"
syn match decNumber "\<[0-9]\+D\=\>"
syn match floatE "_*E_*" contained
syn match floatExponent "_*E_*[-+]\=[0-9]\+" contained contains=floatE
syn match floatNumber "[-+]\=[0-9]\+_*E_*[-+]\=[0-9]\+" contains=floatExponent
syn match floatNumber "[-+]\=[0-9]\+\.[0-9]\+\(E[-+]\=[0-9]\+\)\=" contains=floatExponent
syn match floatNumber ":\([0-9a-f]\+_*\)\+"
" Character string constants
"syn match asmx86StringError "'[ -~]*'"
"syn match asmx86StringError "'[ -~]*$"
"syn region asmx86String start="'" skip="''" end="'" oneline contains=asmx86CharError
syn match asmx86CharError "[^ -~]" contained
" Immediate data
" syn match asmx86Immediate "#\$[0-9a-fA-F]\+" contains=hexNumber
" syn match asmx86Immediate "#[0-9][0-9a-fA-F]*H" contains=hexNumber
" syn match asmx86Immediate "#@[0-7]\+" contains=octNumber
" syn match asmx86Immediate "#[0-7]\+[QO]" contains=octNumber
" syn match asmx86Immediate "#%[01]\+" contains=binNumber
" syn match asmx86Immediate "#[01]\+B" contains=binNumber
" syn match asmx86Immediate "#[0-9]\+D\=" contains=decNumber
syn match asmx86Symbol "[a-z_?.][a-z0-9_?.$]*" contained
" syn match asmx86Immediate "#[a-z_?.][a-z0-9_?.]*" contains=asmx86Symbol
" Special items for comments
syn keyword asmx86Todo contained TODO XXX FIXME CHANGED
" Operators
syn match asmx86Operator "\.SIZEOF\."
syn match asmx86Operator "\.STARTOF\."
syn match asmx86Operator "<<" " shift left
syn match asmx86Operator ">>" " shift right
syn match asmx86Operator "&" " bit-wise logical and
syn match asmx86Operator "!" " bit-wise logical or
syn match asmx86Operator "!!" " exclusive or
syn match asmx86Operator "<>" " inequality
syn match asmx86Operator "=" " must be before other ops containing '='
syn match asmx86Operator ">="
syn match asmx86Operator "<="
syn match asmx86Operator "==" " operand existance - used in macro definitions
" Condition code style operators
syn match asmx86Operator "<[CV][CS]>"
syn match asmx86Operator "<EQ>"
syn match asmx86Operator "<G[TE]>"
syn match asmx86Operator "<[HM]I>"
syn match asmx86Operator "<L[SET]>"
syn match asmx86Operator "<NE>"
syn match asmx86Operator "<PL>"
" Include
syn match asmx86Include "\<INCLUDE\s"
syn region asmIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match asmx86Included display contained "<[^"]*>"
syn match asmx86Include display "^\s*#\s*include\>\s*["<]" contains=asmx86Included
" Comments
" syn match asmx86Comment ";.*" contains=asmx86Todo
" syn match asmx86Comment "#.*" contains=asmx86Todo
" syn match asmx86Comment "\s!.*"ms=s+1 contains=asmx86Todo
" syn match asmx86Comment "^\s*[*!].*" contains=asmx86Todo
" Standard macros
syn match asmx86Cond "\<IF\(\.[BWL]\)\=\s"
syn match asmx86Cond "\<THEN\(\.[SL]\)\=\>"
syn match asmx86Cond "\<ELSE\(\.[SL]\)\=\>"
syn match asmx86Cond "\<ENDI\>"
syn match asmx86Cond "\<BREAK\(\.[SL]\)\=\>"
syn match asmx86Repeat "\<FOR\(\.[BWL]\)\=\s"
syn match asmx86Repeat "\<DOWNTO\s"
syn match asmx86Repeat "\<TO\s"
syn match asmx86Repeat "\<BY\s"
syn match asmx86Repeat "\<DO\(\.[SL]\)\=\>"
syn match asmx86Repeat "\<ENDF\>"
syn match asmx86Repeat "\<NEXT\(\.[SL]\)\=\>"
syn match asmx86Repeat "\<REPEAT\>"
syn match asmx86Repeat "\<UNTIL\(\.[BWL]\)\=\s"
syn match asmx86Repeat "\<WHILE\(\.[BWL]\)\=\s"
syn match asmx86Repeat "\<ENDW\>"
" Macro definition
syn match asmx86Macro "\<MACRO\>"
syn match asmx86Macro "\<LOCAL\s"
syn match asmx86Macro "\<MEXIT\>"
syn match asmx86Macro "\<ENDM\>"
syn match asmx86MacroParam "\\[0-9]"
" Conditional assembly
syn match asmx86PreCond "\<IFC\s"
syn match asmx86PreCond "\<IFDEF\s"
syn match asmx86PreCond "\<IFEQ\s"
syn match asmx86PreCond "\<IFGE\s"
syn match asmx86PreCond "\<IFGT\s"
syn match asmx86PreCond "\<IFLE\s"
syn match asmx86PreCond "\<IFLT\s"
syn match asmx86PreCond "\<IFNC\>"
syn match asmx86PreCond "\<IFNDEF\s"
syn match asmx86PreCond "\<IFNE\s"
syn match asmx86PreCond "\<ELSEC\>"
syn match asmx86PreCond "\<ENDC\>"
" Loop control
syn match asmx86PreCond "\<REPT\s"
syn match asmx86PreCond "\<IRP\s"
syn match asmx86PreCond "\<IRPC\s"
syn match asmx86PreCond "\<ENDR\>"
" Directives
syn match asmx86Directive "\<ALIGN\s"
syn match asmx86Directive "\<CHIP\s"
syn match asmx86Directive "\<COMLINE\s"
syn match asmx86Directive "\<COMMON\(\.S\)\=\s"
syn match asmx86Directive "\<DC\(\.[BWLSDXP]\)\=\s"
syn match asmx86Directive "\<DC\.\\[0-9]\s"me=e-3 " Special use in a macro def
syn match asmx86Directive "\<DCB\(\.[BWLSDXP]\)\=\s"
syn match asmx86Directive "\<DS\(\.[BWLSDXP]\)\=\s"
syn match asmx86Directive "\<END\>"
syn match asmx86Directive "\<EQU\s"
syn match asmx86Directive "\<FEQU\(\.[SDXP]\)\=\s"
syn match asmx86Directive "\<FAIL\>"
syn match asmx86Directive "\<FOPT\s"
syn match asmx86Directive "\<\(NO\)\=FORMAT\>"
syn match asmx86Directive "\<IDNT\>"
syn match asmx86Directive "\<\(NO\)\=LIST\>"
syn match asmx86Directive "\<LLEN\s"
syn match asmx86Directive "\<MASK2\>"
syn match asmx86Directive "\<NAME\s"
syn match asmx86Directive "\<NOOBJ\>"
syn match asmx86Directive "\<OFFSET\s"
syn match asmx86Directive "\<OPT\>"
syn match asmx86Directive "\<ORG\(\.[SL]\)\=\>"
syn match asmx86Directive "\<\(NO\)\=PAGE\>"
syn match asmx86Directive "\<PLEN\s"
syn match asmx86Directive "\<REG\s"
syn match asmx86Directive "\<RESTORE\>"
syn match asmx86Directive "\<SAVE\>"
syn match asmx86Directive "\<SECT\(\.S\)\=\s"
syn match asmx86Directive "\<SECTION\(\.S\)\=\s"
syn match asmx86Directive "\<SET\s"
syn match asmx86Directive "\<SPC\s"
syn match asmx86Directive "\<TTL\s"
syn match asmx86Directive "\<XCOM\s"
syn match asmx86Directive "\<XDEF\s"
syn match asmx86Directive "\<XREF\(\.S\)\=\s"
syn match asmx86Constraint "\.[a-z]\+[a-z0-9]*\>"
syn match asmx86Constraintconst "\.\(\(byte\)\|\(d\=word\)\)\>"
syn case match
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_asmx86_syntax_inits")
if version < 508
let did_asmx86_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
" The default methods for highlighting. Can be overridden later
" Comment Constant Error Identifier PreProc Special Statement Todo Type
"
" Constant Boolean Character Number String
" Identifier Function
" PreProc Define Include Macro PreCondit
" Special Debug Delimiter SpecialChar SpecialComment Tag
" Statement Conditional Exception Keyword Label Operator Repeat
" Type StorageClass Structure Typedef
HiLink asmx86Comment DarkGrey
HiLink asmx86Commentcpp DarkGrey
HiLink asmx86Commentc DarkGrey
HiLink asmx86Commentcxx DarkGrey
HiLink asmx86Commenthash DarkGrey
HiLink asmx86Todo Todo
HiLink hexNumber Number " Constant
HiLink octNumber Number " Constant
HiLink binNumber Number " Constant
HiLink decNumber Number " Constant
HiLink floatNumber Number " Constant
HiLink floatExponent Number " Constant
HiLink floatE SpecialChar " Statement
"HiLink floatE Number " Constant
HiLink asmx86Immediate Identifier " Statement
"HiLink asmx86Symbol Constant
HiLink asmx86String String " Constant
HiLink asmx86Included String " Constant
HiLink asmx86CharError Error
HiLink asmx86StringError Error
HiLink asmx86Reg Identifier
HiLink asmx86Operator Identifier
HiLink asmx86Include Include " PreProc
HiLink asmx86Macro Macro " PreProc
HiLink asmx86PreProc PreProc " PreProc
HiLink asmx86MacroParam Keyword " Statement
HiLink asmx86Directive Special
HiLink asmx86PreCond Special
HiLink asmx86Constraint Keyword
HiLink asmx86Constraintconst Type
HiLink asmx86Opcode Keyword
HiLink asmx86Opcode_mv Special
HiLink asmx86Opcode_pre Todo
HiLink asmx86Opcode_br Macro
HiLink asmx86Opcode_io String
HiLink asmx86Opcode_o2 String
" We have "normal" opcodes, "move" opcodes, "prefix" opcodes, and "branch"
" opcodes..... Prefixes are rare, and we should alert them VERY specially
HiLink asmx86Cond Conditional " Statement
HiLink asmx86Repeat Repeat " Statement
HiLink asmx86Label Type
delcommand HiLink
endif
let b:current_syntax = "asmx86"
" vim: ts=8 sw=2

39
.vim/syntax/eruby.vim Normal file
View file

@ -0,0 +1,39 @@
" Vim syntax file
" Language: eruby
" Maintainer: Michael Brailsford <brailsmt@yahoo.com>
" Installation:
" To automatilcally load this file when a .rhtml file is opened, add the
" following lines to ~/.vim/filetype.vim:
"
" augroup filetypedetect
" au! BufRead,BufNewFile *.rhtml setfiletype eruby
" augroup END
"
" You will have to restart vim for this to take effect. In any case it
" is a good idea to read ":he new-filetype" so that you know what is going
" on, and why the above lines work.
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
"Source the html syntax file
ru! syntax/html.vim
"Set the filetype to html to load the html ftplugins
"set ft=html
unlet b:current_syntax
"Put the ruby syntax file in @rubyTop
syn include @rubyTop syntax/ruby.vim
syn region erubyBlock matchgroup=erubyRubyDelim start=#<%=\?# end=#%># keepend containedin=ALL contains=@rubyTop,erubyEnd
syn region erubyComment start=+<%#+ end=#%># keepend
syn match erubyEnd #\<end\>#
hi link erubyRubyDelim todo
hi link erubyComment comment
hi link erubyEnd rubyControl
" vim: set ts=4 sw=4:

113
.vim/syntax/haml.vim Normal file
View file

@ -0,0 +1,113 @@
" Vim syntax file
" Language: Haml (XHTML Abstraction Markup Language)
" Maintainer: Dmitry A. Ilyashevich <dmitry.ilyashevich@gmail.com>
" License: This file can be redistribued and/or modified under the same terms
" as Vim itself.
"
" Version: 0.3
" Last Change: 2008-03-16
" Notes: Last synced with Haml 1.8
" TODO: Support for indented multiline sections
"
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
"
" Changes:
" - David Bushong added support for Haml 1.8's == syntax for ruby strings;
" - Lasse Jansen make syntax highlighting of multiline ruby commands work
" ("|" at the end of the line).
"
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = 'haml'
endif
if version < 600
so <sfile>:p:h/html.vim
syn include @rubyTop <sfile>:p:h/ruby.vim
else
runtime! syntax/html.vim
unlet b:current_syntax
syn include @rubyTop syntax/ruby.vim
endif
syn region hamlLineTag start="^\s*%[a-zA-Z0-9\-_\:]\+" end="$" oneline keepend contains=hamlHtmlTag,hamlCssClassIncluded,hamlCssIdIncluded,hamlHtmlTagEnd,hamlRubyCodeIncluded,hamlRubyHash,hamlSpecialChar
syn region hamlLineTag start="^\s*%[a-zA-Z0-9\-_\:]\+" end="$" oneline keepend contains=hamlHtmlTag,hamlCssClassIncluded,hamlCssIdIncluded,hamlHtmlTagEnd,hamlRubyCodeIncluded,hamlRubyHash,hamlRubyStringIncluded
syn match hamlHtmlTagEnd "/$" contained
syn match hamlHtmlTag "^\s*%[a-zA-Z0-9\-_\:]\+" contained contains=htmlTagName
syn match hamlCssClassIncluded "\.[a-zA-Z0-9\-_\:]\+" contained
syn match hamlCssIdIncluded "\#[a-zA-Z0-9\-_\:]\+" contained
syn region hamlLineClass start="^\s*\.[a-zA-Z0-9\-_\:]*" end="$" oneline keepend contains=hamlCssClass,hamlCssClassIncluded,hamlCssIdIncluded,hamlRubyCodeIncluded,hamlRubyStringIncluded
syn region hamlLineId start="^\s*\#[a-zA-Z0-9\-_\:]*" end="$" oneline keepend contains=hamlCssId,hamlCssClassIncluded,hamlCssIdIncluded,hamlRubyCodeIncluded,hamlRubyStringIncluded
syn match hamlCssId "^\s*#[a-zA-Z0-9\-_\:]*" contained
syn match hamlCssClass "^\s*\.[a-zA-Z0-9\-_\:]*" contained
syn region hamlRubyCodeIncluded matchgroup=Delimiter start="[=~-] " end="$" contained contains=@rubyTop,hamlRubyHash keepend
syn region hamlRubyHash matchgroup=Delimiter start="{" end="}" contained contains=@rubyTop keepend
syn region hamlRubyCode matchgroup=Delimiter start="^\s*[=~-]" end="$" contains=@rubyTop,hamlRubyHash keepend
syn region hamlRubyStringIncluded matchgroup=Delimiter start="== " end="$" contained contains=@rubyStringSpecial keepend
syn region hamlRubyString matchgroup=Delimiter start="^\s*==" end="$" contains=@rubyStringSpecial
syn match hamlPreDef "^\s*:[a-zA-Z0-9\-_\:]\+"
syn region hamlPreProc start="^\s*\\" end="$"
syn match hamlPreProc " |$"
syn match hamlComment "^!!!.*$"
syn match hamlComment "^\s*/.*$" contains=hamlTodo,@Spell
syn keyword hamlTodo TODO FIXME XXX contained
" special characters
syn match hamlSpecialChar contained "&#\=[0-9A-Za-z]\{1,8};"
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_haml_syntax_inits")
if version < 508
let did_haml_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink hamlLineClass hamlLineTag
HiLink hamlLineId hamlLineTag
HiLink hamlCssClassIncluded hamlCssClass
HiLink hamlCssIdIncluded Type
HiLink hamlCssId Type
HiLink hamlHtmlTagEnd hamlHtmlTag
HiLink hamlPreDef hamlHtmlTag
HiLink hamlRubyHash hamlLineTag
HiLink hamlRubyCode hamlLineTag
HiLink hamlRubyCodeIncluded hamlLineTag
HiLink hamlRubyString hamlLineTag
HiLink hamlRubyStringIncluded hamlLineTag
HiLink hamlLineTag Text
HiLink hamlHtmlTag Statement
HiLink hamlCssClass Type
HiLink hamlPreProc PreProc
HiLink hamlComment Comment
HiLink hamlTodo Todo
HiLink hamlSpecialChar Special
delcommand HiLink
endif
let b:current_syntax = "haml"
if main_syntax == 'haml'
unlet main_syntax
endif
" vim: nowrap sw=2 sts=2 ts=8 ff=unix:

149
.vim/syntax/jflex.vim Normal file
View file

@ -0,0 +1,149 @@
" Vim syntax file
" Language: JFlex
" Maintainer: Gerwin Klein <lsf@jflex.de>
" Last Change: $Revision: 50 $, $Date: 2003-06-08 21:01:12 +1000 (Sun, 08 Jun 2003) $
" Thanks to Michael Brailsford for help and suggestions
" Quit when a syntax file was already loaded {{{
if exists("b:current_syntax")
finish
endif
"}}}
" Include java syntax {{{
if version >= 600
runtime! syntax/java.vim
unlet b:current_syntax
else
so $VIMRUNTIME/syntax/java.vim
endif
"}}}
syn cluster jflexOptions contains=jflexOption,jflexCodeInclude,jflexComment,jflexMacroIdent,jflexMacroRegExp,jflexOptionError
syn cluster jflexRules contains=jflexRule,jflexComment,jflexActionCode,jflexRuleStates,jflexRegExp
" java code section
syn region jflexStart start="/\*\|//\|import\|package\|class"me=s end="^%%"me=e-2 contains=@javaTop nextgroup=jflexOptionReg
" %%
" options
syn region jflexOptionReg matchgroup=jflexSectionSep start="^%%" end="^%%"me=e-2 contains=@jflexOptions nextgroup=jflexRulesReg
syn match jflexOptionError "%\i*" contained
syn match jflexOption "^\(%s\|%x\)" contained
syn match jflexOption "^%state" contained
syn match jflexOption "^%states" contained
syn match jflexOption "^%xstate" contained
syn match jflexOption "^%xstates" contained
syn match jflexOption "^%char" contained
syn match jflexOption "^%line" contained
syn match jflexOption "^%column" contained
syn match jflexOption "^%byaccj" contained
syn match jflexOption "^%cup" contained
syn match jflexOption "^%cupsym" contained
syn match jflexOption "^%cupdebug" contained
syn match jflexOption "^%eofclose" contained
syn match jflexOption "^%class" contained
syn match jflexOption "^%function" contained
syn match jflexOption "^%type" contained
syn match jflexOption "^%integer" contained
syn match jflexOption "^%int" contained
syn match jflexOption "^%intwrap" contained
syn match jflexOption "^%yyeof" contained
syn match jflexOption "^%notunix" contained
syn match jflexOption "^%7bit" contained
syn match jflexOption "^%8bit" contained
syn match jflexOption "^%full" contained
syn match jflexOption "^%16bit" contained
syn match jflexOption "^%unicode" contained
syn match jflexOption "^%caseless" contained
syn match jflexOption "^%ignorecase" contained
syn match jflexOption "^%implements" contained
syn match jflexOption "^%extends" contained
syn match jflexOption "^%public" contained
syn match jflexOption "^%apiprivate" contained
syn match jflexOption "^%final" contained
syn match jflexOption "^%abstract" contained
syn match jflexOption "^%debug" contained
syn match jflexOption "^%standalone" contained
syn match jflexOption "^%switch" contained
syn match jflexOption "^%table" contained
syn match jflexOption "^%pack" contained
syn match jflexOption "^%include" contained
syn match jflexOption "^%buffer" contained
syn match jflexOption "^%initthrow" contained
syn match jflexOption "^%eofthrow" contained
syn match jflexOption "^%yylexthrow" contained
syn match jflexOption "^%throws" contained
syn match jflexOption "^%scannerror" contained
syn match jflexMacroIdent "\I\i*\s*="me=e-1 contained nextgroup=jflexMacroRegExp
syn region jflexMacroRegExp matchgroup=jflexOperator start="=" end="^\(%\|\I\|\i\|/\)"me=e-1 contains=NONE contained
syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%{" end="^%}" contains=@javaTop contained
syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%init{" end="^%init}" contains=@javaTop contained
syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%initthrow{" end="^%initthrow}" contains=@javaTop contained
syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%eof{" end="^%eof}" contains=@javaTop contained
syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%eofthrow{" end="^%eofthrow}" contains=@javaTop contained
syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%yylexthrow{" end="^%yylexthrow}" contains=@javaTop contained
syn region jflexCodeInclude matchgroup=jflexCodeIncludeMark start="^%eofval{" end="^%eofval}" contains=@javaTop contained
" rules (end pattern shouldn't occur, if it does anyway we just stay in jflexRulesReg)
syn region jflexRulesReg matchgroup=jflexSectionSep start="^%%" end="^%%"me=e-2 contains=@jflexRules
" at first everything but strings is a regexp
syn match jflexRegExp "\([^\" \t]\|\\\"\)\+" contained
" take out comments
syn match jflexComment "//.*" contained
syn region jflexComment start="/\*" end="\*/" contained contains=jflexComment
" lex states
syn match jflexRuleStates "<\s*\I\i*\(\s*,\s*\I\i*\)*\s*>" contained skipnl skipwhite nextgroup=jflexStateGroup
" action code (only after states braces and macro use)
syn region jflexActionCode matchgroup=Delimiter start="{" end="}" contained contains=@javaTop,jflexJavaBraces
" macro use
syn match jflexRegExp "{\s*\I\i*\s*}" contained
" state braces (only active after <state>)
syn region jflexStateGroup matchgroup=jflexRuleStates start="{$" start="{\s" end="}" contained contains=@jflexRules
" string
syn region jflexRegExp matchgroup=String start=+"+ skip=+\\\\\|\\"+ end=+"+ contained
" not to be confused with a state
syn match jflexRegExp "<<EOF>>" contained
" escape sequence
syn match jflexRegExp "\\." contained
" keep braces in actions balanced
syn region jflexJavaBraces start="{" end="}" contained contains=@javaTop,jflexJavaBraces
" syncing
syn sync clear
syn sync minlines=10
syn sync match jflexSync grouphere jflexOptionReg "^%[a-z]"
syn sync match jflexSync grouphere jflexRulesReg "^<"
" highlighting
hi link jflexOption Special
hi link jflexMacroIdent Ident
hi link jflexMacroRegExp Macro
hi link jflexOptionError Error
hi link jflexComment Comment
hi link jflexOperator Operator
hi link jflexRuleStates Special
hi link jflexRegExp Function
hi jflexSectionSep guifg=yellow ctermfg=yellow guibg=blue ctermbg=blue gui=bold cterm=bold
hi link jflexCodeIncludeMark jflexSectionSep
let b:current_syntax="jflex"

74
.vim/syntax/kpl.vim Normal file
View file

@ -0,0 +1,74 @@
" Vim syntax file
" Language: KPL
" Maintainer: Adam Blinkinsop <blinks@acm.org>
" Last Change: 2007 Apr 17
" Remark: A Kernel Programming Language used by the BLITZ tools.
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" Comments
syntax region kplSingleLineComment start=/--/ end=/$/ contained
syntax region kplMultiLineComment start=/\/\*/ end=/\*\// contained
syntax cluster kplComment contains=kplSingleLineComment,kplMultiLineComment
" Types
syntax keyword kplType char int double bool void typeOfNull anyType ptr to array of function returns
syntax region kplRecord matchgroup=kplType start=/record/ end=/endRecord/ contains=ALL
" Expressions
syntax keyword kplOperator asPtrTo asInteger arraySize isInstanceOf isKindOf new alloc sizeOf
syntax match kplOp /[][.()<=>|&^!+*/%]/ contained
syntax keyword kplConstant null self super
syntax keyword kplBoolean true false
syntax match kplCharacter /'\\?.'/
syntax match kplInteger /[0-9]+/
syntax match kplHex /0x[0-9a-fA-F]+/
syntax match kplFloat /[0-9]+\.[0-9]+(e[0-9]+)?/
syntax region kplString start=/"/ end=/"/ skip=/\\"/
" Statements
syntax keyword kplConditional if elseIf else endIf switch endSwitch
syntax keyword kplRepeat while endWhile do until for endFor
syntax keyword kplStatement break continue free debug
syntax keyword kplLabel case default
syntax keyword kplException try catch throw endTry
" Block Definitions
syntax keyword kplKeyword extends messages implements superclass fields uses renaming to const var errors type enum returns function[s] external endFunction infix prefix method[s] endMethod
syntax region kplInterface matchgroup=kplDefBlock start=/interface/ end=/endInterface/ contains=ALL
syntax region kplClass matchgroup=kplDefBlock start=/class/ end=/endClass/ contains=ALL
syntax region kplBehavior matchgroup=kplDefBlock start=/behavior/ end=/endBehavior/ contains=ALL
" File Blocks
syntax region kplHeader matchgroup=kplFile start=/header/ end=/endHeader/ contains=ALLBUT,kplHeader,kplCode
syntax region kplCode matchgroup=kplFile start=/code/ end=/endCode/ contains=ALLBUT,kplHeader,kplCode
syntax sync match kplCode grouphere kplCode 'code'
syntax sync match kplCode groupthere kplCode 'endCode'
syntax sync match kplHeader grouphere kplHeader 'region'
syntax sync match kplHeader groupthere kplHeader 'endRegion'
hi def link kplSingleLineComment Comment
hi def link kplMultiLineComment Comment
hi def link kplType Type
hi def link kplOperator Operator
hi def link kplOp Operator
hi def link kplConstant Constant
hi def link kplBoolean Boolean
hi def link kplString String
hi def link kplCharacter Character
hi def link kplInteger Number
hi def link kplHex Number
hi def link kplFloat Float
hi def link kplConditional Conditional
hi def link kplRepeat Repeat
hi def link kplStatement Statement
hi def link kplLabel Label
hi def link kplException Exception
hi def link kplKeyword Keyword
hi def link kplFile Special
hi def link kplDefBlock Structure

144
.vim/syntax/lhaskell.vim Normal file
View file

@ -0,0 +1,144 @@
" Vim syntax file
" Language: Haskell with literate comments, Bird style,
" TeX style and plain text surrounding
" \begin{code} \end{code} blocks
" Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org>
" Original Author: Arthur van Leeuwen <arthurvl@cs.uu.nl>
" Last Change: Jan 05, 2008 by Kalman Noel
" Version: 1.02
"
" Thanks to Ian Lynagh for thoughtful comments on initial versions and
" for the inspiration for writing this in the first place.
"
" This style guesses as to the type of markup used in a literate haskell
" file and will highlight (La)TeX markup if it finds any
" This behaviour can be overridden, both glabally and locally using
" the lhs_markup variable or b:lhs_markup variable respectively.
"
" lhs_markup must be set to either tex or none to indicate that
" you always want (La)TeX highlighting or no highlighting
" must not be set to let the highlighting be guessed
" b:lhs_markup must be set to eiterh tex or none to indicate that
" you want (La)TeX highlighting or no highlighting for
" this particular buffer
" must not be set to let the highlighting be guessed
"
"
" 2004 February 18: New version, based on Ian Lynagh's TeX guessing
" lhaskell.vim, cweb.vim, tex.vim, sh.vim and fortran.vim
" 2004 February 20: Cleaned up the guessing and overriding a bit
" 2004 February 23: Cleaned up syntax highlighting for \begin{code} and
" \end{code}, added some clarification to the attributions
" 2008 January 05: Fixed broken highlighting when some totally common TeX
" environments or commands are used (document, section, ...)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" First off, see if we can inherit a user preference for lhs_markup
if !exists("b:lhs_markup")
if exists("lhs_markup")
if lhs_markup =~ '\<\%(tex\|none\)\>'
let b:lhs_markup = matchstr(lhs_markup,'\<\%(tex\|none\)\>')
else
echohl WarningMsg | echo "Unknown value of lhs_markup" | echohl None
let b:lhs_markup = "unknown"
endif
else
let b:lhs_markup = "unknown"
endif
else
if b:lhs_markup !~ '\<\%(tex\|none\)\>'
let b:lhs_markup = "unknown"
endif
endif
" Remember where the cursor is, and go to upperleft
let s:oldline=line(".")
let s:oldcolumn=col(".")
call cursor(1,1)
" If no user preference, scan buffer for our guess of the markup to
" highlight. We only differentiate between TeX and plain markup, where
" plain is not highlighted. The heuristic for finding TeX markup is if
" one of the following occurs anywhere in the file:
" - \documentclass
" - \begin{env} (for env != code)
" - \part, \chapter, \section, \subsection, \subsubsection, etc
if b:lhs_markup == "unknown"
if search('%\|\\documentclass\|\\begin{\(code}\)\@!\|\\\(sub\)*section\|\\chapter|\\part','W') != 0
let b:lhs_markup = "tex"
else
let b:lhs_markup = "plain"
endif
endif
" If user wants us to highlight TeX syntax, read it.
if b:lhs_markup == "tex"
if version < 600
source <sfile>:p:h/tex.vim
set isk+=_
else
runtime! syntax/tex.vim
unlet b:current_syntax
" Tex.vim removes "_" from 'iskeyword', but we need it for Haskell.
setlocal isk+=_
endif
endif
" Literate Haskell is Haskell in between text, so at least read Haskell
" highlighting
if version < 600
syntax include @haskellTop <sfile>:p:h/haskell.vim
else
syntax include @haskellTop syntax/haskell.vim
endif
" Where Haskell is nested within TeX
syntax cluster lhstex contains=tex.*Zone,texAbstract
syntax region lhsHaskellBirdTrack start="^>" end="\%(^[^>]\)\@=" contains=@haskellTop,lhsBirdTrack containedIn=@lhstex
syntax region lhsHaskellBeginEndBlock start="^\\begin{code}\s*$" matchgroup=NONE end="\%(^\\end{code}.*$\)\@=" contains=@haskellTop,@beginCode containedIn=@lhstex
syntax match lhsBirdTrack "^>" contained
syntax match beginCodeBegin "^\\begin" nextgroup=beginCodeCode contained
syntax region beginCodeCode matchgroup=texDelimiter start="{" end="}"
syntax cluster beginCode contains=beginCodeBegin,beginCodeCode
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_tex_syntax_inits")
if version < 508
let did_tex_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink lhsBirdTrack Comment
HiLink beginCodeBegin texCmdName
HiLink beginCodeCode texSection
delcommand HiLink
endif
" Restore cursor to original position, as it may have been disturbed
" by the searches in our guessing code
call cursor (s:oldline, s:oldcolumn)
unlet s:oldline
unlet s:oldcolumn
let b:current_syntax = "lhaskell"
" vim: ts=8

86
.vim/syntax/puppet.vim Normal file
View file

@ -0,0 +1,86 @@
" puppet syntax file
" Filename: puppet.vim
" Language: puppet configuration file
" Maintainer: Luke Kanies <luke@madstop.com>
" URL:
" Last Change:
" Version:
"
" Copied from the cfengine, ruby, and perl syntax files
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn region puppetDefine start="^\s*\(class\|define\|site\|node\)" end="{" contains=puppetDefType,puppetDefName,puppetDefArguments
syn keyword puppetDefType class define site node inherits contained
syn keyword puppetInherits inherits contained
syn region puppetDefArguments start="(" end=")" contains=puppetArgument
syn match puppetArgument "\w\+" contained
syn match puppetDefName "\w\+" contained
syn match puppetInstance "\w\+\s*{" contains=puppetTypeBrace,puppetTypeName,puppetTypeDefault
syn match puppetTypeBrace "{" contained
syn match puppetTypeName "[a-z]\w*" contained
syn match puppetTypeDefault "[A-Z]\w*" contained
syn match puppetParam "\w\+\s*=>" contains=puppetTypeRArrow,puppetParamName
syn match puppetParamRArrow "=>" contained
syn match puppetParamName "\w\+" contained
syn match puppetVariable "$\w\+"
syn match puppetVariable "${\w\+}"
syn match puppetParen "("
syn match puppetParen ")"
syn match puppetBrace "{"
syn match puppetBrace "}"
syn region puppetString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=puppetVariable
syn keyword puppetBoolean true false
syn keyword puppetKeyword import inherits include
syn keyword puppetControl case default
" comments last overriding everything else
syn match puppetComment "\s*#.*$" contains=puppetTodo
syn keyword puppetTodo TODO NOTE FIXME XXX contained
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_puppet_syn_inits")
if version < 508
let did_puppet_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink puppetVariable Identifier
HiLink puppetBoolean Boolean
HiLink puppetType Identifier
HiLink puppetDefault Identifier
HiLink puppetKeyword Define
HiLink puppetTypeDefs Define
HiLink puppetComment Comment
HiLink puppetString String
HiLink puppetTodo Todo
" HiLink puppetBrace Delimiter
" HiLink puppetTypeBrace Delimiter
" HiLink puppetParen Delimiter
HiLink puppetDelimiter Delimiter
HiLink puppetControl Statement
HiLink puppetDefType Define
HiLink puppetDefName Type
HiLink puppetTypeName Statement
HiLink puppetTypeDefault Type
HiLink puppetParamName Identifier
HiLink puppetArgument Identifier
delcommand HiLink
endif
let b:current_syntax = "puppet"

11
.vim/syntax/rht.bak Normal file
View file

@ -0,0 +1,11 @@
" load all of the HTML info
"source $VIMRUNTIME/syntax/html.vim
runtime! syntax/html.vim
unlet b:current_syntax
" load all of the ruby info into @Ruby
syntax include @Ruby $VIMRUNTIME/syntax/ruby.vim
unlet b:current_syntax
syntax region rhtmlRuby start="<%" end="%" contains=@Ruby,rhtmlRuby
let b:current_syntax = "rhtml"

25
.vim/syntax/rhtml.vim Normal file
View file

@ -0,0 +1,25 @@
" HTML with embedded Ruby
" Language: HTML + Ruby
" Maintainer: Tobias DiPasquale <anany / ece.villanova.edu>
" Last Modified: 2002 Mar 07
" Location: http://cbcg.net/rhtml.vim
" for portability
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" load all of the HTML info
source $VIMRUNTIME/syntax/html.vim
unlet b:current_syntax
" load all of the ruby info into @Ruby
syntax include @Ruby $VIMRUNTIME/syntax/ruby.vim
syntax region rhtmlRuby
\ start=/<%/
\ end=/%>/
\ contains=@Ruby, rhtmlRuby
let b:current_syntax = "rhtml"

View file

@ -0,0 +1,6 @@
" load all of the HTML info
source $VIMRUNTIME/syntax/html.vim
unlet b:current_syntax
syntax include @Ruby runtime! syntax/ruby.vim
syntax region rhtmlRuby start=+<%+ end=+%>+ contains=@Ruby,rhtmlRuby
let b:current_syntax="rhtml"

787
.vimrc Normal file
View file

@ -0,0 +1,787 @@
scriptencoding utf-8
"-----------------------------------------------------------------------
"BaSS vimrc based con ciaran
"-----------------------------------------------------------------------
"-----------------------------------------------------------------------
" terminal setup
"-----------------------------------------------------------------------
" Extra terminal things
set termencoding=utf-8
set encoding=utf-8
" Turn off the menubar so we don't get key accelerators with Meta.
" Don't include the toolbar
set guioptions=aegiLt
colorscheme inkpot
set fenc=utf-8
if exists('&t_SI')
let &t_SI = "\<Esc>]12;lightgoldenrod\x7"
let &t_EI = "\<Esc>]12;grey80\x7"
endif
"-----------------------------------------------------------------------
" settings
"-----------------------------------------------------------------------
" Don't be compatible with vi
set nocompatible
" Enable a nice big viminfo file
set viminfo='1000,f1,:1000,/1000
set history=500
" Make backspace delete lots of things
set backspace=indent,eol,start
" Create backups
"set backup
set nobackup
" Show us the command we're typing
set showcmd
" Highlight matching parens
set showmatch
" Search options: incremental search, highlight search
set hlsearch
set incsearch
" Selective case insensitivity
set ignorecase
set infercase
" Show full tags when doing search completion
set showfulltag
" Speed up macros
set lazyredraw
" No annoying error noises
set noerrorbells
set visualbell t_vb=
if has("autocmd")
autocmd GUIEnter * set visualbell t_vb=
endif
" Try to show at least three lines and two columns of context when
" scrolling
set scrolloff=3
set sidescrolloff=2
" Wrap on these
set whichwrap+=<,>,[,]
" Use the cool tab complete menu
set wildmenu
set wildignore+=*.o,*~
set suffixes+=.in,.a
" Allow edit buffers to be hidden
set hidden
" 1 height windows
set winminheight=1
" Enable syntax highlighting
if has("syntax")
syntax on
endif
" Set our fonts
if has("gui_kde")
set guifont=Terminus/12/-1/5/50/0/0/0/0/0
elseif has("gui_gtk")
set guifont=Terminus\ 12
elseif has("gui_running")
set guifont=-xos4-terminus-medium-r-normal--12-140-72-72-c-80-iso8859-1
endif
" Try to load a nice colourscheme
set t_Co=256
color inkpot
" No icky toolbar, menu or scrollbars in the GUI
"if has('gui')
" set guioptions-=m
" set guioptions-=T
" set guioptions-=l
" set guioptions-=L
" set guioptions-=r
" set guioptions-=R
"end
" By default, go for an indent of 4 tab stuff
set expandtab
set shiftwidth=4
set tabstop=4
" Do clever indent things. Don't make a # force column zero.
set autoindent
set smartindent
inoremap # X<BS>#
" Enable folds
if has("folding")
set foldenable
set foldmethod=marker
endif
" Syntax when printing
set popt+=syntax:y
" Enable filetype settings
if has("eval")
filetype on
filetype plugin on
filetype indent on
endif
" Enable modelines only on secure vim versions
if (v:version >= 604)
set modeline
else
set nomodeline
endif
" Nice statusbar
set laststatus=2
set statusline=
set statusline+=%2*%-3.3n%0*\ " buffer number
set statusline+=%f\ " file name
set statusline+=%h%1*%m%r%w%0* " flags
set statusline+=\[%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{&encoding}, " encoding
set statusline+=%{&fileformat}] " file format
if filereadable(expand("$VIM/vimfiles/plugin/vimbuddy.vim"))
set statusline+=\ %{VimBuddy()} " vim buddy
endif
set statusline+=%= " right align
set statusline+=%2*0x%-8B\ " current char
set statusline+=%-14.(%l,%c%V%)\ %<%P " offset
" special statusbar for special windows
if has("autocmd")
au FileType qf
\ if &buftype == "quickfix" |
\ setlocal statusline=%2*%-3.3n%0* |
\ setlocal statusline+=\ \[Compiler\ Messages\] |
\ setlocal statusline+=%=%2*\ %<%P |
\ endif
fun! <SID>FixMiniBufExplorerTitle()
if "-MiniBufExplorer-" == bufname("%")
setlocal statusline=%2*%-3.3n%0*
setlocal statusline+=\[Buffers\]
setlocal statusline+=%=%2*\ %<%P
endif
endfun
au BufWinEnter *
\ let oldwinnr=winnr() |
\ windo call <SID>FixMiniBufExplorerTitle() |
\ exec oldwinnr . " wincmd w"
endif
" Nice window title
if has('title') && (has('gui_running') || &title)
set titlestring=
set titlestring+=%f\ " file name
set titlestring+=%h%m%r%w " flags
set titlestring+=\ -\ %{v:progname} " program name
endif
" If possible, try to use a narrow number column.
if v:version >= 700
try
setlocal numberwidth=3
catch
endtry
endif
" Include $HOME in cdpath
if has("file_in_path")
let &cdpath=','.expand("$HOME").','.expand("$HOME").'/work'
endif
" Better include path
set path+=src/
" Show tabs and trailing whitespace visually
if (&termencoding == "utf-8") || has("gui_running")
if v:version >= 700
set list listchars=tab:»·,trail,extends:…,nbsp:‗
else
set list listchars=tab:»·,trail,extends:…
endif
else
if v:version >= 700
set list listchars=tab:>-,trail:.,extends:>,nbsp:_
else
set list listchars=tab:>-,trail:.,extends:>
endif
endif
map <F9> :set nolist listchars<CR>
" Show lines longer than 80 characters
au BufWinEnter * let w:m1=matchadd('Search', '\%<81v.\%>77v', -1)
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
set fillchars=fold:-
"-----------------------------------------------------------------------
" completion
"-----------------------------------------------------------------------
set dictionary=/usr/share/dict/words
"-----------------------------------------------------------------------
" miniBufExpl
"-----------------------------------------------------------------------
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
"-----------------------------------------------------------------------
" autocmds
"-----------------------------------------------------------------------
if has("eval")
" If we're in a wide window, enable line numbers.
fun! <SID>WindowWidth()
if winwidth(0) > 90
setlocal foldcolumn=1
setlocal number
else
setlocal nonumber
setlocal foldcolumn=0
endif
endfun
endif
" content creation
if has("autocmd")
augroup content
autocmd!
autocmd BufNewFile *.rb 0put ='# vim: set sw=2 sts=2 et tw=80 :' |
\ 0put ='#!/usr/bin/env ruby' | set sw=2 sts=2 et tw=80 |
\ norm G
autocmd BufNewFile,BufRead *.rb,*rhtml,*haml
\ set tabstop=2 shiftwidth=2 softtabstop=2 |
\ setf eruby
autocmd BufNewFile,BufRead *.php
\ set ai
autocmd BufNewFile *.hh 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' |
\ 1put ='' | call MakeIncludeGuards() |
\ 5put ='#include \"config.h\"' |
\ set sw=4 sts=4 et tw=80 | norm G
autocmd BufNewFile *.cc 0put ='/* vim: set sw=4 sts=4 et foldmethod=syntax : */' |
\ 1put ='' | 2put ='' | call setline(3, '#include "' .
\ substitute(expand("%:t"), ".cc$", ".hh", "") . '"') |
\ set sw=4 sts=4 et tw=80 | norm G
autocmd BufNewFile configure.ac
\ 0put ='dnl vim: set sw=8 sts=8 noet :' |
\ $put ='' |
\ call setline(line('$'), 'AC_INIT([' . substitute(expand('%:p:h'),
\ '^.\{-}/\([^/]\+\)\(/trunk\)\?$', '\1', '') . '], [0.0])') |
\ $put ='AC_PREREQ(2.5)' |
\ $put ='AC_CONFIG_SRCDIR([])' |
\ $put ='AC_CONFIG_AUX_DIR(config)' |
\ $put ='AM_INIT_AUTOMAKE(1.9)' |
\ $put ='' |
\ $put ='dnl check for required programs' |
\ $put ='AC_PROG_CXX' |
\ $put ='AC_PROG_INSTALL' |
\ $put ='AC_PROG_LN_S' |
\ $put ='AC_PROG_RANLIB' |
\ $put ='AC_PROG_MAKE_SET' |
\ $put ='' |
\ $put ='dnl output' |
\ $put ='AM_CONFIG_HEADER(config.h)' |
\ $put ='AC_OUTPUT(' |
\ $put =' Makefile' |
\ $put =' src/Makefile' |
\ $put =' )' |
\ set sw=8 sts=8 noet |
\ norm ggjjjjf]
autocmd BufNewFile autogen.bash
\ 0put ='#!/usr/bin/env bash' |
\ 1put ='# vim: set sw=4 sts=4 et tw=80 :' |
\ $put ='run() {' |
\ $put ='echo \">>> $@\"' |
\ $put =' if ! $@ ; then' |
\ $put =' echo \"oops!\" 1>&2' |
\ $put =' exit 127' |
\ $put =' fi' |
\ $put ='}' |
\ $put ='' |
\ $put ='get() {' |
\ $put =' type ${1}-${2} &>/dev/null && echo ${1}-${2} && return' |
\ $put =' type ${1}${2//.} &>/dev/null && echo ${1}${2//.} && return' |
\ $put =' type ${1} &>/dev/null && echo ${1} && return' |
\ $put =' echo \"Could not find ${1} ${2}\" 1>&2' |
\ $put =' exit 127' |
\ $put ='}' |
\ $put ='' |
\ $put ='run mkdir -p config' |
\ $put ='run $(get libtoolize 1.5 ) --copy --force --automake' |
\ $put ='rm -f config.cache' |
\ $put ='run $(get aclocal 1.9 )' |
\ $put ='run $(get autoheader 2.59 )' |
\ $put ='run $(get autoconf 2.59 )' |
\ $put ='run $(get automake 1.9 ) -a --copy' |
\ set sw=4 sts=4 et tw=80 |
\ norm gg=Ggg
autocmd BufNewFile Makefile.am
\ 0put ='CLEANFILES = *~' |
\ if (! filereadable(expand("%:p:h:h") . '/Makefile.am')) |
\ $put ='MAINTAINERCLEANFILES = Makefile.in configure config/* aclocal.m4 \' |
\ $put ='' |
\ call setline(line('$'), "\t\t\tconfig.h config.h.in") |
\ $put ='AUTOMAKE_OPTIONS = foreign dist-bzip2' |
\ $put ='EXTRA_DIST = autogen.bash' |
\ else |
\ $put ='MAINTAINERCLEANFILES = Makefile.in' |
\ endif
augroup END
endif
"-----------------------------------------------------------------------
" mappings
"-----------------------------------------------------------------------
nmap <silent> <S-Right> :bnext<CR>
" v_K is really really annoying
vmap K k
" Delete a buffer but keep layout
if has("eval")
command! Kwbd enew|bw #
nmap <C-w>! :Kwbd<CR>
endif
" quickfix things
nmap <Leader>cwc :cclose<CR>
nmap <Leader>cwo :botright copen 5<CR><C-w>p
nmap <Leader>cn :cnext<CR>
" Annoying default mappings
inoremap <S-Up> <C-o>gk
inoremap <S-Down> <C-o>gj
noremap <S-Up> gk
noremap <S-Down> gj
" Make <space> in normal mode go down a page rather than left a
" character
noremap <space> <C-f>
noremap <backspace> <C-b>
" Useful things from inside imode
inoremap <C-z>w <C-o>:w<CR>
inoremap <C-z>q <C-o>gq}<C-o>k<C-o>$
" Commonly used commands
"nmap <silent> <F3> :silent nohlsearch<CR>
"imap <silent> <F3> <C-o>:silent nohlsearch<CR>
"nmap <F4> :Kwbd<CR>
"nmap <F5> <C-w>c
"nmap <F7> :make check<CR>
"nmap <F8> :make<CR>
"nmap <F10> :!svn update<CR>
"nmap <F11> :!svn status \| grep -v '^?' \| sort -k2<CR>
" Insert a single char
noremap <Leader>i i<Space><Esc>r
" Split the line
nmap <Leader>n \i<CR>
" Pull the following line to the cursor position
noremap <Leader>J :s/\%#\(.*\)\n\(.*\)/\2\1<CR>
" In normal mode, jj escapes
inoremap jj <Esc>
" Kill line
noremap <C-k> "_dd
" Select everything
noremap <Leader>gg ggVG
" Reformat everything
noremap <Leader>gq gggqG
" Reformat paragraph
noremap <Leader>gp gqap
" Clear lines
noremap <Leader>clr :s/^.*$//<CR>:nohls<CR>
" Delete blank lines
noremap <Leader>dbl :g/^$/d<CR>:nohls<CR>
" Enclose each selected line with markers
noremap <Leader>enc :<C-w>execute
\ substitute(":'<,'>s/^.*/#&#/ \| :nohls", "#", input(">"), "g")<CR>
" Enable fancy % matching
if has("eval")
runtime! macros/matchit.vim
endif
" q: sucks
nmap q: :q
" set up some more useful digraphs
if has("digraphs")
digraph ., 8230 " ellipsis (…)
endif
if has("eval")
" GNU format changelog entry
fun! MakeChangeLogEntry()
norm gg
/^\d
norm 2O
norm k
call setline(line("."), strftime("%Y-%m-%d") .
\ " J. Alberto Suárez López <bass@gentoo.org>")
norm 2o
call setline(line("."), "\t* ")
norm $
endfun
noremap <Leader>cl :call MakeChangeLogEntry()<CR>
" command aliases, can't call these until after cmdalias.vim is loaded
au VimEnter * if exists("loaded_cmdalias") |
\ call CmdAlias("mkdir", "!mkdir") |
\ call CmdAlias("cvs", "!cvs") |
\ call CmdAlias("svn", "!svn") |
\ call CmdAlias("commit", "!svn commit -m \"") |
\ call CmdAlias("upload", "make upload") |
\ endif
endif
" super i_c-y / i_c-e
if v:version >= 700 && has("eval")
fun! SuperYank(offset)
let l:cursor_pos = col(".")
let l:this_line = line(".")
let l:source_line = l:this_line + a:offset
let l:this_line_text = getline(l:this_line)
let l:source_line_text = getline(l:source_line)
let l:add_text = ""
let l:motion = "" . nr2char(getchar())
if -1 != match(l:motion, '\d')
let l:count = 0
while -1 != match(l:motion, '\d')
let l:count = l:count * 10 + l:motion
let l:motion = "" . nr2char(getchar())
endwhile
else
let l:count = 1
endif
if l:motion == "$"
let l:add_text = strpart(l:source_line_text, l:cursor_pos - 1)
elseif l:motion == "w"
let l:add_text = strpart(l:source_line_text, l:cursor_pos - 1)
let l:add_text = substitute(l:add_text,
\ '^\(\s*\%(\S\+\s*\)\{,' . l:count . '}\)\?.*', '\1', '')
elseif l:motion == "f" || l:motion == "t"
let l:add_text = strpart(l:source_line_text, l:cursor_pos - 1)
let l:char = nr2char(getchar())
let l:pos = matchend(l:add_text,
\ '^\%([^' . l:char . ']\{-}' . l:char . '\)\{' . l:count . '}')
if -1 != l:pos
let l:add_text = strpart(l:add_text, 0, l:motion == "f" ? l:pos : l:pos - 1)
else
let l:add_text = ''
endif
else
echo "Unknown motion: " . l:motion
endif
if l:add_text != ""
let l:new_text = strpart(l:this_line_text, 0, l:cursor_pos - 1) .
\ l:add_text . strpart(l:this_line_text, l:cursor_pos - 1)
call setline(l:this_line, l:new_text)
call cursor(l:this_line, l:cursor_pos + strlen(l:add_text))
endif
endfun
inoremap <C-g>y <C-\><C-o>:call SuperYank(-1)<CR>
inoremap <C-g>e <C-\><C-o>:call SuperYank(1)<CR>
endif
" tab completion
if has("eval")
function! CleverTab()
if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
return "\<Tab>"
else
return "\<C-N>"
endif
endfun
inoremap <Tab> <C-R>=CleverTab()<CR>
inoremap <S-Tab> <C-P>
endif
"-----------------------------------------------------------------------
" abbreviations
"-----------------------------------------------------------------------
if has("eval") && has("autocmd")
fun! <SID>abbrev_cpp()
iabbrev <buffer> raise throw
iabbrev <buffer> jci const_iterator
iabbrev <buffer> jcl class
iabbrev <buffer> jco const
iabbrev <buffer> jdb \bug
iabbrev <buffer> jde \throws
iabbrev <buffer> jdf /** \file<CR><CR>/<Up>
iabbrev <buffer> jdg \ingroup
iabbrev <buffer> jdn /** \namespace<CR><CR>/<Up>
iabbrev <buffer> jdp \param
iabbrev <buffer> jdt \test
iabbrev <buffer> jdx /**<CR><CR>/<Up>
iabbrev <buffer> jit iterator
iabbrev <buffer> jns namespace
iabbrev <buffer> jpr protected
iabbrev <buffer> jpu public
iabbrev <buffer> jpv private
iabbrev <buffer> jsl std::list
iabbrev <buffer> jsm std::map
iabbrev <buffer> jss std::string
iabbrev <buffer> jsv std::vector
iabbrev <buffer> jty typedef
iabbrev <buffer> jun using namespace
iabbrev <buffer> jvi virtual
endfun
augroup abbreviations
autocmd!
autocmd FileType cpp :call <SID>abbrev_cpp()
augroup END
endif
"-----------------------------------------------------------------------
" special less.sh and man modes
"-----------------------------------------------------------------------
if has("eval") && has("autocmd")
fun! <SID>check_pager_mode()
if exists("g:loaded_less") && g:loaded_less
" we're in vimpager / less.sh / man mode
set laststatus=0
set ruler
set foldmethod=manual
set foldlevel=99
set nolist
endif
endfun
autocmd VimEnter * :call <SID>check_pager_mode()
endif
"-----------------------------------------------------------------------
" plugin / script / app settings
"-----------------------------------------------------------------------
if has("eval")
" Perl specific options
let perl_include_pod=1
let perl_fold=1
let perl_fold_blocks=1
" Vim specific options
let g:vimsyntax_noerror=1
let g:vimembedscript=0
" c specific options
let g:c_gnu=1
let g:c_no_curly_error=1
" eruby options
au Syntax * hi link erubyRubyDelim Directory
" ruby options
let ruby_operators=1
let ruby_space_errors=1
" php specific options
let php_sql_query=1
let php_htmlInStrings=1
" Settings for taglist.vim
let Tlist_Use_Right_Window=1
let Tlist_Auto_Open=0
let Tlist_Enable_Fold_Column=0
let Tlist_Compact_Format=1
let Tlist_WinWidth=28
let Tlist_Exit_OnlyWindow=1
let Tlist_File_Fold_Auto_Close = 1
"nnoremap <silent> <F9> :Tlist<CR>
" Settings minibufexpl.vim
let g:miniBufExplModSelTarget = 1
let g:miniBufExplWinFixHeight = 1
let g:miniBufExplWinMaxSize = 1
" let g:miniBufExplForceSyntaxEnable = 1
" Settings for showmarks.vim
if has("gui_running")
let g:showmarks_enable=1
else
let g:showmarks_enable=0
let loaded_showmarks=1
endif
let g:showmarks_include="abcdefghijklmnopqrstuvwxyz"
if has("autocmd")
fun! <SID>FixShowmarksColours()
if has('gui')
hi ShowMarksHLl gui=bold guifg=#a0a0e0 guibg=#2e2e2e
hi ShowMarksHLu gui=none guifg=#a0a0e0 guibg=#2e2e2e
hi ShowMarksHLo gui=none guifg=#a0a0e0 guibg=#2e2e2e
hi ShowMarksHLm gui=none guifg=#a0a0e0 guibg=#2e2e2e
hi SignColumn gui=none guifg=#f0f0f8 guibg=#2e2e2e
endif
endfun
if v:version >= 700
autocmd VimEnter,Syntax,ColorScheme * call <SID>FixShowmarksColours()
else
autocmd VimEnter,Syntax * call <SID>FixShowmarksColours()
endif
endif
" Settings for explorer.vim
let g:explHideFiles='^\.'
" Settings for netrw
let g:netrw_list_hide='^\.,\~$'
" Settings for :TOhtml
let html_number_lines=1
let html_use_css=1
let use_xhtml=1
" cscope settings
if has('cscope') && filereadable("/usr/bin/cscope")
set csto=0
set cscopetag
set nocsverb
if filereadable("cscope.out")
cs add cscope.out
endif
set csverb
let x = "sgctefd"
while x != ""
let y = strpart(x, 0, 1) | let x = strpart(x, 1)
exec "nmap <C-j>" . y . " :cscope find " . y .
\ " <C-R>=expand(\"\<cword\>\")<CR><CR>"
exec "nmap <C-j><C-j>" . y . " :scscope find " . y .
\ " <C-R>=expand(\"\<cword\>\")<CR><CR>"
endwhile
nmap <C-j>i :cscope find i ^<C-R>=expand("<cword>")<CR><CR>
nmap <C-j><C-j>i :scscope find i ^<C-R>=expand("<cword>")<CR><CR>
endif
endif
"-----------------------------------------------------------------------
" final commands
"-----------------------------------------------------------------------
" mio
let Tlist_Ctags_Cmd="/usr/bin/exuberant-ctags"
" plegado ident para python
au FileType python set foldmethod=indent
" plegado syntax para sgml,htmls,xml y xsl
au Filetype html,xml,xsl,sgml,docbook
" explorador vertical
let g:explVertical=1
" define leader como =
let mapleader = "="
" Terminal companability
map <F15> <S-F3>
nmap <Esc>[14~ <S-F4>
map <F17> <S-F5>
map <F18> <S-F6>
map <F19> <S-F7>
map <F20> <S-F8>
map <F21> <S-F9>
map <F22> <S-F10>
map <F23> <S-F11>
map <F24> <S-F12>
map <S-F2> :vsplit ~/.vim/ref_full.vim<CR>
map <F2> :11vsplit ~/.vim/ref.vim<CR>
map <F3> :Sexplore /home/bass/<CR>
map <S-F3> :2split ~/.vim/fun_ref.vim<CR>
map <F4> :set nu<CR>
map <S-F4> :set nu!<CR>
map <F5> ggVGg?
map <F6> :set encoding=utf-8<CR> | :set fenc=utf-8<CR>
map <S-F6> :set encoding=iso8859-15<CR> | :set fenc=iso8859-15<CR>
map <F7> :SpellProposeAlternatives<CR>
map <S-F7> :SpellCheck<CR>
map <C-F7> :let spell_language_list = "english,spanish"
nnoremap <silent> <F8> :Tlist<CR>
nnoremap <silent> <S-F8> :TlistSync<CR>
map <F11> !!date<CR>
map <F12> :TC<CR>
nmap :X :x
nmap :W :w
nmap :Q :q
noremap <Leader>rg :color relaxedgreen<CR>
noremap <Leader>ip :color inkpot<CR>
" Javac
set makeprg=javac\ %
set errorformat=%A%f:%l:\ %m,%-Z%p^,%-C%.%#
map <F8> :make<CR>
" CVS
nmap <leader>cadd <Plug>CVSAdd
nmap <leader>cci <Plug>CVSCommit
nmap <leader>clog <Plug>CVSLog
map <leader>cre <Plug>CVSRevert
nmap <leader>cup <Plug>CVSUpdate
nmap <leader>cdiff <Plug>CVSDiff
" Spell
let spell_executable = "aspell"
let spell_language_list = "spanish,english"
" Comentiffy
let g:EnhCommentifyMultiPartBlocks = 'yes'
let g:EnhCommentifyAlignRight = 'yes'
" let g:EnhCommentifyRespectIndent = 'Yes'
let g:EnhCommentifyPretty = 'Yes'
" let g:EnhCommentifyUserBindings = 'yes'
" turn off any existing search
if has("autocmd")
au VimEnter * nohls
endif
"-----------------------------------------------------------------------
" vim: set shiftwidth=4 softtabstop=4 expandtab tw=72 :