Aggiunta impostazioni base vim.

This commit is contained in:
Emiliano Vavassori 2023-04-29 16:36:57 +02:00
parent 56f659d5ce
commit 0f56baa132
48 changed files with 10738 additions and 1 deletions

View File

@ -38,6 +38,14 @@ fi
if [[ ! -f "$HOME/.tmux.conf" ]]; then
mkdir -p ${HOME}/.config/tmux/plugins
git clone https://github.com/tmux-plugins/tpm ${HOME}/.config/tmux/plugins/tpm
cp "${DOTFILES}/tmux.conf" "$HOME/.tmux.conf"
ln -sf "${DOTFILES}/tmux.conf" "$HOME/.tmux.conf"
echo "Please, open Tmux and run 'prefix I'."
fi
# Vim - configure vundle and install plugins.
if [[ ! -f "${HOME}/.vimrc" ]]; then
ln -sf ${DOTFILES}/vimrc ${HOME}/.vimrc
ln -sf ${DOTFILES}/vim ${HOME}/.vim
# Installing vundle and plugins.
vim +PluginInstall +qall
fi

3
vim/.netrwhist Normal file
View File

@ -0,0 +1,3 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhist_cnt =1
let g:netrw_dirhist_1='/Users/syntaxerrormmm/.docker/machine/machines'

View File

@ -0,0 +1,2 @@
set softtabstop=2
set shiftwidth=2

View File

@ -0,0 +1,167 @@
" Vim syntax file
" Language: Gnuplot
" Maintainer: Jim Eberle <jim.eberle@fastnlight.com>
" Last Change: Dec 21, 2006
" URL: http://www.fastnlight.com/syntax/gnuplot.vim
" Use :syn w/in a buffer to see language element breakdown
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" --- Statement ---
syn keyword plotStmt cd call clear exit fit if help history load
syn keyword plotStmt pause plot print pwd quit replot reread
syn keyword plotStmt reset save set shell show splot system
syn keyword plotStmt test unset update
hi def link plotStmt Statement
" --- Option ---
syn keyword plotOption angles arrow autoscale bars boxwidth clabel
syn keyword plotOption clip cntrparam colorbox contour decimalsign
syn keyword plotOption dgrid3d dummy encoding fit format grid
syn keyword plotOption historysize isosamples key locale logscale
syn keyword plotOption mapping mouse multiplot offsets origin output
syn keyword plotOption palette parametric pm3d polar print
syn keyword plotOption samples style surface terminal ticscale
syn keyword plotOption ticslevel timestamp timefmt title view zero
syn keyword plotOption zeroaxis label tics margin
syn match plotOption "[xyz]2\?range"
syn match plotOption "[xyz]2\?data"
syn match plotOption "[xyz]2\?label"
syn match plotOption "[xyz]2\?zeroaxis"
syn match plotOption "[rtuv]range"
syn match plotOption "[blrt]margin"
syn match plotOption "\(no\)\?m\?[xyz]2\?tics"
syn match plotOption "\(no\)\?m\?cbtics"
syn match plotOption "[xyz]2\?[md]tics"
syn keyword plotOption cbtics cblabel cbrange cbdata
syn keyword plotOption cbdtics cbmtics
hi def link plotOption Identifier
" --- Operator ---
syn match plotOp "[-+*/^|&?:]"
syn match plotOp "\*\*"
syn match plotOp "&&"
syn match plotOp "||"
hi def link plotOp Operator
" --- Function ---
syn keyword plotFn abs abs acos arg asin atan besj0 besj1
syn keyword plotFn besy0 besy1 ceil cos cosh erf erfc exp
syn keyword plotFn floor gamma ibeta igamma imag int lgamma
syn keyword plotFn log log10 rand real sgn sin sinh sqrt tan tanh
hi def link plotFn Function
" --- String ---
syn region plotString start=+"+ skip=+\\\\\|\\"+ end=+"+
syn region plotString start=+'+ skip=+\\\\\|\\'+ end=+'+
hi def link plotString String
" --- Number ---
syn match plotNumber "\<-\?\d\+\>"
hi def link plotNumber Number
" --- Float ---
syn match plotFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\="
syn match plotFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=\>"
syn match plotFloat display contained "\d\+e[-+]\>"
hi def link plotFloat Float
" --- Constant Pair ---
syn keyword plotPair border noborder
syn keyword plotPair labels nolabels
syn keyword plotPair autotitles noautotitles
syn keyword plotPair filled nofilled
syn keyword plotPair offset nooffset
syn keyword plotPair undefined noundefined
syn keyword plotPair reverse noreverse
syn keyword plotPair ratio noratio
syn keyword plotPair head nohead
syn keyword plotPair rotate norotate
syn keyword plotPair point nopoint
syn keyword plotPair box nobox
syn keyword plotPair square nosquare
syn keyword plotPair mirror nomirror
syn keyword plotPair verbose noverbose
syn keyword plotPair altdiagonal noaltdiagonal
syn keyword plotPair ftriangles noftriangles
syn keyword plotPair hidden3d nohidden3d
syn keyword plotPair bentover nobentover
syn keyword plotPair enhanced noenhanced
syn keyword plotPair doubleclick nodoubleclick
syn keyword plotPair zoomjump nozoomjump
syn keyword plotPair zoomcoordinates nozoomcoordinates
syn keyword plotPair polardistance nopolardistance
syn keyword plotPair errorvariables noerrorvariables
syn keyword plotPair ps_allcF nops_allcF
syn keyword plotPair writeback nowriteback
hi def link plotPair plotConst
" --- Constant ---
syn keyword plotConst pi
syn keyword plotConst degrees radians
syn keyword plotConst default restore user
syn keyword plotConst left right center top bottom outside below Left Right
syn keyword plotConst front back layerdefault
syn keyword plotConst tiny small medium large giant size
syn keyword plotConst absolute relative
syn keyword plotConst vertical horizontal
syn keyword plotConst min max fixmin fixmax fix keepfix
syn keyword plotConst on off begin end in out push pop
syn keyword plotConst zero one two
syn keyword plotConst empty solid pattern
syn keyword plotConst linear cubicspline bspline
syn keyword plotConst bdefault base both
syn keyword plotConst iso_8859_1 iso_8859_2 iso_8859_15 cp850 cp852 cp437 koi8r
syn keyword plotConst cartesian spherical cylindrical
syn keyword plotConst gray color positive negative
syn keyword plotConst fill line
syn keyword plotConst linestyle ls
syn keyword plotConst linetype lt
syn keyword plotConst linewidth lw
syn keyword plotConst pointtype pt
syn keyword plotConst pointsize ps
syn keyword plotConst textcolor tc
syn keyword plotConst xy xz yz xyz
syn keyword plotConst clipboardformat mouseformat
syn keyword plotConst trianglepattern labeloptions
syn keyword plotConst heads arrowstyle as rto
syn keyword plotConst boxes filledcurves financebars candlesticks
syn keyword plotConst boxerrorbars boxxyerrorbars xerrorbars xerrorlines
syn keyword plotConst xyerrorbars xyerrorlines yerrorbars yerrorlines
syn keyword plotConst dots fsteps histeps impulses lines linespoints steps
syn keyword plotConst points vectors
syn keyword plotConst binary matrix axis autofreq
syn keyword plotConst loadpath fontpath logfile datafile file
syn keyword plotConst scansautomatic scansbackward scansforward separator
syn keyword plotConst corners2color mean median geomean
syn keyword plotConst clip1in clip4in c1 c2 c3 c4
syn keyword plotConst flush implicit explicit
syn keyword plotConst order auto levels discrete incremental
syn keyword plotConst closed commentschars
syn keyword plotConst data defined
syn keyword plotConst font function functions height width
syn keyword plotConst map maxcolors missing model
syn keyword plotConst rgbformulae samplen spacing
hi def link plotConst Constant
" --- Keyword ---
syn keyword plotKW all using index every
syn keyword plotKW at by from to with
syn keyword plotKW x y z
hi def link plotKW Keyword
" --- Comment ---
syn match plotComment "#.*"
hi def link plotComment Comment
" --- Todo ---
syn keyword plotTodo contained TODO FIXME XXX
hi def link plotTodo Todo
let b:current_syntax = "gnuplot"

View File

@ -0,0 +1,2 @@
set softtabstop=2
set sw=2

View File

@ -0,0 +1,3 @@
set textwidth=78
set softtabstop=4
set shiftwidth=4

View File

@ -0,0 +1,2 @@
set sts=2
set sw=2

View File

@ -0,0 +1,2 @@
set softtabstop=2
set shiftwidth=2

View File

@ -0,0 +1,2 @@
set softtabstop=4
set shiftwidth=4

View File

@ -0,0 +1,2 @@
set softtabstop=2
set shiftwidth=2

View File

@ -0,0 +1,2 @@
set softtabstop=2
set shiftwidth=2

View File

@ -0,0 +1,2 @@
set softtabstop=2
set shiftwidth=2

View File

@ -0,0 +1,80 @@
" Vim syntax file
" Language: Cisco IOS config file
" Last Change: 2008-07-16
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
setlocal iskeyword+=-
syn match ciscoComment "^\s*!.*$"
hi def link ciscoComment Comment
syn match ciscoIpAddr /\<\(25[0-5]\|2[0-4][0-9]\|[01]\?[0-9][0-9]\?\)\.\(25[0-5]\|2[0-4][0-9]\|[01]\?[0-9][0-9]\?\)\.\(25[0-5]\|2[0-4][0-9]\|[01]\?[0-9][0-9]\?\)\.\(25[0-5]\|2[0-4][0-9]\|[01]\?[0-9][0-9]\?\)\>/
hi def link ciscoIpAddr Number
syn match ciscoIfName /\<\(Loopback\|Tunnel\|Dialer\)[0-9][0-9]*\>/
syn match ciscoIfName +\<\(Ethernet\|FastEthernet\|GigabitEthernet\)[0-9][0-9]*/[0-9][0-9]*\(/[0-9][0-9]*\)\?\(\.[0-9][0-9]*\)\?\>+
syn match ciscoIfName +\<ATM[0-9][0-9]*\(/[0-9][0-9]*\)*\(\.[0-9][0-9]*\)\?\>+
hi def link ciscoIfName Identifier
syn match ciscoWord contained +[a-zA-Z0-9-_]*+
hi def link ciscoWord String
syn region ciscoUsernames start=+^username\s+ skip=+^username\s+ end=+^\S+me=s-1 fold
syn region ciscoIpHosts start=+^ip host\s+ skip=+^ip host\s+ end=+^\S+me=s-1 fold
syn region ciscoInterfaces start=+^interface\s+ skip=+^\(!\n\)\?interface\s+ end=+^\S+me=s-1 fold contains=ciscoInterfaceRegion
syn region ciscoInterfaceRegion contained start=+^interface\s+ end=+^\S+me=s-1 fold contains=ciscoIpAddr,ciscoIfName,ciscoComment
syn region ciscoRouters start=+^router\s+ skip=+^\(!\n\)\?router\s+ end=+^\S+me=s-1 fold contains=ciscoRouterRegion
syn region ciscoRouterRegion start=+^router\s+ end=+^\S+me=s-1 contained fold contains=ciscoIpAddr,ciscoIfName,ciscoComment
syn region ciscoIpRoutes start=+^ip route\s+ end=+^\(ip route\)\@!+me=s-1 fold contains=ciscoIpRoute
syn match ciscoIpRoute +^ip route.*$+ contained skipwhite contains=ciscoIpAddr,ciscoNumber,ciscoIfName
syn region ciscoIpAccessLists start=+^ip access-list\s+ skip=+^\(!\n\)\?ip access-list\s+ end=+^\S+me=s-1 fold contains=ciscoIpAccessList
syn region ciscoIpAccessList contained start=+^ip access-list\s+ end=+^\S+me=s-1 fold contains=ciscoIpAccessListNamed,ciscoIpAddr,ciscoIfName,ciscoComment,ciscoAclKeywords,ciscoAclOperator
syn match ciscoIpAccessListNamed +^ip access-list \(standard\|extended\) + contained nextgroup=ciscoWord skipwhite
syn keyword ciscoAclKeywords contained skipwhite host any
syn keyword ciscoAclOperator contained skipwhite eq ne
hi def link ciscoAclKeywords Keyword
hi def link ciscoAclOperator Special
syn region ciscoAccessLists start=+^access-list\s+ skip=+^access-list\s+ end=+^\S+me=s-1 fold contains=ciscoAccessList
syn region ciscoAccessList start=+^access-list \z(\d\+\)\ + skip=+^access-list \z1 + end=+^\S+me=s-1 contained fold contains=ciscoIpAddr,ciscoIfName
syn region ciscoRouteMaps start=+^route-map\s+ skip=+^\(!\n\)\?route-map\s+ end=+^\S+me=s-1 fold contains=ciscoRouteMap
syn region ciscoRouteMap contained start=+^route-map\s+ end=+^\S+me=s-1 fold contains=ciscoIpAddr,ciscoIfName,ciscoComment
syn region ciscoCryptoIsakmp start=+^crypto isakmp\s+ end=+^\S+me=s-1 fold
syn region ciscoCryptoIsakmpKeys start=+^crypto isakmp key\s+ skip=+^crypto isakmp key\s+ end=+^\S+me=s-1 fold
syn region ciscoCryptoIpsecTses start=+^crypto ipsec transform-set\s+ skip=+^crypto ipsec transform-set\s+ end=+^\S+me=s-1 fold contains=ciscoCryptoIpsecTs
syn match ciscoCryptoIpsecTs contained +^crypto ipsec transform-set + nextgroup=ciscoWord skipwhite
syn region ciscoCryptoMaps start=+^crypto map\s+ skip=+^crypto map\s+ end=+^\S+me=s-1 fold contains=ciscoCryptoMap
syn region ciscoCryptoMap start=+^crypto map \z(\S\+\)\ + skip=+^crypto map \z1 + end=+^\S+me=s-1 contained fold contains=ciscoCryptoMapEntry
syn region ciscoCryptoMapEntry contained start=+^crypto map\s+ end=+^\S+me=s-1 fold contains=ciscoCryptoMapName,ciscoIpAddr
syn match ciscoCryptoMapName contained +^crypto map + nextgroup=ciscoWord skipwhite
set foldmethod=syntax
let b:current_syntax = "ciscoconfig"
" vim: set ts=4

View File

@ -0,0 +1,26 @@
" Vim syntax file
" Language: Cisco IOS "show ip route"
" Last Change: 2008-03-13
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn match ciscoIpAddr /\<\(25[0-5]\|2[0-4][0-9]\|[01]\?[0-9][0-9]\?\)\.\(25[0-5]\|2[0-4][0-9]\|[01]\?[0-9][0-9]\?\)\.\(25[0-5]\|2[0-4][0-9]\|[01]\?[0-9][0-9]\?\)\.\(25[0-5]\|2[0-4][0-9]\|[01]\?[0-9][0-9]\?\)\>/
hi def link ciscoIpAddr Number
syn match ciscoIfName /\<\(Loopback\|Tunnel\|Dialer\)[0-9][0-9]*\>/
syn match ciscoIfName +\<\(Ethernet\|FastEthernet\|ATM\)[0-9][0-9]*/[0-9][0-9]*\(/[0-9][0-9]*\)\?\(\.[0-9][0-9]*\)\?\>+
hi def link ciscoIfName Identifier
syn region ciscoNetwork start=+^.* is \(variably \)\?subnetted+ end=+^.* is \(variably \)\?subnetted+me=s-1 fold contains=ciscoIpAddr,ciscoIfName
set foldmethod=syntax
let b:current_syntax = "ciscoiproute"
" vim: set ts=4

View File

