parent
bab1979d4b
commit
7632f23d10
@ -0,0 +1,96 @@
|
|||||||
|
[submodule ".vim/bundle/vim-pandoc"]
|
||||||
|
path = vim/.vim/bundle/vim-pandoc
|
||||||
|
url = git://github.com/vim-pandoc/vim-pandoc.git
|
||||||
|
[submodule ".vim/bundle/vim-textobj-user"]
|
||||||
|
path = vim/.vim/bundle/vim-textobj-user
|
||||||
|
url = git://github.com/kana/vim-textobj-user.git
|
||||||
|
[submodule ".vim/bundle/vim-textobj-line"]
|
||||||
|
path = vim/.vim/bundle/vim-textobj-line
|
||||||
|
url = git://github.com/kana/vim-textobj-line.git
|
||||||
|
[submodule ".vim/bundle/argtextobj.vim"]
|
||||||
|
path = vim/.vim/bundle/argtextobj.vim
|
||||||
|
url = git://github.com/vim-scripts/argtextobj.vim.git
|
||||||
|
[submodule ".vim/bundle/gist-vim"]
|
||||||
|
path = vim/.vim/bundle/gist-vim
|
||||||
|
url = git://github.com/mattn/gist-vim.git
|
||||||
|
[submodule ".vim/bundle/vim-textobj-rubyblock"]
|
||||||
|
path = vim/.vim/bundle/vim-textobj-rubyblock
|
||||||
|
url = git://github.com/nelstrom/vim-textobj-rubyblock.git
|
||||||
|
[submodule ".vim/bundle/vim-indent-object"]
|
||||||
|
path = vim/.vim/bundle/vim-indent-object
|
||||||
|
url = git://github.com/michaeljsmith/vim-indent-object.git
|
||||||
|
[submodule ".vim/bundle/vim-colors-solarized"]
|
||||||
|
path = vim/.vim/bundle/vim-colors-solarized
|
||||||
|
url = git://github.com/altercation/vim-colors-solarized.git
|
||||||
|
[submodule ".vim/bundle/vim-commentary"]
|
||||||
|
path = vim/.vim/bundle/vim-commentary
|
||||||
|
url = git://github.com/tpope/vim-commentary.git
|
||||||
|
[submodule ".vim/bundle/vim-repeat"]
|
||||||
|
path = vim/.vim/bundle/vim-repeat
|
||||||
|
url = git://github.com/tpope/vim-repeat.git
|
||||||
|
[submodule ".vim/bundle/vimux"]
|
||||||
|
path = vim/.vim/bundle/vimux
|
||||||
|
url = git://github.com/benmills/vimux.git
|
||||||
|
[submodule ".vim/bundle/vim-surround"]
|
||||||
|
path = vim/.vim/bundle/vim-surround
|
||||||
|
url = git://github.com/tpope/vim-surround.git
|
||||||
|
[submodule ".vim/bundle/tabular"]
|
||||||
|
path = vim/.vim/bundle/tabular
|
||||||
|
url = git://github.com/godlygeek/tabular.git
|
||||||
|
[submodule ".vim/bundle/vim-ruby"]
|
||||||
|
path = vim/.vim/bundle/vim-ruby
|
||||||
|
url = git://github.com/vim-ruby/vim-ruby.git
|
||||||
|
[submodule ".vim/bundle/vim-fugitive"]
|
||||||
|
path = vim/.vim/bundle/vim-fugitive
|
||||||
|
url = git://github.com/tpope/vim-fugitive.git
|
||||||
|
[submodule ".vim/bundle/vim-coffee-script"]
|
||||||
|
path = vim/.vim/bundle/vim-coffee-script
|
||||||
|
url = git://github.com/kchmck/vim-coffee-script.git
|
||||||
|
[submodule ".vim/bundle/vim-haml"]
|
||||||
|
path = vim/.vim/bundle/vim-haml
|
||||||
|
url = git://github.com/tpope/vim-haml.git
|
||||||
|
[submodule ".vim/bundle/bufkill"]
|
||||||
|
path = vim/.vim/bundle/bufkill
|
||||||
|
url = git://github.com/vim-scripts/bufkill.vim.git
|
||||||
|
[submodule ".vim/bundle/vim-easymotion"]
|
||||||
|
path = vim/.vim/bundle/vim-easymotion
|
||||||
|
url = git://github.com/Lokaltog/vim-easymotion.git
|
||||||
|
[submodule ".vim/bundle/vim-seek"]
|
||||||
|
path = vim/.vim/bundle/vim-seek
|
||||||
|
url = git://github.com/goldfeld/vim-seek.git
|
||||||
|
[submodule ".vim/bundle/gundo"]
|
||||||
|
path = vim/.vim/bundle/gundo
|
||||||
|
url = git://github.com/sjl/gundo.vim.git
|
||||||
|
[submodule ".vim/bundle/vim-dispatch"]
|
||||||
|
path = vim/.vim/bundle/vim-dispatch
|
||||||
|
url = git://github.com/tpope/vim-dispatch.git
|
||||||
|
[submodule ".vim/bundle/tagbar"]
|
||||||
|
path = vim/.vim/bundle/tagbar
|
||||||
|
url = git://github.com/majutsushi/tagbar.git
|
||||||
|
[submodule ".vim/bundle/ctrlp"]
|
||||||
|
path = vim/.vim/bundle/ctrlp
|
||||||
|
url = git@github.com:kien/ctrlp.vim.git
|
||||||
|
[submodule ".vim/bundle/sensible"]
|
||||||
|
path = vim/.vim/bundle/sensible
|
||||||
|
url = git@github.com:tpope/vim-sensible.git
|
||||||
|
[submodule ".vim/bundle/base16"]
|
||||||
|
path = vim/.vim/bundle/base16
|
||||||
|
url = git://github.com/chriskempson/base16-vim.git
|
||||||
|
[submodule "vim/.vim/bundle/fakeclip"]
|
||||||
|
path = vim/.vim/bundle/fakeclip
|
||||||
|
url = https://github.com/kana/vim-fakeclip
|
||||||
|
[submodule "vim/.vim/bundle/ag"]
|
||||||
|
path = vim/.vim/bundle/ag
|
||||||
|
url = git@github.com:rking/ag.vim.git
|
||||||
|
[submodule "vim/.vim/bundle/vimwiki"]
|
||||||
|
path = vim/.vim/bundle/vimwiki
|
||||||
|
url = https://github.com/vimwiki/vimwiki
|
||||||
|
[submodule "vim/.vim/bundle/vinegar"]
|
||||||
|
path = vim/.vim/bundle/vinegar
|
||||||
|
url = git://github.com/tpope/vim-vinegar.git
|
||||||
|
[submodule "vim/.vim/bundle/go"]
|
||||||
|
path = vim/.vim/bundle/go
|
||||||
|
url = https://github.com/fatih/vim-go.git
|
||||||
|
[submodule "vim/.vim/bundle/vim-tmux-navigator"]
|
||||||
|
path = vim/.vim/bundle/vim-tmux-navigator
|
||||||
|
url = git@github.com:christoomey/vim-tmux-navigator.git
|
@ -1,3 +1,3 @@
|
|||||||
[defaults]
|
[defaults]
|
||||||
hostfile = my.hosts
|
hostfile = hosts
|
||||||
# ask_sudo_pass = True
|
# ask_sudo_pass = True
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
tComment.vba: call delete('C:\Users\alphach\vimfiles/doc/tComment.txt')|call delete('C:\Users\alphach\vimfiles/plugin/tComment.vim')|call delete('C:\Users\alphach\vimfiles/autoload/tcomment.vim')
|
@ -0,0 +1,6 @@
|
|||||||
|
let g:netrw_dirhistmax =10
|
||||||
|
let g:netrw_dirhist_cnt =4
|
||||||
|
let g:netrw_dirhist_1='/Users/alpha/Dropbox/conf_dir/Alfred 2/Alfred.alfredpreferences/workflows'
|
||||||
|
let g:netrw_dirhist_2='/Users/alpha/src/sm/sm-cap/.bundle/gems/chef-api-0.2.1'
|
||||||
|
let g:netrw_dirhist_3='/Users/alpha/Dropbox/src/github.com/kejadlen/dotfiles/ansible'
|
||||||
|
let g:netrw_dirhist_4='/Users/alpha/src/sm/sd-worker'
|
@ -0,0 +1,4 @@
|
|||||||
|
setlocal tabstop=4
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
setlocal noexpandtab
|
@ -0,0 +1 @@
|
|||||||
|
setlocal noexpandtab
|
@ -0,0 +1,8 @@
|
|||||||
|
setlocal tabstop=4
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
setlocal noexpandtab
|
||||||
|
setlocal commentstring=//\ %s
|
||||||
|
setlocal foldmethod=syntax
|
||||||
|
compiler go
|
||||||
|
let b:dispatch="go test -v"
|
@ -0,0 +1,4 @@
|
|||||||
|
setlocal tabstop=4
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
setlocal noexpandtab
|
@ -0,0 +1,4 @@
|
|||||||
|
setlocal tabstop=4
|
||||||
|
setlocal softtabstop=4
|
||||||
|
setlocal shiftwidth=4
|
||||||
|
" setlocal nosmartindent
|
@ -0,0 +1,2 @@
|
|||||||
|
setlocal foldmethod=syntax
|
||||||
|
setlocal foldlevelstart=5
|
@ -0,0 +1 @@
|
|||||||
|
setlocal noexpandtab
|
@ -0,0 +1 @@
|
|||||||
|
nmap <leader><space> <Plug>VimwikiToggleListItem
|
@ -0,0 +1,328 @@
|
|||||||
|
" 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:
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 369c617c23d7683e936eef25250ec77ab3dc8a9b
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit f3fbe427f7b4ec436416a5816d714dc917dc530b
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c0ad852dd453e4e9ac63cf7de89aae0c83f317a7
|
@ -0,0 +1,24 @@
|
|||||||
|
bufexplorer bufexplorer.txt /*bufexplorer*
|
||||||
|
bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog*
|
||||||
|
bufexplorer-credits bufexplorer.txt /*bufexplorer-credits*
|
||||||
|
bufexplorer-customization bufexplorer.txt /*bufexplorer-customization*
|
||||||
|
bufexplorer-installation bufexplorer.txt /*bufexplorer-installation*
|
||||||
|
bufexplorer-todo bufexplorer.txt /*bufexplorer-todo*
|
||||||
|
bufexplorer-usage bufexplorer.txt /*bufexplorer-usage*
|
||||||
|
bufexplorer-windowlayout bufexplorer.txt /*bufexplorer-windowlayout*
|
||||||
|
bufexplorer.txt bufexplorer.txt /*bufexplorer.txt*
|
||||||
|
buffer-explorer bufexplorer.txt /*buffer-explorer*
|
||||||
|
g:bufExplorerChgWin bufexplorer.txt /*g:bufExplorerChgWin*
|
||||||
|
g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp*
|
||||||
|
g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp*
|
||||||
|
g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive*
|
||||||
|
g:bufExplorerFuncRef bufexplorer.txt /*g:bufExplorerFuncRef*
|
||||||
|
g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort*
|
||||||
|
g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories*
|
||||||
|
g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath*
|
||||||
|
g:bufExplorerShowTabBuffer bufexplorer.txt /*g:bufExplorerShowTabBuffer*
|
||||||
|
g:bufExplorerShowUnlisted bufexplorer.txt /*g:bufExplorerShowUnlisted*
|
||||||
|
g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy*
|
||||||
|
g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow*
|
||||||
|
g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName*
|
||||||
|
g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight*
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 1beec8127b6b03ea931b8e9e973b65bb1e2d7cb0
|
@ -0,0 +1 @@
|
|||||||
|
camelcasemotion.vba: call delete('/Users/alpha/.vim/bundle/camelcasemotion//autoload/camelcasemotion.vim')|call delete('/Users/alpha/.vim/bundle/camelcasemotion//plugin/camelcasemotion.vim')|call delete('/Users/alpha/.vim/bundle/camelcasemotion//doc/camelcasemotion.txt')
|
@ -0,0 +1,173 @@
|
|||||||
|
" camelcasemotion.vim: Motion through CamelCaseWords and underscore_notation.
|
||||||
|
"
|
||||||
|
" DEPENDENCIES:
|
||||||
|
" - Requires Vim 7.0 or higher.
|
||||||
|
"
|
||||||
|
" Copyright: (C) 2007-2009 by Ingo Karkat
|
||||||
|
" The VIM LICENSE applies to this script; see ':help copyright'.
|
||||||
|
"
|
||||||
|
" Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||||
|
" REVISION DATE REMARKS
|
||||||
|
" 1.50.001 05-May-2009 Do not create mappings for select mode;
|
||||||
|
" according to|Select-mode|, printable character
|
||||||
|
" commands should delete the selection and insert
|
||||||
|
" the typed characters.
|
||||||
|
" Moved functions from plugin to separate autoload
|
||||||
|
" script.
|
||||||
|
" file creation
|
||||||
|
|
||||||
|
"- functions ------------------------------------------------------------------"
|
||||||
|
function! s:Move( direction, count, mode )
|
||||||
|
" Note: There is no inversion of the regular expression character class
|
||||||
|
" 'keyword character' (\k). We need an inversion "non-keyword" defined as
|
||||||
|
" "any non-whitespace character that is not a keyword character" (e.g.
|
||||||
|
" [!@#$%^&*()]). This can be specified via a non-whitespace character in
|
||||||
|
" whose place no keyword character matches (\k\@!\S).
|
||||||
|
|
||||||
|
"echo "count is " . a:count
|
||||||
|
let l:i = 0
|
||||||
|
while l:i < a:count
|
||||||
|
if a:direction == 'e'
|
||||||
|
" "Forward to end" motion.
|
||||||
|
"call search( '\>\|\(\a\|\d\)\+\ze_', 'We' )
|
||||||
|
" end of ...
|
||||||
|
" number | ACRONYM followed by CamelCase or number | CamelCase | underscore_notation | non-keyword | word
|
||||||
|
call search( '\d\+\|\u\+\ze\%(\u\l\|\d\)\|\u\l\+\|\%(\a\|\d\)\+\ze_\|\%(\k\@!\S\)\+\|\%(_\@!\k\)\+\>', 'We' )
|
||||||
|
" Note: word must be defined as '\k\>'; '\>' on its own somehow
|
||||||
|
" dominates over the previous branch. Plus, \k must exclude the
|
||||||
|
" underscore, or a trailing one will be incorrectly moved over:
|
||||||
|
" '\%(_\@!\k\)'.
|
||||||
|
if a:mode == 'o'
|
||||||
|
" Note: Special additional treatment for operator-pending mode
|
||||||
|
" "forward to end" motion.
|
||||||
|
" The difference between normal mode, operator-pending and visual
|
||||||
|
" mode is that in the latter two, the motion must go _past_ the
|
||||||
|
" final "word" character, so that all characters of the "word" are
|
||||||
|
" selected. This is done by appending a 'l' motion after the
|
||||||
|
" search for the next "word".
|
||||||
|
"
|
||||||
|
" In operator-pending mode, the 'l' motion only works properly
|
||||||
|
" at the end of the line (i.e. when the moved-over "word" is at
|
||||||
|
" the end of the line) when the 'l' motion is allowed to move
|
||||||
|
" over to the next line. Thus, the 'l' motion is added
|
||||||
|
" temporarily to the global 'whichwrap' setting.
|
||||||
|
" Without this, the motion would leave out the last character in
|
||||||
|
" the line. I've also experimented with temporarily setting
|
||||||
|
" "set virtualedit=onemore" , but that didn't work.
|
||||||
|
let l:save_ww = &whichwrap
|
||||||
|
set whichwrap+=l
|
||||||
|
normal! l
|
||||||
|
let &whichwrap = l:save_ww
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
" Forward (a:direction == '') and backward (a:direction == 'b')
|
||||||
|
" motion.
|
||||||
|
|
||||||
|
let l:direction = (a:direction == 'w' ? '' : a:direction)
|
||||||
|
|
||||||
|
" CamelCase: Jump to beginning of either (start of word, Word, WORD,
|
||||||
|
" 123).
|
||||||
|
" Underscore_notation: Jump to the beginning of an underscore-separated
|
||||||
|
" word or number.
|
||||||
|
"call search( '\<\|\u', 'W' . l:direction )
|
||||||
|
"call search( '\<\|\u\(\l\+\|\u\+\ze\u\)\|\d\+', 'W' . l:direction )
|
||||||
|
"call search( '\<\|\u\(\l\+\|\u\+\ze\u\)\|\d\+\|_\zs\(\a\|\d\)\+', 'W' . l:direction )
|
||||||
|
" beginning of ...
|
||||||
|
" word | empty line | non-keyword after whitespaces | non-whitespace after word | number | ACRONYM followed by CamelCase or number | CamelCase | underscore followed by ACRONYM, Camel, lowercase or number
|
||||||
|
call search( '\<\D\|^$\|\%(^\|\s\)\+\zs\k\@!\S\|\>\S\|\d\+\|\u\+\ze\%(\u\l\|\d\)\|\u\l\+\|_\zs\%(\u\+\|\u\l\+\|\l\+\|\d\+\)', 'W' . l:direction )
|
||||||
|
" Note: word must be defined as '\<\D' to avoid that a word like
|
||||||
|
" 1234Test is moved over as [1][2]34[T]est instead of [1]234[T]est
|
||||||
|
" because \< matches with zero width, and \d\+ will then start
|
||||||
|
" matching '234'. To fix that, we make \d\+ be solely responsible
|
||||||
|
" for numbers by taken this away from \< via \<\D. (An alternative
|
||||||
|
" would be to replace \d\+ with \D\%#\zs\d\+, but that one is more
|
||||||
|
" complex.) All other branches are not affected, because they match
|
||||||
|
" multiple characters and not the same character multiple times.
|
||||||
|
endif
|
||||||
|
let l:i = l:i + 1
|
||||||
|
endwhile
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! camelcasemotion#Motion( direction, count, mode )
|
||||||
|
"*******************************************************************************
|
||||||
|
"* PURPOSE:
|
||||||
|
" Perform the motion over CamelCaseWords or underscore_notation.
|
||||||
|
"* ASSUMPTIONS / PRECONDITIONS:
|
||||||
|
" none
|
||||||
|
"* EFFECTS / POSTCONDITIONS:
|
||||||
|
" Move cursor / change selection.
|
||||||
|
"* INPUTS:
|
||||||
|
" a:direction one of 'w', 'b', 'e'
|
||||||
|
" a:count number of "words" to move over
|
||||||
|
" a:mode one of 'n', 'o', 'v', 'iv' (latter one is a special visual mode
|
||||||
|
" when inside the inner "word" text objects.
|
||||||
|
"* RETURN VALUES:
|
||||||
|
" none
|
||||||
|
"*******************************************************************************
|
||||||
|
" Visual mode needs special preparations and postprocessing;
|
||||||
|
" normal and operator-pending mode breeze through to s:Move().
|
||||||
|
|
||||||
|
if a:mode == 'v'
|
||||||
|
" Visual mode was left when calling this function. Reselecting the current
|
||||||
|
" selection returns to visual mode and allows to call search() and issue
|
||||||
|
" normal mode motions while staying in visual mode.
|
||||||
|
normal! gv
|
||||||
|
endif
|
||||||
|
if a:mode == 'v' || a:mode == 'iv'
|
||||||
|
|
||||||
|
" Note_1a:
|
||||||
|
if &selection != 'exclusive' && a:direction == 'w'
|
||||||
|
normal! l
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
call s:Move( a:direction, a:count, a:mode )
|
||||||
|
|
||||||
|
if a:mode == 'v' || a:mode == 'iv'
|
||||||
|
" Note: 'selection' setting.
|
||||||
|
if &selection == 'exclusive' && a:direction == 'e'
|
||||||
|
" When set to 'exclusive', the "forward to end" motion (',e') does not
|
||||||
|
" include the last character of the moved-over "word". To include that, an
|
||||||
|
" additional 'l' motion is appended to the motion; similar to the
|
||||||
|
" special treatment in operator-pending mode.
|
||||||
|
normal! l
|
||||||
|
elseif &selection != 'exclusive' && a:direction != 'e'
|
||||||
|
" Note_1b:
|
||||||
|
" The forward and backward motions move to the beginning of the next "word".
|
||||||
|
" When 'selection' is set to 'inclusive' or 'old', this is one character too far.
|
||||||
|
" The appended 'h' motion undoes this. Because of this backward step,
|
||||||
|
" though, the forward motion finds the current "word" again, and would
|
||||||
|
" be stuck on the current "word". An 'l' motion before the CamelCase
|
||||||
|
" motion (see Note_1a) fixes that.
|
||||||
|
normal! h
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! camelcasemotion#InnerMotion( direction, count )
|
||||||
|
" If the cursor is positioned on the first character of a CamelWord, the
|
||||||
|
" backward motion would move to the previous word, which would result in a
|
||||||
|
" wrong selection. To fix this, first move the cursor to the right, so that
|
||||||
|
" the backward motion definitely will cover the current "word" under the
|
||||||
|
" cursor.
|
||||||
|
normal! l
|
||||||
|
|
||||||
|
" Move "word" backwards, enter visual mode, then move "word" forward. This
|
||||||
|
" selects the inner "word" in visual mode; the operator-pending mode takes
|
||||||
|
" this selection as the area covered by the motion.
|
||||||
|
if a:direction == 'b'
|
||||||
|
" Do not do the selection backwards, because the backwards "word" motion
|
||||||
|
" in visual mode + selection=inclusive has an off-by-one error.
|
||||||
|
call camelcasemotion#Motion( 'b', a:count, 'n' )
|
||||||
|
normal! v
|
||||||
|
" We decree that 'b' is the opposite of 'e', not 'w'. This makes more
|
||||||
|
" sense at the end of a line and for underscore_notation.
|
||||||
|
call camelcasemotion#Motion( 'e', a:count, 'iv' )
|
||||||
|
else
|
||||||
|
call camelcasemotion#Motion( 'b', 1, 'n' )
|
||||||
|
normal! v
|
||||||
|
call camelcasemotion#Motion( a:direction, a:count, 'iv' )
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim: set sts=4 sw=4 noexpandtab ff=unix fdm=syntax :
|
@ -0,0 +1,183 @@
|
|||||||
|
*camelcasemotion.txt* Motion through CamelCaseWords and underscore_notation.
|
||||||
|
|
||||||
|
CAMEL CASE MOTION by Ingo Karkat
|
||||||
|
*camelcasemotion.vim*
|
||||||
|
description |camelcasemotion-description|
|
||||||
|
usage |camelcasemotion-usage|
|
||||||
|
installation |camelcasemotion-installation|
|
||||||
|
configuration |camelcasemotion-configuration|
|
||||||
|
known problems |camelcasemotion-known-problems|
|
||||||
|
todo |camelcasemotion-todo|
|
||||||
|
history |camelcasemotion-history|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
DESCRIPTION *camelcasemotion-description*
|
||||||
|
|
||||||
|
Vim provides many built-in motions, e.g. to move to the next word, or end of
|
||||||
|
the current word. Most programming languages use either CamelCase
|
||||||
|
("anIdentifier") or underscore_notation ("an_identifier") naming conventions
|
||||||
|
for identifiers. The best way to navigate inside those identifiers using Vim
|
||||||
|
built-in motions is the [count]f{char} motion, i.e. f{uppercase-char} or f_,
|
||||||
|
respectively. But we can make this easier:
|
||||||
|
|
||||||
|
This script defines motions|,w|,|,b| and|,e|(similar to |w|,|b|,|e|), which do
|
||||||
|
not move word-wise (forward/backward), but Camel-wise; i.e. to word boundaries
|
||||||
|
and uppercase letters. The motions also work on underscore notation, where
|
||||||
|
words are delimited by underscore ('_') characters. From here on, both
|
||||||
|
CamelCase and underscore_notation entities are referred to as "words" (in
|
||||||
|
double quotes). Just like with the regular motions, a [count] can be prepended
|
||||||
|
to move over multiple "words" at once. Outside of "words" (e.g. in non-keyword
|
||||||
|
characters like // or ;), the new motions move just like the regular motions.
|
||||||
|
|
||||||
|
Vim provides a built-in|iw|text object called 'inner word', which works in
|
||||||
|
operator-pending and visual mode. Analog to that, this script defines inner
|
||||||
|
"word" motions |i,w|,|i,b| and|i,e|, which select the "word" (or multiple
|
||||||
|
"words" if a [count] is given) where the cursor is located.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
USAGE *camelcasemotion-usage*
|
||||||
|
*,w* *,b* *,e*
|
||||||
|
Use the new motions|,w|,|,b| and|,e| in normal mode, operator-pending mode
|
||||||
|
(cp.|operator|), and visual mode. For example, type 'bc,w' to change 'Camel'
|
||||||
|
in 'CamelCase' to something else.
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLE: motions
|
||||||
|
Given the following CamelCase identifiers in a source code fragment:
|
||||||
|
set Script31337PathAndNameWithoutExtension11=%~dpn0 ~
|
||||||
|
set Script31337PathANDNameWITHOUTExtension11=%~dpn0 ~
|
||||||
|
and the corresponding identifiers in underscore_notation:
|
||||||
|
set script_31337_path_and_name_without_extension_11=%~dpn0 ~
|
||||||
|
set SCRIPT_31337_PATH_AND_NAME_WITHOUT_EXTENSION_11=%~dpn0 ~
|
||||||
|
|
||||||
|
,w moves to ([x] is cursor position): [s]et, [s]cript, [3]1337, [p]ath,
|
||||||
|
[a]nd, [n]ame, [w]ithout, [e]xtension, [1]1, [d]pn0, dpn[0], [s]et
|
||||||
|
,b moves to: [d]pn0, [1]1, [e]xtension, [w]ithout, ...
|
||||||
|
,e moves to: se[t], scrip[t], 3133[7], pat[h], an[d], nam[e], withou[t],
|
||||||
|
extensio[n], 1[1], dpn[0]
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLE: inner motions
|
||||||
|
Given the following identifier, with the cursor positioned at [x]:
|
||||||
|
script_31337_path_and_na[m]e_without_extension_11 ~
|
||||||
|
|
||||||
|
v3i,w selects script_31337_path_and_[name_without_extension_]11
|
||||||
|
v3i,b selects script_31337_[path_and_name]_without_extension_11
|
||||||
|
v3i,e selects script_31337_path_and_[name_without_extension]_11
|
||||||
|
Instead of visual mode, you can also use c3i,w to change, d3i,w to delete,
|
||||||
|
gU3i,w to upper-case, and so on.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
INSTALLATION *camelcasemotion-installation*
|
||||||
|
|
||||||
|
This script is packaged as a|vimball|. If you have the "gunzip" decompressor
|
||||||
|
in your PATH, simply edit the *.vba.gz package in Vim; otherwise, decompress
|
||||||
|
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
|
||||||
|
vimball or via the|:UseVimball|command. >
|
||||||
|
vim camelcasemotion.vba.gz
|
||||||
|
:so %
|
||||||
|
To uninstall, use the|:RmVimball|command.
|
||||||
|
|
||||||
|
DEPENDENCIES *camelcasemotion-dependencies*
|
||||||
|
|
||||||
|
- Requires Vim 7.0 or higher.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
CONFIGURATION *camelcasemotion-configuration*
|
||||||
|
|
||||||
|
If you want to use different mappings, map your keys to the
|
||||||
|
<Plug>CamelCaseMotion_? mapping targets _before_ sourcing this script (e.g. in
|
||||||
|
your|vimrc|).
|
||||||
|
|
||||||
|
EXAMPLE: Replace the default|w|,|b| and|e| mappings instead of defining
|
||||||
|
additional mappings|,w|,|,b| and|,e|: >
|
||||||
|
map <silent> w <Plug>CamelCaseMotion_w
|
||||||
|
map <silent> b <Plug>CamelCaseMotion_b
|
||||||
|
map <silent> e <Plug>CamelCaseMotion_e
|
||||||
|
sunmap w
|
||||||
|
sunmap b
|
||||||
|
sunmap e
|
||||||
|
|
||||||
|
EXAMPLE: Replace default|iw|text-object and define|ib|and |ie|motions: >
|
||||||
|
omap <silent> iw <Plug>CamelCaseMotion_iw
|
||||||
|
xmap <silent> iw <Plug>CamelCaseMotion_iw
|
||||||
|
omap <silent> ib <Plug>CamelCaseMotion_ib
|
||||||
|
xmap <silent> ib <Plug>CamelCaseMotion_ib
|
||||||
|
omap <silent> ie <Plug>CamelCaseMotion_ie
|
||||||
|
xmap <silent> ie <Plug>CamelCaseMotion_ie
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
KNOWN PROBLEMS *camelcasemotion-known-problems*
|
||||||
|
|
||||||
|
- A degenerate CamelCaseWord containing '\U\u\d' (e.g. "MaP1Roblem") confuses
|
||||||
|
the operator-pending and visual mode ,e mapping if 'selection' is not set to
|
||||||
|
"exclusive". It'll skip "P" and select "P1" in one step. As a workaround,
|
||||||
|
use ',w' instead of ',e'; those two mappings have the same effect inside
|
||||||
|
CamelCaseWords, anyway.
|
||||||
|
- The operator-pending and visual mode ,e mapping doesn't work properly when
|
||||||
|
it reaches the end of the buffer; the final character of the moved-over
|
||||||
|
"word" remains. As a workaround, use the default 'e' motion instead of ',e'.
|
||||||
|
- When the Vim setting 'selection' is not set to "exclusive", a
|
||||||
|
forward-backward combination in visual mode (e.g. 'v,w,b') selects one
|
||||||
|
additional character to the left, instead of only the character where the
|
||||||
|
motion started. Likewise, extension of the visual selection from the front
|
||||||
|
end is off by one additional character.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
TODO *camelcasemotion-todo*
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
HISTORY *camelcasemotion-history*
|
||||||
|
|
||||||
|
1.50 05-May-2009
|
||||||
|
- Do not create mappings for select mode; according to|Select-mode|, printable
|
||||||
|
character commands should delete the selection and insert the typed
|
||||||
|
characters. Now using :xmap to only target visual mode.
|
||||||
|
- Moved functions from plugin to separate autoload script.
|
||||||
|
- Split off documentation into separate help file.
|
||||||
|
|
||||||
|
1.40 30-Jun-2008
|
||||||
|
BF: Now using :normal! to be independent from any user mappings. Thanks to
|
||||||
|
Neil Walker for the patch.
|
||||||
|
|
||||||
|
1.40 19-May-2008
|
||||||
|
BF: Wrong forward motion stop at the second digit if a word starts with
|
||||||
|
multiple numbers (e.g. 1234.56789). Thanks to Wasim Ahmed for reporting this.
|
||||||
|
|
||||||
|
1.40 24-Apr-2008
|
||||||
|
ENH: Added inner "word" text objects 'i,w' etc. that work analoguous to the
|
||||||
|
built-in |iw| text object. Thanks to David Kotchan for this suggestion.
|
||||||
|
|
||||||
|
1.30 20-Apr-2008
|
||||||
|
The motions now also stop at non-keyword boundaries, just like the regular
|
||||||
|
motions. This has no effect inside a CamelCaseWord or inside
|
||||||
|
underscore_notation, but it makes the motions behave like the regular motions
|
||||||
|
(which is important if you replace the default motions). Thanks to Mun Johl
|
||||||
|
for reporting this.
|
||||||
|
|
||||||
|
1.30 09-Apr-2008
|
||||||
|
- Allowing users to use mappings different than ,w ,b ,e by defining
|
||||||
|
<Plug>CamelCaseMotion_? target mappings. This can even be used to replace
|
||||||
|
the default 'w', 'b' and 'e' mappings, as suggested by Mun Johl.
|
||||||
|
- Now requires VIM 7.0 or higher.
|
||||||
|
|
||||||
|
1.20 29-May-2007
|
||||||
|
ENH: The visual mode motions now also (mostly) work with the (default) setting
|
||||||
|
'set selection=inclusive', instead of selecting one character too much.
|
||||||
|
|
||||||
|
1.10 28-May-2007
|
||||||
|
Incorporated major improvements and simplifications done by Joseph Barker.
|
||||||
|
|
||||||
|
1.00 22-May-2007
|
||||||
|
First published version.
|
||||||
|
|
||||||
|
0.01 11-Oct-2005
|
||||||
|
Started development based on vimtip #1016 by Anthony Van Ham.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
Copyright: (C) 2007-2009 by Ingo Karkat
|
||||||
|
The VIM LICENSE applies to this script; see|copyright|.
|
||||||
|
|
||||||
|
Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||||
|
==============================================================================
|
||||||
|
vim:tw=78:ts=8:ft=help:norl:
|
@ -0,0 +1,13 @@
|
|||||||
|
,b camelcasemotion.txt /*,b*
|
||||||
|
,e camelcasemotion.txt /*,e*
|
||||||
|
,w camelcasemotion.txt /*,w*
|
||||||
|
camelcasemotion-configuration camelcasemotion.txt /*camelcasemotion-configuration*
|
||||||
|
camelcasemotion-dependencies camelcasemotion.txt /*camelcasemotion-dependencies*
|
||||||
|
camelcasemotion-description camelcasemotion.txt /*camelcasemotion-description*
|
||||||
|
camelcasemotion-history camelcasemotion.txt /*camelcasemotion-history*
|
||||||
|
camelcasemotion-installation camelcasemotion.txt /*camelcasemotion-installation*
|
||||||
|
camelcasemotion-known-problems camelcasemotion.txt /*camelcasemotion-known-problems*
|
||||||
|
camelcasemotion-todo camelcasemotion.txt /*camelcasemotion-todo*
|
||||||
|
camelcasemotion-usage camelcasemotion.txt /*camelcasemotion-usage*
|
||||||
|
camelcasemotion.txt camelcasemotion.txt /*camelcasemotion.txt*
|
||||||
|
camelcasemotion.vim camelcasemotion.txt /*camelcasemotion.vim*
|
@ -0,0 +1,204 @@
|
|||||||
|
" camelcasemotion.vim: Motion through CamelCaseWords and underscore_notation.
|
||||||
|
"
|
||||||
|
" DEPENDENCIES:
|
||||||
|
" - Requires Vim 7.0 or higher.
|
||||||
|
"
|
||||||
|
" Copyright: (C) 2007-2009 by Ingo Karkat
|
||||||
|
" The VIM LICENSE applies to this script; see ':help copyright'.
|
||||||
|
"
|
||||||
|
" Source: Based on vimtip #1016 by Anthony Van Ham.
|
||||||
|
" Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||||
|
" REVISION DATE REMARKS
|
||||||
|
" 1.50.019 05-May-2009 Do not create mappings for select mode;
|
||||||
|
" according to|Select-mode|, printable character
|
||||||
|
" commands should delete the selection and insert
|
||||||
|
" the typed characters.
|
||||||
|
" Moved functions from plugin to separate autoload
|
||||||
|
" script.
|
||||||
|
" Split off documentation into separate help file.
|
||||||
|
" Now cleaning up Create...Mappings functions.
|
||||||
|
" 1.40.018 30-Jun-2008 Minor: Removed unnecessary <script> from
|
||||||
|
" mappings.
|
||||||
|
" 1.40.017 19-May-2008 BF: Now using :normal! to be independent from
|
||||||
|
" any user mappings. Thanks to Neil Walker for the
|
||||||
|
" patch.
|
||||||
|
" 1.40.016 28-Apr-2008 BF: Wrong forward motion stop at the second
|
||||||
|
" digit if a word starts with multiple numbers
|
||||||
|
" (e.g. 1234.56789). Thanks to Wasim Ahmed for
|
||||||
|
" reporting this.
|
||||||
|
" 1.40.015 24-Apr-2008 ENH: Added inner "word" text objects 'i,w' etc.
|
||||||
|
" that work analogous to the built-in 'iw' text
|
||||||
|
" object. Thanks to David Kotchan for this
|
||||||
|
" suggestion.
|
||||||
|
" 1.30.014 20-Apr-2008 The motions now also stop at non-keyword
|
||||||
|
" boundaries, just like the regular motions. This
|
||||||
|
" has no effect inside a CamelCaseWord or inside
|
||||||
|
" underscore_notation, but it makes the motions
|
||||||
|
" behave like the regular motions (which is
|
||||||
|
" important if you replace the default motions).
|
||||||
|
" Thanks to Mun Johl for reporting this.
|
||||||
|
" Now using non-capturing parentheses \%() in the
|
||||||
|
" patterns.
|
||||||
|
" 1.30.013 09-Apr-2008 Refactored away s:VisualCamelCaseMotion().
|
||||||
|
" Allowing users to use mappings different than
|
||||||
|
" ,w ,b ,e by defining <Plug>CamelCaseMotion_?
|
||||||
|
" target mappings. This can even be used to
|
||||||
|
" replace the default 'w', 'b' and 'e' mappings,
|
||||||
|
" as suggested by Mun Johl.
|
||||||
|
" Mappings are now created in a generic function.
|
||||||
|
" Now requires Vim 7.0 or higher.
|
||||||
|
" 1.20.012 02-Jun-2007 BF: Corrected motions through mixed
|
||||||
|
" CamelCase_and_UnderScore words by re-ordering
|
||||||
|
" and narrowing the search patterns.
|
||||||
|
" 1.20.011 02-Jun-2007 Thanks again to Joseph Barker for discussing the
|
||||||
|
" complicated visual mode mapping on the vim-dev
|
||||||
|
" mailing list and coming up with a great
|
||||||
|
" simplification:
|
||||||
|
" Removed s:CheckForChangesToTheSelectionSetting().
|
||||||
|
" Introduced s:VisualCamelCaseMotion(), which
|
||||||
|
" handles the differences depending on the
|
||||||
|
" 'selection' setting.
|
||||||
|
" Visual mode mappings now directly map to the
|
||||||
|
" s:VisualCamelCaseMotion() function; no mark is
|
||||||
|
" clobbered, the complex mapping with the inline
|
||||||
|
" expression has been retired.
|
||||||
|
" 1.20.010 29-May-2007 BF: The operator-pending and visual mode ,e
|
||||||
|
" mapping doesn't work properly when it reaches
|
||||||
|
" the end of line; the final character of the
|
||||||
|
" moved-over "word" remains. Fixed this problem
|
||||||
|
" unless the "word" is at the very end of the
|
||||||
|
" buffer.
|
||||||
|
" ENH: The visual mode motions now also (mostly)
|
||||||
|
" work with the (default) setting
|
||||||
|
" 'set selection=inclusive', instead of selecting
|
||||||
|
" one character too much.
|
||||||
|
" ENH: All mappings will check for changes to the
|
||||||
|
" 'selection' setting and remap the visual mode
|
||||||
|
" mappings via function
|
||||||
|
" s:SetupVisualModeMappings(). We cannot rely on
|
||||||
|
" the setting while sourcing camelcasemotion.vim
|
||||||
|
" because the mswin.vim script may be sourced
|
||||||
|
" afterwards, and its 'behave mswin' changes
|
||||||
|
" 'selection'.
|
||||||
|
" Refactored the arguments of function
|
||||||
|
" s:CamelCaseMotion(...).
|
||||||
|
" 1.10.009 28-May-2007 BF: Degenerate CamelCaseWords that consist of
|
||||||
|
" only a single uppercase letter (e.g. "P" in
|
||||||
|
" "MapPRoblem") are skipped by all motions. Thanks
|
||||||
|
" to Joseph Barker for reporting this.
|
||||||
|
" BF: In CamelCaseWords that consist of uppercase
|
||||||
|
" letters followed by decimals (e.g.
|
||||||
|
" "MyUPPER123Problem", the uppercase "word" is
|
||||||
|
" skipped by all motions.
|
||||||
|
" 1.10.008 28-May-2007 Incorporated major improvements and
|
||||||
|
" simplifications done by Joseph Barker:
|
||||||
|
" Operator-pending and visual mode motions now
|
||||||
|
" accept [count] of more than 9.
|
||||||
|
" Visual selections can now be extended from
|
||||||
|
" either end.
|
||||||
|
" Instead of misusing the :[range], the special
|
||||||
|
" variable v:count1 is used. Custom commands are
|
||||||
|
" not needed anymore.
|
||||||
|
" Operator-pending and visual mode mappings are
|
||||||
|
" now generic: There's only a single mapping for
|
||||||
|
" ,w that can be repeated, rather than having a
|
||||||
|
" separate mapping for 1,w 2,w 3,w ...
|
||||||
|
" 1.00.007 22-May-2007 Added documentation for publication.
|
||||||
|
" 006 20-May-2007 BF: visual mode [1,2,3],e on pure CamelCase
|
||||||
|
" mistakenly marks [2,4,6] words. If the cursor is
|
||||||
|
" on a uppercase letter, the search pattern
|
||||||
|
" '\u\l\+' doesn't match at the cursor position,
|
||||||
|
" so another match won. Changed search pattern
|
||||||
|
" from '\l\+',
|
||||||
|
" 005 16-May-2007 Added support for underscore notation.
|
||||||
|
" Added support for "forward to end of word"
|
||||||
|
" (',e') motion.
|
||||||
|
" 004 16-May-2007 Improved search pattern so that
|
||||||
|
" UppercaseWORDSInBetween and digits are handled,
|
||||||
|
" too.
|
||||||
|
" 003 15-May-2007 Changed mappings from <Leader>w to ,w;
|
||||||
|
" other \w mappings interfere here, because it's
|
||||||
|
" irritating when the cursor jump doesn't happen
|
||||||
|
" immediately, because Vim waits whether the
|
||||||
|
" mapping is complete. ,w is faster to type that
|
||||||
|
" \w (and, because of the left-right touch,
|
||||||
|
" preferred over gw).
|
||||||
|
" Added visual mode mappings.
|
||||||
|
" 0.02 15-Feb-2006 BF: missing <SID> for omaps.
|
||||||
|
" 0.01 11-Oct-2005 file creation
|
||||||
|
|
||||||
|
" Avoid installing twice or when in compatible mode
|
||||||
|
if exists('g:loaded_camelcasemotion') || (v:version < 700)
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:loaded_camelcasemotion = 1
|
||||||
|
|
||||||
|
"- mappings -------------------------------------------------------------------
|
||||||
|
" The count is passed into the function through the special variable 'v:count1',
|
||||||
|
" which is easier than misusing the :[range] that :call supports.
|
||||||
|
" <C-U> is used to delete the unused range.
|
||||||
|
" Another option would be to use a custom 'command! -count=1', but that doesn't
|
||||||
|
" work with the normal mode mapping: When a count is typed before the mapping,
|
||||||
|
" the ':' will convert a count of 3 into ':.,+2MyCommand', but ':3MyCommand'
|
||||||
|
" would be required to use -count and <count>.
|
||||||
|
"
|
||||||
|
" We do not provide the fourth "backward to end" motion (,E), because it is
|
||||||
|
" seldomly used.
|
||||||
|
|
||||||
|
function! s:CreateMotionMappings()
|
||||||
|
" Create mappings according to this template:
|
||||||
|
" (* stands for the mode [nov], ? for the underlying motion [wbe].)
|
||||||
|
"
|
||||||
|
" *noremap <Plug>CamelCaseMotion_? :<C-U>call camelcasemotion#Motion('?',v:count1,'*')<CR>
|
||||||
|
" if ! hasmapto('<Plug>CamelCaseMotion_?', '*')
|
||||||
|
" *map <silent> ,? <Plug>CamelCaseMotion_?
|
||||||
|
" endif
|
||||||
|
|
||||||
|
for l:mode in ['n', 'o', 'v']
|
||||||
|
for l:motion in ['w', 'b', 'e']
|
||||||
|
let l:targetMapping = '<Plug>CamelCaseMotion_' . l:motion
|
||||||
|
execute l:mode . 'noremap ' . l:targetMapping . ' :<C-U>call camelcasemotion#Motion(''' . l:motion . ''',v:count1,''' . l:mode . ''')<CR>'
|
||||||
|
if ! hasmapto(l:targetMapping, l:mode)
|
||||||
|
execute (l:mode ==# 'v' ? 'x' : l:mode) . 'map <silent> ,' . l:motion . ' ' . l:targetMapping
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" To create a text motion, a mapping for operator-pending mode needs to be
|
||||||
|
" defined. This mapping should move the cursor according to the implemented
|
||||||
|
" motion, or mark the covered text via a visual selection. As inner text motions
|
||||||
|
" need to mark both to the left and right of the cursor position, the visual
|
||||||
|
" selection needs to be used.
|
||||||
|
"
|
||||||
|
" Vim's built-in inner text objects also work in visual mode; they have
|
||||||
|
" different behavior depending on whether visual mode has just been entered or
|
||||||
|
" whether text has already been selected.
|
||||||
|
" We deviate from that and always override the existing selection.
|
||||||
|
function! s:CreateInnerMotionMappings()
|
||||||
|
" Create mappings according to this template:
|
||||||
|
" (* stands for the mode [ov], ? for the underlying motion [wbe].)
|
||||||
|
"
|
||||||
|
" *noremap <Plug>CamelCaseMotion_i? :<C-U>call camelcasemotion#InnerMotion('?',v:count1)<CR>
|
||||||
|
" if ! hasmapto('<Plug>CamelCaseInnerMotion_i?', '*')
|
||||||
|
" *map <silent> i,? <Plug>CamelCaseInnerMotion_i?
|
||||||
|
" endif
|
||||||
|
|
||||||
|
for l:mode in ['o', 'v']
|
||||||
|
for l:motion in ['w', 'b', 'e']
|
||||||
|
let l:targetMapping = '<Plug>CamelCaseMotion_i' . l:motion
|
||||||
|
execute l:mode . 'noremap ' . l:targetMapping . ' :<C-U>call camelcasemotion#InnerMotion(''' . l:motion . ''',v:count1)<CR>'
|
||||||
|
if ! hasmapto(l:targetMapping, l:mode)
|
||||||
|
execute (l:mode ==# 'v' ? 'x' : l:mode) . 'map <silent> i,' . l:motion . ' ' . l:targetMapping
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call s:CreateMotionMappings()
|
||||||
|
call s:CreateInnerMotionMappings()
|
||||||
|
|
||||||
|
delfunction s:CreateMotionMappings
|
||||||
|
delfunction s:CreateInnerMotionMappings
|
||||||
|
|
||||||
|
" vim: set sts=4 sw=4 noexpandtab ff=unix fdm=syntax :
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit b5d3fe66a58a13d2ff8b6391f4387608496a030f
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 04da1a1c25faf792d94498084d5b36f8ec752b9e
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 71ed5f7e3a60dc0bbcfe419a4476f72a2004fcd8
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 3367878b12bb7ca998ffceb687c0f27449e588fd
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 3975ac871565115e3769dc69c06bc88ddc1369af
|
@ -0,0 +1,157 @@
|
|||||||
|
# vim:fileencoding=utf-8:noet
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import codecs
|
||||||
|
|
||||||
|
try:
|
||||||
|
import vim
|
||||||
|
except ImportError:
|
||||||
|
vim = {}
|
||||||
|
|
||||||
|
if hasattr(vim, 'bindeval'):
|
||||||
|
def vim_get_func(f, rettype=None):
|
||||||
|
'''Return a vim function binding.'''
|
||||||
|
try:
|
||||||
|
func = vim.bindeval('function("' + f + '")')
|
||||||
|
if sys.version_info >= (3,) and rettype is str:
|
||||||
|
return (lambda *args, **kwargs: func(*args, **kwargs).decode('utf-8', errors='replace'))
|
||||||
|
return func
|
||||||
|
except vim.error:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
import json
|
||||||
|
|
||||||
|
class VimFunc(object):
|
||||||
|
'''Evaluate a vim function using vim.eval().
|
||||||
|
|
||||||
|
This is a fallback class for older vim versions.
|
||||||
|
'''
|
||||||
|
__slots__ = ('f', 'rettype')
|
||||||
|
|
||||||
|
def __init__(self, f, rettype=None):
|
||||||
|
self.f = f
|
||||||
|
self.rettype = rettype
|
||||||
|
|
||||||
|
def __call__(self, *args):
|
||||||
|
r = vim.eval(self.f + '(' + json.dumps(args)[1:-1] + ')')
|
||||||
|
if self.rettype:
|
||||||
|
return self.rettype(r)
|
||||||
|
return r
|
||||||
|
|
||||||
|
vim_get_func = VimFunc
|
||||||
|
|
||||||
|
|
||||||
|
# It may crash on some old vim versions and I do not remember in which patch
|
||||||
|
# I fixed this crash.
|
||||||
|
if hasattr(vim, 'vvars') and vim.vvars['version'] > 703:
|
||||||
|
_vim_to_python_types = {
|
||||||
|
vim.Dictionary: lambda value: dict(((key, _vim_to_python(value[key])) for key in value.keys())),
|
||||||
|
vim.List: lambda value: [_vim_to_python(item) for item in value],
|
||||||
|
vim.Function: lambda _: None,
|
||||||
|
}
|
||||||
|
|
||||||
|
_id = lambda value: value
|
||||||
|
|
||||||
|
def _vim_to_python(value):
|
||||||
|
return _vim_to_python_types.get(type(value), _id)(value)
|
||||||
|
|
||||||
|
def vim_getvar(varname):
|
||||||
|
return _vim_to_python(vim.vars[str(varname)])
|
||||||
|
|
||||||
|
def bufvar_exists(buffer, varname):
|
||||||
|
buffer = buffer or vim.current.buffer
|
||||||
|
return varname in buffer.vars
|
||||||
|
|
||||||
|
def vim_getwinvar(segment_info, varname):
|
||||||
|
return _vim_to_python(segment_info['window'].vars[str(varname)])
|
||||||
|
else:
|
||||||
|
_vim_exists = vim_get_func('exists', rettype=int)
|
||||||
|
|
||||||
|
def vim_getvar(varname): # NOQA
|
||||||
|
varname = 'g:' + varname
|
||||||
|
if _vim_exists(varname):
|
||||||
|
return vim.eval(varname)
|
||||||
|
else:
|
||||||
|
raise KeyError(varname)
|
||||||
|
|
||||||
|
def bufvar_exists(buffer, varname): # NOQA
|
||||||
|
if not buffer or buffer.number == vim.current.buffer.number:
|
||||||
|
return vim.eval('exists("b:{0}")'.format(varname))
|
||||||
|
else:
|
||||||
|
return vim.eval('has_key(getbufvar({0}, ""), {1})'
|
||||||
|
.format(buffer.number, varname))
|
||||||
|
|
||||||
|
def vim_getwinvar(segment_info, varname): # NOQA
|
||||||
|
result = vim.eval('getwinvar({0}, "{1}")'.format(segment_info['winnr'], varname))
|
||||||
|
if result == '':
|
||||||
|
if not int(vim.eval('has_key(getwinvar({0}, ""), "{1}")'.format(segment_info['winnr'], varname))):
|
||||||
|
raise KeyError(varname)
|
||||||
|
return result
|
||||||
|
|
||||||
|
if hasattr(vim, 'options'):
|
||||||
|
def vim_getbufoption(info, option):
|
||||||
|
return info['buffer'].options[str(option)]
|
||||||
|
else:
|
||||||
|
def vim_getbufoption(info, option): # NOQA
|
||||||
|
return getbufvar(info['bufnr'], '&' + option)
|
||||||
|
|
||||||
|
|
||||||
|
if sys.version_info < (3,) or not hasattr(vim, 'bindeval'):
|
||||||
|
getbufvar = vim_get_func('getbufvar')
|
||||||
|
else:
|
||||||
|
_getbufvar = vim_get_func('getbufvar')
|
||||||
|
|
||||||
|
def getbufvar(*args):
|
||||||
|
r = _getbufvar(*args)
|
||||||
|
if type(r) is bytes:
|
||||||
|
return r.decode('utf-8')
|
||||||
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
class VimEnviron(object):
|
||||||
|
@staticmethod
|
||||||
|
def __getitem__(key):
|
||||||
|
return vim.eval('$' + key)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get(key, default=None):
|
||||||
|
return vim.eval('$' + key) or default
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def __setitem__(key, value):
|
||||||
|
return vim.command('let $' + key + '="'
|
||||||
|
+ value.replace('"', '\\"').replace('\\', '\\\\').replace('\n', '\\n').replace('\0', '')
|
||||||
|
+ '"')
|
||||||
|
|
||||||
|
|
||||||
|
if sys.version_info < (3,):
|
||||||
|
def buffer_name(buf):
|
||||||
|
return buf.name
|
||||||
|
else:
|
||||||
|
vim_bufname = vim_get_func('bufname')
|
||||||
|
|
||||||
|
def buffer_name(buf): # NOQA
|
||||||
|
try:
|
||||||
|
name = buf.name
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
return vim_bufname(buf.number)
|
||||||
|
else:
|
||||||
|
return name.encode('utf-8') if name else None
|
||||||
|
|
||||||
|
|
||||||
|
vim_strtrans = vim_get_func('strtrans')
|
||||||
|
|
||||||
|
|
||||||
|
def powerline_vim_strtrans_error(e):
|
||||||
|
if not isinstance(e, UnicodeDecodeError):
|
||||||
|
raise NotImplementedError
|
||||||
|
# Assuming &encoding is utf-8 strtrans should not return anything but ASCII
|
||||||
|
# under current circumstances
|
||||||
|
text = vim_strtrans(e.object[e.start:e.end]).decode()
|
||||||
|
return (text, e.end)
|
||||||
|
|
||||||
|
|
||||||
|
codecs.register_error('powerline_vim_strtrans_error', powerline_vim_strtrans_error)
|
||||||
|
|
||||||
|
|
||||||
|
environ = VimEnviron()
|
Binary file not shown.
@ -0,0 +1,89 @@
|
|||||||
|
if exists('g:powerline_loaded')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:powerline_loaded = 1
|
||||||
|
|
||||||
|
if !has('python') && !has('python3')
|
||||||
|
if !exists('g:powerline_no_python_error')
|
||||||
|
echohl ErrorMsg
|
||||||
|
echomsg 'You need vim compiled with Python 2.6, 2.7 or 3.2 and later support'
|
||||||
|
echomsg 'for Powerline to work. Please consult the documentation for more'
|
||||||
|
echomsg 'details.'
|
||||||
|
echohl None
|
||||||
|
endif
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:pycmd = substitute(get(g:, 'powerline_pycmd', has('python') ? 'py' : 'py3'), '\v^(py)%[thon](3?)$', '\1\2', '')
|
||||||
|
let s:pyeval = get(g:, 'powerline_pyeval', s:pycmd.'eval')
|
||||||
|
|
||||||
|
let s:import_cmd = 'from powerline.vim import setup as powerline_setup'
|
||||||
|
try
|
||||||
|
let s:pystr = "try:\n"
|
||||||
|
let s:pystr .= " ".s:import_cmd."\n"
|
||||||
|
let s:pystr .= "except ImportError:\n"
|
||||||
|
let s:pystr .= " import sys, vim\n"
|
||||||
|
let s:pystr .= " sys.path.append(vim.eval('expand(\"<sfile>:h:h:h:h:h\")'))\n"
|
||||||
|
let s:pystr .= " ".s:import_cmd."\n"
|
||||||
|
execute s:pycmd s:pystr
|
||||||
|
unlet s:pystr
|
||||||
|
let s:launched = 1
|
||||||
|
finally
|
||||||
|
unlet s:import_cmd
|
||||||
|
if !exists('s:launched')
|
||||||
|
echohl ErrorMsg
|
||||||
|
echomsg 'An error occurred while importing powerline package.'
|
||||||
|
echomsg 'This could be caused by invalid sys.path setting,'
|
||||||
|
echomsg 'or by an incompatible Python version (powerline requires'
|
||||||
|
echomsg 'Python 2.6, 2.7 or 3.2 and later to work). Please consult'
|
||||||
|
echomsg 'the troubleshooting section in the documentation for'
|
||||||
|
echomsg 'possible solutions.'
|
||||||
|
echohl None
|
||||||
|
let s:pystr = "def powerline_troubleshoot():\n"
|
||||||
|
let s:pystr .= " import sys\n"
|
||||||
|
let s:pystr .= " if sys.version_info < (2, 6):\n"
|
||||||
|
let s:pystr .= " print('Too old python version: ' + sys.version + ' (first supported is 2.6)')\n"
|
||||||
|
let s:pystr .= " elif sys.version_info[0] == 3 and sys.version_info[1] < 2:\n"
|
||||||
|
let s:pystr .= " print('Too old python 3 version: ' + sys.version + ' (first supported is 3.2)')\n"
|
||||||
|
let s:pystr .= " try:\n"
|
||||||
|
let s:pystr .= " import powerline\n"
|
||||||
|
let s:pystr .= " except ImportError:\n"
|
||||||
|
let s:pystr .= " print('Unable to import powerline, is it installed?')\n"
|
||||||
|
if expand('<sfile>')[:4] isnot# '/usr/'
|
||||||
|
let s:pystr .= " else:\n"
|
||||||
|
let s:pystr .= " import os\n"
|
||||||
|
let s:pystr .= " powerline_dir = os.path.dirname(os.path.realpath(powerline.__file__))\n"
|
||||||
|
let s:pystr .= " this_dir = os.path.dirname(os.path.realpath(vim.eval('expand(\"<sfile>:p\")')))\n"
|
||||||
|
let s:pystr .= " this_dir = os.path.dirname(os.path.dirname(os.path.dirname(this_dir)))\n"
|
||||||
|
let s:pystr .= " if os.path.basename(this_dir) != 'powerline':\n"
|
||||||
|
let s:pystr .= " print('Check your installation:')\n"
|
||||||
|
let s:pystr .= " print('this script is not in powerline[/bindings/vim/plugin] directory,')\n"
|
||||||
|
let s:pystr .= " print('neither it is installed system-wide')\n"
|
||||||
|
let s:pystr .= " this_dir = os.path.dirname(this_dir)\n"
|
||||||
|
let s:pystr .= " real_powerline_dir = os.path.realpath(powerline_dir)\n"
|
||||||
|
let s:pystr .= " real_this_dir = os.path.realpath(this_dir)\n"
|
||||||
|
let s:pystr .= " if real_this_dir != sys.path[-1]:\n"
|
||||||
|
let s:pystr .= " print('Check your installation:')\n"
|
||||||
|
let s:pystr .= " print('this script is symlinked somewhere where powerline is not present.')\n"
|
||||||
|
let s:pystr .= " elif real_powerline_dir != real_this_dir:\n"
|
||||||
|
let s:pystr .= " print('It appears that you have two powerline versions installed:')\n"
|
||||||
|
let s:pystr .= " print('one in ' + real_powerline_dir + ', other in ' + real_this_dir + '.')\n"
|
||||||
|
let s:pystr .= " print('You should remove one of this. Check out troubleshooting section,')\n"
|
||||||
|
let s:pystr .= " print('it contains some information about the alternatives.')\n"
|
||||||
|
endif
|
||||||
|
execute s:pycmd s:pystr
|
||||||
|
unlet s:pystr
|
||||||
|
unlet s:pycmd
|
||||||
|
unlet s:pyeval
|
||||||
|
finish
|
||||||
|
else
|
||||||
|
unlet s:launched
|
||||||
|
endif
|
||||||
|
endtry
|
||||||
|
|
||||||
|
execute s:pycmd 'import vim'
|
||||||
|
execute s:pycmd 'powerline_setup(pyeval=vim.eval("s:pyeval"), pycmd=vim.eval("s:pycmd"))'
|
||||||
|
execute s:pycmd 'del powerline_setup'
|
||||||
|
|
||||||
|
unlet s:pycmd
|
||||||
|
unlet s:pyeval
|
@ -0,0 +1,134 @@
|
|||||||
|
" scratch.vim
|
||||||
|
" Author: Abhilash Koneri (abhilash_koneri at hotmail dot com)
|
||||||
|
" Improved By: Hari Krishna Dara (hari_vim at yahoo dot com)
|
||||||
|
" Last Change: 25-Feb-2004 @ 09:48
|
||||||
|
" Created: 17-Aug-2002
|
||||||
|
" Version: 1.0.0
|
||||||
|
" Download From:
|
||||||
|
" http://www.vim.org/script.php?script_id=389
|
||||||
|
"----------------------------------------------------------------------
|
||||||
|
" This is a simple plugin that creates a scratch buffer for your
|
||||||
|
" vim session and helps to access it when you need it.
|
||||||
|
"
|
||||||
|
" If you like the custom mappings provided in the script - hitting
|
||||||
|
" <F8> should create a new scratch buffer. You can do your scribes
|
||||||
|
" here and if you want to get rid of it, hit <F8> again inside scratch buffer
|
||||||
|
" window. If you want to get back to the scratch buffer repeat <F8>. Use
|
||||||
|
" <Plug>ShowScratchBuffer and <Plug>InsShowScratchBuffer to customize these
|
||||||
|
" mappings.
|
||||||
|
"
|
||||||
|
" If you want to designate a file into which the scratch buffer contents
|
||||||
|
" should automatically be dumped to, when Vim exits, set its path to
|
||||||
|
" g:scratchBackupFile global variable. This file can be accessed just in case
|
||||||
|
" you happen to have some important information in the scratch buffer and quit
|
||||||
|
" Vim (or shutdown the m/c) forgetting to copy it over. The target file is
|
||||||
|
" force overwritten using the :write! command so make sure you set a file name
|
||||||
|
" that can accidentally be used for other purposes (especially when you use
|
||||||
|
" relative paths). I recommend a value of '/tmp/scratch.txt'.
|
||||||
|
" CAUTION: This feature works only when Vim generates VimLeavePre autocommad.
|
||||||
|
"
|
||||||
|
" Custom mappings
|
||||||
|
" ---------------
|
||||||
|
" The ones defined below are not very ergonomic!
|
||||||
|
"----------------------------------------------------------------------
|
||||||
|
"Standard Inteface: <F8> to make a new ScratchBuffer, <F8>-again to hide one
|
||||||
|
|
||||||
|
if exists('loaded_scratch')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let loaded_scratch = 1
|
||||||
|
|
||||||
|
" Make sure line-continuations won't cause any problem. This will be restored
|
||||||
|
" at the end
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
if (! exists("no_plugin_maps") || ! no_plugin_maps) &&
|
||||||
|
\ (! exists("no_scratch_maps") || ! no_scratch_maps)
|
||||||
|
if !hasmapto('<Plug>ShowScratchBuffer',"n")
|
||||||
|
nmap <unique> <silent> <F8> <Plug>ShowScratchBuffer
|
||||||
|
endif
|
||||||
|
if !hasmapto('<Plug>InsShowScratchBuffer',"i")
|
||||||
|
imap <unique> <silent> <F8> <Plug>InsShowScratchBuffer
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" User Overrideable Plugin Interface
|
||||||
|
nmap <script> <silent> <Plug>ShowScratchBuffer
|
||||||
|
\ :silent call <SID>ShowScratchBuffer()<cr>
|
||||||
|
imap <script> <silent> <Plug>InsShowScratchBuffer
|
||||||
|
\ <c-o>:silent call <SID>ShowScratchBuffer()<cr>
|
||||||
|
|
||||||
|
command! -nargs=0 Scratch :call <SID>ShowScratchBuffer()
|
||||||
|
|
||||||
|
if !exists('g:scratchBackupFile')
|
||||||
|
let g:scratchBackupFile = '' " So that users can easily find this var.
|
||||||
|
endif
|
||||||
|
aug ScratchBackup
|
||||||
|
au!
|
||||||
|
au VimLeavePre * :call <SID>BackupScratchBuffer()
|
||||||
|
aug END
|
||||||
|
|
||||||
|
let s:SCRATCH_BUFFER_NAME="[Scratch]"
|
||||||
|
if !exists('s:buffer_number') " Supports reloading.
|
||||||
|
let s:buffer_number = -1
|
||||||
|
endif
|
||||||
|
|
||||||
|
"----------------------------------------------------------------------
|
||||||
|
" Diplays the scratch buffer. Creates one if it is an already
|
||||||
|
" present
|
||||||
|
"----------------------------------------------------------------------
|
||||||
|
function! <SID>ShowScratchBuffer()
|
||||||
|
if(s:buffer_number == -1 || bufexists(s:buffer_number) == 0)
|
||||||
|
" Temporarily modify isfname to avoid treating the name as a pattern.
|
||||||
|
let _isf = &isfname
|
||||||
|
set isfname-=\
|
||||||
|
set isfname-=[
|
||||||
|
if exists('+shellslash')
|
||||||
|
exec "sp \\\\". s:SCRATCH_BUFFER_NAME
|
||||||
|
else
|
||||||
|
exec "sp \\". s:SCRATCH_BUFFER_NAME
|
||||||
|
endif
|
||||||
|
let &isfname = _isf
|
||||||
|
let s:buffer_number = bufnr('%')
|
||||||
|
else
|
||||||
|
let buffer_win=bufwinnr(s:buffer_number)
|
||||||
|
if(buffer_win == -1)
|
||||||
|
exec 'sb '. s:buffer_number
|
||||||
|
else
|
||||||
|
exec buffer_win.'wincmd w'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
" Do setup always, just in case.
|
||||||
|
setlocal buftype=nofile
|
||||||
|
setlocal bufhidden=hide
|
||||||
|
setlocal nobuflisted
|
||||||
|
setlocal noswapfile
|
||||||
|
setlocal noro
|
||||||
|
nmap <buffer> <silent> <Plug>ShowScratchBuffer :hide<cr>
|
||||||
|
imap <buffer> <silent> <Plug>InsShowScratchBuffer <c-o>:hide<cr>
|
||||||
|
command! -buffer -nargs=0 Scratch :hide
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:BackupScratchBuffer()
|
||||||
|
if s:buffer_number != -1 && exists('g:scratchBackupFile') &&
|
||||||
|
\ g:scratchBackupFile != ''
|
||||||
|
exec 'split #' . s:buffer_number
|
||||||
|
" Avoid writing empty scratch buffers.
|
||||||
|
if line('$') > 1 || getline(1) !~ '^\s*$'
|
||||||
|
let _cpo=&cpo
|
||||||
|
try
|
||||||
|
set cpo-=A
|
||||||
|
exec 'write!' g:scratchBackupFile
|
||||||
|
finally
|
||||||
|
let &cpo=_cpo
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Restore cpo.
|
||||||
|
let &cpo = s:save_cpo
|
||||||
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
" vim6: sw=2 et
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 98a6555e4a26451145c2739052e124b88da99eac
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 60f25648814f0695eeb6c1040d97adca93c4e0bb
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 9bf4fd99e4b460c547207b0f0bc3557280874b61
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 18c68524ab8a043a566bbe227ea8f81ab922d092
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 528a59f26d12278698bb946f8fb82a63711eec21
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 4658aa78fd1b797fb0645064afe8eebbf2bfbb54
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 49307b76fc076f8a44bbda020bcc48e951e1ffc1
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 9f836921d37e050cada7fa911a025638c6708dc8
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c99f0ff06bd1915b2f05c5750283aa9e826ad3d8
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c5b09ad120c20aa79cc061d48db84697eab44ca1
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 78fffa609b3e6b84ef01ee4c9aba6d7435d7b18e
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 3196aec8899101a3939c7366e8028c9bdd56da77
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 2a3c5f8e3c26a57b8eb4cfc4be79615a1c508ef6
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit e9a7554bca4a3b6676b1277fe69ba37d9fbe8e74
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 8c81c0099a8b18fdc2e31aab5f6e76e211727e3a
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 42e9b46e7a20a2f394664874c7bbd9d6f6c39e8a
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit f8ab33c017f329248773e92968a7a3497b48d287
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit b5b84e49e609439e81aa03fa8e605a6097185665
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 96aeac30a586c7b55e4f408e2afa1f25862e3526
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 45e697c2a42f28b915e5f38fc2fccca104b41cda
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit fbb873a26568d9db2b109df0705dd25364685b37
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 2c03d82a0e4662adf1e347487d73a9bf4bf6fdac
|
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 835dd5a448e1fcf98b869ae69bfe099830b984a7
|
@ -0,0 +1,338 @@
|
|||||||
|
" 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:
|
@ -0,0 +1 @@
|
|||||||
|
au BufRead,BufNewFile *.applescript setf applescript
|
@ -0,0 +1 @@
|
|||||||
|
au BufRead,BufNewFile *.rl setf ragel
|
@ -0,0 +1,196 @@
|
|||||||
|
" 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
|
@ -0,0 +1,245 @@
|
|||||||
|
" 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"
|
||||||
|
|
@ -0,0 +1,149 @@
|
|||||||
|
" 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"
|
@ -0,0 +1,87 @@
|
|||||||
|
"
|
||||||
|
" 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