parent
c3c8be8edc
commit
277c59392a
@ -1,328 +0,0 @@
|
|||||||
" pathogen.vim - path option manipulation
|
|
||||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
|
||||||
" Version: 2.2
|
|
||||||
|
|
||||||
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
|
|
||||||
"
|
|
||||||
" For management of individually installed plugins in ~/.vim/bundle (or
|
|
||||||
" ~\vimfiles\bundle), adding `call pathogen#infect()` to the top of your
|
|
||||||
" .vimrc is the only other setup necessary.
|
|
||||||
"
|
|
||||||
" The API is documented inline below. For maximum ease of reading,
|
|
||||||
" :set foldmethod=marker
|
|
||||||
|
|
||||||
if exists("g:loaded_pathogen") || &cp
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:loaded_pathogen = 1
|
|
||||||
|
|
||||||
function! s:warn(msg)
|
|
||||||
if &verbose
|
|
||||||
echohl WarningMsg
|
|
||||||
echomsg a:msg
|
|
||||||
echohl NONE
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Point of entry for basic default usage. Give a relative path to invoke
|
|
||||||
" pathogen#incubate() (defaults to "bundle/{}"), or an absolute path to invoke
|
|
||||||
" pathogen#surround(). For backwards compatibility purposes, a full path that
|
|
||||||
" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories()
|
|
||||||
" instead.
|
|
||||||
function! pathogen#infect(...) abort " {{{1
|
|
||||||
for path in a:0 ? reverse(copy(a:000)) : ['bundle/{}']
|
|
||||||
if path =~# '^[^\\/]\+$'
|
|
||||||
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
|
||||||
call pathogen#incubate(path . '/{}')
|
|
||||||
elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$'
|
|
||||||
call pathogen#incubate(path)
|
|
||||||
elseif path =~# '[\\/]\%({}\|\*\)$'
|
|
||||||
call pathogen#surround(path)
|
|
||||||
else
|
|
||||||
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
|
|
||||||
call pathogen#surround(path . '/{}')
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
call pathogen#cycle_filetype()
|
|
||||||
return ''
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Split a path into a list.
|
|
||||||
function! pathogen#split(path) abort " {{{1
|
|
||||||
if type(a:path) == type([]) | return a:path | endif
|
|
||||||
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
|
|
||||||
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Convert a list to a path.
|
|
||||||
function! pathogen#join(...) abort " {{{1
|
|
||||||
if type(a:1) == type(1) && a:1
|
|
||||||
let i = 1
|
|
||||||
let space = ' '
|
|
||||||
else
|
|
||||||
let i = 0
|
|
||||||
let space = ''
|
|
||||||
endif
|
|
||||||
let path = ""
|
|
||||||
while i < a:0
|
|
||||||
if type(a:000[i]) == type([])
|
|
||||||
let list = a:000[i]
|
|
||||||
let j = 0
|
|
||||||
while j < len(list)
|
|
||||||
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
|
|
||||||
let path .= ',' . escaped
|
|
||||||
let j += 1
|
|
||||||
endwhile
|
|
||||||
else
|
|
||||||
let path .= "," . a:000[i]
|
|
||||||
endif
|
|
||||||
let i += 1
|
|
||||||
endwhile
|
|
||||||
return substitute(path,'^,','','')
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
|
|
||||||
function! pathogen#legacyjoin(...) abort " {{{1
|
|
||||||
return call('pathogen#join',[1] + a:000)
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Remove duplicates from a list.
|
|
||||||
function! pathogen#uniq(list) abort " {{{1
|
|
||||||
let i = 0
|
|
||||||
let seen = {}
|
|
||||||
while i < len(a:list)
|
|
||||||
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
|
|
||||||
call remove(a:list,i)
|
|
||||||
elseif a:list[i] ==# ''
|
|
||||||
let i += 1
|
|
||||||
let empty = 1
|
|
||||||
else
|
|
||||||
let seen[a:list[i]] = 1
|
|
||||||
let i += 1
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
return a:list
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" \ on Windows unless shellslash is set, / everywhere else.
|
|
||||||
function! pathogen#separator() abort " {{{1
|
|
||||||
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Convenience wrapper around glob() which returns a list.
|
|
||||||
function! pathogen#glob(pattern) abort " {{{1
|
|
||||||
let files = split(glob(a:pattern),"\n")
|
|
||||||
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
|
|
||||||
endfunction "}}}1
|
|
||||||
|
|
||||||
" Like pathogen#glob(), only limit the results to directories.
|
|
||||||
function! pathogen#glob_directories(pattern) abort " {{{1
|
|
||||||
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
|
||||||
endfunction "}}}1
|
|
||||||
|
|
||||||
" Turn filetype detection off and back on again if it was already enabled.
|
|
||||||
function! pathogen#cycle_filetype() " {{{1
|
|
||||||
if exists('g:did_load_filetypes')
|
|
||||||
filetype off
|
|
||||||
filetype on
|
|
||||||
endif
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Check if a bundle is disabled. A bundle is considered disabled if it ends
|
|
||||||
" in a tilde or its basename or full name is included in the list
|
|
||||||
" g:pathogen_disabled.
|
|
||||||
function! pathogen#is_disabled(path) " {{{1
|
|
||||||
if a:path =~# '\~$'
|
|
||||||
return 1
|
|
||||||
elseif !exists("g:pathogen_disabled")
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
let blacklist = g:pathogen_disabled
|
|
||||||
return index(blacklist, strpart(a:path, strridx(a:path, sep)+1)) != -1 && index(blacklist, a:path) != 1
|
|
||||||
endfunction "}}}1
|
|
||||||
|
|
||||||
" Prepend the given directory to the runtime path and append its corresponding
|
|
||||||
" after directory. If the directory is already included, move it to the
|
|
||||||
" outermost position. Wildcards are added as is. Ending a path in /{} causes
|
|
||||||
" all subdirectories to be added (except those in g:pathogen_disabled).
|
|
||||||
function! pathogen#surround(path) abort " {{{1
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
let rtp = pathogen#split(&rtp)
|
|
||||||
if a:path =~# '[\\/]{}$'
|
|
||||||
let path = fnamemodify(a:path[0:-4], ':p:s?[\\/]\=$??')
|
|
||||||
let before = filter(pathogen#glob_directories(path.sep.'*'), '!pathogen#is_disabled(v:val)')
|
|
||||||
let after = filter(reverse(pathogen#glob_directories(path.sep."*".sep."after")), '!pathogen#is_disabled(v:val[0:-7])')
|
|
||||||
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
|
|
||||||
else
|
|
||||||
let path = fnamemodify(a:path, ':p:s?[\\/]\=$??')
|
|
||||||
let before = [path]
|
|
||||||
let after = [path . sep . 'after']
|
|
||||||
call filter(rtp, 'index(before + after, v:val) == -1')
|
|
||||||
endif
|
|
||||||
let &rtp = pathogen#join(before, rtp, after)
|
|
||||||
return &rtp
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Prepend all subdirectories of path to the rtp, and append all 'after'
|
|
||||||
" directories in those subdirectories. Deprecated.
|
|
||||||
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
|
|
||||||
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#surround('.string(a:path.'/{}').')')
|
|
||||||
return pathogen#surround(a:path . pathogen#separator() . '{}')
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" For each directory in the runtime path, add a second entry with the given
|
|
||||||
" argument appended. If the argument ends in '/{}', add a separate entry for
|
|
||||||
" each subdirectory. The default argument is 'bundle/{}', which means that
|
|
||||||
" .vim/bundle/*, $VIM/vimfiles/bundle/*, $VIMRUNTIME/bundle/*,
|
|
||||||
" $VIM/vim/files/bundle/*/after, and .vim/bundle/*/after will be added (on
|
|
||||||
" UNIX).
|
|
||||||
function! pathogen#incubate(...) abort " {{{1
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
let name = a:0 ? a:1 : 'bundle/{}'
|
|
||||||
if "\n".s:done_bundles =~# "\\M\n".name."\n"
|
|
||||||
return ""
|
|
||||||
endif
|
|
||||||
let s:done_bundles .= name . "\n"
|
|
||||||
let list = []
|
|
||||||
for dir in pathogen#split(&rtp)
|
|
||||||
if dir =~# '\<after$'
|
|
||||||
if name =~# '{}$'
|
|
||||||
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name[0:-3],'').'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
|
|
||||||
else
|
|
||||||
let list += [dir, substitute(dir, 'after$', '', '') . name . sep . 'after']
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
if name =~# '{}$'
|
|
||||||
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name[0:-3].'*[^~]'), '!pathogen#is_disabled(v:val)')
|
|
||||||
else
|
|
||||||
let list += [dir . sep . name, dir]
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
let &rtp = pathogen#join(pathogen#uniq(list))
|
|
||||||
return 1
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Deprecated alias for pathogen#incubate().
|
|
||||||
function! pathogen#runtime_append_all_bundles(...) abort " {{{1
|
|
||||||
if a:0
|
|
||||||
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#incubate('.string(a:1.'/{}').')')
|
|
||||||
else
|
|
||||||
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#incubate()')
|
|
||||||
endif
|
|
||||||
return call('pathogen#incubate', map(copy(a:000),'v:val . "/{}"'))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let s:done_bundles = ''
|
|
||||||
" }}}1
|
|
||||||
|
|
||||||
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
|
||||||
function! pathogen#helptags() abort " {{{1
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
for glob in pathogen#split(&rtp)
|
|
||||||
for dir in split(glob(glob), "\n")
|
|
||||||
if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.sep.'doc') == 2 && !empty(filter(split(glob(dir.sep.'doc'.sep.'*'),"\n>"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags'))
|
|
||||||
helptags `=dir.'/doc'`
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endfor
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
command! -bar Helptags :call pathogen#helptags()
|
|
||||||
|
|
||||||
" Execute the given command. This is basically a backdoor for --remote-expr.
|
|
||||||
function! pathogen#execute(...) abort " {{{1
|
|
||||||
for command in a:000
|
|
||||||
execute command
|
|
||||||
endfor
|
|
||||||
return ''
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Like findfile(), but hardcoded to use the runtimepath.
|
|
||||||
function! pathogen#runtime_findfile(file,count) abort "{{{1
|
|
||||||
let rtp = pathogen#join(1,pathogen#split(&rtp))
|
|
||||||
let file = findfile(a:file,rtp,a:count)
|
|
||||||
if file ==# ''
|
|
||||||
return ''
|
|
||||||
else
|
|
||||||
return fnamemodify(file,':p')
|
|
||||||
endif
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Backport of fnameescape().
|
|
||||||
function! pathogen#fnameescape(string) abort " {{{1
|
|
||||||
if exists('*fnameescape')
|
|
||||||
return fnameescape(a:string)
|
|
||||||
elseif a:string ==# '-'
|
|
||||||
return '\-'
|
|
||||||
else
|
|
||||||
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
|
|
||||||
endif
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
if exists(':Vedit')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:vopen_warning = 0
|
|
||||||
|
|
||||||
function! s:find(count,cmd,file,lcd) " {{{1
|
|
||||||
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
|
|
||||||
let file = pathogen#runtime_findfile(a:file,a:count)
|
|
||||||
if file ==# ''
|
|
||||||
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
|
|
||||||
endif
|
|
||||||
if !s:vopen_warning
|
|
||||||
let s:vopen_warning = 1
|
|
||||||
let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
|
|
||||||
else
|
|
||||||
let warning = ''
|
|
||||||
endif
|
|
||||||
if a:lcd
|
|
||||||
let path = file[0:-strlen(a:file)-2]
|
|
||||||
execute 'lcd `=path`'
|
|
||||||
return a:cmd.' '.pathogen#fnameescape(a:file) . warning
|
|
||||||
else
|
|
||||||
return a:cmd.' '.pathogen#fnameescape(file) . warning
|
|
||||||
endif
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
function! s:Findcomplete(A,L,P) " {{{1
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
let cheats = {
|
|
||||||
\'a': 'autoload',
|
|
||||||
\'d': 'doc',
|
|
||||||
\'f': 'ftplugin',
|
|
||||||
\'i': 'indent',
|
|
||||||
\'p': 'plugin',
|
|
||||||
\'s': 'syntax'}
|
|
||||||
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
|
|
||||||
let request = cheats[a:A[0]].a:A[1:-1]
|
|
||||||
else
|
|
||||||
let request = a:A
|
|
||||||
endif
|
|
||||||
let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
|
|
||||||
let found = {}
|
|
||||||
for path in pathogen#split(&runtimepath)
|
|
||||||
let path = expand(path, ':p')
|
|
||||||
let matches = split(glob(path.sep.pattern),"\n")
|
|
||||||
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
|
|
||||||
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
|
|
||||||
for match in matches
|
|
||||||
let found[match] = 1
|
|
||||||
endfor
|
|
||||||
endfor
|
|
||||||
return sort(keys(found))
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
|
||||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
|
|
||||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
|
|
||||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
|
|
||||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
|
|
||||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
|
|
||||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
|
|
||||||
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
|
|
||||||
|
|
||||||
" vim:set et sw=2:
|
|
@ -1,338 +0,0 @@
|
|||||||
" Vim color file
|
|
||||||
" Maintainer: Henry So, Jr. <henryso@panix.com>
|
|
||||||
|
|
||||||
" These are the colors of the "desert" theme by Hans Fugal with a few small
|
|
||||||
" modifications (namely that I lowered the intensity of the normal white and
|
|
||||||
" made the normal and nontext backgrounds black), modified to work with 88-
|
|
||||||
" and 256-color xterms.
|
|
||||||
"
|
|
||||||
" The original "desert" theme is available as part of the vim distribution or
|
|
||||||
" at http://hans.fugal.net/vim/colors/.
|
|
||||||
"
|
|
||||||
" The real feature of this color scheme, with a wink to the "inkpot" theme, is
|
|
||||||
" the programmatic approximation of the gui colors to the palettes of 88- and
|
|
||||||
" 256- color xterms. The functions that do this (folded away, for
|
|
||||||
" readability) are calibrated to the colors used for Thomas E. Dickey's xterm
|
|
||||||
" (version 200), which is available at http://dickey.his.com/xterm/xterm.html.
|
|
||||||
"
|
|
||||||
" I struggled with trying to parse the rgb.txt file to avoid the necessity of
|
|
||||||
" converting color names to #rrggbb form, but decided it was just not worth
|
|
||||||
" the effort. Maybe someone seeing this may decide otherwise...
|
|
||||||
|
|
||||||
set background=dark
|
|
||||||
if version > 580
|
|
||||||
" no guarantees for version 5.8 and below, but this makes it stop
|
|
||||||
" complaining
|
|
||||||
hi clear
|
|
||||||
if exists("syntax_on")
|
|
||||||
syntax reset
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
let g:colors_name="desert256"
|
|
||||||
|
|
||||||
if has("gui_running") || &t_Co == 88 || &t_Co == 256
|
|
||||||
" functions {{{
|
|
||||||
" returns an approximate grey index for the given grey level
|
|
||||||
fun <SID>grey_number(x)
|
|
||||||
if &t_Co == 88
|
|
||||||
if a:x < 23
|
|
||||||
return 0
|
|
||||||
elseif a:x < 69
|
|
||||||
return 1
|
|
||||||
elseif a:x < 103
|
|
||||||
return 2
|
|
||||||
elseif a:x < 127
|
|
||||||
return 3
|
|
||||||
elseif a:x < 150
|
|
||||||
return 4
|
|
||||||
elseif a:x < 173
|
|
||||||
return 5
|
|
||||||
elseif a:x < 196
|
|
||||||
return 6
|
|
||||||
elseif a:x < 219
|
|
||||||
return 7
|
|
||||||
elseif a:x < 243
|
|
||||||
return 8
|
|
||||||
else
|
|
||||||
return 9
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
if a:x < 14
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
let l:n = (a:x - 8) / 10
|
|
||||||
let l:m = (a:x - 8) % 10
|
|
||||||
if l:m < 5
|
|
||||||
return l:n
|
|
||||||
else
|
|
||||||
return l:n + 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" returns the actual grey level represented by the grey index
|
|
||||||
fun <SID>grey_level(n)
|
|
||||||
if &t_Co == 88
|
|
||||||
if a:n == 0
|
|
||||||
return 0
|
|
||||||
elseif a:n == 1
|
|
||||||
return 46
|
|
||||||
elseif a:n == 2
|
|
||||||
return 92
|
|
||||||
elseif a:n == 3
|
|
||||||
return 115
|
|
||||||
elseif a:n == 4
|
|
||||||
return 139
|
|
||||||
elseif a:n == 5
|
|
||||||
return 162
|
|
||||||
elseif a:n == 6
|
|
||||||
return 185
|
|
||||||
elseif a:n == 7
|
|
||||||
return 208
|
|
||||||
elseif a:n == 8
|
|
||||||
return 231
|
|
||||||
else
|
|
||||||
return 255
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
if a:n == 0
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 8 + (a:n * 10)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" returns the palette index for the given grey index
|
|
||||||
fun <SID>grey_color(n)
|
|
||||||
if &t_Co == 88
|
|
||||||
if a:n == 0
|
|
||||||
return 16
|
|
||||||
elseif a:n == 9
|
|
||||||
return 79
|
|
||||||
else
|
|
||||||
return 79 + a:n
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
if a:n == 0
|
|
||||||
return 16
|
|
||||||
elseif a:n == 25
|
|
||||||
return 231
|
|
||||||
else
|
|
||||||
return 231 + a:n
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" returns an approximate color index for the given color level
|
|
||||||
fun <SID>rgb_number(x)
|
|
||||||
if &t_Co == 88
|
|
||||||
if a:x < 69
|
|
||||||
return 0
|
|
||||||
elseif a:x < 172
|
|
||||||
return 1
|
|
||||||
elseif a:x < 230
|
|
||||||
return 2
|
|
||||||
else
|
|
||||||
return 3
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
if a:x < 75
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
let l:n = (a:x - 55) / 40
|
|
||||||
let l:m = (a:x - 55) % 40
|
|
||||||
if l:m < 20
|
|
||||||
return l:n
|
|
||||||
else
|
|
||||||
return l:n + 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" returns the actual color level for the given color index
|
|
||||||
fun <SID>rgb_level(n)
|
|
||||||
if &t_Co == 88
|
|
||||||
if a:n == 0
|
|
||||||
return 0
|
|
||||||
elseif a:n == 1
|
|
||||||
return 139
|
|
||||||
elseif a:n == 2
|
|
||||||
return 205
|
|
||||||
else
|
|
||||||
return 255
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
if a:n == 0
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 55 + (a:n * 40)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" returns the palette index for the given R/G/B color indices
|
|
||||||
fun <SID>rgb_color(x, y, z)
|
|
||||||
if &t_Co == 88
|
|
||||||
return 16 + (a:x * 16) + (a:y * 4) + a:z
|
|
||||||
else
|
|
||||||
return 16 + (a:x * 36) + (a:y * 6) + a:z
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" returns the palette index to approximate the given R/G/B color levels
|
|
||||||
fun <SID>color(r, g, b)
|
|
||||||
" get the closest grey
|
|
||||||
let l:gx = <SID>grey_number(a:r)
|
|
||||||
let l:gy = <SID>grey_number(a:g)
|
|
||||||
let l:gz = <SID>grey_number(a:b)
|
|
||||||
|
|
||||||
" get the closest color
|
|
||||||
let l:x = <SID>rgb_number(a:r)
|
|
||||||
let l:y = <SID>rgb_number(a:g)
|
|
||||||
let l:z = <SID>rgb_number(a:b)
|
|
||||||
|
|
||||||
if l:gx == l:gy && l:gy == l:gz
|
|
||||||
" there are two possibilities
|
|
||||||
let l:dgr = <SID>grey_level(l:gx) - a:r
|
|
||||||
let l:dgg = <SID>grey_level(l:gy) - a:g
|
|
||||||
let l:dgb = <SID>grey_level(l:gz) - a:b
|
|
||||||
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
|
||||||
let l:dr = <SID>rgb_level(l:gx) - a:r
|
|
||||||
let l:dg = <SID>rgb_level(l:gy) - a:g
|
|
||||||
let l:db = <SID>rgb_level(l:gz) - a:b
|
|
||||||
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
|
|
||||||
if l:dgrey < l:drgb
|
|
||||||
" use the grey
|
|
||||||
return <SID>grey_color(l:gx)
|
|
||||||
else
|
|
||||||
" use the color
|
|
||||||
return <SID>rgb_color(l:x, l:y, l:z)
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
" only one possibility
|
|
||||||
return <SID>rgb_color(l:x, l:y, l:z)
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" returns the palette index to approximate the 'rrggbb' hex string
|
|
||||||
fun <SID>rgb(rgb)
|
|
||||||
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
|
|
||||||
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
|
|
||||||
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
|
|
||||||
|
|
||||||
return <SID>color(l:r, l:g, l:b)
|
|
||||||
endfun
|
|
||||||
|
|
||||||
" sets the highlighting for the given group
|
|
||||||
fun <SID>X(group, fg, bg, attr)
|
|
||||||
if a:fg != ""
|
|
||||||
exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . <SID>rgb(a:fg)
|
|
||||||
endif
|
|
||||||
if a:bg != ""
|
|
||||||
exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . <SID>rgb(a:bg)
|
|
||||||
endif
|
|
||||||
if a:attr != ""
|
|
||||||
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
|
|
||||||
endif
|
|
||||||
endfun
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
call <SID>X("Normal", "cccccc", "000000", "")
|
|
||||||
|
|
||||||
" highlight groups
|
|
||||||
call <SID>X("Cursor", "708090", "f0e68c", "")
|
|
||||||
"CursorIM
|
|
||||||
"Directory
|
|
||||||
"DiffAdd
|
|
||||||
"DiffChange
|
|
||||||
"DiffDelete
|
|
||||||
"DiffText
|
|
||||||
"ErrorMsg
|
|
||||||
call <SID>X("VertSplit", "c2bfa5", "7f7f7f", "reverse")
|
|
||||||
call <SID>X("Folded", "ffd700", "4d4d4d", "")
|
|
||||||
call <SID>X("FoldColumn", "d2b48c", "4d4d4d", "")
|
|
||||||
call <SID>X("IncSearch", "708090", "f0e68c", "")
|
|
||||||
"LineNr
|
|
||||||
call <SID>X("ModeMsg", "daa520", "", "")
|
|
||||||
call <SID>X("MoreMsg", "2e8b57", "", "")
|
|
||||||
call <SID>X("NonText", "addbe7", "000000", "bold")
|
|
||||||
call <SID>X("Question", "00ff7f", "", "")
|
|
||||||
call <SID>X("Search", "f5deb3", "cd853f", "")
|
|
||||||
call <SID>X("SpecialKey", "9acd32", "", "")
|
|
||||||
call <SID>X("StatusLine", "c2bfa5", "000000", "reverse")
|
|
||||||
call <SID>X("StatusLineNC", "c2bfa5", "7f7f7f", "reverse")
|
|
||||||
call <SID>X("Title", "cd5c5c", "", "")
|
|
||||||
call <SID>X("Visual", "6b8e23", "f0e68c", "reverse")
|
|
||||||
"VisualNOS
|
|
||||||
call <SID>X("WarningMsg", "fa8072", "", "")
|
|
||||||
"WildMenu
|
|
||||||
"Menu
|
|
||||||
"Scrollbar
|
|
||||||
"Tooltip
|
|
||||||
|
|
||||||
" syntax highlighting groups
|
|
||||||
call <SID>X("Comment", "87ceeb", "", "")
|
|
||||||
call <SID>X("Constant", "ffa0a0", "", "")
|
|
||||||
call <SID>X("Identifier", "98fb98", "", "none")
|
|
||||||
call <SID>X("Statement", "f0e68c", "", "bold")
|
|
||||||
call <SID>X("PreProc", "cd5c5c", "", "")
|
|
||||||
call <SID>X("Type", "bdb76b", "", "bold")
|
|
||||||
call <SID>X("Special", "ffdead", "", "")
|
|
||||||
"Underlined
|
|
||||||
call <SID>X("Ignore", "666666", "", "")
|
|
||||||
"Error
|
|
||||||
call <SID>X("Todo", "ff4500", "eeee00", "")
|
|
||||||
|
|
||||||
" delete functions {{{
|
|
||||||
delf <SID>X
|
|
||||||
delf <SID>rgb
|
|
||||||
delf <SID>color
|
|
||||||
delf <SID>rgb_color
|
|
||||||
delf <SID>rgb_level
|
|
||||||
delf <SID>rgb_number
|
|
||||||
delf <SID>grey_color
|
|
||||||
delf <SID>grey_level
|
|
||||||
delf <SID>grey_number
|
|
||||||
" }}}
|
|
||||||
else
|
|
||||||
" color terminal definitions
|
|
||||||
hi SpecialKey ctermfg=darkgreen
|
|
||||||
hi NonText cterm=bold ctermfg=darkblue
|
|
||||||
hi Directory ctermfg=darkcyan
|
|
||||||
hi ErrorMsg cterm=bold ctermfg=7 ctermbg=1
|
|
||||||
hi IncSearch cterm=NONE ctermfg=yellow ctermbg=green
|
|
||||||
hi Search cterm=NONE ctermfg=grey ctermbg=blue
|
|
||||||
hi MoreMsg ctermfg=darkgreen
|
|
||||||
hi ModeMsg cterm=NONE ctermfg=brown
|
|
||||||
hi LineNr ctermfg=3
|
|
||||||
hi Question ctermfg=green
|
|
||||||
hi StatusLine cterm=bold,reverse
|
|
||||||
hi StatusLineNC cterm=reverse
|
|
||||||
hi VertSplit cterm=reverse
|
|
||||||
hi Title ctermfg=5
|
|
||||||
hi Visual cterm=reverse
|
|
||||||
hi VisualNOS cterm=bold,underline
|
|
||||||
hi WarningMsg ctermfg=1
|
|
||||||
hi WildMenu ctermfg=0 ctermbg=3
|
|
||||||
hi Folded ctermfg=darkgrey ctermbg=NONE
|
|
||||||
hi FoldColumn ctermfg=darkgrey ctermbg=NONE
|
|
||||||
hi DiffAdd ctermbg=4
|
|
||||||
hi DiffChange ctermbg=5
|
|
||||||
hi DiffDelete cterm=bold ctermfg=4 ctermbg=6
|
|
||||||
hi DiffText cterm=bold ctermbg=1
|
|
||||||
hi Comment ctermfg=darkcyan
|
|
||||||
hi Constant ctermfg=brown
|
|
||||||
hi Special ctermfg=5
|
|
||||||
hi Identifier ctermfg=6
|
|
||||||
hi Statement ctermfg=3
|
|
||||||
hi PreProc ctermfg=5
|
|
||||||
hi Type ctermfg=2
|
|
||||||
hi Underlined cterm=underline ctermfg=5
|
|
||||||
hi Ignore ctermfg=darkgrey
|
|
||||||
hi Error cterm=bold ctermfg=7 ctermbg=1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" vim: set fdl=0 fdm=marker:
|
|
@ -1,196 +0,0 @@
|
|||||||
" Python indent file
|
|
||||||
" Language: Python
|
|
||||||
" Maintainer: Eric Mc Sween <em@tomcom.de>
|
|
||||||
" Original Author: David Bustos <bustos@caltech.edu>
|
|
||||||
" Last Change: 2004 Jun 07
|
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
|
||||||
if exists("b:did_indent")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let b:did_indent = 1
|
|
||||||
|
|
||||||
setlocal expandtab
|
|
||||||
setlocal nolisp
|
|
||||||
setlocal autoindent
|
|
||||||
setlocal indentexpr=GetPythonIndent(v:lnum)
|
|
||||||
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
|
|
||||||
|
|
||||||
let s:maxoff = 50
|
|
||||||
|
|
||||||
" Find backwards the closest open parenthesis/bracket/brace.
|
|
||||||
function! s:SearchParensPair()
|
|
||||||
let line = line('.')
|
|
||||||
let col = col('.')
|
|
||||||
|
|
||||||
" Skip strings and comments and don't look too far
|
|
||||||
let skip = "line('.') < " . (line - s:maxoff) . " ? dummy :" .
|
|
||||||
\ 'synIDattr(synID(line("."), col("."), 0), "name") =~? ' .
|
|
||||||
\ '"string\\|comment"'
|
|
||||||
|
|
||||||
" Search for parentheses
|
|
||||||
call cursor(line, col)
|
|
||||||
let parlnum = searchpair('(', '', ')', 'bW', skip)
|
|
||||||
let parcol = col('.')
|
|
||||||
|
|
||||||
" Search for brackets
|
|
||||||
call cursor(line, col)
|
|
||||||
let par2lnum = searchpair('\[', '', '\]', 'bW', skip)
|
|
||||||
let par2col = col('.')
|
|
||||||
|
|
||||||
" Search for braces
|
|
||||||
call cursor(line, col)
|
|
||||||
let par3lnum = searchpair('{', '', '}', 'bW', skip)
|
|
||||||
let par3col = col('.')
|
|
||||||
|
|
||||||
" Get the closest match
|
|
||||||
if par2lnum > parlnum || (par2lnum == parlnum && par2col > parcol)
|
|
||||||
let parlnum = par2lnum
|
|
||||||
let parcol = par2col
|
|
||||||
endif
|
|
||||||
if par3lnum > parlnum || (par3lnum == parlnum && par3col > parcol)
|
|
||||||
let parlnum = par3lnum
|
|
||||||
let parcol = par3col
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Put the cursor on the match
|
|
||||||
if parlnum > 0
|
|
||||||
call cursor(parlnum, parcol)
|
|
||||||
endif
|
|
||||||
return parlnum
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Find the start of a multi-line statement
|
|
||||||
function! s:StatementStart(lnum)
|
|
||||||
let lnum = a:lnum
|
|
||||||
while 1
|
|
||||||
if getline(lnum - 1) =~ '\\$'
|
|
||||||
let lnum = lnum - 1
|
|
||||||
else
|
|
||||||
call cursor(lnum, 1)
|
|
||||||
let maybe_lnum = s:SearchParensPair()
|
|
||||||
if maybe_lnum < 1
|
|
||||||
return lnum
|
|
||||||
else
|
|
||||||
let lnum = maybe_lnum
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Find the block starter that matches the current line
|
|
||||||
function! s:BlockStarter(lnum, block_start_re)
|
|
||||||
let lnum = a:lnum
|
|
||||||
let maxindent = 10000 " whatever
|
|
||||||
while lnum > 1
|
|
||||||
let lnum = prevnonblank(lnum - 1)
|
|
||||||
if indent(lnum) < maxindent
|
|
||||||
if getline(lnum) =~ a:block_start_re
|
|
||||||
return lnum
|
|
||||||
else
|
|
||||||
let maxindent = indent(lnum)
|
|
||||||
" It's not worth going further if we reached the top level
|
|
||||||
if maxindent == 0
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
return -1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! GetPythonIndent(lnum)
|
|
||||||
|
|
||||||
" First line has indent 0
|
|
||||||
if a:lnum == 1
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If we can find an open parenthesis/bracket/brace, line up with it.
|
|
||||||
call cursor(a:lnum, 1)
|
|
||||||
let parlnum = s:SearchParensPair()
|
|
||||||
if parlnum > 0
|
|
||||||
let parcol = col('.')
|
|
||||||
let closing_paren = match(getline(a:lnum), '^\s*[])}]') != -1
|
|
||||||
if match(getline(parlnum), '[([{]\s*$', parcol - 1) != -1
|
|
||||||
if closing_paren
|
|
||||||
return indent(parlnum)
|
|
||||||
else
|
|
||||||
return indent(parlnum) + &shiftwidth
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
if closing_paren
|
|
||||||
return parcol - 1
|
|
||||||
else
|
|
||||||
return parcol
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Examine this line
|
|
||||||
let thisline = getline(a:lnum)
|
|
||||||
let thisindent = indent(a:lnum)
|
|
||||||
|
|
||||||
" If the line starts with 'elif' or 'else', line up with 'if' or 'elif'
|
|
||||||
if thisline =~ '^\s*\(elif\|else\)\>'
|
|
||||||
let bslnum = s:BlockStarter(a:lnum, '^\s*\(if\|elif\)\>')
|
|
||||||
if bslnum > 0
|
|
||||||
return indent(bslnum)
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the line starts with 'except' or 'finally', line up with 'try'
|
|
||||||
" or 'except'
|
|
||||||
if thisline =~ '^\s*\(except\|finally\)\>'
|
|
||||||
let bslnum = s:BlockStarter(a:lnum, '^\s*\(try\|except\)\>')
|
|
||||||
if bslnum > 0
|
|
||||||
return indent(bslnum)
|
|
||||||
else
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Examine previous line
|
|
||||||
let plnum = a:lnum - 1
|
|
||||||
let pline = getline(plnum)
|
|
||||||
let sslnum = s:StatementStart(plnum)
|
|
||||||
|
|
||||||
" If the previous line is blank, keep the same indentation
|
|
||||||
if pline =~ '^\s*$'
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If this line is explicitly joined, try to find an indentation that looks
|
|
||||||
" good.
|
|
||||||
if pline =~ '\\$'
|
|
||||||
let compound_statement = '^\s*\(if\|while\|for\s.*\sin\|except\)\s*'
|
|
||||||
let maybe_indent = matchend(getline(sslnum), compound_statement)
|
|
||||||
if maybe_indent != -1
|
|
||||||
return maybe_indent
|
|
||||||
else
|
|
||||||
return indent(sslnum) + &sw * 2
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the previous line ended with a colon, indent relative to
|
|
||||||
" statement start.
|
|
||||||
if pline =~ ':\s*$'
|
|
||||||
return indent(sslnum) + &sw
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the previous line was a stop-execution statement or a pass
|
|
||||||
if getline(sslnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
|
||||||
" See if the user has already dedented
|
|
||||||
if indent(a:lnum) > indent(sslnum) - &sw
|
|
||||||
" If not, recommend one dedent
|
|
||||||
return indent(sslnum) - &sw
|
|
||||||
endif
|
|
||||||
" Otherwise, trust the user
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" In all other cases, line up with the start of the previous statement.
|
|
||||||
return indent(sslnum)
|
|
||||||
endfunction
|
|
@ -1,245 +0,0 @@
|
|||||||
" Vim syntax file
|
|
||||||
" Language: AppleScript
|
|
||||||
" Maintainer: Jim Eberle <jim.eberle@fastnlight.com>
|
|
||||||
" Last Change: Mar 18, 2010
|
|
||||||
" URL: http://www.fastnlight.com/syntax/applescript.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 scptStmt get set count copy run global local prop property
|
|
||||||
syn keyword scptStmt close put delete duplicate exists
|
|
||||||
syn keyword scptStmt launch open print quit make move reopen save
|
|
||||||
syn keyword scptStmt saving into
|
|
||||||
hi def link scptStmt Statement
|
|
||||||
|
|
||||||
" --- Type ---
|
|
||||||
syn keyword scptType text string number integer real color date
|
|
||||||
hi def link scptType Type
|
|
||||||
|
|
||||||
" --- Operator ---
|
|
||||||
syn keyword scptOp div mod not and or as
|
|
||||||
syn match scptOp "[-+*/^&]"
|
|
||||||
" MacRoman single char :- (divide)
|
|
||||||
exec 'syn match scptOp "'.nr2char(214).'"'
|
|
||||||
syn match scptOp "\<\(a \)\?\(ref\( to\)\?\|reference to\)\>"
|
|
||||||
hi def link scptOp Operator
|
|
||||||
|
|
||||||
" Containment
|
|
||||||
syn match scptIN "\<starts\? with\>"
|
|
||||||
syn match scptIN "\<begins\? with\>"
|
|
||||||
syn match scptIN "\<ends\? with\>"
|
|
||||||
syn match scptIN "\<contains\>"
|
|
||||||
syn match scptIN "\<does not contain\>"
|
|
||||||
syn match scptIN "\<doesn't contain\>"
|
|
||||||
syn match scptIN "\<is in\>"
|
|
||||||
syn match scptIN "\<is contained by\>"
|
|
||||||
syn match scptIN "\<is not in\>"
|
|
||||||
syn match scptIN "\<is not contained by\>"
|
|
||||||
syn match scptIN "\<isn't contained by\>"
|
|
||||||
hi def link scptIN scptOp
|
|
||||||
|
|
||||||
" Equals
|
|
||||||
syn match scptEQ "="
|
|
||||||
syn match scptEQ "\<equal\>"
|
|
||||||
syn match scptEQ "\<equals\>"
|
|
||||||
syn match scptEQ "\<equal to\>"
|
|
||||||
syn match scptEQ "\<is\>"
|
|
||||||
syn match scptEQ "\<is equal to\>"
|
|
||||||
hi def link scptEQ scptOp
|
|
||||||
|
|
||||||
" Not Equals
|
|
||||||
syn match scptNE "\<does not equal\>"
|
|
||||||
syn match scptNE "\<doesn't equal\>"
|
|
||||||
syn match scptNE "\<is not\>"
|
|
||||||
syn match scptNE "\<is not equal\( to\)\?\>"
|
|
||||||
syn match scptNE "\<isn't\>"
|
|
||||||
syn match scptNE "\<isn't equal\( to\)\?\>"
|
|
||||||
hi def link scptNE scptOp
|
|
||||||
" MacRoman single char /=
|
|
||||||
exec 'syn match scptNE "'.nr2char(173).'"'
|
|
||||||
|
|
||||||
" Less Than
|
|
||||||
syn match scptLT "<"
|
|
||||||
syn match scptLT "\<comes before\>"
|
|
||||||
syn match scptLT "\(is \)\?less than"
|
|
||||||
syn match scptLT "\<is not greater than or equal\( to\)\?\>"
|
|
||||||
syn match scptLT "\<isn't greater than or equal\( to\)\?\>"
|
|
||||||
hi def link scptLT scptOp
|
|
||||||
|
|
||||||
" Greater Than
|
|
||||||
syn match scptGT ">"
|
|
||||||
syn match scptGT "\<comes after\>"
|
|
||||||
syn match scptGT "\(is \)\?greater than"
|
|
||||||
syn match scptGT "\<is not less than or equal\( to\)\?\>"
|
|
||||||
syn match scptGT "\<isn't less than or equal\( to\)\?\>"
|
|
||||||
hi def link scptGT scptOp
|
|
||||||
|
|
||||||
" Less Than or Equals
|
|
||||||
syn match scptLE "<="
|
|
||||||
syn match scptLE "\<does not come after\>"
|
|
||||||
syn match scptLE "\<doesn't come after\>"
|
|
||||||
syn match scptLE "\(is \)\?less than or equal\( to\)\?"
|
|
||||||
syn match scptLE "\<is not greater than\>"
|
|
||||||
syn match scptLE "\<isn't greater than\>"
|
|
||||||
hi def link scptLE scptOp
|
|
||||||
" MacRoman single char <=
|
|
||||||
exec 'syn match scptLE "'.nr2char(178).'"'
|
|
||||||
|
|
||||||
" Greater Than or Equals
|
|
||||||
syn match scptGE ">="
|
|
||||||
syn match scptGE "\<does not come before\>"
|
|
||||||
syn match scptGE "\<doesn't come before\>"
|
|
||||||
syn match scptGE "\(is \)\?greater than or equal\( to\)\?"
|
|
||||||
syn match scptGE "\<is not less than\>"
|
|
||||||
syn match scptGE "\<isn't less than\>"
|
|
||||||
hi def link scptGE scptOp
|
|
||||||
" MacRoman single char >=
|
|
||||||
exec 'syn match scptGE "'.nr2char(179).'"'
|
|
||||||
|
|
||||||
" --- Constant String ---
|
|
||||||
syn region scptString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
|
||||||
hi def link scptString String
|
|
||||||
|
|
||||||
" --- Constant Number ---
|
|
||||||
syn match scptNumber "\<-\?\d\+\>"
|
|
||||||
hi def link scptNumber Number
|
|
||||||
|
|
||||||
" --- Constant Float ---
|
|
||||||
syn match scptFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\="
|
|
||||||
syn match scptFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=\>"
|
|
||||||
syn match scptFloat display contained "\d\+e[-+]\>"
|
|
||||||
hi def link scptFloat Float
|
|
||||||
|
|
||||||
" --- Constant Boolean ---
|
|
||||||
syn keyword scptBoolean true false yes no ask
|
|
||||||
hi def link scptBoolean Boolean
|
|
||||||
|
|
||||||
" --- Other Constants ---
|
|
||||||
syn keyword scptConst it me version pi result space tab anything
|
|
||||||
syn match scptConst "\<missing value\>"
|
|
||||||
|
|
||||||
" Considering and Ignoring
|
|
||||||
syn match scptConst "\<application responses\>"
|
|
||||||
syn match scptConst "\<current application\>"
|
|
||||||
syn match scptConst "\<white space\>"
|
|
||||||
syn keyword scptConst case diacriticals expansion hyphens punctuation
|
|
||||||
hi def link scptConst Constant
|
|
||||||
|
|
||||||
" Style
|
|
||||||
syn match scptStyle "\<all caps\>"
|
|
||||||
syn match scptStyle "\<all lowercase\>"
|
|
||||||
syn match scptStyle "\<small caps\>"
|
|
||||||
syn keyword scptStyle bold condensed expanded hidden italic outline plain
|
|
||||||
syn keyword scptStyle shadow strikethrough subscript superscript underline
|
|
||||||
hi def link scptStyle scptConst
|
|
||||||
|
|
||||||
" Day
|
|
||||||
syn keyword scptDay Mon Tue Wed Thu Fri Sat Sun
|
|
||||||
syn keyword scptDay Monday Tuesday Wednesday Thursday Friday Saturday Sunday
|
|
||||||
syn keyword scptDay weekday
|
|
||||||
hi def link scptDay scptConst
|
|
||||||
|
|
||||||
" Month
|
|
||||||
syn keyword scptMonth Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
|
|
||||||
syn keyword scptMonth January February March
|
|
||||||
syn keyword scptMonth April May June
|
|
||||||
syn keyword scptMonth July August September
|
|
||||||
syn keyword scptMonth October November December
|
|
||||||
syn keyword scptMonth month
|
|
||||||
hi def link scptMonth scptConst
|
|
||||||
|
|
||||||
" Time
|
|
||||||
syn keyword scptTime minutes hours days weeks
|
|
||||||
hi def link scptTime scptConstant
|
|
||||||
|
|
||||||
" --- Conditional ---
|
|
||||||
syn keyword scptCond if then else
|
|
||||||
syn match scptCond "\<end if\>"
|
|
||||||
hi def link scptCond Conditional
|
|
||||||
|
|
||||||
" --- Repeat ---
|
|
||||||
syn keyword scptRepeat repeat with from to by continue
|
|
||||||
syn match scptRepeat "\<repeat while\>"
|
|
||||||
syn match scptRepeat "\<repeat until\>"
|
|
||||||
syn match scptRepeat "\<repeat with\>"
|
|
||||||
syn match scptRepeat "\<end repeat\>"
|
|
||||||
hi def link scptRepeat Repeat
|
|
||||||
|
|
||||||
" --- Exception ---
|
|
||||||
syn keyword scptException try error
|
|
||||||
syn match scptException "\<on error\>"
|
|
||||||
syn match scptException "\<end try\>"
|
|
||||||
syn match scptException "\<end error\>"
|
|
||||||
hi def link scptException Exception
|
|
||||||
|
|
||||||
" --- Keyword ---
|
|
||||||
syn keyword scptKeyword end tell times exit
|
|
||||||
syn keyword scptKeyword application file alias activate
|
|
||||||
syn keyword scptKeyword script on return without given
|
|
||||||
syn keyword scptKeyword considering ignoring items delimiters
|
|
||||||
syn keyword scptKeyword some each every whose where id index item its
|
|
||||||
syn keyword scptKeyword first second third fourth fifth sixth seventh
|
|
||||||
syn keyword scptKeyword eighth ninth tenth container
|
|
||||||
syn match scptKeyword "\d\+\(st\|nd\|rd\|th\)"
|
|
||||||
syn keyword scptKeyword last front back middle named thru through
|
|
||||||
syn keyword scptKeyword before after in of the
|
|
||||||
syn match scptKeyword "\<text \>"
|
|
||||||
syn match scptKeyword "\<partial result\>"
|
|
||||||
syn match scptKeyword "\<but ignoring\>"
|
|
||||||
syn match scptKeyword "\<but considering\>"
|
|
||||||
syn match scptKeyword "\<with timeout\>"
|
|
||||||
syn match scptKeyword "\<with transaction\>"
|
|
||||||
syn match scptKeyword "\<do script\>"
|
|
||||||
syn match scptKeyword "\<POSIX path\>"
|
|
||||||
syn match scptKeyword "\<quoted form\>"
|
|
||||||
syn match scptKeyword "'s"
|
|
||||||
hi def link scptKeyword Keyword
|
|
||||||
|
|
||||||
" US Units
|
|
||||||
syn keyword scptUnitUS quarts gallons ounces pounds inches feet yards miles
|
|
||||||
syn match scptUnitUS "\<square feet\>"
|
|
||||||
syn match scptUnitUS "\<square yards\>"
|
|
||||||
syn match scptUnitUS "\<square miles\>"
|
|
||||||
syn match scptUnitUS "\<cubic inches\>"
|
|
||||||
syn match scptUnitUS "\<cubic feet\>"
|
|
||||||
syn match scptUnitUS "\<cubic yards\>"
|
|
||||||
syn match scptUnitUS "\<degrees Fahrenheit\>"
|
|
||||||
hi def link scptUnitUS scptKey
|
|
||||||
|
|
||||||
" British Units
|
|
||||||
syn keyword scptUnitBT litres centimetres metres kilometres
|
|
||||||
syn match scptUnitBT "\<square metres\>"
|
|
||||||
syn match scptUnitBT "\<square kilometres\>"
|
|
||||||
syn match scptUnitBT "\<cubic centimetres\>"
|
|
||||||
syn match scptUnitBT "\<cubic metres\>"
|
|
||||||
hi def link scptUnitBT scptKey
|
|
||||||
|
|
||||||
" Metric Units
|
|
||||||
syn keyword scptUnitMT liters centimeters meters kilometers grams kilograms
|
|
||||||
syn match scptUnitMT "\<square meters\>"
|
|
||||||
syn match scptUnitMT "\<square kilometers\>"
|
|
||||||
syn match scptUnitMT "\<cubic centimeters\>"
|
|
||||||
syn match scptUnitMT "\<cubic meters\>"
|
|
||||||
syn match scptUnitMT "\<degrees Celsius\>"
|
|
||||||
syn match scptUnitMT "\<degrees Kelvin\>"
|
|
||||||
hi def link scptUnitMT scptKey
|
|
||||||
|
|
||||||
" --- Comment ---
|
|
||||||
syn match scptComment "--.*"
|
|
||||||
syn match scptComment "#.*"
|
|
||||||
syn region scptComment start="(\*" end="\*)"
|
|
||||||
hi def link scptComment Comment
|
|
||||||
|
|
||||||
" --- Todo ---
|
|
||||||
syn keyword scptTodo contained TODO FIXME XXX
|
|
||||||
hi def link scptTodo Todo
|
|
||||||
|
|
||||||
let b:current_syntax = "applescript"
|
|
||||||
|
|
@ -1,149 +0,0 @@
|
|||||||
" Vim syntax file
|
|
||||||
"
|
|
||||||
" Language: Ragel
|
|
||||||
" Author: Adrian Thurston
|
|
||||||
|
|
||||||
syntax clear
|
|
||||||
|
|
||||||
"
|
|
||||||
" Outside code
|
|
||||||
"
|
|
||||||
|
|
||||||
" Comments
|
|
||||||
syntax region ocComment start="\/\*" end="\*\/"
|
|
||||||
syntax match ocComment "\/\/.*$"
|
|
||||||
|
|
||||||
" Anything preprocessor
|
|
||||||
syntax match ocPreproc "#\(.\|\\\n\)*$"
|
|
||||||
syntax region ocPreproc start="#" end="[^\\]$"
|
|
||||||
|
|
||||||
" Strings
|
|
||||||
syntax match ocLiteral "'\(\\.\|[^'\\]\)*'"
|
|
||||||
syntax match ocLiteral "\"\(\\.\|[^\"\\]\)*\""
|
|
||||||
|
|
||||||
" C/C++ Keywords
|
|
||||||
syntax keyword ocType unsigned signed void char short int long float double bool
|
|
||||||
syntax keyword ocType inline static extern register const volatile auto
|
|
||||||
syntax keyword ocType union enum struct class typedef
|
|
||||||
syntax keyword ocType namespace template typename mutable
|
|
||||||
syntax keyword ocKeyword break continue default do else for
|
|
||||||
syntax keyword ocKeyword goto if return switch while
|
|
||||||
syntax keyword ocKeyword new delete this using friend public private protected sizeof
|
|
||||||
syntax keyword ocKeyword throw try catch operator typeid
|
|
||||||
syntax keyword ocKeyword and bitor xor compl bitand and_eq or_eq xor_eq not not_eq
|
|
||||||
syntax keyword ocKeyword static_cast dynamic_cast
|
|
||||||
|
|
||||||
" Numbers
|
|
||||||
syntax match ocNumber "[0-9][0-9]*"
|
|
||||||
syntax match ocNumber "0x[0-9a-fA-F][0-9a-fA-F]*"
|
|
||||||
|
|
||||||
" Booleans
|
|
||||||
syntax keyword ocBoolean true false
|
|
||||||
|
|
||||||
" Identifiers
|
|
||||||
syntax match anyId "[a-zA-Z_][a-zA-Z_0-9]*"
|
|
||||||
|
|
||||||
" Inline code only
|
|
||||||
syntax keyword fsmType fpc fc fcurs fbuf fblen ftargs fstack
|
|
||||||
syntax keyword fsmKeyword fhold fgoto fcall fret fentry fnext fexec fbreak
|
|
||||||
|
|
||||||
syntax cluster rlItems contains=rlComment,rlLiteral,rlAugmentOps,rlOtherOps,rlKeywords,rlWrite,rlCodeCurly,rlCodeSemi,rlNumber,anyId,rlLabelColon,rlExprKeywords
|
|
||||||
|
|
||||||
syntax region machineSpec1 matchgroup=beginRL start="%%{" end="}%%" contains=@rlItems
|
|
||||||
syntax region machineSpec2 matchgroup=beginRL start="%%[^{]"rs=e-1 end="$" keepend contains=@rlItems
|
|
||||||
syntax region machineSpec2 matchgroup=beginRL start="%%$" end="$" keepend contains=@rlItems
|
|
||||||
|
|
||||||
" Comments
|
|
||||||
syntax match rlComment "#.*$" contained
|
|
||||||
|
|
||||||
" Literals
|
|
||||||
syntax match rlLiteral "'\(\\.\|[^'\\]\)*'[i]*" contained
|
|
||||||
syntax match rlLiteral "\"\(\\.\|[^\"\\]\)*\"[i]*" contained
|
|
||||||
syntax match rlLiteral /\/\(\\.\|[^\/\\]\)*\/[i]*/ contained
|
|
||||||
syntax match rlLiteral "\[\(\\.\|[^\]\\]\)*\]" contained
|
|
||||||
|
|
||||||
" Numbers
|
|
||||||
syntax match rlNumber "[0-9][0-9]*" contained
|
|
||||||
syntax match rlNumber "0x[0-9a-fA-F][0-9a-fA-F]*" contained
|
|
||||||
|
|
||||||
" Operators
|
|
||||||
syntax match rlAugmentOps "[>$%@]" contained
|
|
||||||
syntax match rlAugmentOps "<>\|<" contained
|
|
||||||
syntax match rlAugmentOps "[>\<$%@][!\^/*~]" contained
|
|
||||||
syntax match rlAugmentOps "[>$%]?" contained
|
|
||||||
syntax match rlAugmentOps "<>[!\^/*~]" contained
|
|
||||||
syntax match rlAugmentOps "=>" contained
|
|
||||||
syntax match rlOtherOps "->" contained
|
|
||||||
|
|
||||||
syntax match rlOtherOps ":>" contained
|
|
||||||
syntax match rlOtherOps ":>>" contained
|
|
||||||
syntax match rlOtherOps "<:" contained
|
|
||||||
|
|
||||||
" Keywords
|
|
||||||
" FIXME: Enable the range keyword post 5.17.
|
|
||||||
" syntax keyword rlKeywords machine action context include range contained
|
|
||||||
syntax keyword rlKeywords machine action context include import export prepush postpop contained
|
|
||||||
syntax keyword rlExprKeywords when inwhen outwhen err lerr eof from to contained
|
|
||||||
|
|
||||||
" Case Labels
|
|
||||||
syntax keyword caseLabelKeyword case contained
|
|
||||||
syntax cluster caseLabelItems contains=ocComment,ocPreproc,ocLiteral,ocType,ocKeyword,caseLabelKeyword,ocNumber,ocBoolean,anyId,fsmType,fsmKeyword
|
|
||||||
syntax match caseLabelColon "case" contains=@caseLabelItems
|
|
||||||
syntax match caseLabelColon "case[\t ]\+.*:$" contains=@caseLabelItems
|
|
||||||
syntax match caseLabelColon "case[\t ]\+.*:[^=:]"me=e-1 contains=@caseLabelItems
|
|
||||||
|
|
||||||
" Labels
|
|
||||||
syntax match ocLabelColon "^[\t ]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:$" contains=anyLabel
|
|
||||||
syntax match ocLabelColon "^[\t ]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:[^=:]"me=e-1 contains=anyLabel
|
|
||||||
|
|
||||||
syntax match rlLabelColon "[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:$" contained contains=anyLabel
|
|
||||||
syntax match rlLabelColon "[a-zA-Z_][a-zA-Z_0-9]*[ \t]*:[^=:>]"me=e-1 contained contains=anyLabel
|
|
||||||
syntax match anyLabel "[a-zA-Z_][a-zA-Z_0-9]*" contained
|
|
||||||
|
|
||||||
" All items that can go in a code block.
|
|
||||||
|
|
||||||
syntax cluster inlineItems contains=rlCodeCurly,ocComment,ocPreproc,ocLiteral,ocType,ocKeyword,ocNumber,ocBoolean,ocLabelColon,anyId,fsmType,fsmKeyword,caseLabelColon
|
|
||||||
|
|
||||||
" Blocks of code. rlCodeCurly is recursive.
|
|
||||||
syntax region rlCodeCurly matchgroup=NONE start="{" end="}" contained contains=@inlineItems
|
|
||||||
syntax region rlCodeSemi matchgroup=Type start="\<alphtype\>" start="\<getkey\>" start="\<access\>" start="\<variable\>" matchgroup=NONE end=";" contained contains=@inlineItems
|
|
||||||
|
|
||||||
syntax region rlWrite matchgroup=Type start="\<write\>" matchgroup=NONE end="[;)]" contained contains=rlWriteKeywords,rlWriteOptions
|
|
||||||
|
|
||||||
syntax keyword rlWriteKeywords init data exec exports start error first_final contained
|
|
||||||
syntax keyword rlWriteOptions noerror nofinal noprefix noend nocs contained
|
|
||||||
|
|
||||||
"
|
|
||||||
" Sync at the start of machine specs.
|
|
||||||
"
|
|
||||||
" Match The ragel delimiters only if there quotes no ahead on the same line.
|
|
||||||
" On the open marker, use & to consume the leader.
|
|
||||||
syntax sync match ragelSyncPat grouphere NONE "^[^\'\"%]*%%{&^[^\'\"%]*"
|
|
||||||
syntax sync match ragelSyncPat grouphere NONE "^[^\'\"%]*%%[^{]&^[^\'\"%]*"
|
|
||||||
syntax sync match ragelSyncPat grouphere NONE "^[^\'\"]*}%%"
|
|
||||||
|
|
||||||
"
|
|
||||||
" Specifying Groups
|
|
||||||
"
|
|
||||||
hi link ocComment Comment
|
|
||||||
hi link ocPreproc Macro
|
|
||||||
hi link ocLiteral String
|
|
||||||
hi link ocType Type
|
|
||||||
hi link ocKeyword Keyword
|
|
||||||
hi link ocNumber Number
|
|
||||||
hi link ocBoolean Boolean
|
|
||||||
hi link rlComment Comment
|
|
||||||
hi link rlNumber Number
|
|
||||||
hi link rlLiteral String
|
|
||||||
hi link rlAugmentOps Keyword
|
|
||||||
hi link rlExprKeywords Keyword
|
|
||||||
hi link rlWriteKeywords Keyword
|
|
||||||
hi link rlWriteOptions Keyword
|
|
||||||
hi link rlKeywords Type
|
|
||||||
hi link fsmType Type
|
|
||||||
hi link fsmKeyword Keyword
|
|
||||||
hi link anyLabel Label
|
|
||||||
hi link caseLabelKeyword Keyword
|
|
||||||
hi link beginRL Type
|
|
||||||
|
|
||||||
let b:current_syntax = "ragel"
|
|
@ -1,87 +0,0 @@
|
|||||||
"
|
|
||||||
" You will have to restart vim for this to take effect. In any case
|
|
||||||
" it is a good idea to read ":he new-filetype" so that you know what
|
|
||||||
" is going on, and why the above lines work.
|
|
||||||
"
|
|
||||||
" Written originally by Dominic Mitchell, Jan 2006.
|
|
||||||
" happygiraffe.net
|
|
||||||
"
|
|
||||||
" Modified by Aaron Bieber, May 2007.
|
|
||||||
" blog.aaronbieber.com
|
|
||||||
"
|
|
||||||
" Modified by Tim Harper, July 2008 - current
|
|
||||||
" tim.theenchanter.com
|
|
||||||
" @(#) $Id$
|
|
||||||
|
|
||||||
if version < 600
|
|
||||||
syntax clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Textile commands like "h1" are case sensitive, AFAIK.
|
|
||||||
syn case match
|
|
||||||
|
|
||||||
" Textile syntax: <http://textism.com/tools/textile/>
|
|
||||||
|
|
||||||
" Inline elements.
|
|
||||||
syn match txtEmphasis /_[^_]\+_/
|
|
||||||
syn match txtBold /\*[^*]\+\*/
|
|
||||||
syn match txtCite /??.\+??/
|
|
||||||
syn match txtDeleted /-[^-]\+-/
|
|
||||||
syn match txtInserted /+[^+]\++/
|
|
||||||
syn match txtSuper /\^[^^]\+\^/
|
|
||||||
syn match txtSub /\~[^~]\+\~/
|
|
||||||
syn match txtSpan /%[^%]\+%/
|
|
||||||
syn match txtFootnoteRef /\[[0-9]\+]/
|
|
||||||
syn match txtCode /@[^@]\+@/
|
|
||||||
|
|
||||||
" Block elements.
|
|
||||||
syn match txtHeader /^h1\. .\+/
|
|
||||||
syn match txtHeader2 /^h2\. .\+/
|
|
||||||
syn match txtHeader3 /^h[3-6]\..\+/
|
|
||||||
syn match txtBlockquote /^bq\./
|
|
||||||
syn match txtFootnoteDef /^fn[0-9]\+\./
|
|
||||||
syn match txtListBullet /\v^\*+ /
|
|
||||||
syn match txtListBullet2 /\v^(\*\*)+ /
|
|
||||||
syn match txtListNumber /\v^#+ /
|
|
||||||
syn match txtListNumber2 /\v^(##)+ /
|
|
||||||
|
|
||||||
syn cluster txtBlockElement contains=txtHeader,txtBlockElement,txtFootnoteDef,txtListBullet,txtListNumber
|
|
||||||
|
|
||||||
|
|
||||||
" Everything after the first colon is from RFC 2396, with extra
|
|
||||||
" backslashes to keep vim happy... Original:
|
|
||||||
" ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
|
|
||||||
"
|
|
||||||
" Revised the pattern to exclude spaces from the URL portion of the
|
|
||||||
" pattern. Aaron Bieber, 2007.
|
|
||||||
syn match txtLink /"[^"]\+":\(\([^:\/?# ]\+\):\)\?\(\/\/\([^\/?# ]*\)\)\?\([^?# ]*\)\(?\([^# ]*\)\)\?\(#\([^ ]*\)\)\?/
|
|
||||||
|
|
||||||
syn cluster txtInlineElement contains=txtEmphasis,txtBold,txtCite,txtDeleted,txtInserted,txtSuper,txtSub,txtSpan
|
|
||||||
|
|
||||||
if version >= 508 || !exists("did_txt_syn_inits")
|
|
||||||
if version < 508
|
|
||||||
let did_txt_syn_inits = 1
|
|
||||||
command -nargs=+ HiLink hi link <args>
|
|
||||||
else
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
|
|
||||||
HiLink txtHeader Title
|
|
||||||
HiLink txtHeader2 Question
|
|
||||||
HiLink txtHeader3 Statement
|
|
||||||
HiLink txtBlockquote Comment
|
|
||||||
HiLink txtListBullet Operator
|
|
||||||
HiLink txtListBullet2 Constant
|
|
||||||
HiLink txtListNumber Operator
|
|
||||||
HiLink txtListNumber2 Constant
|
|
||||||
HiLink txtLink String
|
|
||||||
HiLink txtCode Identifier
|
|
||||||
hi def txtEmphasis term=underline cterm=underline gui=italic
|
|
||||||
hi def txtBold term=bold cterm=bold gui=bold
|
|
||||||
|
|
||||||
delcommand HiLink
|
|
||||||
endif
|
|
||||||
|
|
||||||
" vim: set ai et sw=4 :
|
|
Loading…
Reference in new issue