@ -0,0 +1,861 @@
" Vim completion script
" Language: HTML and XHTML
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" Last Change: 2006 Oct 19
" Modified: othree <othree@gmail.com>
" Changes: Add HTML5, WAI-ARIA support
" Last Change: 2010 Sep 25
if !exists('g:aria_attributes_complete')
let g:aria_attributes_complete = 1
endif
function! htmlcomplete#CompleteTags(findstart, base)
if a:findstart
" locate the start of the word
let line = getline('.')
let start = col('.') - 1
let curline = line('.')
let compl_begin = col('.') - 2
while start >= 0 && line[start - 1] =~ '\(\k\|[!:.-]\)'
let start -= 1
endwhile
" Handling of entities {{{
if start >= 0 && line[start - 1] =~ '&'
let b:entitiescompl = 1
let b:compl_context = ''
return start
endif
" }}}
" Handling of <style> tag {{{
let stylestart = searchpair('<style\>', '', '<\/style\>', "bnW")
let styleend = searchpair('<style\>', '', '<\/style\>', "nW")
if stylestart != 0 && styleend != 0
if stylestart <= curline && styleend >= curline
let start = col('.') - 1
let b:csscompl = 1
while start >= 0 && line[start - 1] =~ '\(\k\|-\)'
let start -= 1
endwhile
endif
endif
" }}}
" Handling of <script> tag {{{
let scriptstart = searchpair('<script\>', '', '<\/script\>', "bnW")
let scriptend = searchpair('<script\>', '', '<\/script\>', "nW")
if scriptstart != 0 && scriptend != 0
if scriptstart <= curline && scriptend >= curline
let start = col('.') - 1
let b:jscompl = 1
let b:jsrange = [scriptstart, scriptend]
while start >= 0 && line[start - 1] =~ '\k'
let start -= 1
endwhile
" We are inside of <script> tag. But we should also get contents
" of all linked external files and (secondary, less probably) other <script> tags
" This logic could possible be done in separate function - may be
" reused in events scripting (also with option could be reused for
" CSS
let b:js_extfiles = []
let l = line('.')
let c = col('.')
call cursor(1,1)
while search('<\@<=script\>', 'W') && line('.') <= l
if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment'
let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1')
if filereadable(sname)
let b:js_extfiles += readfile(sname)
endif
endif
endwhile
call cursor(1,1)
let js_scripttags = []
while search('<script\>', 'W') && line('.') < l
if matchstr(getline('.'), '<script[^>]*src') == ''
let js_scripttag = getline(line('.'), search('</script>', 'W'))
let js_scripttags += js_scripttag
endif
endwhile
let b:js_extfiles += js_scripttags
call cursor(l,c)
unlet! l c
endif
endif
" }}}
if !exists("b:csscompl") && !exists("b:jscompl")
let b:compl_context = getline('.')[0:(compl_begin)]
if b:compl_context !~ '<[^>]*$'
" Look like we may have broken tag. Check previous lines.
let i = 1
while 1
let context_line = getline(curline-i)
if context_line =~ '<[^>]*$'
" Yep, this is this line
let context_lines = getline(curline-i, curline-1) + [b:compl_context]
let b:compl_context = join(context_lines, ' ')
break
elseif context_line =~ '>[^<]*$' || i == curline
" We are in normal tag line, no need for completion at all
" OR reached first line without tag at all
let b:compl_context = ''
break
endif
let i += 1
endwhile
" Make sure we don't have counter
unlet! i
endif
let b:compl_context = matchstr(b:compl_context, '.*\zs<.*')
" Return proper start for on-events. Without that beginning of
" completion will be badly reported
if b:compl_context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$'
let start = col('.') - 1
while start >= 0 && line[start - 1] =~ '\k'
let start -= 1
endwhile
endif
" If b:compl_context begins with <? we are inside of PHP code. It
" wasn't closed so PHP completion passed it to HTML
if &filetype =~? 'php' && b:compl_context =~ '^<?'
let b:phpcompl = 1
let start = col('.') - 1
while start >= 0 && line[start - 1] =~ '[a-zA-Z_0-9\x7f-\xff$]'
let start -= 1
endwhile
endif
else
let b:compl_context = getline('.')[0:compl_begin]
endif
return start
else
" Initialize base return lists
let res = []
let res2 = []
" a:base is very short - we need context
let context = b:compl_context
" Check if we should do CSS completion inside of <style> tag
" or JS completion inside of <script> tag or PHP completion in case of <?
" tag AND &ft==php
if exists("b:csscompl")
unlet! b:csscompl
let context = b:compl_context
unlet! b:compl_context
return csscomplete#CompleteCSS(0, context)
elseif exists("b:jscompl")
unlet! b:jscompl
return javascriptcomplete#CompleteJS(0, a:base)
elseif exists("b:phpcompl")
unlet! b:phpcompl
let context = b:compl_context
return phpcomplete#CompletePHP(0, a:base)
else
if len(b:compl_context) == 0 && !exists("b:entitiescompl")
return []
endif
let context = matchstr(b:compl_context, '.\zs.*')
endif
unlet! b:compl_context
" Entities completion {{{
if exists("b:entitiescompl")
unlet! b:entitiescompl
if !exists("b:html_doctype")
call htmlcomplete#CheckDoctype()
endif
if !exists("b:html_omni")
"runtime! autoload/xml/xhtml10s.vim
call htmlcomplete#LoadData()
endif
if g:aria_attributes_complete == 1 && !exists("b:aria_omni")
call htmlcomplete#LoadAria()
endif
let entities = b:html_omni['vimxmlentities']
if len(a:base) == 1
for m in entities
if m =~ '^'.a:base
call add(res, m.';')
endif
endfor
return res
else
for m in entities
if m =~? '^'.a:base
call add(res, m.';')
elseif m =~? a:base
call add(res2, m.';')
endif
endfor
return res + res2
endif
endif
" }}}
if context =~ '>'
" Generally if context contains > it means we are outside of tag and
" should abandon action - with one exception: <style> span { bo
if context =~ 'style[^>]\{-}>[^<]\{-}$'
return csscomplete#CompleteCSS(0, context)
elseif context =~ 'script[^>]\{-}>[^<]\{-}$'
let b:jsrange = [line('.'), search('<\/script\>', 'nW')]
return javascriptcomplete#CompleteJS(0, context)
else
return []
endif
endif
" If context contains > it means we are already outside of tag and we
" should abandon action
" If context contains white space it is attribute.
" It can be also value of attribute.
" We have to get first word to offer proper completions
if context == ''
let tag = ''
else
let tag = split(context)[0]
" Detect if tag is uppercase to return in proper case,
" we need to make it lowercase for processing
if tag =~ '^\u*$'
let uppercase_tag = 1
let tag = tolower(tag)
else
let uppercase_tag = 0
endif
endif
" Get last word, it should be attr name
let attr = matchstr(context, '\S\+="[^"]*$')
if attr == ''
let attr = matchstr(context, '.*\s\zs.*')
endif
" Possible situations where any prediction would be difficult:
" 1. Events attributes
if context =~ '\s'
" Sort out style, class, and on* cases
if context =~? "\\s\\(on[a-z]+\\|id\\|style\\|class\\)\\s*=\\s*[\"']"
" Id, class completion {{{
if context =~? "\\(id\\|class\\)\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
if context =~? "class\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
let search_for = "class"
elseif context =~? "id\\s*=\\s*[\"'][a-zA-Z0-9_ -]*$"
let search_for = "id"
endif
" Handle class name completion
" 1. Find lines of <link stylesheet>
" 1a. Check file for @import
" 2. Extract filename(s?) of stylesheet,
call cursor(1,1)
let head = getline(search('<head\>'), search('<\/head>'))
let headjoined = join(copy(head), ' ')
if headjoined =~ '<style'
" Remove possibly confusing CSS operators
let stylehead = substitute(headjoined, '+>\*[,', ' ', 'g')
if search_for == 'class'
let styleheadlines = split(stylehead)
let headclasslines = filter(copy(styleheadlines), "v:val =~ '\\([a-zA-Z0-9:]\\+\\)\\?\\.[a-zA-Z0-9_-]\\+'")
else
let stylesheet = split(headjoined, '[{}]')
" Get all lines which fit id syntax
let classlines = filter(copy(stylesheet), "v:val =~ '#[a-zA-Z0-9_-]\\+'")
" Filter out possible color definitions
call filter(classlines, "v:val !~ ':\\s*#[a-zA-Z0-9_-]\\+'")
" Filter out complex border definitions
call filter(classlines, "v:val !~ '\\(none\\|hidden\\|dotted\\|dashed\\|solid\\|double\\|groove\\|ridge\\|inset\\|outset\\)\\s*#[a-zA-Z0-9_-]\\+'")
let templines = join(classlines, ' ')
let headclasslines = split(templines)
call filter(headclasslines, "v:val =~ '#[a-zA-Z0-9_-]\\+'")
endif
let internal = 1
else
let internal = 0
endif
let styletable = []
let secimportfiles = []
let filestable = filter(copy(head), "v:val =~ '\\(@import\\|link.*stylesheet\\)'")
for line in filestable
if line =~ "@import"
let styletable += [matchstr(line, "import\\s\\+\\(url(\\)\\?[\"']\\?\\zs\\f\\+\\ze")]
elseif line =~ "<link"
let styletable += [matchstr(line, "href\\s*=\\s*[\"']\\zs\\f\\+\\ze")]
endif
endfor
for file in styletable
if filereadable(file)
let stylesheet = readfile(file)
let secimport = filter(copy(stylesheet), "v:val =~ '@import'")
if len(secimport) > 0
for line in secimport
let secfile = matchstr(line, "import\\s\\+\\(url(\\)\\?[\"']\\?\\zs\\f\\+\\ze")
let secfile = fnamemodify(file, ":p:h").'/'.secfile
let secimportfiles += [secfile]
endfor
endif
endif
endfor
let cssfiles = styletable + secimportfiles
let classes = []
for file in cssfiles
if filereadable(file)
let stylesheet = readfile(file)
let stylefile = join(stylesheet, ' ')
let stylefile = substitute(stylefile, '+>\*[,', ' ', 'g')
if search_for == 'class'
let stylesheet = split(stylefile)
let classlines = filter(copy(stylesheet), "v:val =~ '\\([a-zA-Z0-9:]\\+\\)\\?\\.[a-zA-Z0-9_-]\\+'")
else
let stylesheet = split(stylefile, '[{}]')
" Get all lines which fit id syntax
let classlines = filter(copy(stylesheet), "v:val =~ '#[a-zA-Z0-9_-]\\+'")
" Filter out possible color definitions
call filter(classlines, "v:val !~ ':\\s*#[a-zA-Z0-9_-]\\+'")
" Filter out complex border definitions
call filter(classlines, "v:val !~ '\\(none\\|hidden\\|dotted\\|dashed\\|solid\\|double\\|groove\\|ridge\\|inset\\|outset\\)\\s*#[a-zA-Z0-9_-]\\+'")
let templines = join(classlines, ' ')
let stylelines = split(templines)
let classlines = filter(stylelines, "v:val =~ '#[a-zA-Z0-9_-]\\+'")
endif
" We gathered classes definitions from all external files
let classes += classlines
endif
endfor
if internal == 1
let classes += headclasslines
endif
if search_for == 'class'
let elements = {}
for element in classes
if element =~ '^\.'
let class = matchstr(element, '^\.\zs[a-zA-Z][a-zA-Z0-9_-]*\ze')
let class = substitute(class, ':.*', '', '')
if has_key(elements, 'common')
let elements['common'] .= ' '.class
else
let elements['common'] = class
endif
else
let class = matchstr(element, '[a-zA-Z1-6]*\.\zs[a-zA-Z][a-zA-Z0-9_-]*\ze')
let tagname = tolower(matchstr(element, '[a-zA-Z1-6]*\ze.'))
if tagname != ''
if has_key(elements, tagname)
let elements[tagname] .= ' '.class
else
let elements[tagname] = class
endif
endif
endif
endfor
if has_key(elements, tag) && has_key(elements, 'common')
let values = split(elements[tag]." ".elements['common'])
elseif has_key(elements, tag) && !has_key(elements, 'common')
let values = split(elements[tag])
elseif !has_key(elements, tag) && has_key(elements, 'common')
let values = split(elements['common'])
else
return []
endif
elseif search_for == 'id'
" Find used IDs
" 1. Catch whole file
let filelines = getline(1, line('$'))
" 2. Find lines with possible id
let used_id_lines = filter(filelines, 'v:val =~ "id\\s*=\\s*[\"''][a-zA-Z0-9_-]\\+"')
" 3a. Join all filtered lines
let id_string = join(used_id_lines, ' ')
" 3b. And split them to be sure each id is in separate item
let id_list = split(id_string, 'id\s*=\s*')
" 4. Extract id values
let used_id = map(id_list, 'matchstr(v:val, "[\"'']\\zs[a-zA-Z0-9_-]\\+\\ze")')
let joined_used_id = ','.join(used_id, ',').','
let allvalues = map(classes, 'matchstr(v:val, ".*#\\zs[a-zA-Z0-9_-]\\+")')
let values = []
for element in classes
if joined_used_id !~ ','.element.','
let values += [element]
endif
endfor
endif
" We need special version of sbase
let classbase = matchstr(context, ".*[\"']")
let classquote = matchstr(classbase, '.$')
let entered_class = matchstr(attr, ".*=\\s*[\"']\\zs.*")
for m in sort(values)
if m =~? '^'.entered_class
call add(res, m . classquote)
elseif m =~? entered_class
call add(res2, m . classquote)
endif
endfor
return res + res2
elseif context =~? "style\\s*=\\s*[\"'][^\"']*$"
return csscomplete#CompleteCSS(0, context)
endif
" }}}
" Complete on-events {{{
if context =~? 'on[a-z]*\s*=\s*\(''[^'']*\|"[^"]*\)$'
" We have to:
" 1. Find external files
let b:js_extfiles = []
let l = line('.')
let c = col('.')
call cursor(1,1)
while search('<\@<=script\>', 'W') && line('.') <= l
if synIDattr(synID(line('.'),col('.')-1,0),"name") !~? 'comment'
let sname = matchstr(getline('.'), '<script[^>]*src\s*=\s*\([''"]\)\zs.\{-}\ze\1')
if filereadable(sname)
let b:js_extfiles += readfile(sname)
endif
endif
endwhile
" 2. Find at least one <script> tag
call cursor(1,1)
let js_scripttags = []
while search('<script\>', 'W') && line('.') < l
if matchstr(getline('.'), '<script[^>]*src') == ''
let js_scripttag = getline(line('.'), search('</script>', 'W'))
let js_scripttags += js_scripttag
endif
endwhile
let b:js_extfiles += js_scripttags
" 3. Proper call for javascriptcomplete#CompleteJS
call cursor(l,c)
let js_context = matchstr(a:base, '\k\+$')
let js_shortcontext = substitute(a:base, js_context.'$', '', '')
let b:compl_context = context
let b:jsrange = [l, l]
unlet! l c
return javascriptcomplete#CompleteJS(0, js_context)
endif
" }}}
let stripbase = matchstr(context, ".*\\(on[a-zA-Z]*\\|style\\|class\\)\\s*=\\s*[\"']\\zs.*")
" Now we have context stripped from all chars up to style/class.
" It may fail with some strange style value combinations.
if stripbase !~ "[\"']"
return []
endif
endif
" Value of attribute completion {{{
" If attr contains =\s*[\"'] we catched value of attribute
if attr =~ "=\s*[\"']" || attr =~ "=\s*$"
" Let do attribute specific completion
let attrname = matchstr(attr, '.*\ze\s*=')
let entered_value = matchstr(attr, ".*=\\s*[\"']\\?\\zs.*")
let values = []
" Load data {{{
if !exists("b:html_doctype")
call htmlcomplete#CheckDoctype()
endif
if !exists("b:html_omni")
"runtime! autoload/xml/xhtml10s.vim
call htmlcomplete#LoadData()
endif
if g:aria_attributes_complete == 1 && !exists("b:aria_omni")
call htmlcomplete#LoadAria()
endif
" }}}
if attrname == 'href'
" Now we are looking for local anchors defined by name or id
if entered_value =~ '^#'
let file = join(getline(1, line('$')), ' ')
" Split it be sure there will be one id/name element in
" item, it will be also first word [a-zA-Z0-9_-] in element
let oneelement = split(file, "\\(meta \\)\\@<!\\(name\\|id\\)\\s*=\\s*[\"']")
for i in oneelement
let values += ['#'.matchstr(i, "^[a-zA-Z][a-zA-Z0-9%_-]*")]
endfor
endif
else
if has_key(b:html_omni, tag) && has_key(b:html_omni[tag][1], attrname)
let values = b:html_omni[tag][1][attrname]
elseif attrname =~ '^aria-' && exists("b:aria_omni") && has_key(b:aria_omni['aria_attributes'], attrname)
let values = b:aria_omni['aria_attributes'][attrname]
else
return []
endif
endif
if len(values) == 0
return []
endif
" We need special version of sbase
let attrbase = matchstr(context, ".*[\"']")
let attrquote = matchstr(attrbase, '.$')
if attrquote !~ "['\"]"
let attrquoteopen = '"'
let attrquote = '"'
else
let attrquoteopen = ''
endif
" Multi value attributes don't need ending quote
let info = ''
if has_key(b:html_omni['vimxmlattrinfo'], attrname)
let info = b:html_omni['vimxmlattrinfo'][attrname][0]
elseif exists("b:aria_omni") && has_key(b:aria_omni['vimariaattrinfo'], attrname)
let info = b:aria_omni['vimariaattrinfo'][attrname][0]
endif
if info =~ "^\\*"
let attrquote = ''
endif
if len(entered_value) > 0
if entered_value =~ "\\s$"
let entered_value = ''
else
let entered_value = split(entered_value)[-1]
endif
endif
for m in values
" This if is needed to not offer all completions as-is
" alphabetically but sort them. Those beginning with entered
" part will be as first choices
if m =~ '^'.entered_value
call add(res, attrquoteopen . m . attrquote)
elseif m =~ entered_value
call add(res2, attrquoteopen . m . attrquote)
endif
endfor
return res + res2
endif
" }}}
" Attribute completion {{{
" Shorten context to not include last word
let sbase = matchstr(context, '.*\ze\s.*')
" Load data {{{
if !exists("b:html_doctype")
call htmlcomplete#CheckDoctype()
endif
if !exists("b:html_omni")
call htmlcomplete#LoadData()
endif
if g:aria_attributes_complete == 1 && !exists("b:aria_omni")
call htmlcomplete#LoadAria()
endif
" }}}
if has_key(b:html_omni, tag)
let attrs = keys(b:html_omni[tag][1])
else
return []
endif
if exists("b:aria_omni")
let roles = []
if has_key(b:aria_omni['default_role'], tag)
let roles = [b:aria_omni['default_role'][tag]]
endif
if context =~ 'role='
let start = matchend(context, "role=['\"]")
let end = matchend(context, "[a-z ]\\+['\"]", start)
if start != -1 && end != -1
let roles = split(strpart(context, start, end-start-1), " ")
endif
endif
for i in range(len(roles))
let role = roles[i]
if has_key(b:aria_omni['role_attributes'], role)
let attrs = extend(attrs, b:aria_omni['role_attributes'][role])
endif
endfor
endif
for m in sort(attrs)
if m =~ '^'.attr
call add(res, m)
elseif m =~ attr
call add(res2, m)
endif
endfor
"let menu = res + res2
let menu = res
if has_key(b:html_omni, 'vimxmlattrinfo') || (exists("b:aria_omni") && has_key(b:aria_omni, 'vimariaattrinfo'))
let final_menu = []
for i in range(len(menu))
let item = menu[i]
if has_key(b:html_omni['vimxmlattrinfo'], item)
let m_menu = b:html_omni['vimxmlattrinfo'][item][0]
let m_info = b:html_omni['vimxmlattrinfo'][item][1]
elseif exists("b:aria_omni") && has_key(b:aria_omni['vimariaattrinfo'], item)
let m_menu = b:aria_omni['vimariaattrinfo'][item][0]
let m_info = b:aria_omni['vimariaattrinfo'][item][1]
else
let m_menu = ''
let m_info = ''
endif
if item =~ '^aria-' && exists("b:aria_omni")
if len(b:aria_omni['aria_attributes'][item]) > 0 && b:aria_omni['aria_attributes'][item][0] =~ '^\(BOOL\|'.item.'\)$'
let item = item
let m_menu = 'Bool'
else
let item .= '="'
endif
else
if len(b:html_omni[tag][1][item]) > 0 && b:html_omni[tag][1][item][0] =~ '^\(BOOL\|'.item.'\)$'
let item = item
let m_menu = 'Bool'
else
let item .= '="'
endif
endif
let final_menu += [{'word':item, 'menu':m_menu, 'info':m_info}]
endfor
else
let final_menu = []
for i in range(len(menu))
let item = menu[i]
if len(b:html_omni[tag][1][item]) > 0 && b:html_omni[tag][1][item][0] =~ '^\(BOOL\|'.item.'\)$'
let item = item
else
let item .= '="'
endif
let final_menu += [item]
endfor
return final_menu
endif
return final_menu
endif
" }}}
" Close tag {{{
let b:unaryTagsStack = "area base br col command embed hr img input keygen link meta param source track wbr"
if context =~ '^\/'
if context =~ '^\/.'
return []
else
let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
return [opentag.">"]
endif
endif
" }}}
" Load data {{{
if !exists("b:html_doctype")
call htmlcomplete#CheckDoctype()
endif
if !exists("b:html_omni")
"runtime! autoload/xml/xhtml10s.vim
call htmlcomplete#LoadData()
endif
if g:aria_attributes_complete == 1 && !exists("b:aria_omni")
call htmlcomplete#LoadAria()
endif
" }}}
" Tag completion {{{
" Deal with tag completion.
let opentag = tolower(xmlcomplete#GetLastOpenTag("b:unaryTagsStack"))
" MM: TODO: GLOT works always the same but with some weird situation it
" behaves as intended in HTML but screws in PHP
if opentag == '' || &filetype == 'php' && !has_key(b:html_omni, opentag)
" Hack for sometimes failing GetLastOpenTag.
" As far as I tested fail isn't GLOT fault but problem
" of invalid document - not properly closed tags and other mish-mash.
" Also when document is empty. Return list of *all* tags.
let tags = keys(b:html_omni)
call filter(tags, 'v:val !~ "^vimxml"')
else
if has_key(b:html_omni, opentag)
let tags = b:html_omni[opentag][0]
else
return []
endif
endif
" }}}
if exists("uppercase_tag") && uppercase_tag == 1
let context = tolower(context)
endif
" Handle XML keywords: DOCTYPE
if opentag == ''
let tags = [
\ '!DOCTYPE html>',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
\ '!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/1999/xhtml">'
\ ] + sort(tags)
endif
"for m in sort(tags)
for m in tags
if m =~ '^'.context
call add(res, m)
elseif m =~ context
call add(res2, m)
endif
endfor
let menu = res + res2
if has_key(b:html_omni, 'vimxmltaginfo')
let final_menu = []
for i in range(len(menu))
let item = menu[i]
if has_key(b:html_omni['vimxmltaginfo'], item)
let m_menu = b:html_omni['vimxmltaginfo'][item][0]
let m_info = b:html_omni['vimxmltaginfo'][item][1]
else
let m_menu = ''
let m_info = ''
endif
if &filetype == 'html' && exists("uppercase_tag") && uppercase_tag == 1 && item !~ 'DOCTYPE'
let item = toupper(item)
endif
if item =~ 'DOCTYPE'
if item =~ 'DTD'
let abbr = 'DOCTYPE '.matchstr(item, 'DTD \zsX\?HTML .\{-}\ze\/\/')
else
let abbr = 'DOCTYPE HTML 5'
endif
else
let abbr = item
endif
let final_menu += [{'abbr':abbr, 'word':item, 'menu':m_menu, 'info':m_info}]
endfor
else
let final_menu = menu
endif
return final_menu
" }}}
endif
endfunction
function! htmlcomplete#LoadAria() " {{{
runtime! autoload/xml/aria.vim
if exists("g:xmldata_aria")
\ && has_key(g:xmldata_aria, 'default_role')
\ && has_key(g:xmldata_aria, 'role_attributes')
\ && has_key(g:xmldata_aria, 'vimariaattrinfo')
\ && has_key(g:xmldata_aria, 'aria_attributes')
let b:aria_omni = g:xmldata_aria
else
let g:aria_attributes_complete = 0
endif
endfunction
" }}}
function! htmlcomplete#LoadData() " {{{
if !exists("b:html_omni_flavor")
if &filetype == 'html'
let b:html_omni_flavor = 'html401t'
else
let b:html_omni_flavor = 'xhtml10s'
endif
endif
" With that if we still have bloated memory but create new buffer
" variables only by linking to existing g:variable, not sourcing whole
" file.
if exists('g:xmldata_'.b:html_omni_flavor)
exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
else
exe 'runtime! autoload/xml/'.b:html_omni_flavor.'.vim'
exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
endif
endfunction
" }}}
function! htmlcomplete#CheckDoctype() " {{{
if exists('b:html_omni_flavor')
let old_flavor = b:html_omni_flavor
else
let old_flavor = ''
endif
let i = 1
while i < 10 && i < line("$")
let line = getline(i)
if line =~ '<!DOCTYPE.*\<DTD HTML 3\.2'
let b:html_omni_flavor = 'html32'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Transitional'
let b:html_omni_flavor = 'html40t'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0 Frameset'
let b:html_omni_flavor = 'html40f'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.0'
let b:html_omni_flavor = 'html40s'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Transitional'
let b:html_omni_flavor = 'html401t'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01 Frameset'
let b:html_omni_flavor = 'html401f'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD HTML 4\.01'
let b:html_omni_flavor = 'html401s'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Transitional'
let b:html_omni_flavor = 'xhtml10t'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Frameset'
let b:html_omni_flavor = 'xhtml10f'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.0 Strict'
let b:html_omni_flavor = 'xhtml10s'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE.*\<DTD XHTML 1\.1'
let b:html_omni_flavor = 'xhtml11'
let b:html_doctype = 1
break
elseif line =~ '<!DOCTYPE html'
let b:html_omni_flavor = 'html5'
let b:html_doctype = 1
break
endif
let i += 1
endwhile
if !exists("b:html_doctype")
return
else
" Tie g:xmldata with b:html_omni this way we need to sourca data file only
" once, not every time per buffer.
if old_flavor == b:html_omni_flavor
return
else
if exists('g:xmldata_'.b:html_omni_flavor)
exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
else
exe 'runtime! autoload/xml/'.b:html_omni_flavor.'.vim'
exe 'let b:html_omni = g:xmldata_'.b:html_omni_flavor
endif
return
endif
endif
endfunction
" }}}
" vim:set foldmethod=marker:

4684
vim/autoload/rails.vim Normal file

File diff suppressed because it is too large Load Diff

232
vim/autoload/xml/aria.vim Normal file
View File

@ -0,0 +1,232 @@
" Vim completion for WAI-ARIA data file
" Language: HTML + WAI-ARIA
" Maintainer: othree <othree@gmail.com>
" Last Change: 2010 Sep 09
" WAI_ARIA: {{{
" Ref: http://www.w3.org/TR/wai-aria/
" Version: Draft 15 December 2009
let abstract_role = {}
let role_attributes = {}
let default_role = {}
" Ref: http://www.w3.org/TR/wai-aria/roles
" Version: Draft 15 December 2009
let widget_role = ['alert', 'alertdialog', 'button', 'checkbox', 'combobox', 'dialog', 'gridcell', 'link', 'log', 'marquee', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'progressbar', 'radio', 'radiogroup', 'scrollbar', 'slider', 'spinbutton', 'status', 'tab', 'tabpanel', 'textbox', 'timer', 'tooltip', 'treeitem', 'combobox', 'grid', 'listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid']
let document_structure = ['article', 'columnheader', 'definition', 'directory', 'document', 'group', 'heading', 'img', 'list', 'listitem', 'math', 'note', 'presentation', 'region', 'row', 'rowheader', 'separator']
let landmark_role = ['application', 'banner', 'complementary', 'contentinfo', 'form', 'main', 'navigation', 'search']
let role = extend(widget_role, document_structure)
let role = extend(role, landmark_role)
" http://www.w3.org/TR/wai-aria/states_and_properties#state_prop_taxonomy
"let global_states_and_properties = {'aria-atomic': ['true', 'false'], 'aria-busy': ['true', 'false'], 'aria-controls': [], 'aria-describedby': [], 'aria-disabled': ['true', 'false'], 'aria-dropeffect': ['copy', 'move', 'link', 'execute', 'popup', 'none'], 'aria-flowto': [], 'aria-grabbed': ['true', 'false', 'undefined'], 'aria-haspopup': ['true', 'false'], 'aria-hidden': ['true', 'false'], 'aria-invalid': ['grammar', 'spelling', 'true', 'false'], 'aria-label': [], 'aria-labelledby': [], 'aria-live': ['off', 'polite', 'assertive'], 'aria-owns': [], 'aria-relevant': ['additions', 'removals', 'text', 'all']}
let widget_attributes = {'aria-autocomplete': ['inline', 'list', 'both', 'none'], 'aria-checked': ['true', 'false', 'mixed', 'undefined'], 'aria-disabled': ['true', 'false'], 'aria-expanded': ['true', 'false', 'undefined'], 'aria-haspopup': ['true', 'false'], 'aria-hidden': ['true', 'false'], 'aria-invalid': ['grammar', 'spelling', 'true', 'false'], 'aria-label': [], 'aria-level': [], 'aria-multiline': ['true', 'false'], 'aria-multiselectable': ['true', 'false'], 'aria-orientation': ['horizontal', 'vertical'], 'aria-pressed': ['true', 'false', 'mixed', 'undefined'], 'aria-readonly': ['true', 'false'], 'aria-required': ['true', 'false'], 'aria-selected': ['true', 'false', 'undefined'], 'aria-sort': ['ascending', 'descending', 'none', 'other'], 'aria-valuemax': [], 'aria-valuemin': [], 'aria-valuenow': [], 'aria-valuetext': []}
let live_region_attributes = {'aria-atomic': ['true', 'false'], 'aria-busy': ['true', 'false'], 'aria-live': ['off', 'polite', 'assertive'], 'aria-relevant': ['additions', 'removals', 'text', 'all', 'additions text']}
let drag_and_drop_attributes = {'aria-dropeffect': ['copy', 'move', 'link', 'execute', 'popup', 'none'], 'aria-grabbed': ['true', 'false', 'undefined']}
let relationship_attributes = {'aria-activedescendant': [], 'aria-controls': [], 'aria-describedby': [], 'aria-flowto': [], 'aria-labelledby': [], 'aria-owns': [], 'aria-posinset': [], 'aria-setsize': []}
let aria_attributes = widget_attributes
let aria_attributes = extend(aria_attributes, live_region_attributes)
let aria_attributes = extend(aria_attributes, drag_and_drop_attributes)
let aria_attributes = extend(aria_attributes, relationship_attributes)
" Abstract Roles
let abstract_role['roletype'] = ['aria-atomic', 'aria-busy', 'aria-controls', 'aria-describedby', 'aria-disabled', 'aria-dropeffect', 'aria-flowto', 'aria-grabbed', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-label', 'aria-labelledby', 'aria-live', 'aria-owns', 'aria-relevant']
let role_attributes['default'] = abstract_role['roletype']
let abstract_role['structure'] = abstract_role['roletype']
let abstract_role['widget'] = abstract_role['roletype']
let abstract_role['window'] = abstract_role['roletype'] + ['aria-expanded']
let abstract_role['composite'] = abstract_role['widget'] + ['aria-activedescendant']
let abstract_role['input'] = abstract_role['widget']
let abstract_role['section'] = abstract_role['structure'] + ['aria-expanded']
let abstract_role['sectionhead'] = abstract_role['structure'] + ['aria-expanded']
let role_attributes['group'] = abstract_role['section']
let abstract_role['select'] = abstract_role['composite'] + role_attributes['group'] + abstract_role['input']
let abstract_role['range'] = abstract_role['input'] + ['aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext']
let role_attributes['region'] = abstract_role['section']
let abstract_role['landmark'] = role_attributes['region']
" Widget Roles
let role_attributes['list'] = role_attributes['region']
let role_attributes['listitem'] = abstract_role['section']
let role_attributes['dialog'] = abstract_role['window']
let role_attributes['menuitem'] = abstract_role['input']
let role_attributes['checkbox'] = abstract_role['input'] + ['aria-checked']
let role_attributes['menuitemcheckbox'] = role_attributes['menuitem'] + role_attributes['checkbox']
let role_attributes['option'] = abstract_role['input'] + ['aria-checked', 'aria-posinset', 'aria-selected', 'aria-setsize']
let role_attributes['radio'] = role_attributes['checkbox'] + role_attributes['option']
let role_attributes['directory'] = role_attributes['list']
let role_attributes['alert'] = role_attributes['region']
let role_attributes['alertdialog'] = role_attributes['alert'] + role_attributes['dialog']
let role_attributes['button'] = role_attributes['region'] + role_attributes['menuitemcheckbox']
let role_attributes['combobox'] = abstract_role['select'] + ['aria-expanded', 'aria-required']
let role_attributes['gridcell'] = abstract_role['section'] + abstract_role['widget']
let role_attributes['link'] = abstract_role['widget']
let role_attributes['log'] = role_attributes['region']
let role_attributes['marquee'] = role_attributes['region']
let role_attributes['menuitemradio'] = role_attributes['menuitemcheckbox'] + role_attributes['radio']
let role_attributes['progressbar'] = abstract_role['widget'] + ['aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext']
let role_attributes['radiogroup'] = abstract_role['select'] + ['aria-required']
let role_attributes['scrollbar'] = abstract_role['range'] + ['aria-controls', 'aria-orientation', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow']
let role_attributes['slider'] = abstract_role['range'] + ['aria-valuemax', 'aria-valuemin', 'aria-valuenow']
let role_attributes['spinbutton'] = abstract_role['composite'] + abstract_role['range'] + ['aria-required']
let role_attributes['status'] = abstract_role['composite'] + role_attributes['region']
let role_attributes['tab'] = abstract_role['sectionhead'] + abstract_role['widget'] + ['aria-selected']
let role_attributes['tabpanel'] = role_attributes['region']
let role_attributes['textbox'] = abstract_role['input'] + ['aria-autocomplete', 'aria-multiline', 'aria-readonly', 'aria-required']
let role_attributes['timer'] = role_attributes['status']
let role_attributes['tooltip'] = abstract_role['section']
let role_attributes['treeitem'] = role_attributes['listitem'] + role_attributes['option']
let role_attributes['grid'] = abstract_role['composite'] + role_attributes['region'] + ['aria-level', 'aria-multiselectable', 'aria-readonly']
let role_attributes['listbox'] = role_attributes['list'] + abstract_role['select'] + ['aria-multiselectable', 'aria-required']
let role_attributes['menu'] = role_attributes['list'] + abstract_role['select']
let role_attributes['menubar'] = role_attributes['menu']
let role_attributes['tablist'] = abstract_role['composite'] + role_attributes['directory']
let role_attributes['toolbar'] = role_attributes['group']
let role_attributes['tree'] = abstract_role['select'] + ['aria-multiselectable', 'aria-required']
let role_attributes['treegrid'] = role_attributes['grid'] + role_attributes['tree']
" Document Structure
let role_attributes['document'] = abstract_role['structure'] + ['aria-expanded']
let role_attributes['article'] = role_attributes['document'] + role_attributes['region']
let role_attributes['columnheader'] = role_attributes['gridcell'] + abstract_role['sectionhead'] + ['aria-sort']
let role_attributes['definition'] = abstract_role['section']
let role_attributes['heading'] = abstract_role['sectionhead'] + ['aria-level']
let role_attributes['img'] = abstract_role['section']
let role_attributes['math'] = abstract_role['section']
let role_attributes['note'] = abstract_role['section']
let role_attributes['presentation'] = abstract_role['structure']
let role_attributes['row'] = role_attributes['group'] + ['aria-level', 'aria-selected']
let role_attributes['rowheader'] = role_attributes['gridcell'] + abstract_role['sectionhead']
let role_attributes['separator'] = abstract_role['structure'] + ['aria-expanded']
" Landmark Roles
let role_attributes['application'] = abstract_role['landmark']
let role_attributes['banner'] = abstract_role['landmark']
let role_attributes['complementary'] = abstract_role['landmark']
let role_attributes['contentinfo'] = abstract_role['landmark']
let role_attributes['form'] = abstract_role['landmark']
let role_attributes['main'] = abstract_role['landmark']
let role_attributes['navigation'] = abstract_role['landmark']
let role_attributes['search'] = abstract_role['landmark']
" http://www.w3.org/TR/wai-aria/states_and_properties#state_prop_def
let aria_attributes_value = {
\ 'aria-autocomplete': ['ID', ''],
\ 'aria-checked': ['Token', ''],
\ 'aria-disabled': ['true/false', ''],
\ 'aria-expanded': ['Token', ''],
\ 'aria-haspopup': ['true/false', ''],
\ 'aria-hidden': ['true/false', ''],
\ 'aria-invalid': ['Token', ''],
\ 'aria-label': ['String', ''],
\ 'aria-level': ['Int', ''],
\ 'aria-multiline': ['true/false', ''],
\ 'aria-multiselectable': ['true/false', ''],
\ 'aria-orientation': ['Token', ''],
\ 'aria-pressed': ['Token', ''],
\ 'aria-readonly': ['true/false', ''],
\ 'aria-required': ['true/false', ''],
\ 'aria-selected': ['Token', ''],
\ 'aria-sort': ['Token', ''],
\ 'aria-valuemax': ['Number', ''],
\ 'aria-valuemin': ['Number', ''],
\ 'aria-valuenow': ['Number', ''],
\ 'aria-valuetext': ['String', ''],
\ 'aria-atomic': ['true/false', ''],
\ 'aria-busy': ['true/false', ''],
\ 'aria-live': ['Token', ''],
\ 'aria-relevant': ['*Token', ''],
\ 'aria-dropeffect': ['*Token', ''],
\ 'aria-grabbed': ['Token', ''],
\ 'aria-activedescendant': ['ID', ''],
\ 'aria-controls': ['*ID', ''],
\ 'aria-describedby': ['*ID', ''],
\ 'aria-flowto': ['*ID', ''],
\ 'aria-labelledby': ['*ID', ''],
\ 'aria-owns': ['*ID', ''],
\ 'aria-posinset': ['Int', ''],
\ 'aria-setsize': ['Int', '']
\ }
" http://dev.w3.org/html5/spec/content-models.html#annotations-for-assistive-technology-products-aria
let default_role = {
\ 'a': 'link',
\ 'area': 'link',
\ 'body': 'document',
\ 'button': 'button',
\ 'datalist': 'listbox',
\ 'h1': 'heading',
\ 'h2': 'heading',
\ 'h3': 'heading',
\ 'h4': 'heading',
\ 'h5': 'heading',
\ 'h6': 'heading',
\ 'hgroup': 'heading',
\ 'hr': 'separator',
\ 'img[alt=]': 'presentation',
\ 'input[type=button]': 'button',
\ 'input[type=email]': 'textbox',
\ 'input[type=image]': 'button',
\ 'input[type=number]': 'spinbutton',
\ 'input[type=password]': 'textbox',
\ 'input[type=range]': 'slider',
\ 'input[type=reset]': 'button',
\ 'input[type=search]': 'textbox',
\ 'input[type=submit]': 'button',
\ 'input[type=tel]': 'textbox',
\ 'input[type=text]': 'textbox',
\ 'input[list]': 'combobox',
\ 'input[type=url]': 'textbox',
\ 'input': 'textbox',
\ 'keygen': 'default',
\ 'label': 'default',
\ 'menu[type=list]': 'menu',
\ 'menu[type=toolbar]': 'toolbar',
\ 'menu': 'default',
\ 'link': 'link',
\ 'nav': 'navigation',
\ 'optgroup': 'default',
\ 'option': 'option',
\ 'progress': 'progressbar',
\ 'select': 'listbox',
\ 'summary': 'heading',
\ 'tbody': 'rowgroup',
\ 'td': 'gridcell',
\ 'textarea': 'textbox',
\ 'tfoot': 'rowgroup',
\ 'th[scope=col]': 'columnheader',
\ 'th[scope=row]': 'rowheader',
\ 'tr': 'row',
\ 'address': 'default',
\ 'article': 'article',
\ 'aside': 'note',
\ 'footer': 'default',
\ 'header': 'default',
\ 'details': 'group',
\ 'img': 'img',
\ 'input[type=checkbox]': 'checkbox',
\ 'input[type=radio]': 'radio',
\ 'li': 'listitem',
\ 'ol': 'list',
\ 'output': 'status',
\ 'section': 'region',
\ 'table': 'grid',
\ 'ul': 'list',
\ }
" }}}
let g:xmldata_aria = {
\ 'aria_attributes': aria_attributes,
\ 'role_attributes': role_attributes,
\ 'default_role': default_role,
\ 'vimariaattrinfo': aria_attributes_value
\ }

791
vim/autoload/xml/html5.vim Normal file
View File

@ -0,0 +1,791 @@
" Vim completion for HTML5 data file
" Language: HTML5
" Maintainer: othree <othree@gmail.com>
" Last Change: 2011 Apr 9
" Lang Tag: {{{
" Ref: http://www.iana.org/assignments/language-subtag-registry
" Version: 2010/09/07
" Description: only get two-letter language tag
let lang_tag = [
\ 'aa', 'ab', 'ae', 'af', 'ak', 'am', 'an', 'ar', 'as', 'av', 'ay', 'az', 'ba', 'be', 'bg', 'bh', 'bi', 'bm',
\ 'bn', 'bo', 'br', 'bs', 'ca', 'ce', 'ch', 'co', 'cr', 'cs', 'cu', 'cv', 'cy', 'da', 'de', 'dv', 'dz', 'ee',
\ 'el', 'en', 'eo', 'es', 'et', 'eu', 'fa', 'ff', 'fi', 'fj', 'fo', 'fr', 'fy', 'ga', 'gd', 'gl', 'gn', 'gu',
\ 'gv', 'ha', 'he', 'hi', 'ho', 'hr', 'ht', 'hu', 'hy', 'hz', 'ia', 'id', 'ie', 'ig', 'ii', 'ik', 'in', 'io',
\ 'is', 'it', 'iu', 'iw', 'ja', 'ji', 'jv', 'jw', 'ka', 'kg', 'ki', 'kj', 'kk', 'kl', 'km', 'kn', 'ko', 'kr',
\ 'ks', 'ku', 'kv', 'kw', 'ky', 'la', 'lb', 'lg', 'li', 'ln', 'lo', 'lt', 'lu', 'lv', 'mg', 'mh', 'mi', 'mk',
\ 'ml', 'mn', 'mo', 'mr', 'ms', 'mt', 'my', 'na', 'nb', 'nd', 'ne', 'ng', 'nl', 'nn', 'no', 'nr', 'nv', 'ny',
\ 'oc', 'oj', 'om', 'or', 'os', 'pa', 'pi', 'pl', 'ps', 'pt', 'qu', 'rm', 'rn', 'ro', 'ru', 'rw', 'sa', 'sc',
\ 'sd', 'se', 'sg', 'sh', 'si', 'sk', 'sl', 'sm', 'sn', 'so', 'sq', 'sr', 'ss', 'st', 'su', 'sv', 'sw', 'ta',
\ 'te', 'tg', 'th', 'ti', 'tk', 'tl', 'tn', 'to', 'tr', 'ts', 'tt', 'tw', 'ty', 'ug', 'uk', 'ur', 'uz', 've',
\ 'vi', 'vo', 'wa', 'wo', 'xh', 'yi', 'yo', 'za', 'zh', 'zu', 'zh-CN', 'zh-TW']
" }}}
" Charset: {{{
" Ref: http://www.iana.org/assignments/character-sets
" Version: 2010/09/07
let charset = [
\ 'ANSI_X3.4-1968', 'ISO_8859-1:1987', 'ISO_8859-2:1987', 'ISO_8859-3:1988', 'ISO_8859-4:1988', 'ISO_8859-5:1988',
\ 'ISO_8859-6:1987', 'ISO_8859-7:1987', 'ISO_8859-8:1988', 'ISO_8859-9:1989', 'ISO-8859-10', 'ISO_6937-2-add', 'JIS_X0201',
\ 'JIS_Encoding', 'Shift_JIS', 'Extended_UNIX_Code_Packed_Format_for_Japanese', 'Extended_UNIX_Code_Fixed_Width_for_Japanese',
\ 'BS_4730', 'SEN_850200_C', 'IT', 'ES', 'DIN_66003', 'NS_4551-1', 'NF_Z_62-010', 'ISO-10646-UTF-1', 'ISO_646.basic:1983',
\ 'INVARIANT', 'ISO_646.irv:1983', 'NATS-SEFI', 'NATS-SEFI-ADD', 'NATS-DANO', 'NATS-DANO-ADD', 'SEN_850200_B', 'KS_C_5601-1987',
\ 'ISO-2022-KR', 'EUC-KR', 'ISO-2022-JP', 'ISO-2022-JP-2', 'JIS_C6220-1969-jp', 'JIS_C6220-1969-ro', 'PT', 'greek7-old',
\ 'latin-greek', 'NF_Z_62-010_(1973)', 'Latin-greek-1', 'ISO_5427', 'JIS_C6226-1978', 'BS_viewdata', 'INIS', 'INIS-8',
\ 'INIS-cyrillic', 'ISO_5427:1981', 'ISO_5428:1980', 'GB_1988-80', 'GB_2312-80', 'NS_4551-2', 'videotex-suppl', 'PT2',
\ 'ES2', 'MSZ_7795.3', 'JIS_C6226-1983', 'greek7', 'ASMO_449', 'iso-ir-90', 'JIS_C6229-1984-a', 'JIS_C6229-1984-b',
\ 'JIS_C6229-1984-b-add', 'JIS_C6229-1984-hand', 'JIS_C6229-1984-hand-add', 'JIS_C6229-1984-kana', 'ISO_2033-1983',
\ 'ANSI_X3.110-1983', 'T.61-7bit', 'T.61-8bit', 'ECMA-cyrillic', 'CSA_Z243.4-1985-1', 'CSA_Z243.4-1985-2', 'CSA_Z243.4-1985-gr',
\ 'ISO_8859-6-E', 'ISO_8859-6-I', 'T.101-G2', 'ISO_8859-8-E', 'ISO_8859-8-I', 'CSN_369103', 'JUS_I.B1.002', 'IEC_P27-1',
\ 'JUS_I.B1.003-serb', 'JUS_I.B1.003-mac', 'greek-ccitt', 'NC_NC00-10:81', 'ISO_6937-2-25', 'GOST_19768-74', 'ISO_8859-supp',
\ 'ISO_10367-box', 'latin-lap', 'JIS_X0212-1990', 'DS_2089', 'us-dk', 'dk-us', 'KSC5636', 'UNICODE-1-1-UTF-7', 'ISO-2022-CN',
\ 'ISO-2022-CN-EXT', 'UTF-8', 'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'ISO-8859-16', 'GBK', 'GB18030', 'OSD_EBCDIC_DF04_15',
\ 'OSD_EBCDIC_DF03_IRV', 'OSD_EBCDIC_DF04_1', 'ISO-11548-1', 'KZ-1048', 'ISO-10646-UCS-2', 'ISO-10646-UCS-4', 'ISO-10646-UCS-Basic',
\ 'ISO-10646-Unicode-Latin1', 'ISO-10646-J-1', 'ISO-Unicode-IBM-1261', 'ISO-Unicode-IBM-1268', 'ISO-Unicode-IBM-1276',
\ 'ISO-Unicode-IBM-1264', 'ISO-Unicode-IBM-1265', 'UNICODE-1-1', 'SCSU', 'UTF-7', 'UTF-16BE', 'UTF-16LE', 'UTF-16', 'CESU-8',
\ 'UTF-32', 'UTF-32BE', 'UTF-32LE', 'BOCU-1', 'ISO-8859-1-Windows-3.0-Latin-1', 'ISO-8859-1-Windows-3.1-Latin-1',
\ 'ISO-8859-2-Windows-Latin-2', 'ISO-8859-9-Windows-Latin-5', 'hp-roman8', 'Adobe-Standard-Encoding', 'Ventura-US',
\ 'Ventura-International', 'DEC-MCS', 'IBM850', 'PC8-Danish-Norwegian', 'IBM862', 'PC8-Turkish', 'IBM-Symbols', 'IBM-Thai',
\ 'HP-Legal', 'HP-Pi-font', 'HP-Math8', 'Adobe-Symbol-Encoding', 'HP-DeskTop', 'Ventura-Math', 'Microsoft-Publishing',
\ 'Windows-31J', 'GB2312', 'Big5', 'macintosh', 'IBM037', 'IBM038', 'IBM273', 'IBM274', 'IBM275', 'IBM277', 'IBM278',
\ 'IBM280', 'IBM281', 'IBM284', 'IBM285', 'IBM290', 'IBM297', 'IBM420', 'IBM423', 'IBM424', 'IBM437', 'IBM500', 'IBM851',
\ 'IBM852', 'IBM855', 'IBM857', 'IBM860', 'IBM861', 'IBM863', 'IBM864', 'IBM865', 'IBM868', 'IBM869', 'IBM870', 'IBM871',
\ 'IBM880', 'IBM891', 'IBM903', 'IBM904', 'IBM905', 'IBM918', 'IBM1026', 'EBCDIC-AT-DE', 'EBCDIC-AT-DE-A', 'EBCDIC-CA-FR',
\ 'EBCDIC-DK-NO', 'EBCDIC-DK-NO-A', 'EBCDIC-FI-SE', 'EBCDIC-FI-SE-A', 'EBCDIC-FR', 'EBCDIC-IT', 'EBCDIC-PT', 'EBCDIC-ES',
\ 'EBCDIC-ES-A', 'EBCDIC-ES-S', 'EBCDIC-UK', 'EBCDIC-US', 'UNKNOWN-8BIT', 'MNEMONIC', 'MNEM', 'VISCII', 'VIQR', 'KOI8-R',
\ 'HZ-GB-2312', 'IBM866', 'IBM775', 'KOI8-U', 'IBM00858', 'IBM00924', 'IBM01140', 'IBM01141', 'IBM01142', 'IBM01143',
\ 'IBM01144', 'IBM01145', 'IBM01146', 'IBM01147', 'IBM01148', 'IBM01149', 'Big5-HKSCS', 'IBM1047', 'PTCP154', 'Amiga-1251',
\ 'KOI7-switched', 'BRF', 'TSCII', 'windows-1250', 'windows-1251', 'windows-1252', 'windows-1253', 'windows-1254', 'windows-1255',
\ 'windows-1256', 'windows-1257', 'windows-1258', 'TIS-620', ]
" }}}
" Attributes_and_Settings: {{{
let core_attributes = {'accesskey': [], 'class': [], 'contenteditable': ['true', 'false', ''], 'contextmenu': [], 'dir': ['ltr', 'rtl'], 'draggable': ['true', 'false'], 'hidden': ['hidden', ''], 'id': [], 'lang': lang_tag, 'spellcheck': ['true', 'false', ''], 'style': [], 'tabindex': [], 'title': []}
let xml_attributes = {'xml:lang': lang_tag, 'xml:space': ['preserve'], 'xml:base': [], 'xmlns': []}
let body_attributes = {}
let global_attributes = extend(core_attributes, xml_attributes)
if !exists('g:event_handler_attributes_complete')
let g:event_handler_attributes_complete = 1
endif
" http://dev.w3.org/html5/spec/Overview.html#attributes-1
let attributes_value = {
\ 'accept': ['MIME', ''],
\ 'accept-charset': ['Charset', ''],
\ 'accesskey': ['Character', ''],
\ 'action': ['URL', ''],
\ 'alt': ['Text', ''],
\ 'async': ['Bool', ''],
\ 'autocomplete': ['on/off', ''],
\ 'autofocus': ['Bool', ''],
\ 'autoplay': ['Bool', ''],
\ 'border': ['1', ''],
\ 'challenge': ['Text', ''],
\ 'charset': ['Charset', ''],
\ 'checked': ['Bool', ''],
\ 'cite': ['URL', ''],
\ 'class': ['*Token', ''],
\ 'cols': ['Int', ''],
\ 'colspan': ['Int', ''],
\ 'content': ['Text', ''],
\ 'contenteditable': ['true/false', ''],
\ 'contextmenu': ['ID', ''],
\ 'controls': ['Bool', ''],
\ 'coords': ['*Int', ''],
\ 'data': ['URL', ''],
\ 'datetime': ['Datetime', ''],
\ 'defer': ['Bool', ''],
\ 'dir': ['ltr/rtl', ''],
\ 'disabled': ['Bool', ''],
\ 'draggable': ['true/false', ''],
\ 'enctype': ['Token', ''],
\ 'for': ['ID', ''],
\ 'form': ['ID', ''],
\ 'formaction': ['URL', ''],
\ 'formenctype': ['Token', ''],
\ 'formmethod': ['HTTP Method', ''],
\ 'formnovalidate': ['Bool', ''],
\ 'formtarget': ['Name', ''],
\ 'headers': ['*ID', ''],
\ 'height': ['Int', ''],
\ 'hidden': ['Bool', ''],
\ 'high': ['Number', ''],
\ 'href': ['URL', ''],
\ 'hreflang': ['Lang Tag', ''],
\ 'http-equiv': ['Text', ''],
\ 'icon': ['URL', ''],
\ 'id': ['Text', ''],
\ 'ismap': ['Bool', ''],
\ 'keytype': ['Text', ''],
\ 'label': ['Text', ''],
\ 'lang': ['Lang Tag', ''],
\ 'list': ['ID', ''],
\ 'loop': ['Bool', ''],
\ 'low': ['Number', ''],
\ 'manifest': ['URL', ''],
\ 'max': ['Number', ''],
\ 'maxlength': ['Int', ''],
\ 'media': ['Text', ''],
\ 'method': ['HTTP Method', ''],
\ 'min': ['Number', ''],
\ 'multiple': ['Bool', ''],
\ 'name': ['Text', ''],
\ 'novalidate': ['Bool', ''],
\ 'open': ['Bool', ''],
\ 'optimum': ['Number', ''],
\ 'pattern': ['Pattern', ''],
\ 'placeholder': ['Text', ''],
\ 'poster': ['URL', ''],
\ 'preload': ['Token', ''],
\ 'pubdate': ['Bool', ''],
\ 'radiogroup': ['Text', ''],
\ 'readonly': ['Bool', ''],
\ 'rel': ['*Token', ''],
\ 'required': ['Bool', ''],
\ 'reversed': ['Bool', ''],
\ 'rows': ['Int', ''],
\ 'rowspan': ['Int', ''],
\ 'sandbox': ['*Token', ''],
\ 'spellcheck': ['true/false', ''],
\ 'scope': ['Token', ''],
\ 'scoped': ['Bool', ''],
\ 'seamless': ['Bool', ''],
\ 'selected': ['Bool', ''],
\ 'shape': ['Token', ''],
\ 'size': ['Int', ''],
\ 'sizes': ['*Token', ''],
\ 'span': ['Int', ''],
\ 'src': ['Int', ''],
\ 'srcdoc': ['Document', ''],
\ 'start': ['Int', ''],
\ 'step': ['Int', ''],
\ 'style': ['Style', ''],
\ 'summary': ['Text', ''],
\ 'tabindex': ['Int', ''],
\ 'target': ['Name', ''],
\ 'title': ['Text', ''],
\ 'type': ['Token', ''],
\ 'usemap': ['Name', ''],
\ 'value': ['Text', ''],
\ 'width': ['Int', ''],
\ 'wrap': ['soft/hard', ''],
\ 'xml:lang': ['Lang tag', ''],
\ 'xml:base': ['*URI', ''],
\ 'xml:space': ['preserve', ''],
\ 'xmlns': ['URI', ''],
\ 'version': ['HTML+RDFa 1.1', ''],
\ 'role': ['*Token', '']
\ }
if g:event_handler_attributes_complete == 1
let event_handler_attributes = {'onabort': [], 'onblur': [], 'oncanplay': [], 'oncanplaythrough': [], 'onchange': [], 'onclick': [], 'oncontextmenu': [], 'ondblclick': [], 'ondrag': [], 'ondragend': [], 'ondragenter': [], 'ondragleave': [], 'ondragover': [], 'ondragstart': [], 'ondrop': [], 'ondurationchange': [], 'onemptied': [], 'onended': [], 'onerror': [], 'onfocus': [], 'onformchange': [], 'onforminput': [], 'oninput': [], 'oninvalid': [], 'onkeydown': [], 'onkeypress': [], 'onkeyup': [], 'onload': [], 'onloadeddata': [], 'onloadedmetadata': [], 'onloadstart': [], 'onmousedown': [], 'onmousemove': [], 'onmouseout': [], 'onmouseover': [], 'onmouseup': [], 'onmousewheel': [], 'onpause': [], 'onplay': [], 'onplaying': [], 'onprogress': [], 'onratechange': [], 'onreadystatechange': [], 'onscroll': [], 'onseeked': [], 'onseeking': [], 'onselect': [], 'onshow': [], 'onstalled': [], 'onsubmit': [], 'onsuspend': [], 'ontimeupdate': [], 'onvolumechange': [], 'onwaiting': []}
let global_attributes = extend(global_attributes, event_handler_attributes)
let body_attributes = {'onafterprint': [], 'onbeforeprint': [], 'onbeforeunload': [], 'onblur': [], 'onerror': [], 'onfocus': [], 'onhashchange': [], 'onload': [], 'onmessage': [], 'onoffline': [], 'ononline': [], 'onpopstate': [], 'onredo': [], 'onresize': [], 'onstorage': [], 'onundo': [], 'onunload': []}
let event_attributes_value = {
\ 'onabort': ['Script', ''],
\ 'onafterprint': ['Script', ''],
\ 'onbeforeprint': ['Script', ''],
\ 'onbeforeunload': ['Script', ''],
\ 'onblur': ['Script', ''],
\ 'oncanplay': ['Script', ''],
\ 'oncanplaythrough': ['Script', ''],
\ 'onchange': ['Script', ''],
\ 'onclick': ['Script', ''],
\ 'oncontextmenu': ['Script', ''],
\ 'ondblclick': ['Script', ''],
\ 'ondrag': ['Script', ''],
\ 'ondragend': ['Script', ''],
\ 'ondragenter': ['Script', ''],
\ 'ondragleave': ['Script', ''],
\ 'ondragover': ['Script', ''],
\ 'ondragstart': ['Script', ''],
\ 'ondrop': ['Script', ''],
\ 'ondurationchange': ['Script', ''],
\ 'onemptied': ['Script', ''],
\ 'onended': ['Script', ''],
\ 'onerror': ['Script', ''],
\ 'onfocus': ['Script', ''],
\ 'onformchange': ['Script', ''],
\ 'onforminput': ['Script', ''],
\ 'onhashchange': ['Script', ''],
\ 'oninput': ['Script', ''],
\ 'oninvalid': ['Script', ''],
\ 'onkeydown': ['Script', ''],
\ 'onkeypress': ['Script', ''],
\ 'onkeyup': ['Script', ''],
\ 'onload': ['Script', ''],
\ 'onloadeddata': ['Script', ''],
\ 'onloadedmetadata': ['Script', ''],
\ 'onloadstart': ['Script', ''],
\ 'onmessage': ['Script', ''],
\ 'onmousedown': ['Script', ''],
\ 'onmousemove': ['Script', ''],
\ 'onmouseout': ['Script', ''],
\ 'onmouseover': ['Script', ''],
\ 'onmouseup': ['Script', ''],
\ 'onmousewheel': ['Script', ''],
\ 'onoffline': ['Script', ''],
\ 'ononline': ['Script', ''],
\ 'onpagehide': ['Script', ''],
\ 'onpageshow': ['Script', ''],
\ 'onpause': ['Script', ''],
\ 'onplay': ['Script', ''],
\ 'onplaying': ['Script', ''],
\ 'onpopstate': ['Script', ''],
\ 'onprogress': ['Script', ''],
\ 'onratechange': ['Script', ''],
\ 'onreadystatechange': ['Script', ''],
\ 'onredo': ['Script', ''],
\ 'onresize': ['Script', ''],
\ 'onscroll': ['Script', ''],
\ 'onseeked': ['Script', ''],
\ 'onseeking': ['Script', ''],
\ 'onselect': ['Script', ''],
\ 'onshow': ['Script', ''],
\ 'onstalled': ['Script', ''],
\ 'onstorage': ['Script', ''],
\ 'onsubmit': ['Script', ''],
\ 'onsuspend': ['Script', ''],
\ 'ontimeupdate': ['Script', ''],
\ 'onundo': ['Script', ''],
\ 'onunload': ['Script', ''],
\ 'onvolumechange': ['Script', ''],
\ 'onwaiting': ['Script', '']
\ }
let attributes_value = extend(attributes_value, event_attributes_value)
endif
if !exists('g:rdfa_attributes_complete')
let g:rdfa_attributes_complete = 1
endif
if g:rdfa_attributes_complete == 1
" http://www.w3.org/TR/rdfa-syntax/#s_metaAttributes
" http://www.w3.org/TR/rdfa-core/#s_syntax
let relrev = ['chapter', 'contents', 'copyright', 'first', 'glossary', 'help', 'icon', 'index', 'last', 'license', 'meta', 'next', 'p3pv1', 'prev', 'role', 'section', 'stylesheet', 'subsection', 'start', 'top', 'up']
let rdfa_attributes = {'about': [], 'content': [], 'datatype': [], 'prefix': [], 'profile': [], 'property': [], 'resource': [], 'rel': relrev, 'rev': relrev, 'typeof': [], 'vocab': []}
let global_attributes = extend(global_attributes, rdfa_attributes)
let rdfa_attributes_value = {
\ 'about': ['SafeCURIEorCURIEorURI', ''],
\ 'content': ['CDATA String', ''],
\ 'datatype': ['CURIE', ''],
\ 'prefix': ['*Prefix', ''],
\ 'profile': ['String', ''],
\ 'property': ['*TERMorCURIEorAbsURIs', ''],
\ 'resource': ['URIorSafeCURIE', ''],
\ 'rel': ['*TERMorCURIEorAbsURIs', ''],
\ 'rev': ['*TERMorCURIEorAbsURIs', ''],
\ 'typeof': ['*TERMorCURIEorAbsURIs', ''],
\ 'vocab': ['URI', '']
\ }
let attributes_value = extend(attributes_value, rdfa_attributes_value)
endif
if !exists('g:microdata_attributes_complete')
let g:microdata_attributes_complete = 1
endif
if g:microdata_attributes_complete == 1
let microdata_attributes = {'itemid': [], 'itemscope': ['itemscope', ''], 'itemtype': [], 'itemprop': [], 'itemref': []}
let global_attributes = extend(global_attributes, microdata_attributes)
let microdata_attributes_value = {
\ 'itemid': ['URI', ''],
\ 'itemscope': ['Bool', ''],
\ 'itemtype': ['URI', ''],
\ 'itemprop': ['String', ''],
\ 'itemref': ['*ID', '']
\ }
let attributes_value = extend(attributes_value, microdata_attributes_value)
endif
" }}}
" WAI_ARIA: {{{
" Ref: http://www.w3.org/TR/wai-aria/
" Version: Draft 15 December 2009
if !exists('g:aria_attributes_complete')
let g:aria_attributes_complete = 1
endif
if g:aria_attributes_complete == 1
" Ref: http://www.w3.org/TR/wai-aria/roles
" Version: Draft 15 December 2009
let widget_role = ['alert', 'alertdialog', 'button', 'checkbox', 'combobox', 'dialog', 'gridcell', 'link', 'log', 'marquee', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'progressbar', 'radio', 'radiogroup', 'scrollbar', 'slider', 'spinbutton', 'status', 'tab', 'tabpanel', 'textbox', 'timer', 'tooltip', 'treeitem', 'combobox', 'grid', 'listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid']
let document_structure = ['article', 'columnheader', 'definition', 'directory', 'document', 'group', 'heading', 'img', 'list', 'listitem', 'math', 'note', 'presentation', 'region', 'row', 'rowheader', 'separator']
let landmark_role = ['application', 'banner', 'complementary', 'contentinfo', 'form', 'main', 'navigation', 'search']
let role = extend(widget_role, document_structure)
let role = extend(role, landmark_role)
let global_attributes = extend(global_attributes, {'role': role})
endif
" }}}
" Ref: http://dev.w3.org/html5/markup/
" Version: Draft 05 April 2011
let phrasing_elements = ['a', 'em', 'strong', 'small', 'mark', 'abbr', 'dfn', 'i', 'b', 'u', 'code', 'var', 'samp', 'kbd', 'sup', 'sub', 'q', 'cite', 'span', 'bdo', 'bdi', 'br', 'wbr', 'ins', 'del', 'img', 'embed', 'object', 'iframe', 'map', 'area', 'script', 'noscript', 'ruby', 'video', 'audio', 'input', 'textarea', 'select', 'button', 'label', 'output', 'datalist', 'keygen', 'progress', 'command', 'canvas', 'time', 'meter']
let metadata_elements = ['link', 'style', 'meta', 'script', 'noscript', 'command']
let flow_elements = phrasing_elements + ['p', 'hr', 'pre', 'ul', 'ol', 'dl', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup', 'address', 'blockquote', 'ins', 'del', 'object', 'map', 'noscript', 'section', 'nav', 'article', 'aside', 'header', 'footer', 'video', 'audio', 'figure', 'table', 'form', 'fieldset', 'menu', 'canvas', 'details']
" http://dev.w3.org/html5/spec/Overview.html#linkTypes
let linktypes = ['alternate', 'author', 'bookmark', 'external', 'help', 'icon', 'license', 'next', 'nofollow', 'noreferrer', 'pingback', 'prefetch', 'prev', 'search', 'stylesheet', 'sidebar', 'tag']
" http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html
let linkreltypes = linktypes + ['canonical']
" a and button are special elements for interactive, some element can't be its descendent
let abutton_dec = 'details\\|embed\\|iframe\\|keygen\\|label\\|menu\\|select\\|textarea'
let g:xmldata_html5 = {
\ 'vimxmlentities': ['AElig', 'Aacute', 'Acirc', 'Agrave', 'Alpha', 'Aring', 'Atilde', 'Auml', 'Beta', 'Ccedil', 'Chi', 'Dagger', 'Delta', 'ETH', 'Eacute', 'Ecirc', 'Egrave', 'Epsilon', 'Eta', 'Euml', 'Gamma', 'Iacute', 'Icirc', 'Igrave', 'Iota', 'Iuml', 'Kappa', 'Lambda', 'Mu', 'Ntilde', 'Nu', 'OElig', 'Oacute', 'Ocirc', 'Ograve', 'Omega', 'Omicron', 'Oslash', 'Otilde', 'Ouml', 'Phi', 'Pi', 'Prime', 'Psi', 'Rho', 'Scaron', 'Sigma', 'THORN', 'Tau', 'Theta', 'Uacute', 'Ucirc', 'Ugrave', 'Upsilon', 'Uuml', 'Xi', 'Yacute', 'Yuml', 'Zeta', 'aacute', 'acirc', 'acute', 'aelig', 'agrave', 'alefsym', 'alpha', 'amp', 'and', 'ang', 'apos', 'aring', 'asymp', 'atilde', 'auml', 'bdquo', 'beta', 'brvbar', 'bull', 'cap', 'ccedil', 'cedil', 'cent', 'chi', 'circ', 'clubs', 'cong', 'copy', 'crarr', 'cup', 'curren', 'dArr', 'dagger', 'darr', 'deg', 'delta', 'diams', 'divide', 'eacute', 'ecirc', 'egrave', 'empty', 'emsp', 'ensp', 'epsilon', 'equiv', 'eta', 'eth', 'euml', 'euro', 'exist', 'fnof', 'forall', 'frac12', 'frac14', 'frac34', 'frasl', 'gamma', 'ge', 'gt', 'hArr', 'harr', 'hearts', 'hellip', 'iacute', 'icirc', 'iexcl', 'igrave', 'image', 'infin', 'int', 'iota', 'iquest', 'isin', 'iuml', 'kappa', 'lArr', 'lambda', 'lang', 'laquo', 'larr', 'lceil', 'ldquo', 'le', 'lfloor', 'lowast', 'loz', 'lrm', 'lsaquo', 'lsquo', 'lt', 'macr', 'mdash', 'micro', 'middot', 'minus', 'mu', 'nabla', 'nbsp', 'ndash', 'ne', 'ni', 'not', 'notin', 'nsub', 'ntilde', 'nu', 'oacute', 'ocirc', 'oelig', 'ograve', 'oline', 'omega', 'omicron', 'oplus', 'or', 'ordf', 'ordm', 'oslash', 'otilde', 'otimes', 'ouml', 'para', 'part', 'permil', 'perp', 'phi', 'pi', 'piv', 'plusmn', 'pound', 'prime', 'prod', 'prop', 'psi', 'quot', 'rArr', 'radic', 'rang', 'raquo', 'rarr', 'rceil', 'rdquo', 'real', 'reg', 'rfloor', 'rho', 'rlm', 'rsaquo', 'rsquo', 'sbquo', 'scaron', 'sdot', 'sect', 'shy', 'sigma', 'sigmaf', 'sim', 'spades', 'sub', 'sube', 'sum', 'sup', 'sup1', 'sup2', 'sup3', 'supe', 'szlig', 'tau', 'there4', 'theta', 'thetasym', 'thinsp', 'thorn', 'tilde', 'times', 'trade', 'uArr', 'uacute', 'uarr', 'ucirc', 'ugrave', 'uml', 'upsih', 'upsilon', 'uuml', 'weierp', 'xi', 'yacute', 'yen', 'yuml', 'zeta', 'zwj', 'zwnj'],
\ 'vimxmlroot': ['html'],
\ 'a': [
\ filter(copy(flow_elements), "!(v:val =~ '". abutton_dec ."')"),
\ extend(copy(global_attributes), {'name': [], 'href': [], 'target': [], 'rel': linktypes, 'hreflang': lang_tag, 'media': [], 'type': []})
\ ],
\ 'abbr': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'address': [
\ filter(copy(flow_elements), "!(v:val =~ 'address\\|nav\\|article\\|header\\|footer\\|section\\|aside\\|h1\\|h2\\|h3\\|h4\\|h5\\|h6')"),
\ global_attributes
\ ],
\ 'area': [
\ [],
\ extend(copy(global_attributes), {'alt': [], 'href': [], 'target': [], 'rel': linktypes, 'media': [], 'hreflang': lang_tag, 'type': [], 'shape': ['rect', 'circle', 'poly', 'default'], 'coords': []})
\ ],
\ 'article': [
\ flow_elements + ['style'],
\ global_attributes
\ ],
\ 'aside': [
\ flow_elements + ['style'],
\ global_attributes
\ ],
\ 'audio': [
\ flow_elements + ['source', 'track'],
\ extend(copy(global_attributes), {'autoplay': ['autoplay', ''], 'preload': ['none', 'metadata', 'auto', ''], 'controls': ['controls', ''], 'loop': ['loop', ''], 'src': []})
\ ],
\ 'b': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'base': [
\ [],
\ extend(copy(global_attributes), {'href': [], 'target': []})
\ ],
\ 'bdo': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'bdi': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'blockquote': [
\ flow_elements,
\ extend(copy(global_attributes), {'cite': []})
\ ],
\ 'body': [
\ flow_elements,
\ extend(copy(global_attributes), body_attributes)
\ ],
\ 'br': [
\ [],
\ global_attributes
\ ],
\ 'button': [
\ filter(copy(phrasing_elements), "!(v:val =~ '". abutton_dec ."')"),
\ extend(copy(global_attributes), {'type': ['submit', 'reset', 'button'], 'name': [], 'disabled': ['disabled', ''], 'form': [], 'value': [], 'formaction': [], 'autofocus': ['autofocus', ''], 'formenctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'formmethod': ['get', 'post', 'put', 'delete'], 'formtarget': [], 'formnovalidate': ['formnovalidate', '']})
\ ],
\ 'canvas': [
\ flow_elements,
\ extend(copy(global_attributes), {'height': [], 'width': []})
\ ],
\ 'caption': [
\ filter(copy(flow_elements), "!(v:val =~ 'table')"),
\ global_attributes
\ ],
\ 'cite': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'code': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'col': [
\ [],
\ extend(copy(global_attributes), {'span': []})
\ ],
\ 'colgroup': [
\ [],
\ extend(copy(global_attributes), {'span': []})
\ ],
\ 'command': [
\ ['col'],
\ extend(copy(global_attributes), {'type': ['command', 'radio', 'checkbox'], 'radiogroup': [], 'checked': ['checked', ''], 'label': [], 'icon': [], 'disabled': ['disabled', '']})
\ ],
\ 'datalist': [
\ phrasing_elements + ['option'],
\ global_attributes
\ ],
\ 'dd': [
\ flow_elements,
\ global_attributes
\ ],
\ 'del': [
\ flow_elements,
\ extend(copy(global_attributes), {'cite': [], 'datetime': []})
\ ],
\ 'details': [
\ flow_elements + ['summary'],
\ extend(copy(global_attributes), {'open': ['open', '']})
\ ],
\ 'dfn': [
\ filter(copy(phrasing_elements), "!(v:val =~ 'dfn')"),
\ global_attributes
\ ],
\ 'div': [
\ flow_elements + ['style'],
\ global_attributes
\ ],
\ 'dl': [
\ ['dt', 'dd'],
\ global_attributes
\ ],
\ 'dt': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'em': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'embed': [
\ [],
\ extend(copy(global_attributes), {'src': [], 'type': [], 'height': [], 'width': []})
\ ],
\ 'fieldset': [
\ flow_elements + ['legend'],
\ extend(copy(global_attributes), {'name': [], 'disabled': ['disabled', ''], 'form': []})
\ ],
\ 'figcaption': [
\ flow_elements,
\ global_attributes
\ ],
\ 'figure': [
\ flow_elements + ['figcaption'],
\ global_attributes
\ ],
\ 'footer': [
\ filter(copy(flow_elements), "!(v:val =~ 'address\\|header\\|footer')"),
\ global_attributes
\ ],
\ 'form': [
\ flow_elements,
\ extend(copy(global_attributes), {'name': [], 'action': [], 'enctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'method': ['get', 'post', 'put', 'delete'], 'target': [], 'novalidate': ['novalidate', ''], 'accept-charset': charset, 'autocomplete': ['on', 'off']})
\ ],
\ 'h1': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'h2': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'h3': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'h4': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'h5': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'h6': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'head': [
\ metadata_elements + ['title', 'base'],
\ global_attributes
\ ],
\ 'header': [
\ filter(copy(flow_elements), "!(v:val =~ 'address\\|header\\|footer')"),
\ global_attributes
\ ],
\ 'hgroup': [
\ ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
\ global_attributes
\ ],
\ 'hr': [
\ [],
\ global_attributes
\ ],
\ 'html': [
\ ['head', 'body'],
\ extend(copy(global_attributes), {'manifest': [], 'version': ['HTML+RDFa 1.1']})
\ ],
\ 'i': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'iframe': [
\ [],
\ extend(copy(global_attributes), {'src': [], 'name': [], 'width': [], 'height': [], 'sandbox': ['allow-same-origin', 'allow-forms', 'allow-scripts'], 'seamless': ['seamless', '']})
\ ],
\ 'img': [
\ [],
\ extend(copy(global_attributes), {'src': [], 'alt': [], 'height': [], 'width': [], 'usemap': [], 'ismap': ['ismap', '']})
\ ],
\ 'input': [
\ [],
\ extend(copy(global_attributes), {'type': ['text', 'password', 'checkbox', 'radio', 'button', 'submit', 'reset', 'file', 'hidden', 'image', 'datetime', 'datetime-local', 'date', 'month', 'time', 'week', 'number', 'range', 'email', 'url', 'search', 'tel', 'coloe'], 'name': [], 'disabled': ['disabled', ''], 'form': [], 'maxlength': [], 'readonly': ['readonly', ''], 'size': [], 'value': [], 'autocomplete': ['on', 'off'], 'autofocus': ['autofocus', ''], 'list': [], 'pattern': [], 'required': ['required', ''], 'placeholder': [], 'checked': ['checked'], 'accept': [], 'multiple': ['multiple', ''], 'alt': [], 'src': [], 'height': [], 'width': [], 'min': [], 'max': [], 'step': [], 'formenctype': ['application/x-www-form-urlencoded', 'multipart/form-data', 'text/plain'], 'formmethod': ['get', 'post', 'put', 'delete'], 'formtarget': [], 'formnovalidate': ['formnovalidate', '']})
\ ],
\ 'ins': [
\ flow_elements,
\ extend(copy(global_attributes), {'cite': [], 'datetime': []})
\ ],
\ 'kbd': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'keygen': [
\ [],
\ extend(copy(global_attributes), {'challenge': [], 'keytype': ['rsa'], 'autofocus': ['autofocus', ''], 'name': [], 'disabled': ['disabled', ''], 'form': []})
\ ],
\ 'label': [
\ filter(copy(phrasing_elements), "!(v:val =~ 'label')"),
\ extend(copy(global_attributes), {'for': [], 'form': []})
\ ],
\ 'legend': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'li': [
\ flow_elements,
\ extend(copy(global_attributes), {'value': []})
\ ],
\ 'link': [
\ [],
\ extend(copy(global_attributes), {'href': [], 'rel': linkreltypes, 'hreflang': lang_tag, 'media': [], 'type': [], 'sizes': ['any']})
\ ],
\ 'map': [
\ flow_elements,
\ extend(copy(global_attributes), {'name': []})
\ ],
\ 'mark': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'menu': [
\ flow_elements + ['li'],
\ extend(copy(global_attributes), {'type': ['toolbar', 'context'], 'label': []})
\ ],
\ 'meta': [
\ [],
\ extend(copy(global_attributes), {'name': [], 'http-equiv': ['refresh', 'default-style', 'content-type'], 'content': [], 'charset': charset})
\ ],
\ 'meter': [
\ phrasing_elements,
\ extend(copy(global_attributes), {'value': [], 'min': [], 'low': [], 'high': [], 'max': [], 'optimum': []})
\ ],
\ 'nav': [
\ flow_elements,
\ global_attributes
\ ],
\ 'noscript': [
\ flow_elements + ['link', 'meta', 'style'],
\ global_attributes
\ ],
\ 'object': [
\ flow_elements + ['param'],
\ extend(copy(global_attributes), {'data': [], 'type': [], 'height': [], 'width': [], 'usemap': [], 'name': [], 'form': []})
\ ],
\ 'ol': [
\ ['li'],
\ extend(copy(global_attributes), {'start': [], 'reversed': ['reversed', '']})
\ ],
\ 'optgroup': [
\ ['option'],
\ extend(copy(global_attributes), {'label': [], 'disabled': ['disabled', '']})
\ ],
\ 'option': [
\ [''],
\ extend(copy(global_attributes), {'disabled': ['disabled', ''], 'selected': ['selected', ''], 'label': [], 'value': []})
\ ],
\ 'output': [
\ phrasing_elements,
\ extend(copy(global_attributes), {'name': [], 'form': [], 'for': []})
\ ],
\ 'p': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'param': [
\ [],
\ extend(copy(global_attributes), {'name': [], 'value': []})
\ ],
\ 'pre': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'progress': [
\ filter(copy(phrasing_elements), "!(v:val =~ 'progress')"),
\ extend(copy(global_attributes), {'value': [], 'max': []})
\ ],
\ 'q': [
\ phrasing_elements,
\ extend(copy(global_attributes), {'cite': []})
\ ],
\ 'rp': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'rt': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'ruby': [
\ phrasing_elements + ['rp', 'rt'],
\ global_attributes
\ ],
\ 'samp': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'script': [
\ [],
\ extend(copy(global_attributes), {'src': [], 'defer': ['defer', ''], 'async': ['async', ''], 'type': [], 'charset': charset})
\ ],
\ 'section': [
\ flow_elements + ['style'],
\ global_attributes
\ ],
\ 'select': [
\ ['optgroup', 'option'],
\ extend(copy(global_attributes), {'name': [], 'disabled': ['disabled', ''], 'form': [], 'size': [], 'multiple': ['multiple', '']})
\ ],
\ 'small': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'source': [
\ [],
\ extend(copy(global_attributes), {'src': [], 'type': [], 'media': []})
\ ],
\ 'span': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'strong': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'style': [
\ [],
\ extend(copy(global_attributes), {'type': [], 'media': [], 'scoped': ['scoped', '']})
\ ],
\ 'sub': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'summary': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'sup': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'table': [
\ ['caption', 'col', 'colgroup', 'thead', 'tfoot', 'tbody', 'tr'],
\ extend(copy(global_attributes), {'border': []})
\ ],
\ 'tbody': [
\ ['tr'],
\ global_attributes
\ ],
\ 'td': [
\ flow_elements,
\ extend(copy(global_attributes), {'colspan': [], 'rowspan': [], 'headers': []})
\ ],
\ 'textarea': [
\ [''],
\ extend(copy(global_attributes), {'name': [], 'disabled': ['disabled', ''], 'form': [], 'readonly': ['readonly', ''], 'maxlength': [], 'autofocus': ['autofocus', ''], 'required': ['required', ''], 'placeholder': [], 'rows': [], 'wrap': ['hard', 'soft'], 'cols': []})
\ ],
\ 'tfoot': [
\ ['tr'],
\ global_attributes
\ ],
\ 'th': [
\ phrasing_elements,
\ extend(copy(global_attributes), {'scope': ['row', 'col', 'rowgroup', 'colgroup'], 'colspan': [], 'rowspan': [], 'headers': []})
\ ],
\ 'thead': [
\ ['tr'],
\ global_attributes
\ ],
\ 'time': [
\ phrasing_elements,
\ extend(copy(global_attributes), {'datetime': [], 'pubdate': ['pubdate', '']})
\ ],
\ 'title': [
\ [''],
\ global_attributes
\ ],
\ 'tr': [
\ ['th', 'td'],
\ global_attributes
\ ],
\ 'track': [
\ [],
\ extend(copy(global_attributes), {'kind': ['subtitles', 'captions', 'descriptions', 'chapters', 'metadata'], 'src': [], 'charset': charset, 'srclang': lang_tag, 'label': []})
\ ],
\ 'u': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'ul': [
\ ['li'],
\ global_attributes
\ ],
\ 'var': [
\ phrasing_elements,
\ global_attributes
\ ],
\ 'video': [
\ flow_elements + ['source', 'track'],
\ extend(copy(global_attributes), {'autoplay': ['autoplay', ''], 'preload': ['none', 'metadata', 'auto', ''], 'controls': ['controls', ''], 'loop': ['loop', ''], 'poster': [], 'height': [], 'width': [], 'src': []})
\ ],
\ 'wbr': [
\ [],
\ global_attributes
\ ],
\ 'vimxmlattrinfo' : attributes_value,
\ 'vimxmltaginfo': {
\ 'area': ['/>', ''],
\ 'base': ['/>', ''],
\ 'br': ['/>', ''],
\ 'col': ['/>', ''],
\ 'command': ['/>', ''],
\ 'embed': ['/>', ''],
\ 'hr': ['/>', ''],
\ 'img': ['/>', ''],
\ 'input': ['/>', ''],
\ 'keygen': ['/>', ''],
\ 'link': ['/>', ''],
\ 'meta': ['/>', ''],
\ 'param': ['/>', ''],
\ 'source': ['/>', ''],
\ 'track': ['/>', ''],
\ 'wbr': ['/>', ''],
\ },
\ }

29
vim/compiler/cucumber.vim Normal file
View File

@ -0,0 +1,29 @@
" Vim compiler file
" Compiler: Cucumber
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 Aug 09
if exists("current_compiler")
finish
endif
let current_compiler = "cucumber"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
CompilerSet makeprg=cucumber
CompilerSet errorformat=
\%W%m\ (Cucumber::Undefined),
\%E%m\ (%.%#),
\%Z%f:%l,
\%Z%f:%l:%.%#
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set sw=2 sts=2:

1129
vim/doc/rails.txt Normal file

File diff suppressed because it is too large Load Diff

87
vim/doc/rake.txt Normal file
View File

@ -0,0 +1,87 @@
*rake.vim* It's like rails.vim without the rails
Author: Tim Pope <http://tpo.pe/>
License: Same terms as Vim itself (see |license|)
This plugin is only available if 'compatible' is not set.
INTRODUCTION *rake*
This plugin is designed to let you use your favorite rails.vim commands in a
plain old Ruby project.
Projects are detected by searching for a Rakefile up the directory hierarchy.
Projects without a Rakefile will also be detected if they sit inside
$GEM_PATH, making this plugin ideal for "gem open" or "bundle open".
COMMANDS *rake-commands*
*rake-:Rake*
:Rake [task] Invoke |:make| followed by |:cwindow| with rake as the
'makeprg'. Uses `bundle exec rake` if bundler.vim is
installed and active for the current project.
*rake-:Rcd*
:Rcd [directory] |:cd| relative to the project.
*rake-:Rlcd*
:Rlcd [directory] |:lcd| relative to the project.
*rake-:R*
:R [file] With no argument, edits the "related" file (the test
for an implementation file and vice versa). With an
argument, edit that file, relative to the Gem's root.
*rake-:RS*
:RS [file] Like |:R|, but horizontally split.
*rake-:RV*
:RV [file] Like |:R|, but vertically split.
*rake-:RT*
:RT [file] Like |:R|, but use a new tab.
*rake-:RD*
:RD [file] Like |:R|, but :read the file in.
*rake-:A* *rake-:AS* *rake-:AV* *rake-:AT* *rake-:AD*
:A Unlike in rails.vim, these are identical to their :R
:AS counterparts.
:AV
:AT
:AD
*rake-:Rlib*
:Rlib [file] Edit a Ruby file under lib/, or Gemfile if no argument
is given. Variants exist for :RSlib, :RVlib, :RTlib,
and :RDlib.
*rake-:Rtest*
:Rtest [file] Edit a test file under test/ or a spec file under
spec/. Defaults to the test helper or spec helper.
Has the same variants as |:Rlib|.
*rake-:Rspec*
:Rspec [file] Edit a spec file under spec/ or a test file under
test/. Defaults to the spec helper or test helper.
Has the same variants as |:Rlib|. The only difference
between this command and |:Rtest| is which gets
precedence when both files exist.
*rake-:Rtask*
:Rtask [file] Edit a .rake file under rakelib/, or Rakefile if no
argument is given. Has the same variants as |:Rlib|.
*rake-:Rtags*
:Rtags Invoke ctags for the project. Ordinarily it will
place the resulting tags file in the root of the
project, but if the directory is read only (e.g., a
system gem), it will be placed in a temp file instead.
ABOUT *rake-about*
Grab the latest version or report a bug on GitHub:
http://github.com/tpope/vim-rake
vim:tw=78:et:ft=help:norl:

12
vim/filetype.vim Normal file
View File

@ -0,0 +1,12 @@
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.md set filetype=markdown
au! BufRead,BufNewFile *.markdown set filetype=markdown
au! BufRead,BufNewFile *.kd set filetype=markdown
au! BufRead,BufNewFile *.gp set filetype=gnuplot
au! BufRead,BufNewFile *.html.erb set filetype=eruby.html
au! BufRead,BufNewFile *.feature set sw=2 sts=2 filetype=cucumber
augroup END

View File

@ -0,0 +1,2 @@
" Cucumber
autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber

2
vim/ftdetect/thor.vim Normal file
View File

@ -0,0 +1,2 @@
autocmd BufNewFile,BufRead *.thor set filetype=ruby
autocmd BufNewFile,BufRead Thorfile set filetype=ruby

132
vim/ftplugin/cucumber.vim Normal file
View File

@ -0,0 +1,132 @@
" Vim filetype plugin
" Language: Cucumber
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 Aug 09
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
finish
endif
let b:did_ftplugin = 1
setlocal formatoptions-=t formatoptions+=croql
setlocal comments=:# commentstring=#\ %s
setlocal omnifunc=CucumberComplete
let b:undo_ftplugin = "setl fo< com< cms< ofu<"
let b:cucumber_root = expand('%:p:h:s?.*[\/]\%(features\|stories\)\zs[\/].*??')
if !exists("g:no_plugin_maps") && !exists("g:no_cucumber_maps")
nmap <silent><buffer> <C-]> :<C-U>exe <SID>jump('edit',v:count)<CR>
nmap <silent><buffer> <C-W>] :<C-U>exe <SID>jump('split',v:count)<CR>
nmap <silent><buffer> <C-W><C-]> :<C-U>exe <SID>jump('split',v:count)<CR>
nmap <silent><buffer> <C-W>} :<C-U>exe <SID>jump('pedit',v:count)<CR>
let b:undo_ftplugin .= "| sil! nunmap <buffer> <C-]>| sil! nunmap <buffer> <C-W>]| sil! nunmap <buffer> <C-W><C-]>| sil! nunmap <buffer> <C-W>}"
endif
function! s:jump(command,count)
let steps = s:steps('.')
if len(steps) == 0 || len(steps) < a:count
return 'echoerr "No matching step found"'
elseif len(steps) > 1 && !a:count
return 'echoerr "Multiple matching steps found"'
else
let c = a:count ? a:count-1 : 0
return a:command.' +'.steps[c][1].' '.escape(steps[c][0],' %#')
endif
endfunction
function! s:allsteps()
let step_pattern = '\C^\s*\K\k*\>\s*\zs\S.\{-\}\ze\s*\%(do\|{\)\s*\%(|[^|]*|\s*\)\=\%($\|#\)'
let steps = []
for file in split(glob(b:cucumber_root.'/**/*.rb'),"\n")
let lines = readfile(file)
let num = 0
for line in lines
let num += 1
if line =~ step_pattern
let type = matchstr(line,'\w\+')
let steps += [[file,num,type,matchstr(line,step_pattern)]]
endif
endfor
endfor
return steps
endfunction
function! s:steps(lnum)
let c = indent(a:lnum) + 1
while synIDattr(synID(a:lnum,c,1),'name') !~# '^$\|Region$'
let c = c + 1
endwhile
let step = matchstr(getline(a:lnum)[c-1 : -1],'^\s*\zs.\{-\}\ze\s*$')
return filter(s:allsteps(),'s:stepmatch(v:val[3],step)')
endfunction
function! s:stepmatch(receiver,target)
if a:receiver =~ '^[''"].*[''"]$'
let pattern = '^'.escape(substitute(a:receiver[1:-2],'$\w\+','(.*)','g'),'/').'$'
elseif a:receiver =~ '^/.*/$'
let pattern = a:receiver[1:-2]
elseif a:receiver =~ '^%r..*.$'
let pattern = escape(a:receiver[3:-2],'/')
else
return 0
endif
try
let vimpattern = substitute(substitute(pattern,'\\\@<!(?:','%(','g'),'\\\@<!\*?','{-}','g')
if a:target =~# '\v'.vimpattern
return 1
endif
catch
endtry
if has("ruby") && pattern !~ '\\\@<!#{'
ruby VIM.command("return #{if (begin; Kernel.eval('/'+VIM.evaluate('pattern')+'/'); rescue SyntaxError; end) === VIM.evaluate('a:target') then 1 else 0 end}")
else
return 0
endif
endfunction
function! s:bsub(target,pattern,replacement)
return substitute(a:target,'\C\\\@<!'.a:pattern,a:replacement,'g')
endfunction
function! CucumberComplete(findstart,base) abort
let indent = indent('.')
let group = synIDattr(synID(line('.'),indent+1,1),'name')
let type = matchstr(group,'\Ccucumber\zs\%(Given\|When\|Then\)')
let e = matchend(getline('.'),'^\s*\S\+\s')
if type == '' || col('.') < col('$') || e < 0
return -1
endif
if a:findstart
return e
endif
let steps = []
for step in s:allsteps()
if step[2] ==# type
if step[3] =~ '^[''"]'
let steps += [step[3][1:-2]]
elseif step[3] =~ '^/\^.*\$/$'
let pattern = step[3][2:-3]
let pattern = substitute(pattern,'\C^(?:|I )','I ','')
let pattern = s:bsub(pattern,'\\[Sw]','w')
let pattern = s:bsub(pattern,'\\d','1')
let pattern = s:bsub(pattern,'\\[sWD]',' ')
let pattern = s:bsub(pattern,'\[\^\\\="\]','_')
let pattern = s:bsub(pattern,'[[:alnum:]. _-][?*]?\=','')
let pattern = s:bsub(pattern,'\[\([^^]\).\{-\}\]','\1')
let pattern = s:bsub(pattern,'+?\=','')
let pattern = s:bsub(pattern,'(\([[:alnum:]. -]\{-\}\))','\1')
let pattern = s:bsub(pattern,'\\\([[:punct:]]\)','\1')
if pattern !~ '[\\()*?]'
let steps += [pattern]
endif
endif
endif
endfor
call filter(steps,'strpart(v:val,0,strlen(a:base)) ==# a:base')
return sort(steps)
endfunction
" vim:set sts=2 sw=2:

View File

@ -0,0 +1,142 @@
<+ +> !comp! !exe!
%% Based on <bare_jrnl.tex> in the ieee package available from CTAN,
%% I have changed the options so that most useful ones are clubbed together,
%% Have a look at <bare_jrnl.tex> to understand the function of each package.
%% This code is offered as-is - no warranty - user assumes all risk.
%% Free to use, distribute and modify.
% *** Authors should verify (and, if needed, correct) their LaTeX system ***
% *** with the testflow diagnostic prior to trusting their LaTeX platform ***
% *** with production work. IEEE's font choices can trigger bugs that do ***
% *** not appear when using other class files. ***
% Testflow can be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/contrib/supported/IEEEtran/testflow
% File: !comp!expand("%:p:t")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
%
\documentclass[journal]{IEEEtran}
\usepackage{cite, graphicx, subfigure, amsmath}
\interdisplaylinepenalty=2500
% *** Do not adjust lengths that control margins, column widths, etc. ***
% *** Do not use packages that alter fonts (such as pslatex). ***
% There should be no need to do such things with IEEEtran.cls V1.6 and later.
<++>
% correct bad hyphenation here
\hyphenation{<+op-tical net-works semi-conduc-tor+>}
\begin{document}
%
% paper title
\title{<+Skeleton of IEEEtran.cls for Journals in VIM-Latex+>}
%
%
% author names and IEEE memberships
% note positions of commas and nonbreaking spaces ( ~ ) LaTeX will not break
% a structure at a ~ so this keeps an author's name from being broken across
% two lines.
% use \thanks{} to gain access to the first footnote area
% a separate \thanks must be used for each paragraph as LaTeX2e's \thanks
% was not built to handle multiple paragraphs
\author{<+Sumit Bhardwaj+>~\IEEEmembership{<+Student~Member,~IEEE,+>}
<+John~Doe+>,~\IEEEmembership{<+Fellow,~OSA,+>}
<+and~Jane~Doe,+>~\IEEEmembership{<+Life~Fellow,~IEEE+>}}% <-this % stops a space
\thanks{<+Manuscript received January 20, 2002; revised August 13, 2002.
This work was supported by the IEEE.+>}% <-this % stops a space
\thanks{<+S. Bhardwaj is with the Indian Institute of Technology, Delhi.+>}
%
% The paper headers
\markboth{<+Journal of VIM-\LaTeX\ Class Files,~Vol.~1, No.~8,~August~2002+>}{
<+Bhardwaj \MakeLowercase{\textit{et al.}+>}: <+Skeleton of IEEEtran.cls for Journals in VIM-Latex+>}
% The only time the second header will appear is for the odd numbered pages
% after the title page when using the twoside option.
% If you want to put a publisher's ID mark on the page
% (can leave text blank if you just want to see how the
% text height on the first page will be reduced by IEEE)
%\pubid{0000--0000/00\$00.00~\copyright~2002 IEEE}
% use only for invited papers
%\specialpapernotice{(Invited Paper)}
% make the title area
\maketitle
\begin{abstract}
<+The abstract goes here.+>
\end{abstract}
\begin{keywords}
<+IEEEtran, journal, \LaTeX, paper, template, VIM, VIM-\LaTeX+>.
\end{keywords}
\section{Introduction}
\PARstart{<+T+>}{<+his+>} <+demo file is intended to serve as a ``starter file"
for IEEE journal papers produced under \LaTeX\ using IEEEtran.cls version
1.6 and later.+>
% You must have at least 2 lines in the paragraph with the drop letter
% (should never be an issue)
<+May all your publication endeavors be successful.+>
% needed in second column of first page if using \pubid
%\pubidadjcol
% trigger a \newpage just before the given reference
% number - used to balance the columns on the last page
% adjust value as needed - may need to be readjusted if
% the document is modified later
%\IEEEtriggeratref{8}
% The "triggered" command can be changed if desired:
%\IEEEtriggercmd{\enlargethispage{-5in}}
% references section
%\bibliographystyle{IEEEtran.bst}
%\bibliography{IEEEabrv,../bib/paper}
\begin{thebibliography}{1}
\bibitem{IEEEhowto:kopka}
H.~Kopka and P.~W. Daly, \emph{A Guide to {\LaTeX}}, 3rd~ed.\hskip 1em plus
0.5em minus 0.4em\relax Harlow, England: Addison-Wesley, 1999.
\end{thebibliography}
% biography section
%
\begin{biography}{Sumit Bhardwaj}
Biography text here.
\end{biography}
% if you will not have a photo
\begin{biographynophoto}{John Doe}
Biography text here.
\end{biographynophoto}
% insert where needed to balance the two columns on the last page
%\newpage
\begin{biographynophoto}{Jane Doe}
Biography text here.
\end{biographynophoto}
% You can push biographies down or up by placing
% a \vfill before or after them. The appropriate
% use of \vfill depends on what kind of text is
% on the last page and whether or not the columns
% are being equalized.
%\vfill
% Can be used to pull up biographies so that the bottom of the last one
% is flush with the other column.
%\enlargethispage{-5in}
\end{document}

View File

@ -0,0 +1,13 @@
<+ +> !comp! !exe!
% File: !comp!expand("%:p:t")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
%
\documentclass[a4paper]{article}
\usepackage[italian]{babel}
\usepackage{fontspec,textcomp,xltxtra}
\defaultfontfeatures{Ligatures=Common}
\setmainfont[Mapping=tex-text,Alternate=0,Numbers=OldStyle]{Warnock Pro Light}
\begin{document}
<++>
\end{document}

View File

@ -0,0 +1,41 @@
<+ +> !comp! !exe!
% File: !comp!expand("%:p:t")!comp!
% Creato: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
% Ultima Modifica: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
%
\documentclass{beamer}
\mode<presentation>{
\usetheme{Warsaw}
\setbeamercovered{transparent}
}
\usepackage[italian]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{times}
\usepackage[T1]{fontenc}
\beamerdefaultoverlayspecification{<+->}
\title[<+Titolo Corto+>]{<+Titolo lunghissimo+>}
\subtitle{<+Sottotitolo+>}
\author{Emiliano Vavassori}
\institute[BGlug]{Bergamo Linux Users Group}
\date[<+Evento breve+>]{\today --- <+Occasione lunga+>}
\subject{Talks}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{Sommario}
\tableofcontents
\end{frame}
<++>
\end{document}

View File

@ -0,0 +1,52 @@
<+ +> !comp! !exe!
% File: !comp!expand("%:p:t")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
%
\documentclass[a4paper,12pt,boldsubject,italicsignature]{letteracdp}
\usepackage[italian]{babel}
\usepackage{fontspec,textcomp,xltxtra}
\defaultfontfeatures{Ligatures=Common}
\setmainfont[Mapping=tex-text,Alternate=0,Numbers=OldStyle]{Warnock Pro Light}
\usepackage{hyperref}
\hypersetup{%
colorlinks=true,%
urlcolor=blue,%
pdfauthor={Emiliano Vavassori}%
}
\name{Franco \textsc{Vavassori}}
\address{Franco Vavassori\\
Via B.~Moriggia, n\textdegree~197\\
24050 Covo (BG)\\
Tel.~0363 902222}
\place{Covo}
\signature{Franco Vavassori}
\begin{document}
\begin{letter}{%
<+destinatario+>
}[% \registered % Invio raccomandata
% <+oggetto della lettera+>
]
\opening{}
Con la presente il sottoscritto Franco Vavassori, nato a Romano di Lombardia
il 3 agosto 1956, residente a Covo in via B.~Moriggia n\textdegree~197, Codice
Fiscale \texttt{VVSFNC56M03H509Z},
\begin{center}\scshape\Large
Delega
\end{center}
<+corpo del testo+>
Colgo l'occasione per porgere
\closing{Distinti saluti}
% \begin{enclosures}
% \item Primo oggetto
% \end{enclosures}
\end{letter}
\end{document}

View File

@ -0,0 +1,47 @@
<+ +> !comp! !exe!
% File: !comp!expand("%:p:t")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
%
\documentclass[a4paper,12pt,boldsubject,italicsignature]{letteracdp}
\usepackage[italian]{babel}
\usepackage{fontspec,textcomp,xltxtra,xcolor}
\defaultfontfeatures{Ligatures=Common}
\setmainfont[Mapping=tex-text,Alternate=0,Numbers=OldStyle]{Warnock Pro Light}
\usepackage{hyperref}
\definecolor{darkblue}{rgb}{0 0 .53}
\hypersetup{%
colorlinks=true,%
urlcolor=darkblue,%
pdfauthor={Emiliano Vavassori}%
}
\name{Emiliano \textsc{Vavassori}}
\address{Emiliano Vavassori\\
Via B.~Moriggia, n\textdegree~197\\
24050 Covo (BG)\\
Tel.~0363 902222}
\place{Covo}
\signature{Emiliano Vavassori}
\begin{document}
\begin{foldedletter}{%
<+indirizzo destinatario+>
}[% \registered % Invio raccomandata
% <+oggetto opzionale+>
]
\opening{}
<+corpo del testo+>
Colgo l'occasione per porgere
\closing{Distinti saluti}
% \begin{enclosures}
% \item Primo oggetto
% \end{enclosures}
\end{foldedletter}
\end{document}

View File

@ -0,0 +1,46 @@
<+ +> !comp! !exe!
% File: !comp!expand("%:p:t")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
%
\documentclass[a4paper,12pt,boldsubject,italicsignature]{letteracdp}
\usepackage[italian]{babel}
\usepackage{fontspec,textcomp,xltxtra}
\defaultfontfeatures{Ligatures=Common}
\setmainfont[Mapping=tex-text,Alternate=0,Numbers=OldStyle]{Warnock Pro Light}
\usepackage{hyperref}
\hypersetup{%
colorlinks=true,%
urlcolor=blue,%
pdfauthor={Emiliano Vavassori}%
}
\name{Emiliano \textsc{Vavassori}}
\address{Emiliano Vavassori\\
Via B.~Moriggia, n\textdegree~197\\
24050 Covo (BG)\\
Tel.~0363 902222}
\place{Covo}
\signature{Emiliano Vavassori}
\begin{document}
\begin{letter}{%
<+destinatario+>
}[% \registered % Invio raccomandata
% <+oggetto della lettera+>
]
\opening{}
<+corpo del testo+>
Colgo l'occasione per porgere
\closing{Distinti saluti}
% \begin{enclosures}
% \item Primo oggetto
% \end{enclosures}
\end{letter}
\end{document}

View File

@ -0,0 +1,9 @@
<+ +> !comp! !exe!
% File: !comp!expand("%")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
%
\documentclass[a4paper]{report}
\begin{document}
<++>
\end{document}

View File

@ -0,0 +1,9 @@
<+ +> !comp! !exe!
% File: !comp!expand("%:p:t")!comp!
% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp!
%
\documentclass[a4paper,twocolumn]{report}
\begin{document}
<++>
\end{document}

View File

@ -0,0 +1,3 @@
" Customizing spacing in terraform files
set softtabstop=2
set shiftwidth=2

29
vim/ftplugin/tex.vim Normal file
View File

@ -0,0 +1,29 @@
" this is mostly a matter of taste. but LaTeX looks good with just a bit
" of indentation.
set softtabstop=2
set shiftwidth=2
set textwidth=78
" TIP: if you write your \label's as \label{fig:something}, then if you
" type in \ref{fig: and press <C-n> you will automatically cycle through
" all the figure labels. Very useful!
set iskeyword+=:
" Permits é in documents
imap <buffer> +it <Plug>Tex_InsertItemOnThisLine
" Permits ì in documents
imap <C-l> <Plug>Tex_LeftRight
" PDF Format
let g:Tex_CustomTemplateDirectory = '~/.vim/ftplugin/latex-suite/templates'
let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_CompileRule_pdf = 'xelatex -interaction=nonstopmode $*'
let g:Tex_ViewRule_pdf = 'evince'
" Mappings for Beamer
call IMAP('BFR', "\\begin{frame}\<CR>\<Tab>\\frametitle{<+title+>}\<cr><++>\<cr>\\end{frame}<++>", 'tex')
call IMAP('BAL', "\\alert{~++~}~+overlay+~", 'tex', '~+', '+~')
call IMAP('BBL', "\\begin{block}{~+title+~}~+overlay+~\<CR>~++~\<CR>\\end{block}~++~", 'tex', '~+', '+~')
" Trying a vmap
vmap ,a "zdi\alert{<C-R>z}<ESC>

1
vim/ftplugin/yaml.vim Normal file
View File

@ -0,0 +1 @@
let b:ale_fixers = [ 'yamlfix' ]

74
vim/indent/cucumber.vim Normal file
View File

@ -0,0 +1,74 @@
" Vim indent file
" Language: Cucumber
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Last Change: 2010 May 21
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent
setlocal indentexpr=GetCucumberIndent()
setlocal indentkeys=o,O,*<Return>,<:>,0<Bar>,0#,=,!^F
let b:undo_indent = 'setl ai< inde< indk<'
" Only define the function once.
if exists("*GetCucumberIndent")
finish
endif
function! s:syn(lnum)
return synIDattr(synID(a:lnum,1+indent(a:lnum),1),'name')
endfunction
function! GetCucumberIndent()
let line = getline(prevnonblank(v:lnum-1))
let cline = getline(v:lnum)
let nline = getline(nextnonblank(v:lnum+1))
let syn = s:syn(prevnonblank(v:lnum-1))
let csyn = s:syn(v:lnum)
let nsyn = s:syn(nextnonblank(v:lnum+1))
if csyn ==# 'cucumberFeature' || cline =~# '^\s*Feature:'
" feature heading
return 0
elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'
" examples heading
return 2 * &sw
elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
" background, scenario or outline heading
return &sw
elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'
" line after feature heading
return &sw
elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'
" line after examples heading
return 3 * &sw
elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
" line after background, scenario or outline heading
return 2 * &sw
elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)
" tag or comment before a feature heading
return 0
elseif cline =~# '^\s*@'
" other tags
return &sw
elseif cline =~# '^\s*[#|]' && line =~# '^\s*|'
" mid-table
" preserve indent
return indent(prevnonblank(v:lnum-1))
elseif cline =~# '^\s*|' && line =~# '^\s*[^|]'
" first line of a table, relative indent
return indent(prevnonblank(v:lnum-1)) + &sw
elseif cline =~# '^\s*[^|]' && line =~# '^\s*|'
" line after a table, relative unindent
return indent(prevnonblank(v:lnum-1)) - &sw
elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):')
" comments on scenarios
return &sw
endif
return indent(prevnonblank(v:lnum-1))
endfunction
" vim:set sts=2 sw=2:

282
vim/indent/html.vim Normal file
View File

@ -0,0 +1,282 @@
" Description: html5 (and html4) indenter
" Changed By: Brian Gershon <brian.five@gmail.com>
" Last Change: 30 Jan 2011
"
" 1. Started with vim72 html indent file authored by Johannes Zellner (below)
" 2. Added html5 list as described here:
" http://stackoverflow.com/questions/3232518/how-to-update-vim-to-color-code-new-html-elements
" 3. Added this to a fork of https://github.com/othree/html5.vim
" which already provides nice html5 syntax highlighting.
"
" Description: html indenter
" Author: Johannes Zellner <johannes@zellner.org>
" Last Change: Mo, 05 Jun 2006 22:32:41 CEST
" Restoring 'cpo' and 'ic' added by Bram 2006 May 5
" Globals: g:html_indent_tags -- indenting tags
" g:html_indent_strict -- inhibit 'O O' elements
" g:html_indent_strict_table -- inhibit 'O -' elements
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" [-- local settings (must come before aborting the script) --]
setlocal indentexpr=HtmlIndentGet(v:lnum)
setlocal indentkeys=o,O,*<Return>,<>>,{,}
if exists('g:html_indent_tags')
unlet g:html_indent_tags
endif
" [-- helper function to assemble tag list --]
fun! <SID>HtmlIndentPush(tag)
if exists('g:html_indent_tags')
let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
else
let g:html_indent_tags = a:tag
endif
endfun
" [-- <ELEMENT ? - - ...> --]
call <SID>HtmlIndentPush('a')
call <SID>HtmlIndentPush('abbr')
call <SID>HtmlIndentPush('acronym')
call <SID>HtmlIndentPush('address')
call <SID>HtmlIndentPush('b')
call <SID>HtmlIndentPush('bdo')
call <SID>HtmlIndentPush('big')
call <SID>HtmlIndentPush('blockquote')
call <SID>HtmlIndentPush('button')
call <SID>HtmlIndentPush('caption')
call <SID>HtmlIndentPush('center')
call <SID>HtmlIndentPush('cite')
call <SID>HtmlIndentPush('code')
call <SID>HtmlIndentPush('colgroup')
call <SID>HtmlIndentPush('del')
call <SID>HtmlIndentPush('dfn')
call <SID>HtmlIndentPush('dir')
call <SID>HtmlIndentPush('div')
call <SID>HtmlIndentPush('dl')
call <SID>HtmlIndentPush('em')
call <SID>HtmlIndentPush('fieldset')
call <SID>HtmlIndentPush('font')
call <SID>HtmlIndentPush('form')
call <SID>HtmlIndentPush('frameset')
call <SID>HtmlIndentPush('h1')
call <SID>HtmlIndentPush('h2')
call <SID>HtmlIndentPush('h3')
call <SID>HtmlIndentPush('h4')
call <SID>HtmlIndentPush('h5')
call <SID>HtmlIndentPush('h6')
call <SID>HtmlIndentPush('i')
call <SID>HtmlIndentPush('iframe')
call <SID>HtmlIndentPush('ins')
call <SID>HtmlIndentPush('kbd')
call <SID>HtmlIndentPush('label')
call <SID>HtmlIndentPush('legend')
call <SID>HtmlIndentPush('map')
call <SID>HtmlIndentPush('menu')
call <SID>HtmlIndentPush('noframes')
call <SID>HtmlIndentPush('noscript')
call <SID>HtmlIndentPush('object')
call <SID>HtmlIndentPush('ol')
call <SID>HtmlIndentPush('optgroup')
" call <SID>HtmlIndentPush('pre')
call <SID>HtmlIndentPush('q')
call <SID>HtmlIndentPush('s')
call <SID>HtmlIndentPush('samp')
call <SID>HtmlIndentPush('script')
call <SID>HtmlIndentPush('select')
call <SID>HtmlIndentPush('small')
call <SID>HtmlIndentPush('span')
call <SID>HtmlIndentPush('strong')
call <SID>HtmlIndentPush('style')
call <SID>HtmlIndentPush('sub')
call <SID>HtmlIndentPush('sup')
call <SID>HtmlIndentPush('table')
call <SID>HtmlIndentPush('textarea')
call <SID>HtmlIndentPush('title')
call <SID>HtmlIndentPush('tt')
call <SID>HtmlIndentPush('u')
call <SID>HtmlIndentPush('ul')
call <SID>HtmlIndentPush('var')
" New HTML 5 elements
call <SID>HtmlIndentPush('table')
call <SID>HtmlIndentPush('article')
call <SID>HtmlIndentPush('aside')
call <SID>HtmlIndentPush('audio')
call <SID>HtmlIndentPush('canvas')
call <SID>HtmlIndentPush('command')
call <SID>HtmlIndentPush('datalist')
call <SID>HtmlIndentPush('details')
call <SID>HtmlIndentPush('embed')
call <SID>HtmlIndentPush('figcaption')
call <SID>HtmlIndentPush('figure')
call <SID>HtmlIndentPush('footer')
call <SID>HtmlIndentPush('header')
call <SID>HtmlIndentPush('hgroup')
call <SID>HtmlIndentPush('keygen')
call <SID>HtmlIndentPush('mark')
call <SID>HtmlIndentPush('meter')
call <SID>HtmlIndentPush('nav')
call <SID>HtmlIndentPush('output')
call <SID>HtmlIndentPush('progress')
call <SID>HtmlIndentPush('rp')
call <SID>HtmlIndentPush('rt')
call <SID>HtmlIndentPush('ruby')
call <SID>HtmlIndentPush('section')
call <SID>HtmlIndentPush('source')
call <SID>HtmlIndentPush('summary')
call <SID>HtmlIndentPush('time')
call <SID>HtmlIndentPush('video')
call <SID>HtmlIndentPush('bdi')
" [-- <ELEMENT ? O O ...> --]
if !exists('g:html_indent_strict')
call <SID>HtmlIndentPush('body')
call <SID>HtmlIndentPush('head')
call <SID>HtmlIndentPush('html')
call <SID>HtmlIndentPush('tbody')
endif
" [-- <ELEMENT ? O - ...> --]
if !exists('g:html_indent_strict_table')
call <SID>HtmlIndentPush('th')
call <SID>HtmlIndentPush('td')
call <SID>HtmlIndentPush('tr')
call <SID>HtmlIndentPush('tfoot')
call <SID>HtmlIndentPush('thead')
endif
delfun <SID>HtmlIndentPush
let s:cpo_save = &cpo
set cpo-=C
" [-- count indent-increasing tags of line a:lnum --]
fun! <SID>HtmlIndentOpen(lnum, pattern)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)\('.a:pattern.'\)\>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-decreasing tags of line a:lnum --]
fun! <SID>HtmlIndentClose(lnum, pattern)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)/\('.a:pattern.'\)\>>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-increasing '{' of (java|css) line a:lnum --]
fun! <SID>HtmlIndentOpenAlt(lnum)
return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
endfun
" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
fun! <SID>HtmlIndentCloseAlt(lnum)
return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
endfun
" [-- return the sum of indents respecting the syntax of a:lnum --]
fun! <SID>HtmlIndentSum(lnum, style)
if a:style == match(getline(a:lnum), '^\s*</')
if a:style == match(getline(a:lnum), '^\s*</\<\('.g:html_indent_tags.'\)\>')
let open = <SID>HtmlIndentOpen(a:lnum, g:html_indent_tags)
let close = <SID>HtmlIndentClose(a:lnum, g:html_indent_tags)
if 0 != open || 0 != close
return open - close
endif
endif
endif
if '' != &syntax &&
\ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
\ synIDattr(synID(a:lnum, strlen(getline(a:lnum)), 1), 'name')
\ =~ '\(css\|java\).*'
if a:style == match(getline(a:lnum), '^\s*}')
return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
endif
endif
return 0
endfun
fun! HtmlIndentGet(lnum)
" Find a non-empty line above the current line.
let lnum = prevnonblank(a:lnum - 1)
" Hit the start of the file, use zero indent.
if lnum == 0
return 0
endif
let restore_ic = &ic
setlocal ic " ignore case
" [-- special handling for <pre>: no indenting --]
if getline(a:lnum) =~ '\c</pre>'
\ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nWb')
\ || 0 < searchpair('\c<pre>', '', '\c</pre>', 'nW')
" we're in a line with </pre> or inside <pre> ... </pre>
if restore_ic == 0
setlocal noic
endif
return -1
endif
" [-- special handling for <javascript>: use cindent --]
let js = '<script.*type\s*=\s*.*java'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" by Tye Zdrojewski <zdro@yahoo.com>, 05 Jun 2006
" ZDR: This needs to be an AND (we are 'after the start of the pair' AND
" we are 'before the end of the pair'). Otherwise, indentation
" before the start of the script block will be affected; the end of
" the pair will still match if we are before the beginning of the
" pair.
"
if 0 < searchpair(js, '', '</script>', 'nWb')
\ && 0 < searchpair(js, '', '</script>', 'nW')
" we're inside javascript
if getline(lnum) !~ js && getline(a:lnum) != '</script>'
if restore_ic == 0
setlocal noic
endif
return cindent(a:lnum)
endif
endif
if getline(lnum) =~ '\c</pre>'
" line before the current line a:lnum contains
" a closing </pre>. --> search for line before
" starting <pre> to restore the indent.
let preline = prevnonblank(search('\c<pre>', 'bW') - 1)
if preline > 0
if restore_ic == 0
setlocal noic
endif
return indent(preline)
endif
endif
let ind = <SID>HtmlIndentSum(lnum, -1)
let ind = ind + <SID>HtmlIndentSum(a:lnum, 0)
if restore_ic == 0
setlocal noic
endif
return indent(lnum) + (&sw * ind)
endfun
let &cpo = s:cpo_save
unlet s:cpo_save
" [-- EOF <runtime>/indent/html.vim --]

238
vim/plugin/let-modeline.vim Normal file
View File

@ -0,0 +1,238 @@
" example -> VIM: let b:toto="foo" g:tata=4 g:egal="t=y".&tw
" ===========================================================================
" $Id$
" File: let-modeline.vim {{{1
" Author: Luc Hermitte <EMAIL:hermitte {at} free {dot} fr>
" <URL:http://hermitte.free.fr/vim/>
" URL: http://code.google.com/p/lh-vim/source/browse/misc/trunk/plugin/let-modeline.vim
" Version: 1.9
" Last Update: 21st Apr 2011 ($Date$)
"
" Purpose: {{{2
" Defines the function : FirstModeLine() that extends the VIM modeline
" feature to variables. In VIM, it is possible to set options in the
" first and last lines. -> :h modeline
" The function proposed extends it to 'let {var}={val}' affectations.
"
" Exemples Of Useful Aplications: {{{2
" Typical Example: {{{3
" When editing a LaTeX document composed of several files, it is very
" practical to know the name of the main file whichever file is edited --
" TKlatex does this thanks the global variable g:TeXfile. Hence it knows
" that latex should be called on this main file ; aux2tags.vim could also
" be told to compute the associated .aux file.
" Anyway. Defining (through menus or a let command) g:TeXfile each time is
" really boring. It bored me so much that I programmed a first version of
" this script. In every file of one of my projects I added the line :
" % VIM: let g:TeXfile=main.tex
" [main.tex is the name of the main file of the project]
" Thus, I can very simply call LaTeX from within VIM without having to
" wonder which file is the main one nor having to specify g:TeXfile each
" time.
"
" Using Callback Functions: {{{3
" Actually, in order to affect g:TeXfile, I have to call another function.
" Hence, I define a callback function (in my (La)TeX ftplugin) that checks
" whether I want to set g:TeXfile. In that case, the callback function
" calls the right function and return true. Otherwise, it returns false.
" You will find the code of this precise callback function as an example at
" the end of this file.
"
" Tune C Compilations: {{{3
" An easy way to tune the parameters of the compilation of simple programs
" without having to maintain a makefile:
" // VIM: let $CPPFLAGS='-I../../libs':
"
" ---------------------------------------------------------------------------
" Format: {{{2
" On the _first_ line of any file, the extended modeline format is:
" {line} ::= [text]{white}VIM:[white]let{affectations}
" {affectations} ::= {sgl_affect.}
" {affectations} ::= {sgl_affect.}{white}{affectations}
" {sgl_affect.} ::= {variable}[white]=[white]{value}
" {variable} ::= cf. vim variable format ; beware simple
" variables (other than global-, buffer-,
" or window-variables) are not exported.
" Can also be an environment variable -> $VAR.
" {value} ::= string or numeral value : no function
" call allowed.
"
" Options: {{2
" (*) 'modeline' : vim-option that must be set to 1
" (*) 'modelines': vim-option corrsponding to the number of lines
" searched.
" (*) b:ModeLine_CallBack(var,val) : callback function
" Enable to define callback functions when needed. cf. lhlatex.vim
"
" Installation: {{{2
" (*) Drop the file into your {rtp}/plugin/ folder.
"
" Remarks: {{{2
" (*) The only way to call a function is through the callback feature.
" Affectation like 'let g:foo="abc".DEF()' are recognized and
" forbiden.
" (*) The modeline is recognized thanks to "VIM" in that *must* be in
" uppercase letters
"
" Changes: {{{2
" v1.9: @/ is preserved
" v1.8: autocommands moved to the plugin
" v1.7: Optimizations
" v1.6: Support for environment variables.
" vim 6.x only
" Doesn't check into folded lines anymore
" v1.5: Check that the format of the variables and values is correct
" before it tries to set the variables -> no more error messages
" when using 2html.vim.
" v1.4: With Vim 6.x, it doesn't mess anymore with the search history
" v1.3: Parse several lines according to &modelines and &modeline
" v1.2: no-reinclusion mecanism
" v1.1b: extend variable names to accept underscores
"
" Todo: {{{2
" (*) Enforce the patterns and the resulting errors
" (*) Permit to have comments ending characters at the end of the line.
" (*) Simplify the regexps
"
" }}}1
" ===========================================================================
" Definitions: {{{1
if exists("g:loaded_let_modeline") && ! exists('g:force_reload_let_modeline') | finish | endif
let g:loaded_let_modeline = 1
" Internal function dedicated to the recognition of function calls {{{2
function! s:FoundFunctionCall(value_str)
let str = substitute(a:value_str, '"[^"]*"', '', 'g')
let str = substitute(str, "'[^']*'", '', 'g')
return match(str, '(.*)') != -1
endfunction
let s:re_var = '\s\+\([[:alnum:]:_$]\+\)'
" beware the comments ending characters
let s:re_val = '\(\%(' . "'[^']*'" . '\|"[^"]*"\|[-a-zA-Z0-9:_.&$]\)\+\)$'
let s:re_other = '^\(.\{-}\)'
let s:re_sub = s:re_other . s:re_var . '\s*=\s*' . s:re_val
" Internal function dedicated to the parsing of a line {{{2
function! FML_parse_line(mtch)
" call confirm('Find:'.a:mtch, '&ok', 1)
if a:mtch !=""
let mtch = a:mtch
while strlen(mtch) != 0
let vari = substitute( mtch, s:re_sub, '\2', '' )
let valu = substitute( mtch, s:re_sub, '\3', '' )
" call confirm('regex: '.s:re_sub."\nmtch: <<".mtch.">>\nvar: ".vari."\nval: ".valu, '&ok', 1)
if (vari !~ '^[[:alnum:]:_$]\+$') || (valu !~ s:re_val)
return
endif
" Check : no function !
if s:FoundFunctionCall(valu)
echohl ErrorMsg
echo "Find a function call in the affectation : let " . vari . " = " . valu
echohl None
return
endif
let mtch = substitute( mtch, s:re_sub, '\1', '' )
""echo vari . " = " . valu . " --- " . mtch . "\n"
" call confirm('vari: '.vari.' = '.valu." --- " . mtch, '&Ok', 1)
if exists("b:ModeLine_CallBack")
exe 'let res = '. b:ModeLine_CallBack . '("'.vari.'","'.valu.'")'
if res == 1 | return | endif
endif
" Else
execute "let " . vari . " = " . valu
endwhile
endif
endfunction
" Internal function dedicated searching the matching lines {{{2
" let s:modeline_pat = '[vV][iI][mM]\d*:\s*let\s*\zs.*$'
let s:modeline_pat = '[vV][iI][mM]\d*:\s*let\zs.*$'
function! s:Do_it_on_range(first, last)
if &verbose >= 2 " {{{
echo "\n->"a:first.','.a:last. 'g/'.s:modeline_pat.
\ '/:call FML_parse_line(matchstr(getline("."),"'.
\ escape(s:modeline_pat, '\\') .'"))'
endif " }}}
let s:save_fold_enable= &foldenable
set nofoldenable
if exists(':try')
try
let s = @/
silent execute a:first.','.a:last. 'g/'.s:modeline_pat.
\ '/:call FML_parse_line(matchstr(getline("."),"'.
\ escape(s:modeline_pat, '\\') .'"))'
" Purge the history for the search pattern just used.
call histdel('search', -1)
finally
let @/ = s
let &foldenable = s:save_fold_enable
endtry
else " Older versions of Vim
silent execute a:first.','.a:last. 'g/'.s:modeline_pat.
\ '/:call FML_parse_line(matchstr(getline("."),"'.
\ escape(s:modeline_pat, '\\') .'"))'
" Purge the history for the search pattern just used.
call histdel('search', -1)
let &foldenable = s:save_fold_enable
endif
endfunction
" The main function {{{2
function! FirstModeLine()
if !&modeline | return | endif
let pos = line('.') . 'normal! ' . virtcol('.') . '|'
let e1 = 1+&modelines-1
let b2 = line('$') - &modelines+1
" call confirm('e1='.e1."\nb2=".b2, '&ok', 1)
if e1 >= b2
call s:Do_it_on_range(1, line('$'))
else
call s:Do_it_on_range(1, e1)
call s:Do_it_on_range(b2, line('$'))
endif
if !exists('b:this_is_new_buffer')
exe pos
else
unlet b:this_is_new_buffer
endif
" call confirm('fini!', '&ok', 1)
endfunction
" }}}2
" autocommand {{{2
aug LetModeline
au!
au BufReadPost * :call FirstModeLine()
" To not interfere with Templates loaders
" au BufNewFile * :let b:this_is_new_buffer=1
" Modeline interpretation
" au BufEnter * :call FirstModeLine()
aug END
" }}}1
" ===========================================================================
" Example of a callback function {{{1
" Version I use in my (La)TeX ftplugin
if 0
let b:ModeLine_CallBack = "TeXModeLine_CallBack"
function! TeXModeLine_CallBack(var,val)
if match(a:var, "g:TeXfile") != -1
" restore quotes around the file name
"let valu = substitute( valu, '^"\=\([[:alnum:].]\+\)"\=$', '"\1"', '' )
call TKSetTeXfileName( 2, a:val )
return 1
else
return 0
endif
endfunction
endif
" }}}1
" ===========================================================================
" vim600: set fdm=marker:

249
vim/plugin/libList.vim Normal file
View File

@ -0,0 +1,249 @@
" File: libList.vim
" Last Change: 2001 Dec 10
" Maintainer: Gontran BAERTS <gbcreation@free.fr>
" Version: 0.1
"
" Please don't hesitate to correct my english :)
" Send corrections to <gbcreation@free.fr>
"
"-----------------------------------------------------------------------------
" Description: libList.vim is a set of functions to work with lists or one
" level arrays.
"
"-----------------------------------------------------------------------------
" To Enable: Normally, this file will reside in your plugins directory and be
" automatically sourced.
"
"-----------------------------------------------------------------------------
" Usage: Lists are strings variable with values separated by g:listSep
" character (comma" by default). You may redefine g:listSep variable as you
" wish.
"
" Here are available functions :
"
" - AddListItem( array, newItem, index ) :
" Add item "newItem" to array "array" at "index" position
" - GetListItem( array, index ) :
" Return item at "index" position in array "array"
" - GetListMatchItem( array, pattern ) :
" Return item matching "pattern" in array "array"
" - GetListCount( array ) :
" Return the number of items in array "array"
" - RemoveListItem( array, index ) :
" Remove item at "index" position from array "array"
" - ReplaceListItem( array, index, item ) :
" Remove item at "index" position by "item" in array "array"
" - ExchangeListItems( array, item1Index, item2Index ) :
" Exchange item "item1Index" with item "item2Index" in array "array"
" - QuickSortList( array, beg, end ) :
" Return array "array" with items between "beg" and "end" sorted
"
" Example:
" let mylist=""
" echo GetListCount( mylist ) " --> 0
" let mylist = AddListItem( mylist, "One", 0 ) " mylist == "One"
" let mylist = AddListItem( mylist, "Three", 1 ) " mylist == "One,Three"
" let mylist = AddListItem( mylist, "Two", 1 ) " mylist == "One,Two,Three"
" echo GetListCount( mylist ) " --> 3
" echo GetListItem( mylist, 2 ) " --> Three
" echo GetListMatchItem( mylist, "w" ) " --> two
" echo GetListMatchItem( mylist, "e" ) " --> One
" let mylist = RemoveListItem( mylist, 2 ) " mylist == "One,Two"
" echo GetListCount( mylist ) " --> 2
" let mylist = ReplaceListItem( mylist, 0, "Three" ) " mylist == "Three,Two"
" let mylist = ExchangeListItems( mylist, 0, 1 ) " mylist == "Two,Three"
" let mylist = AddListItem( mylist, "One", 0 ) " mylist == "One,Two,Three"
" let mylist = QuickSortList( mylist, 0, GetListCount(mylist)-1 )
" " mylist == "One,Three,Two"
"
"-----------------------------------------------------------------------------
" Updates:
" in version 0.1
" - First version
" Has this already been loaded ?
if exists("loaded_libList")
finish
endif
let loaded_libList=1
"**
" Separator:
" You may change the separator character et any time.
"**
let g:listSep = ","
"**
"AddListItem:
" Add new item at given position.
" First item index is 0 (zero).
"Parameters:
" - array : Array/List (string of values) which receives the new item.
" - newItem : String containing the item value to add.
" - index : Integer indicating the position at which the new item is added.
" It must be greater than or equals to 0 (zero).
"Return:
"String containing array values, including newItem.
"**
function AddListItem( array, newItem, index )
if a:index == 0
if a:array == ""
return a:newItem
endif
return a:newItem . g:listSep . a:array
endif
return substitute( a:array, '\(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}', '\0' . g:listSep . a:newItem , "" )
endfunction
"**
"GetListItem:
" Get item at given position.
"Parameters:
" - array : Array/List (string of values).
" - index : Integer indicating the position of item to return.
" It must be greater than or equals to 0 (zero).
"Return:
"String representing the item.
"**
function GetListItem( array, index )
if a:index == 0
return matchstr( a:array, '^[^' . g:listSep . ']\+' )
else
return matchstr( a:array, "[^" . g:listSep . "]\\+", matchend( a:array, '\(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}' . g:listSep ) )
endif
endfunction
"**
"GetListMatchItem:
" Get the first item matching given pattern.
"Parameters:
" - array : Array/List (string of values).
" - pattern : Regular expression to match with items.
" Avoid to use ^, $ and listSep characters in pattern, unless you
" know what you do.
"Return:
"String representing the first item that matches the pattern.
"**
function GetListMatchItem( array, pattern )
return matchstr( a:array, '[^' . g:listSep . ']*' . a:pattern . '[^' . g:listSep . ']*' )
endfunction
"**
"ReplaceListItem:
" Replace item at given position by a new one.
"Parameters:
" - array : Array/List (string of values).
" - index : Integer indicating the position of item to replace.
" It must be greater than or equals to 0 (zero).
" - item : String containing the new value of the replaced item.
"Return:
"String containing array values.
"**
function ReplaceListItem( array, index, item )
if a:index == 0
return substitute( a:array, '^[^' .g:listSep. ']\+', a:item, "" )
else
return substitute( a:array, '\(\%(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}\)' . g:listSep . '[^' . g:listSep . ']\+', '\1' . g:listSep . a:item , "" )
endif
endfunction
"**
"RemoveListItem:
" Remove item at given position.
"Parameters:
" - array : Array/List (string of values) from which remove an item.
" - index : Integer indicating the position of item to remove.
" It must be greater than or equals to 0 (zero).
"Return:
"String containing array values, except the removed one.
"**
function RemoveListItem( array, index )
if a:index == 0
return substitute( a:array, '^[^' .g:listSep. ']\+\(' . g:listSep . '\|$\)', "", "" )
else
return substitute( a:array, '\(\%(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}\)' . g:listSep . '[^' . g:listSep . ']\+', '\1', "" )
endif
endfunction
"**
"ExchangeListItems:
" Exchange item at position item1Index with item at position item2Index.
"Parameters:
" - array : Array/List (string of values).
" - item1index : Integer indicating the position of the first item to exchange.
" It must be greater than or equals to 0 (zero).
" - item2index : Integer indicating the position of the second item to
" exchange. It must be greater than or equals to 0 (zero).
"Return:
"String containing array values.
"**
function ExchangeListItems( array, item1Index, item2Index )
let item1 = GetListItem( a:array, a:item1Index )
let array = ReplaceListItem( a:array, a:item1Index, GetListItem( a:array, a:item2Index ) )
return ReplaceListItem( array, a:item2Index, item1 )
endfunction
"**
"GetListCount:
" Number of items in array.
"Parameters:
" - array : Array/List (string of values).
"Return:
"Integer representing the number of items in array.
"Index of last item is GetListCount(array)-1.
"**
function GetListCount( array )
if a:array == "" | return 0 | endif
let pos = 0
let cnt = 0
while pos != -1
let pos = matchend( a:array, g:listSep, pos )
let cnt = cnt + 1
endwhile
return cnt
endfunction
"**
"QuickSortList:
" Sort array.
"Parameters:
" - array : Array/List (string of values).
" - beg : Min index of the range of items to sort.
" - end : Max index of the range of items to sort.
"Return:
"String containing array values with indicated range of items sorted.
"**
function QuickSortList( array, beg, end )
let array = a:array
let pivot = GetListItem( array, a:beg )
let l = a:beg
let r = a:end
while l < r
while GetListItem( array, r ) > pivot
let r = r - 1
endwhile
if l != r
let array = ReplaceListItem( array, l, GetListItem( array, r ) )
let array = ReplaceListItem( array, r, pivot )
let l = l + 1
endif
while GetListItem( array, l ) < pivot
let l = l + 1
endwhile
if l != r
let array = ReplaceListItem( array, r, GetListItem( array, l ) )
let array = ReplaceListItem( array, l, pivot )
let r = r - 1
endif
endwhile
if a:beg < l-1
let array = QuickSortList( array, a:beg, l-1 )
endif
if a:end > l+1
let array = QuickSortList( array, l+1, a:end )
endif
return array
endfunction

340
vim/plugin/rails.vim Normal file
View File

@ -0,0 +1,340 @@
" rails.vim - Detect a rails application
" Author: Tim Pope <vimNOSPAM@tpope.org>
" 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
if exists('g:loaded_rails') || &cp || v:version < 700
finish
endif
let g:loaded_rails = 1
" 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") && v:version >= 700
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
if v:version >= 700
call s:error("Disabling rails.vim: autoload/rails.vim is missing")
else
call s:error("Disabling rails.vim: Vim version 7 or higher required")
endif
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_statusline",1)
call s:SetOptDefault("rails_syntax",1)
call s:SetOptDefault("rails_mappings",1)
call s:SetOptDefault("rails_abbreviations",1)
call s:SetOptDefault("rails_ctags_arguments","--languages=-javascript")
call s:SetOptDefault("rails_default_file","README")
call s:SetOptDefault("rails_root_url",'http://localhost:3000/')
call s:SetOptDefault("rails_modelines",0)
call s:SetOptDefault("rails_menu",!has('mac'))
call s:SetOptDefault("rails_gnu_screen",1)
call s:SetOptDefault("rails_history_size",5)
call s:SetOptDefault("rails_generators","controller\ngenerator\nhelper\nintegration_test\nmailer\nmetal\nmigration\nmodel\nobserver\nperformance_test\nplugin\nresource\nscaffold\nscaffold_controller\nsession_migration\nstylesheets")
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
" }}}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://','','')
let sep = matchstr(fn,'^[^\\/]\{3,\}\zs[\\/]')
if sep != ""
let fn = getcwd().sep.fn
endif
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\|features\|lib\|log\|public\|script\|spec\|stories\|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 Syntax railslog if s:autoload()|call rails#log_syntax()|endif
augroup END
command! -bar -bang -nargs=* -complete=dir Rails :if s:autoload()|call rails#new_app_command(<bang>0,<f-args>)|endif
" }}}1
" abolish.vim support {{{1
function! s:function(name)
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
endfunction
augroup railsPluginAbolish
autocmd!
autocmd VimEnter * call s:abolish_setup()
augroup END
function! s:abolish_setup()
if exists('g:Abolish') && has_key(g:Abolish,'Coercions')
if !has_key(g:Abolish.Coercions,'l')
let g:Abolish.Coercions.l = s:function('s:abolish_l')
endif
if !has_key(g:Abolish.Coercions,'t')
let g:Abolish.Coercions.t = s:function('s:abolish_t')
endif
endif
endfunction
function! s:abolish_l(word)
let singular = rails#singularize(a:word)
return a:word ==? singular ? rails#pluralize(a:word) : singular
endfunction
function! s:abolish_t(word)
if a:word =~# '\u'
return rails#pluralize(rails#underscore(a:word))
else
return rails#singularize(rails#camelize(a:word))
endif
endfunction
" }}}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:menucmd(priority)
return 'anoremenu <script> '.(exists("$CREAM") ? 87 : '').s:gsub(g:rails_installed_menu,'[^.]','').'.'.a:priority.' '
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
let dots = s:gsub(g:rails_installed_menu,'[^.]','')
let menucmd = s:menucmd(200)
if exists("$CREAM")
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
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 :Rcontroller application<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Helper :Rhelper application<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Javascript :Rjavascript application<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &Layout :Rlayout application<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Application\ &README :R doc/README_FOR_APP<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.&Environment :Renvironment<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.&Database\ Configuration :R config/database.yml<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.Database\ &Schema :Rmigration 0<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.R&outes :Rinitializer<CR>'
exe menucmd.g:rails_installed_menu.'.&Other\ files.&Test\ Helper :Rintegrationtest<CR>'
exe menucmd.g:rails_installed_menu.'.-FSep- :'
exe menucmd.g:rails_installed_menu.'.Ra&ke\ :Rake :Rake<CR>'
let menucmd = substitute(menucmd,'200 $','500 ','')
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 substitute(menucmd,'<script>','<script> <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\ :Rscript :Rscript console<CR>'
exe menucmd.g:rails_installed_menu.'.&Preview\ :Rpreview :Rpreview<CR>'
exe menucmd.g:rails_installed_menu.'.&Log\ file\ :Rlog :Rlog<CR>'
exe substitute(s:sub(menucmd,'anoremenu','vnoremenu'),'<script>','<script> <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 substitute(menucmd,'<script>','<script> <silent>','').g:rails_installed_menu.'.&Help\ :help\ rails :if <SID>autoload()<Bar>exe RailsHelpCommand("")<Bar>endif<CR>'
exe substitute(menucmd,'<script>','<script> <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()
silent! exe 'aunmenu '.menu.'.Rake\ tasks'
silent! exe 'aunmenu '.menu.'.Generate'
silent! exe 'aunmenu '.menu.'.Destroy'
if rails#app().cache.needs('rake_tasks') || empty(rails#app().rake_tasks())
exe substitute(s:menucmd(300),'<script>','<script> <silent>','').g:rails_installed_menu.'.Rake\ &tasks\ :Rake.Fill\ this\ menu :call rails#app().rake_tasks()<Bar>call <SID>menuBufLeave()<Bar>call <SID>menuBufEnter()<CR>'
else
let i = 0
while i < len(rails#app().rake_tasks())
let task = rails#app().rake_tasks()[i]
exe s:menucmd(300).g:rails_installed_menu.'.Rake\ &tasks\ :Rake.'.s:sub(task,':',':.').' :Rake '.task.'<CR>'
let i += 1
endwhile
endif
let i = 0
let menucmd = substitute(s:menucmd(400),'<script>','<script> <silent>','').g:rails_installed_menu
while i < len(rails#app().generators())
let generator = rails#app().generators()[i]
exe menucmd.'.&Generate\ :Rgen.'.s:gsub(generator,'_','\\ ').' :call <SID>menuprompt("Rgenerate '.generator.'","Arguments for script/generate '.generator.': ")<CR>'
exe menucmd.'.&Destroy\ :Rdestroy.'.s:gsub(generator,'_','\\ ').' :call <SID>menuprompt("Rdestroy '.generator.'","Arguments for script/destroy '.generator.': ")<CR>'
let i += 1
endwhile
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'
silent! exe 'aunmenu '.menu.'.Rake\ tasks'
silent! exe 'aunmenu '.menu.'.Generate'
silent! exe 'aunmenu '.menu.'.Destroy'
exe s:menucmd(300).g:rails_installed_menu.'.Rake\ tasks\ :Rake.-TSep- :'
exe s:menucmd(400).g:rails_installed_menu.'.&Generate\ :Rgen.-GSep- :'
exe s:menucmd(400).g:rails_installed_menu.'.&Destroy\ :Rdestroy.-DSep- :'
endif
endfunction
function! s:menuprompt(vimcmd,prompt)
let res = inputdialog(a:prompt,'','!!!')
if res == '!!!'
return ""
endif
exe a:vimcmd." ".res
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:

576
vim/plugin/rake.vim Normal file
View File

@ -0,0 +1,576 @@
" rake.vim - It's like rails.vim without the rails
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 1.0
" GetLatestVimScripts: 3669 1 :AutoInstall: rake.vim
if exists('g:loaded_rake') || &cp || v:version < 700
finish
endif
let g:loaded_rake = 1
" Utility {{{1
function! s:function(name) abort
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
endfunction
function! s:sub(str,pat,rep) abort
return substitute(a:str,'\v\C'.a:pat,a:rep,'')
endfunction
function! s:gsub(str,pat,rep) abort
return substitute(a:str,'\v\C'.a:pat,a:rep,'g')
endfunction
function! s:shellesc(arg) abort
if a:arg =~ '^[A-Za-z0-9_/.-]\+$'
return a:arg
else
return shellescape(a:arg)
endif
endfunction
function! s:fnameescape(file) abort
if exists('*fnameescape')
return fnameescape(a:file)
else
return escape(a:file," \t\n*?[{`$\\%#'\"|!<")
endif
endfunction
function! s:shellslash(path)
if exists('+shellslash') && !&shellslash
return s:gsub(a:path,'\\','/')
else
return a:path
endif
endfunction
function! s:fuzzyglob(arg)
return s:gsub(s:gsub(a:arg,'[^/.]','[&]*'),'%(/|^)\.@!|\.','&*')
endfunction
function! s:completion_filter(results,A)
let results = sort(copy(a:results))
call filter(results,'v:val !~# "\\~$"')
let filtered = filter(copy(results),'v:val[0:strlen(a:A)-1] ==# a:A')
if !empty(filtered) | return filtered | endif
let regex = s:gsub(a:A,'[^/:]','[&].*')
let filtered = filter(copy(results),'v:val =~# "^".regex')
if !empty(filtered) | return filtered | endif
let filtered = filter(copy(results),'"/".v:val =~# "[/:]".regex')
if !empty(filtered) | return filtered | endif
let regex = s:gsub(a:A,'.','[&].*')
let filtered = filter(copy(results),'"/".v:val =~# regex')
return filtered
endfunction
function! s:throw(string) abort
let v:errmsg = 'rake: '.a:string
throw v:errmsg
endfunction
function! s:warn(str)
echohl WarningMsg
echomsg a:str
echohl None
let v:warningmsg = a:str
endfunction
function! s:add_methods(namespace, method_names) abort
for name in a:method_names
let s:{a:namespace}_prototype[name] = s:function('s:'.a:namespace.'_'.name)
endfor
endfunction
let s:commands = []
function! s:command(definition) abort
let s:commands += [a:definition]
endfunction
function! s:define_commands()
for command in s:commands
exe 'command! -buffer '.command
endfor
endfunction
augroup rake_utility
autocmd!
autocmd User Rake call s:define_commands()
augroup END
let s:abstract_prototype = {}
" }}}1
" Initialization {{{1
function! s:FindRakeRoot(path) abort
let path = s:shellslash(a:path)
for p in [$GEM_HOME] + split($GEM_PATH,':')
if p !=# '' && s:shellslash(p.'/gems/') ==# (path)[0 : strlen(p)+5]
return simplify(s:shellslash(p.'/gems/')).matchstr(path[strlen(p)+6:-1],'[^\\/]*')
endif
endfor
let fn = fnamemodify(path,':s?[\/]$??')
let ofn = ""
let nfn = fn
while fn != ofn
if filereadable(fn.'/Rakefile')
if filereadable(fn.'/config/environment.rb')
return ''
else
return s:sub(simplify(fnamemodify(fn,':p')),'[\\/]$','')
endif
endif
let ofn = fn
let fn = fnamemodify(ofn,':h')
endwhile
return ''
endfunction
function! s:Detect(path)
if exists('b:rake_root') && b:rake_root ==# ''
unlet b:rake_root
endif
if !exists('b:rake_root')
let dir = s:FindRakeRoot(a:path)
if dir != ''
let b:rake_root = dir
endif
endif
if exists('b:rake_root')
silent doautocmd User Rake
endif
endfunction
augroup rake
autocmd!
autocmd BufNewFile,BufReadPost * call s:Detect(expand('<amatch>:p'))
autocmd FileType netrw call s:Detect(expand('<afile>:p'))
autocmd VimEnter * if expand('<amatch>')==''|call s:Detect(getcwd())|endif
augroup END
" }}}1
" Project {{{1
let s:project_prototype = {}
let s:projects = {}
function! s:project(...) abort
let dir = a:0 ? a:1 : (exists('b:rake_root') && b:rake_root !=# '' ? b:rake_root : s:FindRakeRoot(expand('%:p')))
if dir !=# ''
if has_key(s:projects,dir)
let project = get(s:projects,dir)
else
let project = {'root': dir}
let s:projects[dir] = project
endif
return extend(extend(project,s:project_prototype,'keep'),s:abstract_prototype,'keep')
endif
call s:throw('not a rake project: '.expand('%:p'))
endfunction
function! s:project_path(...) dict abort
return join([self.root]+a:000,'/')
endfunction
call s:add_methods('project',['path'])
function! s:project_dirglob(base) dict abort
let base = s:sub(a:base,'^/','')
let matches = split(glob(self.path(s:gsub(base,'/','*&').'*/')),"\n")
call map(matches,'v:val[ strlen(self.path())+(a:base !~ "^/") : -1 ]')
return matches
endfunction
function! s:project_has_file(file) dict
return filereadable(self.path(a:file))
endfunction
function! s:project_has_directory(file) dict
return isdirectory(self.path(a:file))
endfunction
function! s:project_first_file(...) dict abort
for file in a:000
if s:project().has_file(file)
return file
endif
endfor
for file in a:000
if s:project().has_directory(matchstr(file,'^[^/]*'))
return file
endif
endfor
return a:000[0]
endfunction
call s:add_methods('project',['dirglob','has_file','has_directory','first_file'])
" }}}1
" Buffer {{{1
let s:buffer_prototype = {}
function! s:buffer(...) abort
let buffer = {'#': bufnr(a:0 ? a:1 : '%')}
call extend(extend(buffer,s:buffer_prototype,'keep'),s:abstract_prototype,'keep')
if buffer.getvar('rake_root') !=# ''
return buffer
endif
call s:throw('not a rake project: '.expand('%:p'))
endfunction
function! rake#buffer(...) abort
return s:buffer(a:0 ? a:1 : '%')
endfunction
function! s:buffer_getvar(var) dict abort
return getbufvar(self['#'],a:var)
endfunction
function! s:buffer_setvar(var,value) dict abort
return setbufvar(self['#'],a:var,a:value)
endfunction
function! s:buffer_getline(lnum) dict abort
return getbufline(self['#'],a:lnum)[0]
endfunction
function! s:buffer_project() dict abort
return s:project(self.getvar('rake_root'))
endfunction
function! s:buffer_name() dict abort
return self.path()[strlen(self.project().path())+1 : -1]
endfunction
function! s:buffer_path() dict abort
let bufname = bufname(self['#'])
return s:shellslash(bufname == '' ? '' : fnamemodify(bufname,':p'))
endfunction
call s:add_methods('buffer',['getvar','setvar','getline','project','name','path'])
" }}}1
" Rake {{{1
function! s:push_chdir(...)
if !exists("s:command_stack") | let s:command_stack = [] | endif
let chdir = exists("*haslocaldir") && haslocaldir() ? "lchdir " : "chdir "
call add(s:command_stack,chdir.s:fnameescape(getcwd()))
exe chdir.'`=s:project().path()`'
endfunction
function! s:pop_command()
if exists("s:command_stack") && len(s:command_stack) > 0
exe remove(s:command_stack,-1)
endif
endfunction
function! s:Rake(bang,arg)
let old_makeprg = &l:makeprg
let old_errorformat = &l:errorformat
call s:push_chdir()
try
if exists('b:bundle_root') && b:bundler_root ==# s:project().path()
let &l:makeprg = 'bundle exec rake'
else
let &l:makeprg = 'rake'
endif
let &l:errorformat = '%D(in\ %f),'
\.'%\\s%#from\ %f:%l:%m,'
\.'%\\s%#from\ %f:%l:,'
\.'%\\s#{RAILS_ROOT}/%f:%l:\ %#%m,'
\.'%\\s%#[%f:%l:\ %#%m,'
\.'%W%m\ (Cucumber::Undefined),'
\.'%E%m\ (%.%#),'
\.'%Z%f:%l,'
\.'%Z%f:%l:%.%#,'
\.'%\\s%#%f:%l:\ %#%m,'
\.'%\\s%#%f:%l:,'
\.'%m\ [%f:%l]:'
execute 'make! '.a:arg
if a:bang !=# '!'
return 'cwindow'
endif
return ''
finally
let &l:errorformat = old_errorformat
let &l:makeprg = old_makeprg
call s:pop_command()
endtry
endfunction
function! s:RakeComplete(A,L,P)
return s:completion_filter(s:project().tasks(),a:A)
endfunction
function! s:project_tasks()
call s:push_chdir()
try
let lines = split(system('rake -T'),"\n")
finally
call s:pop_command()
endtry
if v:shell_error != 0
return []
endif
call map(lines,'matchstr(v:val,"^rake\\s\\+\\zs\\S*")')
call filter(lines,'v:val != ""')
return lines
endfunction
call s:add_methods('project',['tasks'])
call s:command("-bar -bang -nargs=? -complete=customlist,s:RakeComplete Rake :execute s:Rake('<bang>',<q-args>)")
" }}}1
" Rcd, Rlcd {{{1
function! s:DirComplete(A,L,P) abort
return s:project().dirglob(a:A)
endfunction
call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Rcd :cd<bang> `=s:project().path(<q-args>)`")
call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Rlcd :lcd<bang> `=s:project().path(<q-args>)`")
" }}}1
" R {{{1
function! s:buffer_related() dict abort
if self.name() =~# '^lib/'
let bare = s:sub(self.name()[4:-1],'\.rb$','')
return s:project().first_file(
\'test/'.bare.'_test.rb',
\'spec/'.bare.'_spec.rb',
\'test/unit/'.bare.'_test.rb',
\'spec/unit/'.bare.'_spec.rb')
elseif self.name() =~# '^\(test\|spec\)/.*_\1\.rb$'
return 'lib/'.self.name()[5:-9].'.rb'
elseif self.name() ==# 'Gemfile'
return 'Gemfile.lock'
elseif self.name() ==# 'Gemfile.lock'
return 'Gemfile'
endif
return ''
endfunction
call s:add_methods('buffer',['related'])
function! s:project_relglob(path,glob,...) dict
if exists("+shellslash") && ! &shellslash
let old_ss = &shellslash
endif
try
let &shellslash = 1
let path = a:path
if path !~ '^/' && path !~ '^\w:'
let path = self.path(path)
endif
let suffix = a:0 ? a:1 : ''
let full_paths = split(glob(path.a:glob.suffix),"\n")
let relative_paths = []
for entry in full_paths
if suffix == '' && isdirectory(entry) && entry !~ '/$'
let entry .= '/'
endif
let relative_paths += [entry[strlen(path) : -strlen(suffix)-1]]
endfor
return relative_paths
finally
if exists("old_ss")
let &shellslash = old_ss
endif
endtry
endfunction
call s:add_methods('project',['relglob'])
function! s:R(cmd,bang,...) abort
let cmds = {'E': 'edit', 'S': 'split', 'V': 'vsplit', 'T': 'tabedit', 'D': 'read'}
let cmd = cmds[a:cmd] . a:bang
try
if a:0
let goal = s:project().path(a:1)
else
let related = s:buffer().related()
if related == ''
call s:throw('no related file')
else
let goal = s:project().path(related)
endif
endif
if goal =~# '[#:]\d\+$'
let cmd .= ' +'.matchstr(goal,'\d\+$')
let goal = matchstr(goal,'.*\ze[:#].*$')
elseif goal =~ '[#:]\w\+[?!=]\=$'
let cmd .= ' +/^\\s*def\\s\\+'.matchstr(goal,'[:#]\zs.\{-\}$')
let goal = matchstr(goal,'.*\ze[:#].*$')
endif
let parent = fnamemodify(goal,':h')
if !isdirectory(parent)
if a:bang ==# '!' && isdirectory(fnamemodify(parent,':h'))
call mkdir(parent)
endif
call s:throw('No such directory: '.parent)
endif
return cmd.' '.s:fnameescape(goal)
return ''
catch /^rake:/
return 'echoerr v:errmsg'
endtry
endfunction
function! s:RComplete(A,L,P) abort
return s:completion_filter(s:project().relglob('',s:fuzzyglob(a:A).'*'),a:A)
endfunction
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete R :execute s:R('E','<bang>',<f-args>)")
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete RS :execute s:R('S','<bang>',<f-args>)")
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete RV :execute s:R('V','<bang>',<f-args>)")
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete RT :execute s:R('T','<bang>',<f-args>)")
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete RD :execute s:R('D','<bang>',<f-args>)")
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete A :execute s:R('E','<bang>',<f-args>)")
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete AS :execute s:R('S','<bang>',<f-args>)")
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete AV :execute s:R('V','<bang>',<f-args>)")
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete AT :execute s:R('T','<bang>',<f-args>)")
call s:command("-bar -bang -nargs=? -complete=customlist,s:RComplete AD :execute s:R('D','<bang>',<f-args>)")
" }}}1
" Rlib, etc. {{{1
function! s:navcommand(name) abort
for type in ['', 'S', 'V', 'T', 'D']
call s:command("-bar -bang -nargs=? -complete=customlist,s:R".a:name."Complete R".type.a:name." :execute s:Edit('".type."','<bang>',s:R".a:name."(matchstr(<q-args>,'[^:#]*')).matchstr(<q-args>,'[:#].*'))")
endfor
endfunction
function! s:Edit(cmd,bang,file)
return s:R(a:cmd == '' ? 'E' : a:cmd, a:bang, a:file)
endfunction
function! s:Rlib(file)
if a:file ==# ''
return get(s:project().relglob('','*.gemspec'),0,'Gemfile')
elseif a:file =~# '/$'
return 'lib/'.a:file
else
return 'lib/'.a:file.'.rb'
endif
endfunction
function! s:RlibComplete(A,L,P)
return s:completion_filter(s:project().relglob('lib/','**/*','.rb'),a:A)
endfunction
function! s:first_file(choices)
return call(s:project().first_file,a:choices,s:project())
endfunction
function! s:Rtestorspec(order,file)
if a:file ==# ''
return s:first_file(map(copy(a:order),'v:val."/".v:val."_helper.rb"'))
elseif a:file =~# '/$'
return s:first_file(map(copy(a:order),'v:val."/".a:file."/"'))
elseif a:file ==# '.'
return s:first_file(map(copy(a:order),'v:val."/"'))
else
return s:first_file(map(copy(a:order),'v:val."/".a:file."_".v:val.".rb"'))
endif
endfunction
function! s:Rtest(...)
return call('s:Rtestorspec',[['test', 'spec']] + a:000)
endfunction
function! s:RtestComplete(A,L,P)
return s:completion_filter(s:project().relglob('test/','**/*','_test.rb')+s:project().relglob('spec/','**/*','_spec.rb'),a:A)
endfunction
function! s:Rspec(...)
return call('s:Rtestorspec',[['spec', 'test']] + a:000)
endfunction
function! s:RspecComplete(A,L,P)
return s:completion_filter(s:project().relglob('spec/','**/*','_spec.rb')+s:project().relglob('test/','**/*','_test.rb'),a:A)
endfunction
function! s:Rtask(file)
if a:file ==# ''
return 'Rakefile'
elseif a:file =~# '/$'
return 'rakelib/'.a:file
else
return 'rakelib/'.a:file.'.rake'
endif
endfunction
function! s:RtaskComplete(A,L,P)
return s:completion_filter(s:project().relglob('rakelib/','**/*','.rake'),a:A)
endfunction
call s:navcommand('lib')
call s:navcommand('test')
call s:navcommand('spec')
call s:navcommand('task')
" }}}1
" Rtags {{{1
function! s:project_tags_file() dict abort
if filereadable(self.path('tags')) || filewritable(self.path())
return self.path('tags')
else
if !has_key(self,'_tags_file')
let self._tags_file = tempname()
endif
endif
return self._tags_file
endfunction
call s:add_methods('project',['tags_file'])
function! s:Tags(args)
if exists("g:Tlist_Ctags_Cmd")
let cmd = g:Tlist_Ctags_Cmd
elseif executable("exuberant-ctags")
let cmd = "exuberant-ctags"
elseif executable("ctags-exuberant")
let cmd = "ctags-exuberant"
elseif executable("ctags")
let cmd = "ctags"
elseif executable("ctags.exe")
let cmd = "ctags.exe"
else
call s:throw("ctags not found")
endif
return escape('!'.cmd.' -f '.s:shellesc(s:project().tags_file()).' -R '.s:shellesc(s:project().path()),'%#').' '.a:args
endfunction
call s:command("-bar -bang -nargs=? Rtags :execute s:Tags(<q-args>)")
augroup rake_tags
autocmd!
autocmd User Rake
\ if stridx(&tags, escape(s:project().tags_file(),', ')) < 0 |
\ let &l:tags = escape(s:project().tags_file(),', ') . ',' . &tags |
\ endif
augroup END
" }}}1
" Path {{{1
augroup rake_path
autocmd!
autocmd User Rake
\ if &suffixesadd =~# '\.rb\>' && stridx(&path, escape(s:project().path('lib'),', ')) < 0 |
\ let &l:path = escape(s:project().path('lib'),', ')
\ . ',' . escape(s:project().path('ext'),', ') . ',' . &path |
\ endif
augroup END
" }}}1
" vim:set sw=2 sts=2:

1
vim/record/html5.vim Normal file
View File

@ -0,0 +1 @@
{'version': 0.3, 'files': [{'file': '/Users/syntaxerrormmm/.vim/autoload/htmlcomplete.vim', 'checksum': '815f87c6224d710f34677d7c74b3a96c'}, {'file': '/Users/syntaxerrormmm/.vim/autoload/xml/aria.vim', 'checksum': '48a1864751a94ecf0f843721201b3017'}, {'file': '/Users/syntaxerrormmm/.vim/autoload/xml/html5.vim', 'checksum': '62b772ad9ae4e29242728925c642f020'}, {'file': '/Users/syntaxerrormmm/.vim/indent/html.vim', 'checksum': 'e76afa1c087e9fbedaa9232b51ff18c7'}, {'file': '/Users/syntaxerrormmm/.vim/syntax/html/aria.vim', 'checksum': 'c2ef8fc6082ad7983d3070004e2a12f3'}, {'file': '/Users/syntaxerrormmm/.vim/syntax/html/html5.vim', 'checksum': 'cb8face4c86aee8bcc20aef07d67e2a6'}, {'file': '/Users/syntaxerrormmm/.vim/syntax/html/rdfa.vim', 'checksum': '77d47e0c27a744dfdb839c539d1a6a45'}], 'install_type': 'makefile', 'script_version': '0.26', 'package': 'html5.vim', 'generated_by': 'Vim-Makefile'}

126
vim/syntax/cucumber.vim Normal file
View File

@ -0,0 +1,126 @@
" Vim syntax file
" Language: Cucumber
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" Filenames: *.feature
" Last Change: 2010 May 21
if exists("b:current_syntax")
finish
endif
syn case match
syn sync minlines=20
let g:cucumber_languages = {
\"en": {"and": "And\\>", "background": "Background\\>", "but": "But\\>", "examples": "Scenarios\\>\\|Examples\\>", "feature": "Feature\\>", "given": "Given\\>", "scenario": "Scenario\\>", "scenario_outline": "Scenario Outline\\>", "then": "Then\\>", "when": "When\\>"},
\"ar": {"and": "\\%u0648\\>", "background": "\\%u0627\\%u0644\\%u062e\\%u0644\\%u0641\\%u064a\\%u0629\\>", "but": "\\%u0644\\%u0643\\%u0646\\>", "examples": "\\%u0627\\%u0645\\%u062b\\%u0644\\%u0629\\>", "feature": "\\%u062e\\%u0627\\%u0635\\%u064a\\%u0629\\>", "given": "\\%u0628\\%u0641\\%u0631\\%u0636\\>", "scenario": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648\\>", "scenario_outline": "\\%u0633\\%u064a\\%u0646\\%u0627\\%u0631\\%u064a\\%u0648 \\%u0645\\%u062e\\%u0637\\%u0637\\>", "then": "\\%u0627\\%u0630\\%u0627\\%u064b\\>\\|\\%u062b\\%u0645\\>", "when": "\\%u0639\\%u0646\\%u062f\\%u0645\\%u0627\\>\\|\\%u0645\\%u062a\\%u0649\\>"},
\"bg": {"and": "\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u0438\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\>", "but": "\\%u041d\\%u043e\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\>", "given": "\\%u0414\\%u0430\\%u0434\\%u0435\\%u043d\\%u043e\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0420\\%u0430\\%u043c\\%u043a\\%u0430 \\%u043d\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "then": "\\%u0422\\%u043e\\>", "when": "\\%u041a\\%u043e\\%u0433\\%u0430\\%u0442\\%u043e\\>"},
\"ca": {"and": "I\\>", "background": "Antecedents\\>\\|Rerefons\\>", "but": "Per\\%u00f2\\>", "examples": "Exemples\\>", "feature": "Caracter\\%u00edstica\\>\\|Funcionalitat\\>", "given": "At\\%u00e8s\\>\\|Donada\\>\\|Donat\\>\\|Atesa\\>", "scenario": "Escenari\\>", "scenario_outline": "Esquema de l'escenari\\>", "then": "Aleshores\\>\\|Cal\\>", "when": "Quan\\>"},
\"cs": {"and": "A tak\\%u00e9\\>\\|A\\>", "background": "Pozad\\%u00ed\\>\\|Kontext\\>", "but": "Ale\\>", "examples": "P\\%u0159\\%u00edklady\\>", "feature": "Po\\%u017eadavek\\>", "given": "Pokud\\>", "scenario": "Sc\\%u00e9n\\%u00e1\\%u0159\\>", "scenario_outline": "N\\%u00e1\\%u010drt Sc\\%u00e9n\\%u00e1\\%u0159e\\>\\|Osnova sc\\%u00e9n\\%u00e1\\%u0159e\\>", "then": "Pak\\>", "when": "Kdy\\%u017e\\>"},
\"cy-GB": {"and": "A\\>", "background": "Cefndir\\>", "but": "Ond\\>", "examples": "Enghreifftiau\\>", "feature": "Arwedd\\>", "given": "Anrhegedig a\\>", "scenario": "Scenario\\>", "scenario_outline": "Scenario Amlinellol\\>", "then": "Yna\\>", "when": "Pryd\\>"},
\"da": {"and": "Og\\>", "background": "Baggrund\\>", "but": "Men\\>", "examples": "Eksempler\\>", "feature": "Egenskab\\>", "given": "Givet\\>", "scenario": "Scenarie\\>", "scenario_outline": "Abstrakt Scenario\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"},
\"de": {"and": "Und\\>", "background": "Grundlage\\>", "but": "Aber\\>", "examples": "Beispiele\\>", "feature": "Funktionalit\\%u00e4t\\>", "given": "Gegeben sei\\>\\|Angenommen\\>", "scenario": "Szenario\\>", "scenario_outline": "Szenariogrundriss\\>", "then": "Dann\\>", "when": "Wenn\\>"},
\"en-Scouse": {"and": "An\\>", "background": "Dis is what went down\\>", "but": "Buh\\>", "examples": "Examples\\>", "feature": "Feature\\>", "given": "Youse know when youse got\\>\\|Givun\\>", "scenario": "The thing of it is\\>", "scenario_outline": "Wharrimean is\\>", "then": "Den youse gotta\\>\\|Dun\\>", "when": "Youse know like when\\>\\|Wun\\>"},
\"en-au": {"and": "N\\>", "background": "Background\\>", "but": "Cept\\>", "examples": "Cobber\\>", "feature": "Crikey\\>", "given": "Ya know how\\>", "scenario": "Mate\\>", "scenario_outline": "Blokes\\>", "then": "Ya gotta\\>", "when": "When\\>"},
\"en-lol": {"and": "AN\\>", "background": "B4\\>", "but": "BUT\\>", "examples": "EXAMPLZ\\>", "feature": "OH HAI\\>", "given": "I CAN HAZ\\>", "scenario": "MISHUN\\>", "scenario_outline": "MISHUN SRSLY\\>", "then": "DEN\\>", "when": "WEN\\>"},
\"en-tx": {"and": "And y'all\\>", "background": "Background\\>", "but": "But y'all\\>", "examples": "Examples\\>", "feature": "Feature\\>", "given": "Given y'all\\>", "scenario": "Scenario\\>", "scenario_outline": "All y'all\\>", "then": "Then y'all\\>", "when": "When y'all\\>"},
\"eo": {"and": "Kaj\\>", "background": "Fono\\>", "but": "Sed\\>", "examples": "Ekzemploj\\>", "feature": "Trajto\\>", "given": "Donita\\%u0135o\\>", "scenario": "Scenaro\\>", "scenario_outline": "Konturo de la scenaro\\>", "then": "Do\\>", "when": "Se\\>"},
\"es": {"and": "Y\\>", "background": "Antecedentes\\>", "but": "Pero\\>", "examples": "Ejemplos\\>", "feature": "Caracter\\%u00edstica\\>", "given": "Dado\\>", "scenario": "Escenario\\>", "scenario_outline": "Esquema del escenario\\>", "then": "Entonces\\>", "when": "Cuando\\>"},
\"et": {"and": "Ja\\>", "background": "Taust\\>", "but": "Kuid\\>", "examples": "Juhtumid\\>", "feature": "Omadus\\>", "given": "Eeldades\\>", "scenario": "Stsenaarium\\>", "scenario_outline": "Raamstsenaarium\\>", "then": "Siis\\>", "when": "Kui\\>"},
\"fi": {"and": "Ja\\>", "background": "Tausta\\>", "but": "Mutta\\>", "examples": "Tapaukset\\>", "feature": "Ominaisuus\\>", "given": "Oletetaan\\>", "scenario": "Tapaus\\>", "scenario_outline": "Tapausaihio\\>", "then": "Niin\\>", "when": "Kun\\>"},
\"fr": {"and": "Et\\>", "background": "Contexte\\>", "but": "Mais\\>", "examples": "Exemples\\>", "feature": "Fonctionnalit\\%u00e9\\>", "given": "Etant donn\\%u00e9\\>\\|Soit\\>", "scenario": "Sc\\%u00e9nario\\>", "scenario_outline": "Plan du sc\\%u00e9nario\\>\\|Plan du Sc\\%u00e9nario\\>", "then": "Alors\\>", "when": "Lorsqu'\\|Lorsque\\>\\|Quand\\>"},
\"he": {"and": "\\%u05d5\\%u05d2\\%u05dd\\>", "background": "\\%u05e8\\%u05e7\\%u05e2\\>", "but": "\\%u05d0\\%u05d1\\%u05dc\\>", "examples": "\\%u05d3\\%u05d5\\%u05d2\\%u05de\\%u05d0\\%u05d5\\%u05ea\\>", "feature": "\\%u05ea\\%u05db\\%u05d5\\%u05e0\\%u05d4\\>", "given": "\\%u05d1\\%u05d4\\%u05d9\\%u05e0\\%u05ea\\%u05df\\>", "scenario": "\\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9\\>", "scenario_outline": "\\%u05ea\\%u05d1\\%u05e0\\%u05d9\\%u05ea \\%u05ea\\%u05e8\\%u05d7\\%u05d9\\%u05e9\\>", "then": "\\%u05d0\\%u05d6\\%u05d9\\>\\|\\%u05d0\\%u05d6\\>", "when": "\\%u05db\\%u05d0\\%u05e9\\%u05e8\\>"},
\"hr": {"and": "I\\>", "background": "Pozadina\\>", "but": "Ali\\>", "examples": "Scenariji\\>\\|Primjeri\\>", "feature": "Mogu\\%u0107nost\\>\\|Mogucnost\\>\\|Osobina\\>", "given": "Zadano\\>\\|Zadani\\>\\|Zadan\\>", "scenario": "Scenarij\\>", "scenario_outline": "Koncept\\>\\|Skica\\>", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"},
\"hu": {"and": "\\%u00c9s\\>", "background": "H\\%u00e1tt\\%u00e9r\\>", "but": "De\\>", "examples": "P\\%u00e9ld\\%u00e1k\\>", "feature": "Jellemz\\%u0151\\>", "given": "Ha\\>", "scenario": "Forgat\\%u00f3k\\%u00f6nyv\\>", "scenario_outline": "Forgat\\%u00f3k\\%u00f6nyv v\\%u00e1zlat\\>", "then": "Akkor\\>", "when": "Majd\\>"},
\"id": {"and": "Dan\\>", "background": "Dasar\\>", "but": "Tapi\\>", "examples": "Contoh\\>", "feature": "Fitur\\>", "given": "Dengan\\>", "scenario": "Skenario\\>", "scenario_outline": "Skenario konsep\\>", "then": "Maka\\>", "when": "Ketika\\>"},
\"it": {"and": "E\\>", "background": "Contesto\\>", "but": "Ma\\>", "examples": "Esempi\\>", "feature": "Funzionalit\\%u00e0\\>", "given": "Dato\\>", "scenario": "Scenario\\>", "scenario_outline": "Schema dello scenario\\>", "then": "Allora\\>", "when": "Quando\\>"},
\"ja": {"and": "\\%u304b\\%u3064", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u3057\\%u304b\\%u3057\\|\\%u305f\\%u3060\\%u3057\\|\\%u4f46\\%u3057", "examples": "\\%u30b5\\%u30f3\\%u30d7\\%u30eb\\>\\|\\%u4f8b\\>", "feature": "\\%u30d5\\%u30a3\\%u30fc\\%u30c1\\%u30e3\\>\\|\\%u6a5f\\%u80fd\\>", "given": "\\%u524d\\%u63d0", "scenario": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\>", "scenario_outline": "\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30a2\\%u30a6\\%u30c8\\%u30e9\\%u30a4\\%u30f3\\>\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\%u30fc\\%u30c8\\>\\|\\%u30b7\\%u30ca\\%u30ea\\%u30aa\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\>\\|\\%u30c6\\%u30f3\\%u30d7\\%u30ec\\>", "then": "\\%u306a\\%u3089\\%u3070", "when": "\\%u3082\\%u3057"},
\"ko": {"and": "\\%uadf8\\%ub9ac\\%uace0", "background": "\\%ubc30\\%uacbd\\>", "but": "\\%ud558\\%uc9c0\\%ub9cc\\|\\%ub2e8", "examples": "\\%uc608\\>", "feature": "\\%uae30\\%ub2a5\\>", "given": "\\%uc870\\%uac74\\|\\%uba3c\\%uc800", "scenario": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624\\>", "scenario_outline": "\\%uc2dc\\%ub098\\%ub9ac\\%uc624 \\%uac1c\\%uc694\\>", "then": "\\%uadf8\\%ub7ec\\%uba74", "when": "\\%ub9cc\\%uc77c\\|\\%ub9cc\\%uc57d"},
\"lt": {"and": "Ir\\>", "background": "Kontekstas\\>", "but": "Bet\\>", "examples": "Pavyzd\\%u017eiai\\>\\|Scenarijai\\>\\|Variantai\\>", "feature": "Savyb\\%u0117\\>", "given": "Duota\\>", "scenario": "Scenarijus\\>", "scenario_outline": "Scenarijaus \\%u0161ablonas\\>", "then": "Tada\\>", "when": "Kai\\>"},
\"lu": {"and": "an\\>\\|a\\>", "background": "Hannergrond\\>", "but": "m\\%u00e4\\>\\|awer\\>", "examples": "Beispiller\\>", "feature": "Funktionalit\\%u00e9it\\>", "given": "ugeholl\\>", "scenario": "Szenario\\>", "scenario_outline": "Plang vum Szenario\\>", "then": "dann\\>", "when": "wann\\>"},
\"lv": {"and": "Un\\>", "background": "Situ\\%u0101cija\\>\\|Konteksts\\>", "but": "Bet\\>", "examples": "Piem\\%u0113ri\\>\\|Paraugs\\>", "feature": "Funkcionalit\\%u0101te\\>\\|F\\%u012b\\%u010da\\>", "given": "Kad\\>", "scenario": "Scen\\%u0101rijs\\>", "scenario_outline": "Scen\\%u0101rijs p\\%u0113c parauga\\>", "then": "Tad\\>", "when": "Ja\\>"},
\"nl": {"and": "En\\>", "background": "Achtergrond\\>", "but": "Maar\\>", "examples": "Voorbeelden\\>", "feature": "Functionaliteit\\>", "given": "Gegeven\\>\\|Stel\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstract Scenario\\>", "then": "Dan\\>", "when": "Als\\>"},
\"no": {"and": "Og\\>", "background": "Bakgrunn\\>", "but": "Men\\>", "examples": "Eksempler\\>", "feature": "Egenskap\\>", "given": "Gitt\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstrakt Scenario\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e5r\\>"},
\"pl": {"and": "Oraz\\>", "background": "Za\\%u0142o\\%u017cenia\\>", "but": "Ale\\>", "examples": "Przyk\\%u0142ady\\>", "feature": "W\\%u0142a\\%u015bciwo\\%u015b\\%u0107\\>", "given": "Zak\\%u0142adaj\\%u0105c\\>", "scenario": "Scenariusz\\>", "scenario_outline": "Szablon scenariusza\\>", "then": "Wtedy\\>", "when": "Je\\%u017celi\\>"},
\"pt": {"and": "E\\>", "background": "Contexto\\>", "but": "Mas\\>", "examples": "Exemplos\\>", "feature": "Funcionalidade\\>", "given": "Dado\\>", "scenario": "Cen\\%u00e1rio\\>\\|Cenario\\>", "scenario_outline": "Esquema do Cen\\%u00e1rio\\>\\|Esquema do Cenario\\>", "then": "Ent\\%u00e3o\\>\\|Entao\\>", "when": "Quando\\>"},
\"ro": {"and": "Si\\>", "background": "Conditii\\>", "but": "Dar\\>", "examples": "Exemplele\\>", "feature": "Functionalitate\\>", "given": "Daca\\>", "scenario": "Scenariu\\>", "scenario_outline": "Scenariul de sablon\\>", "then": "Atunci\\>", "when": "Cand\\>"},
\"ro-RO": {"and": "\\%u0218i\\>", "background": "Condi\\%u0163ii\\>", "but": "Dar\\>", "examples": "Exemplele\\>", "feature": "Func\\%u021bionalitate\\>", "given": "Dac\\%u0103\\>", "scenario": "Scenariu\\>", "scenario_outline": "Scenariul de \\%u015fablon\\>", "then": "Atunci\\>", "when": "C\\%u00e2nd\\>"},
\"ru": {"and": "\\%u041a \\%u0442\\%u043e\\%u043c\\%u0443 \\%u0436\\%u0435\\>\\|\\%u0418\\>", "background": "\\%u041f\\%u0440\\%u0435\\%u0434\\%u044b\\%u0441\\%u0442\\%u043e\\%u0440\\%u0438\\%u044f\\>", "but": "\\%u041d\\%u043e\\>\\|\\%u0410\\>", "examples": "\\%u0417\\%u043d\\%u0430\\%u0447\\%u0435\\%u043d\\%u0438\\%u044f\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\>\\|\\%u0424\\%u0438\\%u0447\\%u0430\\>", "given": "\\%u0414\\%u043e\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u044f\\>", "then": "\\%u0422\\%u043e\\>", "when": "\\%u0415\\%u0441\\%u043b\\%u0438\\>"},
\"sk": {"and": "A\\>", "background": "Pozadie\\>", "but": "Ale\\>", "examples": "Pr\\%u00edklady\\>", "feature": "Po\\%u017eiadavka\\>", "given": "Pokia\\%u013e\\>", "scenario": "Scen\\%u00e1r\\>", "scenario_outline": "N\\%u00e1\\%u010drt Scen\\%u00e1ru\\>", "then": "Tak\\>", "when": "Ke\\%u010f\\>"},
\"sr-Cyrl": {"and": "\\%u0418\\>", "background": "\\%u041a\\%u043e\\%u043d\\%u0442\\%u0435\\%u043a\\%u0441\\%u0442\\>\\|\\%u041f\\%u043e\\%u0437\\%u0430\\%u0434\\%u0438\\%u043d\\%u0430\\>\\|\\%u041e\\%u0441\\%u043d\\%u043e\\%u0432\\%u0430\\>", "but": "\\%u0410\\%u043b\\%u0438\\>", "examples": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0438\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041c\\%u043e\\%u0433\\%u0443\\%u045b\\%u043d\\%u043e\\%u0441\\%u0442\\>\\|\\%u041e\\%u0441\\%u043e\\%u0431\\%u0438\\%u043d\\%u0430\\>", "given": "\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u043e\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0435\\>\\|\\%u0417\\%u0430\\%u0434\\%u0430\\%u0442\\%u0438\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043c\\%u0435\\%u0440\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0458\\%u0430\\>\\|\\%u041a\\%u043e\\%u043d\\%u0446\\%u0435\\%u043f\\%u0442\\>\\|\\%u0421\\%u043a\\%u0438\\%u0446\\%u0430\\>", "then": "\\%u041e\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u041a\\%u0430\\%u0434\\%u0430\\>\\|\\%u041a\\%u0430\\%u0434\\>"},
\"sr-Latn": {"and": "I\\>", "background": "Kontekst\\>\\|Pozadina\\>\\|Osnova\\>", "but": "Ali\\>", "examples": "Scenariji\\>\\|Primeri\\>", "feature": "Mogu\\%u0107nost\\>\\|Funkcionalnost\\>\\|Mogucnost\\>\\|Osobina\\>", "given": "Zadato\\>\\|Zadate\\>\\|Zatati\\>", "scenario": "Scenario\\>\\|Primer\\>", "scenario_outline": "Struktura scenarija\\>\\|Koncept\\>\\|Skica\\>", "then": "Onda\\>", "when": "Kada\\>\\|Kad\\>"},
\"sv": {"and": "Och\\>", "background": "Bakgrund\\>", "but": "Men\\>", "examples": "Exempel\\>", "feature": "Egenskap\\>", "given": "Givet\\>", "scenario": "Scenario\\>", "scenario_outline": "Abstrakt Scenario\\>", "then": "S\\%u00e5\\>", "when": "N\\%u00e4r\\>"},
\"tr": {"and": "Ve\\>", "background": "Ge\\%u00e7mi\\%u015f\\>", "but": "Fakat\\>\\|Ama\\>", "examples": "\\%u00d6rnekler\\>", "feature": "\\%u00d6zellik\\>", "given": "Diyelim ki\\>", "scenario": "Senaryo\\>", "scenario_outline": "Senaryo tasla\\%u011f\\%u0131\\>", "then": "O zaman\\>", "when": "E\\%u011fer ki\\>"},
\"uk": {"and": "\\%u0406\\>", "background": "\\%u041f\\%u0435\\%u0440\\%u0435\\%u0434\\%u0443\\%u043c\\%u043e\\%u0432\\%u0430\\>", "but": "\\%u0410\\%u043b\\%u0435\\>", "examples": "\\%u041f\\%u0440\\%u0438\\%u043a\\%u043b\\%u0430\\%u0434\\%u0438\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0456\\%u043e\\%u043d\\%u0430\\%u043b\\>", "given": "\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e, \\%u0449\\%u043e\\>\\|\\%u041f\\%u0440\\%u0438\\%u043f\\%u0443\\%u0441\\%u0442\\%u0438\\%u043c\\%u043e\\>\\|\\%u041d\\%u0435\\%u0445\\%u0430\\%u0439\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430 \\%u0441\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0456\\%u044e\\>", "then": "\\%u0422\\%u043e\\>", "when": "\\%u042f\\%u043a\\%u0449\\%u043e\\>"},
\"uz": {"and": "\\%u0412\\%u0430\\>", "background": "\\%u0422\\%u0430\\%u0440\\%u0438\\%u0445\\>", "but": "\\%u041b\\%u0435\\%u043a\\%u0438\\%u043d\\>\\|\\%u0411\\%u0438\\%u0440\\%u043e\\%u043a\\>\\|\\%u0410\\%u043c\\%u043c\\%u043e\\>", "examples": "\\%u041c\\%u0438\\%u0441\\%u043e\\%u043b\\%u043b\\%u0430\\%u0440\\>", "feature": "\\%u0424\\%u0443\\%u043d\\%u043a\\%u0446\\%u0438\\%u043e\\%u043d\\%u0430\\%u043b\\>", "given": "\\%u0410\\%u0433\\%u0430\\%u0440\\>", "scenario": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439\\>", "scenario_outline": "\\%u0421\\%u0446\\%u0435\\%u043d\\%u0430\\%u0440\\%u0438\\%u0439 \\%u0441\\%u0442\\%u0440\\%u0443\\%u043a\\%u0442\\%u0443\\%u0440\\%u0430\\%u0441\\%u0438\\>", "then": "\\%u0423\\%u043d\\%u0434\\%u0430\\>", "when": "\\%u0410\\%u0433\\%u0430\\%u0440\\>"},
\"vi": {"and": "V\\%u00e0\\>", "background": "B\\%u1ed1i c\\%u1ea3nh\\>", "but": "Nh\\%u01b0ng\\>", "examples": "D\\%u1eef li\\%u1ec7u\\>", "feature": "T\\%u00ednh n\\%u0103ng\\>", "given": "Bi\\%u1ebft\\>\\|Cho\\>", "scenario": "T\\%u00ecnh hu\\%u1ed1ng\\>\\|K\\%u1ecbch b\\%u1ea3n\\>", "scenario_outline": "Khung t\\%u00ecnh hu\\%u1ed1ng\\>\\|Khung k\\%u1ecbch b\\%u1ea3n\\>", "then": "Th\\%u00ec\\>", "when": "Khi\\>"},
\"zh-CN": {"and": "\\%u800c\\%u4e14", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50\\>", "feature": "\\%u529f\\%u80fd\\>", "given": "\\%u5047\\%u5982", "scenario": "\\%u573a\\%u666f\\>", "scenario_outline": "\\%u573a\\%u666f\\%u5927\\%u7eb2\\>", "then": "\\%u90a3\\%u4e48", "when": "\\%u5f53"},
\"zh-TW": {"and": "\\%u800c\\%u4e14\\|\\%u4e26\\%u4e14", "background": "\\%u80cc\\%u666f\\>", "but": "\\%u4f46\\%u662f", "examples": "\\%u4f8b\\%u5b50\\>", "feature": "\\%u529f\\%u80fd\\>", "given": "\\%u5047\\%u8a2d", "scenario": "\\%u5834\\%u666f\\>\\|\\%u5287\\%u672c\\>", "scenario_outline": "\\%u5834\\%u666f\\%u5927\\%u7db1\\>\\|\\%u5287\\%u672c\\%u5927\\%u7db1\\>", "then": "\\%u90a3\\%u9ebc", "when": "\\%u7576"}}
function! s:pattern(key)
let language = matchstr(getline(1),'#\s*language:\s*\zs\S\+')
if &fileencoding == 'latin1' && language == ''
let language = 'en'
endif
if has_key(g:cucumber_languages, language)
let languages = [g:cucumber_languages[language]]
else
let languages = values(g:cucumber_languages)
end
return '\<\%('.join(map(languages,'get(v:val,a:key,"\\%(a\\&b\\)")'),'\|').'\)'
endfunction
function! s:Add(name)
let next = " skipempty skipwhite nextgroup=".join(map(["Region","AndRegion","ButRegion","Comment","String","Table"],'"cucumber".a:name.v:val'),",")
exe "syn region cucumber".a:name.'Region matchgroup=cucumber'.a:name.' start="\%(^\s*\)\@<=\%('.s:pattern(tolower(a:name)).'\)" end="$"'.next
exe 'syn region cucumber'.a:name.'AndRegion matchgroup=cucumber'.a:name.'And start="\%(^\s*\)\@<='.s:pattern('and').'" end="$" contained'.next
exe 'syn region cucumber'.a:name.'ButRegion matchgroup=cucumber'.a:name.'But start="\%(^\s*\)\@<='.s:pattern('but').'" end="$" contained'.next
exe 'syn match cucumber'.a:name.'Comment "\%(^\s*\)\@<=#.*" contained'.next
exe 'syn region cucumber'.a:name.'String start=+\%(^\s*\)\@<="""+ end=+"""+ contained'.next
exe 'syn match cucumber'.a:name.'Table "\%(^\s*\)\@<=|.*" contained contains=cucumberDelimiter'.next
exe 'hi def link cucumber'.a:name.'Comment cucumberComment'
exe 'hi def link cucumber'.a:name.'String cucumberString'
exe 'hi def link cucumber'.a:name.'But cucumber'.a:name.'And'
exe 'hi def link cucumber'.a:name.'And cucumber'.a:name
exe 'syn cluster cucumberStepRegions add=cucumber'.a:name.'Region,cucumber'.a:name.'AndRegion,cucumber'.a:name.'ButRegion'
endfunction
syn match cucumberComment "\%(^\s*\)\@<=#.*"
syn match cucumberComment "\%(\%^\s*\)\@<=#.*" contains=cucumberLanguage
syn match cucumberLanguage "\%(#\s*\)\@<=language:" contained
syn match cucumberUnparsed "\S.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained
syn match cucumberUnparsedComment "#.*" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberTags,cucumberBackground,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty contained
exe 'syn match cucumberFeature "\%(^\s*\)\@<='.s:pattern('feature').':" nextgroup=cucumberUnparsedComment,cucumberUnparsed,cucumberBackground,cucumberScenario,cucumberScenarioOutline,cucumberExamples skipwhite skipempty'
exe 'syn match cucumberBackground "\%(^\s*\)\@<='.s:pattern('background').':"'
exe 'syn match cucumberScenario "\%(^\s*\)\@<='.s:pattern('scenario').':"'
exe 'syn match cucumberScenarioOutline "\%(^\s*\)\@<='.s:pattern('scenario_outline').':"'
exe 'syn match cucumberExamples "\%(^\s*\)\@<='.s:pattern('examples').':" nextgroup=cucumberExampleTable skipempty skipwhite'
syn match cucumberPlaceholder "<[^<>]*>" contained containedin=@cucumberStepRegions
syn match cucumberExampleTable "\%(^\s*\)\@<=|.*" contains=cucumberDelimiter
syn match cucumberDelimiter "\\\@<!\%(\\\\\)*\zs|" contained
syn match cucumberTags "\%(^\s*\)\@<=\%(@[^@[:space:]]\+\s\+\)*@[^@[:space:]]\+\s*$" contains=@NoSpell
call s:Add('Then')
call s:Add('When')
call s:Add('Given')
hi def link cucumberUnparsedComment cucumberComment
hi def link cucumberComment Comment
hi def link cucumberLanguage SpecialComment
hi def link cucumberFeature Macro
hi def link cucumberBackground Define
hi def link cucumberScenario Define
hi def link cucumberScenarioOutline Define
hi def link cucumberExamples Define
hi def link cucumberPlaceholder Constant
hi def link cucumberDelimiter Delimiter
hi def link cucumberTags Tag
hi def link cucumberString String
hi def link cucumberGiven Conditional
hi def link cucumberWhen Function
hi def link cucumberThen Type
let b:current_syntax = "cucumber"
" vim:set sts=2 sw=2:

35
vim/syntax/html/aria.vim Normal file
View File

@ -0,0 +1,35 @@
" Vim syntax file
" Language: WAI-ARIA
" Maintainer: othree <othree@gmail.com>
" URL: http://github.com/othree/html5-syntax.vim
" Last Change: 2010-09-25
" License: MIT
" Changes: update to Draft 16 September 2010
" WAI-ARIA States and Properties
" http://www.w3.org/TR/wai-aria/states_and_properties
syn keyword htmlArg contained role
" Global States and Properties
syn match htmlArg contained "\<aria-\(atomic\|busy\|controls\|describedby\)\>"
syn match htmlArg contained "\<aria-\(disabled\|dropeffect\|flowto\|grabbed\)\>"
syn match htmlArg contained "\<aria-\(haspopup\|hidden\|invalid\|label\)\>"
syn match htmlArg contained "\<aria-\(labelledby\|live\|owns\|relevant\)\>"
" Widget Attributes
syn match htmlArg contained "\<aria-\(autocomplete\|checked\|disabled\|expanded\)\>"
syn match htmlArg contained "\<aria-\(haspopup\|hidden\|invalid\|label\)\>"
syn match htmlArg contained "\<aria-\(level\|multiline\|multiselectable\|orientation\)\>"
syn match htmlArg contained "\<aria-\(pressed\|readonly\|required\|selected\)\>"
syn match htmlArg contained "\<aria-\(sort\|valuemax\|valuemin\|valuenow\|valuetext\|\)\>"
" Live Region Attributes
syn match htmlArg contained "\<aria-\(atomic\|busy\|live\|relevant\|\)\>"
" Drag-and-Drop attributes
syn match htmlArg contained "\<aria-\(dropeffect\|grabbed\)\>"
" Relationship Attributes
syn match htmlArg contained "\<aria-\(activedescendant\|controls\|describedby\|flowto\|\)\>"
syn match htmlArg contained "\<aria-\(labelledby\|owns\|posinset\|setsize\|\)\>"

59
vim/syntax/html/html5.vim Normal file
View File

@ -0,0 +1,59 @@
" Vim syntax file
" Language: HTML (version 5)
" Maintainer: Rodrigo Machado <rcmachado@gmail.com>
" URL: http://rm.blog.br/vim/syntax/html.vim
" Last Change: 2009 Aug 19
" License: Public domain
" (but let me know if you like :) )
"
" Note: This file just adds the new tags from HTML 5
" and don't replace default html.vim syntax file
"
" Modified: othree <othree@gmail.com>
" Changes: update to Draft 13 January 2011
" add complete new attributes
" add microdata Attributes
" add bdi element
" HTML 5 tags
syn keyword htmlTagName contained article aside audio canvas command
syn keyword htmlTagName contained datalist details dialog embed figcaption figure footer
syn keyword htmlTagName contained header hgroup keygen mark meter menu nav output
syn keyword htmlTagName contained progress time ruby rt rp section source summary time track video
syn keyword htmlTagName contained wbr bdi
" HTML 5 arguments
" Core Attributes
syn keyword htmlArg contained accesskey class contenteditable contextmenu dir
syn keyword htmlArg contained draggable hidden id lang spellcheck style tabindex title
" Event-handler Attributes
syn keyword htmlArg contained onabort onblur oncanplay oncanplaythrough onchange
syn keyword htmlArg contained onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover
syn keyword htmlArg contained ondragstart ondrop ondurationchange onemptied onended onerror onfocus onformchange
syn keyword htmlArg contained onforminput oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata
syn keyword htmlArg contained onloadedmetadata onloadstart onmousedown onmousemove onmouseout onmouseover onmouseup
syn keyword htmlArg contained onmousewheel onpause onplay onplaying onprogress onratechange onreadystatechange
syn keyword htmlArg contained onscroll onseeked onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate
syn keyword htmlArg contained onvolumechange onwaiting
" XML Attributes
syn keyword htmlArg contained xml:lang xml:space xml:base
" new features
" <body>
syn keyword htmlArg contained onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload
syn keyword htmlArg contained onmessage onoffline ononline onpopstate onredo onresize onstorage onundo onunload
" <video>, <audio>, <source>, <track>
syn keyword htmlArg contained autoplay preload controls loop poster media kind charset srclang track
" <form>, <input>, <button>
syn keyword htmlArg contained form autocomplete autofocus list min max step
syn keyword htmlArg contained formaction autofocus formenctype formmethod formtarget formnovalidate
syn keyword htmlArg contained required placeholder
" <command>, <details>, <time>
syn keyword htmlArg contained label icon open datetime pubdate
" Custom Data Attributes
" http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data
syn match htmlArg "\<\(data(\-[a-z]\+)\+\)=" contained
" Microdata
" http://dev.w3.org/html5/md/
syn keyword htmlArg contained itemid itemscope itemtype itemprop itemref

11
vim/syntax/html/rdfa.vim Normal file
View File

@ -0,0 +1,11 @@
" Vim syntax file
" Language: RDFa
" Maintainer: othree <othree@gmail.com>
" URL: http://github.com/othree/html5-syntax.vim
" Last Change: 2010-09-25
" License: MIT
" Changes: update to Rec 14 October 2008
" RDFa
" http://www.w3.org/TR/rdfa-syntax/#a_xhtmlrdfa_dtd
syn keyword htmlArg contained about typeof property resource content datatype rel rev

90
vimrc Normal file
View File

@ -0,0 +1,90 @@
" Impostazioni di base
syntax on
set background=dark
set modelines=5
set modeline
set incsearch
set showcmd
set laststatus=2
let g:airline_powerline_fonts = 1
" Override grep
set grepprg=grep\ -nH\ $*
" Cambio il tex flavor
let g:tex_flavor='latex'
" Vundle stuff
set nocompatible
filetype off
" Set runtimepath to include Vundle
set rtp+=~/.vim/bundle/Vundle.vim
" Vundle configuration begin
call vundle#begin()
" Let vundle manage itself
Plugin 'VundleVim/Vundle.vim'
" Git wrapper
Plugin 'tpope/vim-fugitive'
" File explorer
Plugin 'scrooloose/nerdtree'
" Ansible syntax highlight
Bundle 'chase/vim-ansible-yaml'
" Blade syntax highlight
Bundle 'xsbeats/vim-blade'
" Solarized theme
Bundle 'altercation/vim-colors-solarized'
" HTML 5 template
Bundle 'othree/html5.vim'
" Vim Airline
Plugin 'vim-airline/vim-airline'
" Vim Airline
Plugin 'vim-airline/vim-airline-themes'
" Vim-latexsuite
Plugin 'vim-latex/vim-latex'
" NERDTree git plugin
Plugin 'Xuyuanp/nerdtree-git-plugin'
" DevIcons
Plugin 'ryanoasis/vim-devicons'
" Fuzzy Finder
Plugin 'junegunn/fzf.vim'
" ALE - Linter and fixers
Plugin 'dense-analysis/ale'
" Vundle configuration end
call vundle#end()
" Set up airline-theme
let g:airline_theme='dark'
" ALE options
nmap <silent> <C-e> <Plug>(ale_next_wrap)
let g:ale_sign_error = '⬥'
let g:ale_sign_warning = '⬦'
" Configurations for GVim
if has('gui_running')
set guifont=FuraMono\ Nerd\ Font\ Regular\ 13,Ubuntu\ Mono\ derivative\ Powerline\ 14
colorscheme solarized
let g:airline_theme='base16'
endif
" Riattivo i pluing di tipo
filetype plugin indent on
" Configurazioni addizionali
map <C-n> :NERDTreeToggle<CR>