This commit is contained in:
Barak Michener 2024-05-18 18:50:38 -07:00
parent f0510126ba
commit 7a7c647c22
212 changed files with 30625 additions and 30625 deletions

View file

@ -0,0 +1 @@
setlocal tabstop=2 shiftwidth=2 nolist

View file

@ -0,0 +1,2 @@
setlocal omnifunc=necoghc#omnifunc
let g:ycm_key_invoke_completion = '<Leader><TAB>'

View file

@ -0,0 +1,3 @@
nmap <buffer> { <Plug>(qf_previous_file)
nmap <buffer> } <Plug>(qf_next_file)
nmap <buffer> dd <cmd>.Reject<cr>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,59 @@
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Description: Better syntax highlighting for Objective-C files (part of the
" cocoa.vim plugin).
" Last Updated: June 23, 2009
" NOTE: This next file (cocoa_keywords.vim) is rather large and may slow
" things down. Loading it seems to take less than 0.5 microseconds
" on my machine, but I'm not sure of the consequences; if it is slow
" for you, just comment out the next line.
ru after/syntax/cocoa_keywords.vim
syn match objcDirective '@synthesize\|@property' display
syn keyword objcType IBOutlet IBAction Method
syn keyword objcConstant YES NO TRUE FALSE
syn region objcImp start='@implementation' end='@end' transparent
syn region objcHeader start='@interface' end='@end' transparent
" I make this typo sometimes so it's nice to have it highlighted.
syn match objcError '\v(NSLogv=\(\s*)@<=[^@]=["'].*'me=e-1
syn match objcSubclass '\(@implementation\|@interface\)\@<=\s*\k\+' display contained containedin=objcImp,objcHeader
syn match objcSuperclass '\(@\(implementation\|interface\)\s*\k\+\s*:\)\@<=\s*\k*' display contained containedin=objcImp,objcHeader
" Matches "- (void) foo: (int) bar and: (float) foobar"
syn match objcMethod '^\s*[-+]\s*\_.\{-}[\{;]'me=e-1 transparent contains=cParen,objcInstMethod,objcFactMethod
" Matches "bar & foobar" in above
syn match objcMethodArg ')\@<=\s*\k\+' contained containedin=objcMethod
" Matches "foo:" & "and:" in above
syn match objcMethodName '\(^\s*[-+]\s*(\_[^)]*)\)\@<=\_\s*\_\k\+' contained containedin=objcMethod
syn match objcMethodColon '\k\+\s*:' contained containedin=objcMethod
" Don't match these groups in cParen "(...)"
syn cluster cParenGroup add=objcMethodName,objcMethodArg,objcMethodColon
" This fixes a bug with completion inside parens (e.g. if ([NSString ]))
syn cluster cParenGroup remove=objcMessage
" Matches "bar" in "[NSObject bar]" or "bar" in "[[NSObject foo: baz] bar]",
" but NOT "bar" in "[NSObject foo: bar]".
syn match objcMessageName '\(\[\s*\k\+\s\+\|\]\s*\)\@<=\k*\s*\]'me=e-1 display contained containedin=objcMessage
" Matches "foo:" in "[NSObject foo: bar]" or "[[NSObject new] foo: bar]"
syn match objcMessageColon '\(\_\S\+\_\s\+\)\@<=\k\+\s*:' display contained containedin=objcMessage
" Don't match these in this strange group for edge cases...
syn cluster cMultiGroup add=objcMessageColon,objcMessageName,objcMethodName,objcMethodArg,objcMethodColon
" You may want to customize this one. I couldn't find a default group to suit
" it, but you can modify your colorscheme to make this a different color.
hi link objcMethodName Special
hi link objcMethodColon objcMethodName
hi link objcMethodArg Identifier
hi link objcMessageName objcMethodArg
hi link objcMessageColon objcMessageName
hi link objcSubclass objcMethodName
hi link objcSuperclass String
hi link objcError Error

View file

@ -0,0 +1,61 @@
" vim-airline companion theme of Ubaryd
" (https://github.com/Donearm/Ubaryd)
" Normal mode
let s:N1 = [ '#141413' , '#b3b3b3' , 232 , 252 ] " blackestgravel & bleaksand
let s:N2 = [ '#b3b3b3' , '#414141' , 252, 238 ] " bleaksand & deepgravel
let s:N3 = [ '#e0e0e0' , '#363636' , 254, 237 ] " toffee & darkgravel
let s:N4 = [ '#363946' , 237 ] " gravel
" Insert mode
let s:I1 = [ '#1a1a18' , '#fade3e' , 232 , 221 ] " blackestgravel & warmcorn
let s:I2 = [ '#c7b386' , '#45413b' , 252 , 238 ] " bleaksand & deepgravel
let s:I3 = [ '#f4cf86' , '#242321' , 222 , 235 ] " lighttannedskin & darkgravel
" Visual mode
let s:V1 = [ '#1c1b1a' , '#9a4820' , 233 , 88 ] " blackgravel & warmadobe
let s:V2 = [ '#000000' , '#88633f' , 16 , 95 ] " coal & cappuccino
let s:V3 = [ '#88633f' , '#c7b386' , 95 , 252 ] " cappuccino & bleaksand
let s:V4 = [ '#c14c3d' , 160 ] " tannedumbrella
" Replace mode
let s:RE = [ '#c7915b' , 173 ] " nut
" Paste mode
let s:PA = [ '#f9ef6d' , 154 ] " bleaklemon
let s:file = [ '#ff7400' , '' , 196 , '' , '' ]
let s:IA = [ '#767986', '#363946', 244, 237, '' ]
let g:airline#themes#barak#palette = {}
let g:airline#themes#barak#palette.inactive = {
\ 'airline_a' : [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] }
let g:airline#themes#barak#palette.accents = {
\ 'red': [ '#ff7400' , '' , 196 , '' , '' ],
\ }
let g:airline#themes#barak#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#barak#palette.normal_modified = {
\ 'airline_a' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] ,
\ 'airline_c' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] }
let g:airline#themes#barak#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
let g:airline#themes#barak#palette.insert_modified = {
\ 'airline_c' : [ s:V2[1] , s:N2[1] , s:V2[3] , s:N2[3] , '' ] }
let g:airline#themes#barak#palette.insert_paste = {
\ 'airline_a' : [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] }
let g:airline#themes#barak#palette.replace = copy(airline#themes#barak#palette.insert)
let g:airline#themes#barak#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
let g:airline#themes#barak#palette.replace_modified = g:airline#themes#barak#palette.insert_modified
let g:airline#themes#barak#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
let g:airline#themes#barak#palette.visual_modified = {
\ 'airline_c' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] }
let g:airline#themes#barak#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)

1954
dot_vim/autoload/genutils.vim Executable file

File diff suppressed because it is too large Load diff

472
dot_vim/autoload/lookupfile.vim Executable file
View file

@ -0,0 +1,472 @@
" lookupfile.vim: See plugin/lookupfile.vim
" Make sure line-continuations won't cause any problem. This will be restored
" at the end
let s:save_cpo = &cpo
set cpo&vim
" Some onetime initialization of variables
if !exists('s:myBufNum')
let s:windowName = '[Lookup File]'
let s:myBufNum = -1
let s:popupIsHidden = 0
endif
let g:lookupfile#lastPattern = ""
let g:lookupfile#lastResults = []
let g:lookupfile#lastStatsMsg = []
let g:lookupfile#recentFiles = []
function! lookupfile#OpenWindow(bang, initPat)
let origWinnr = winnr()
let _isf = &isfname
let _splitbelow = &splitbelow
set nosplitbelow
try
if s:myBufNum == -1
" Temporarily modify isfname to avoid treating the name as a pattern.
set isfname-=\
set isfname-=[
if exists('+shellslash')
call genutils#OpenWinNoEa("1sp \\\\". escape(s:windowName, ' '))
else
call genutils#OpenWinNoEa("1sp \\". escape(s:windowName, ' '))
endif
let s:myBufNum = bufnr('%')
else
let winnr = bufwinnr(s:myBufNum)
if winnr == -1
call genutils#OpenWinNoEa('1sb '. s:myBufNum)
else
let wasVisible = 1
exec winnr 'wincmd w'
endif
endif
finally
let &isfname = _isf
let &splitbelow = _splitbelow
endtry
call s:SetupBuf()
let initPat = ''
if a:bang != ''
let initPat = ''
elseif a:initPat != ''
let initPat = a:initPat
elseif g:lookupfile#lastPattern != '' && g:LookupFile_PreserveLastPattern
let initPat = g:lookupfile#lastPattern
endif
$
if getline('.') !=# initPat
silent! put=''
call setline('.', initPat)
endif
startinsert!
if !g:LookupFile_OnCursorMovedI
" This is a hack to bring up the popup immediately, while reopening the
" window, just for a better response.
aug LookupFileCursorHoldImm
au!
au CursorMovedI <buffer> nested exec 'doautocmd LookupFile CursorHoldI' |
\ au! LookupFileCursorHoldImm
aug END
endif
call s:LookupFileSet()
aug LookupFileReset
au!
au CursorMovedI <buffer> call <SID>LookupFileSet()
au CursorMoved <buffer> call <SID>LookupFileSet()
au WinEnter <buffer> call <SID>LookupFileSet()
au TabEnter <buffer> call <SID>LookupFileSet()
au WinEnter * call <SID>LookupFileReset(0)
au TabEnter * call <SID>LookupFileReset(0)
au CursorMoved * call <SID>LookupFileReset(0)
" Better be safe than sorry.
au BufHidden <buffer> call <SID>LookupFileReset(1)
aug END
endfunction
function! lookupfile#CloseWindow()
if bufnr('%') != s:myBufNum
return
endif
call s:LookupFileReset(1)
close
endfunction
function! lookupfile#ClearCache()
let g:lookupfile#lastPattern = ""
let g:lookupfile#lastResults = []
endfunction
function! s:LookupFileSet()
if bufnr('%') != s:myBufNum || exists('s:_backspace')
return
endif
let s:_backspace = &backspace
set backspace=start
let s:_completeopt = &completeopt
set completeopt+=menuone
let s:_updatetime = &updatetime
let &updatetime = g:LookupFile_UpdateTime
endfunction
function! s:LookupFileReset(force)
if a:force
aug LookupFileReset
au!
aug END
endif
" Ignore the event while in the same buffer.
if exists('s:_backspace') && (a:force || (bufnr('%') != s:myBufNum))
let &backspace = s:_backspace
let &completeopt = s:_completeopt
let &updatetime = s:_updatetime
unlet s:_backspace s:_completeopt s:_updatetime
endif
endfunction
function! s:HidePopup()
let s:popupIsHidden = 1
return "\<C-E>"
endfunction
function! lookupfile#IsPopupHidden()
return s:popupIsHidden
endfunction
function! s:SetupBuf()
call genutils#SetupScratchBuffer()
resize 1
setlocal wrap
setlocal bufhidden=hide
setlocal winfixheight
setlocal wrapmargin=0
setlocal textwidth=0
setlocal completefunc=lookupfile#Complete
syn clear
set ft=lookupfile
" Setup maps to open the file.
inoremap <silent> <buffer> <expr> <C-E> <SID>HidePopup()
inoremap <silent> <buffer> <expr> <CR> <SID>AcceptFile(0, "\<CR>")
inoremap <silent> <buffer> <expr> <C-O> <SID>AcceptFile(1, "\<C-O>")
" This prevents the "Whole line completion" from getting triggered with <BS>,
" however this might make the dropdown kind of flash.
inoremap <buffer> <expr> <BS> pumvisible()?"\<C-E>\<BS>":"\<BS>"
inoremap <buffer> <expr> <S-BS> pumvisible()?"\<C-E>\<BS>":"\<BS>"
" Make <C-Y> behave just like <CR>
imap <buffer> <C-Y> <CR>
if g:LookupFile_EscCancelsPopup
inoremap <buffer> <expr> <Esc> pumvisible()?"\<C-E>\<C-C>":"\<Esc>"
endif
inoremap <buffer> <expr> <silent> <Down> <SID>GetCommand(1, 1, "\<C-N>",
\ "\"\\<Lt>C-N>\"")
inoremap <buffer> <expr> <silent> <Up> <SID>GetCommand(1, 1, "\<C-P>",
\ "\"\\<Lt>C-P>\"")
inoremap <buffer> <expr> <silent> <PageDown> <SID>GetCommand(1, 0,
\ "\<PageDown>", '')
inoremap <buffer> <expr> <silent> <PageUp> <SID>GetCommand(1, 0,
\ "\<PageUp>", '')
nnoremap <silent> <buffer> o :OpenFile<CR>
nnoremap <silent> <buffer> O :OpenFile!<CR>
command! -buffer -nargs=0 -bang OpenFile
\ :call <SID>OpenCurFile('<bang>' != '')
command! -buffer -nargs=0 -bang AddPattern :call <SID>AddPattern()
nnoremap <buffer> <silent> <Plug>LookupFile :call lookupfile#CloseWindow()<CR>
inoremap <buffer> <silent> <Plug>LookupFile <C-E><C-C>:call lookupfile#CloseWindow()<CR>
aug LookupFile
au!
if g:LookupFile_ShowFiller
exec 'au' (g:LookupFile_OnCursorMovedI ? 'CursorMovedI' : 'CursorHoldI')
\ '<buffer> call <SID>ShowFiller()'
endif
exec 'au' (g:LookupFile_OnCursorMovedI ? 'CursorMovedI' : 'CursorHoldI')
\ '<buffer> call lookupfile#LookupFile(0)'
aug END
endfunction
function! s:GetCommand(withPopupTrigger, withSkipPat, actCmd, innerCmd)
let cmd = ''
if a:withPopupTrigger && !pumvisible()
let cmd .= "\<C-X>\<C-U>"
endif
let cmd .= a:actCmd. "\<C-R>=(getline('.') == lookupfile#lastPattern) ? ".
\ a:innerCmd." : ''\<CR>"
return cmd
endfunction
function! s:AddPattern()
if g:LookupFile_PreservePatternHistory
silent! put! =g:lookupfile#lastPattern
$
endif
endfunction
function! s:AcceptFile(splitWin, key)
if s:popupIsHidden
return a:key
endif
if !pumvisible()
call lookupfile#LookupFile(0, 1)
endif
let acceptCmd = ''
if type(g:LookupFile_LookupAcceptFunc) == 2 ||
\ (type(g:LookupFile_LookupAcceptFunc) == 1 &&
\ substitute(g:LookupFile_LookupAcceptFunc, '\s', '', 'g') != '')
let acceptCmd = call(g:LookupFile_LookupAcceptFunc, [a:splitWin, a:key])
else
let acceptCmd = lookupfile#AcceptFile(a:splitWin, a:key)
endif
return (!pumvisible() ? "\<C-X>\<C-U>" : '').acceptCmd
endfunction
function! s:IsValid(fileName)
if bufnr('%') != s:myBufNum || a:fileName == ''
return 0
endif
if !filereadable(a:fileName) && !isdirectory(a:fileName)
if g:LookupFile_AllowNewFiles
" Check if the parent directory exists, then we can create a new buffer
" (Ido feature)
let parent = fnamemodify(a:fileName, ':h')
if parent == '' || (parent != '' && !isdirectory(parent))
return 1
endif
endif
return 0
endif
return 1
endfunction
function! lookupfile#AcceptFile(splitWin, key)
if len(g:lookupfile#lastResults) == 0 && !s:IsValid(getline('.'))
return "\<C-O>:echohl ErrorMsg | echo 'No such file or directory' | echohl NONE\<CR>"
endif
" Skip the first match, which is essentially the same as pattern.
let nextCmd = "\<C-N>\<C-R>=(getline('.') == lookupfile#lastPattern)?\"\\<C-N>\":''\<CR>"
let acceptCmd = "\<C-Y>\<Esc>:AddPattern\<CR>:OpenFile".(a:splitWin?'!':'').
\ "\<CR>"
if getline('.') ==# g:lookupfile#lastPattern
if len(g:lookupfile#lastResults) == 0
" FIXME: shouldn't this be an error?
let acceptCmd = acceptCmd
elseif len(g:lookupfile#lastResults) == 1 || g:LookupFile_AlwaysAcceptFirst
" If there is only one file, we will also select it (if not already
" selected)
let acceptCmd = nextCmd.acceptCmd
else
let acceptCmd = nextCmd
endif
endif
return acceptCmd
endfunction
function! s:OpenCurFile(splitWin)
let fileName = getline('.')
if fileName =~ '^\s*$'
return
endif
if !s:IsValid(fileName)
echohl ErrorMsg | echo 'No such file or directory' | echohl NONE
endif
if type(g:LookupFile_LookupNotifyFunc) == 2 ||
\ (type(g:LookupFile_LookupNotifyFunc) == 1 &&
\ substitute(g:LookupFile_LookupNotifyFunc, '\s', '', 'g') != '')
call call(g:LookupFile_LookupNotifyFunc, [])
endif
call lookupfile#CloseWindow()
" Update the recent files list.
if g:LookupFile_RecentFileListSize > 0
let curPos = index(g:lookupfile#recentFiles, fileName)
call add(g:lookupfile#recentFiles, fileName)
if curPos != -1
call remove(g:lookupfile#recentFiles, curPos)
elseif len(g:lookupfile#recentFiles) > g:LookupFile_RecentFileListSize
let g:lookupfile#recentFiles = g:lookupfile#recentFiles[
\ -g:LookupFile_RecentFileListSize :]
endif
endif
let bufnr = genutils#FindBufferForName(fileName)
let winnr = bufwinnr(bufnr)
if winnr == -1 && g:LookupFile_SearchForBufsInTabs
for i in range(tabpagenr('$'))
if index(tabpagebuflist(i+1), bufnr) != -1
" Switch to the tab and set winnr.
exec 'tabnext' (i+1)
let winnr = bufwinnr(bufnr)
endif
endfor
endif
if winnr != -1
exec winnr.'wincmd w'
else
let splitOpen = 0
if &switchbuf ==# 'split' || a:splitWin
let splitOpen = 1
endif
" First try opening as a buffer, if it fails, we will open as a file.
try
if bufnr == -1
throw ''
endif
exec (splitOpen?'s':'').'buffer' bufnr
catch /^Vim\%((\a\+)\)\=:E325/
" Ignore, this anyway means the file was found.
catch
try
exec (splitOpen?'split':'edit') fileName
catch /^Vim\%((\a\+)\)\=:E325/
" Ignore, this anyway means the file was found.
endtry
endtry
endif
endfunction
function! s:ShowFiller()
return lookupfile#LookupFile(1)
endfunction
function! lookupfile#Complete(findstart, base)
if a:findstart
return 0
else
call lookupfile#LookupFile(0, 1, a:base)
return g:lookupfile#lastStatsMsg+g:lookupfile#lastResults
endif
endfunction
function! lookupfile#LookupFile(showingFiller, ...)
let generateMode = (a:0 == 0 ? 0 : a:1)
if generateMode
let pattern = (a:0 > 1) ? a:2 : getline('.')
else
let pattern = getline('.')
" The normal completion behavior is to stop completion when cursor is moved.
if col('.') == 1 || (col('.') != col('$'))
return ''
endif
endif
if pattern == '' || (pattern ==# g:lookupfile#lastPattern && pumvisible())
return ''
endif
if s:popupIsHidden && g:lookupfile#lastPattern ==# pattern
return ''
endif
let s:popupIsHidden = 0
let statusMsg = ''
if pattern == ' '
if len(g:lookupfile#recentFiles) == 0
let statusMsg = '<<< No recent files >>>'
let files = []
else
let statusMsg = '<<< Showing '.len(g:lookupfile#recentFiles).' recent files >>>'
let files = reverse(copy(g:lookupfile#recentFiles))
endif
elseif strlen(pattern) < g:LookupFile_MinPatLength
let statusMsg = '<<< Type at least '.g:LookupFile_MinPatLength.
\ ' characters >>>'
let files = []
" We ignore filler when we have the result in hand.
elseif g:lookupfile#lastPattern ==# pattern
" This helps at every startup as we start with the previous pattern.
let files = g:lookupfile#lastResults
elseif a:showingFiller
" Just show a filler and return. We could return this as the only match, but
" unless 'completeopt' has "menuone", menu doesn't get shown.
let statusMsg = '<<< Looking up files... hit ^C to break >>>'
let files = []
else
if type(g:LookupFile_LookupFunc) == 2 ||
\ (type(g:LookupFile_LookupFunc) == 1 &&
\ substitute(g:LookupFile_LookupFunc, '\s', '', 'g') != '')
let files = call(g:LookupFile_LookupFunc, [pattern])
else
let _tags = &tags
try
let &tags = eval(g:LookupFile_TagExpr)
let taglist = taglist(g:LookupFile_TagsExpandCamelCase ?
\ lookupfile#ExpandCamelCase(pattern) : pattern)
catch
echohl ErrorMsg | echo "Exception: " . v:exception | echohl NONE
return ''
finally
let &tags = _tags
endtry
" Show the matches for what is typed so far.
if g:LookupFile_UsingSpecializedTags
let files = map(taglist, '{'.
\ '"word": fnamemodify(v:val["filename"], ":p"), '.
\ '"abbr": v:val["name"], '.
\ '"menu": fnamemodify(v:val["filename"], ":h"), '.
\ '"dup": 1, '.
\ '}')
else
let files = map(taglist, 'fnamemodify(v:val["filename"], ":p")')
endif
endif
let pat = g:LookupFile_FileFilter
if pat != ''
call filter(files, '(type(v:val) == 4) ? v:val["word"] !~ pat : v:val !~ pat')
endif
if g:LookupFile_SortMethod ==# 'alpha'
" When UsingSpecializedTags, sort by the actual name (Timothy, Guo
" (firemeteor dot guo at gmail dot com)).
if type(get(files, 0)) == 4
call sort(files, "s:CmpByName")
else
call sort(files)
endif
endif
let g:lookupfile#lastPattern = pattern
let g:lookupfile#lastResults = files
endif
if statusMsg == ''
if len(files) > 0
let statusMsg = '<<< '.len(files).' Matching >>>'
else
let statusMsg = '<<< None Matching >>>'
endif
endif
let msgLine = [{'word': pattern, 'abbr': statusMsg, 'menu': pattern}]
let g:lookupfile#lastStatsMsg = msgLine
if !generateMode
call complete(1, msgLine+files)
endif
return ''
endfunction
function! lookupfile#ExpandCamelCase(str)
let pat = a:str
" Check if there are at least two consecutive uppercase letters to turn on
" the CamelCase expansion.
if match(a:str, '\u\u') != -1
let pat = '\C'.substitute(a:str, '\u\+',
\ '\=substitute(submatch(0), ".", '."'".'&\\U*'."'".', "g")', 'g')
let @*=pat
endif
return pat
endfunction
function! s:CmpByName(i1, i2)
let ileft = a:i1["abbr"]
let iright = a:i2["abbr"]
return ileft == iright ? 0 : ileft > iright ? 1 : -1
endfunc
" Restore cpo.
let &cpo = s:save_cpo
unlet s:save_cpo
" vim6:fdm=marker et sw=2

View file

@ -0,0 +1,215 @@
" File: cocoacomplete.vim (part of the cocoa.vim plugin)
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Last Updated: June 30, 2009
" Description: An omni-completion plugin for Cocoa/Objective-C.
let s:lib_dir = fnameescape($HOME.'/.vim/lib/')
let s:cocoa_indexes = s:lib_dir.'cocoa_indexes/'
if !isdirectory(s:cocoa_indexes)
echom 'Error in cocoacomplete.vim: could not find ~/.vim/lib/cocoa_indexes directory'
endif
fun! objc#cocoacomplete#Complete(findstart, base)
if a:findstart
" Column where completion starts:
return match(getline('.'), '\k\+\%'.col('.').'c')
else
let matches = []
let complete_type = s:GetCompleteType(line('.'), col('.') - 1)
if complete_type == 'methods'
call s:Complete(a:base, ['alloc', 'init', 'retain', 'release',
\ 'autorelease', 'retainCount',
\ 'description', 'class', 'superclass',
\ 'self', 'zone', 'isProxy', 'hash'])
let obj_pos = s:GetObjPos(line('.'), col('.'))
call extend(matches, s:CompleteMethod(line('.'), obj_pos, a:base))
elseif complete_type == 'types' || complete_type == 'returntypes'
let opt_types = complete_type == 'returntypes' ? ['IBAction'] : []
call s:Complete(a:base, opt_types + ['void', 'id', 'BOOL', 'int',
\ 'double', 'float', 'char'])
call extend(matches, s:CompleteCocoa(a:base, 'classes', 'types',
\ 'notifications'))
elseif complete_type != ''
if complete_type =~ 'function_params$'
let complete_type = substitute(complete_type, 'function_params$', '', '')
let functions = s:CompleteFunction(a:base)
endif
" Mimic vim's dot syntax for other complete types (see :h ft).
let word = a:base == '' ? 'NS' : a:base
let args = [word] + split(complete_type, '\.')
call extend(matches, call('s:CompleteCocoa', args))
" List functions after the other items in the menu.
if exists('functions') | call extend(matches, functions) | endif
endif
return matches
endif
endf
fun s:GetCompleteType(lnum, col)
let scopelist = map(synstack(a:lnum, a:col), 'synIDattr(v:val, "name")')
if empty(scopelist) | return 'types' | endif
let current_scope = scopelist[-1]
let beforeCursor = strpart(getline(a:lnum), 0, a:col)
" Completing a function name:
if getline(a:lnum) =~ '\%'.(a:col + 1).'c\s*('
return 'functions'
elseif current_scope == 'objcSuperclass'
return 'classes'
" Inside brackets "[ ... ]":
elseif index(scopelist, 'objcMessage') != -1
return beforeCursor =~ '\[\k*$' ? 'classes' : 'methods'
" Inside parentheses "( ... )":
elseif current_scope == 'cParen'
" Inside parentheses for method definition:
if beforeCursor =~ '^\s*[-+]\s*([^{;]*'
return beforeCursor =~ '^\s*[-+]\s*([^)]*$' ? 'returntypes' : 'types'
" Inside function, loop, or conditional:
else
return 'classes.types.constants.function_params'
endif
" Inside braces "{ ... }" or after equals "=":
elseif current_scope == 'cBlock' || current_scope == 'objcAssign' || current_scope == ''
let type = current_scope == 'cBlock' ? 'types.constants.' : ''
let type = 'classes.'.type.'function_params'
if beforeCursor =~ 'IBOutlet' | return 'classes' | endif
return beforeCursor =~ '\v(^|[{};=\])]|return)\s*\k*$'? type : 'methods'
" Directly inside "@implementation ... @end" or "@interface ... @end"
elseif current_scope == 'objcImp' || current_scope == 'objcHeader'
" TODO: Complete delegate/subclass methods
endif
return ''
endf
" Adds item to the completion menu if they match the base.
fun s:Complete(base, items)
for item in a:items
if item =~ '^'.a:base | call complete_add(item) | endif
endfor
endf
" Returns position of "foo" in "[foo bar]" or "[baz bar: [foo bar]]".
fun s:GetObjPos(lnum, col)
let beforeCursor = strpart(getline(a:lnum), 0, a:col)
return match(beforeCursor, '\v.*(^|[\[=;])\s*\[*\zs[A-Za-z0-9_@]+') + 1
endf
" Completes a method given the position of the object and the method
" being completed.
fun s:CompleteMethod(lnum, col, method)
let class = s:GetCocoaClass(a:lnum, a:col)
if class == ''
let object = matchstr(getline(a:lnum), '\%'.a:col.'c\k\+')
let class = s:GetDeclWord(object)
if class == '' | return [] | endif
endif
let method = s:GetMethodName(a:lnum, a:col, a:method)
let matches = split(system(s:lib_dir.'get_methods.sh '.class.
\ '|grep "^'.method.'"'), "\n")
if exists('g:loaded_snips') " Use snipMate if it's installed
call objc#pum_snippet#Map()
else " Otherwise, only complete the method name.
call map(matches, 'substitute(v:val, ''\v:\zs.{-}\ze(\w+:|$)'', " ", "g")')
endif
" If dealing with a partial method name, only complete past it. E.g., in
" "[NSString stringWithCharacters:baz l|]" (where | is the cursor),
" only return "length", not "stringWithCharacters:length:".
if stridx(method, ':') != -1
let method = substitute(method, a:method.'$', '\\\\zs&', '')
call map(matches, 'matchstr(v:val, "'.method.'.*")')
endif
return matches
endf
" Returns the Cocoa class at a given position if it exists, or
" an empty string "" if it doesn't.
fun s:GetCocoaClass(lnum, col)
let class = matchstr(getline(a:lnum), '\%'.a:col.'c[A-Za-z0-9_"@]\+')
if class =~ '^@"' | return 'NSString' | endif " Treat @"..." as an NSString
let v:errmsg = ''
sil! hi cocoaClass
if v:errmsg == '' && synIDattr(synID(a:lnum, a:col, 0), 'name') == 'cocoaClass'
return class " If cocoaClass is defined, try using that.
endif
return system('grep ^'.class.' '.s:cocoa_indexes.'classes.txt') != ''
\ ? class : '' " Use grep as a fallback.
endf
" Returns the word before a variable declaration.
fun s:GetDeclWord(var)
let startpos = [line('.'), col('.')]
let line_found = searchdecl(a:var) != 0 ? 0 : line('.')
call cursor(startpos)
let matchstr = '\v(IBOutlet\s+)=\zs\k+\s*\ze\**\s*'
" If the declaration was not found in the implementation file, check
" the header.
if !line_found && expand('%:e') == 'm'
let header_path = expand('%:p:r').'.h'
if filereadable(header_path)
for line in readfile(header_path)
if line =~ '^\s*\(IBOutlet\)\=\s*\k*\s*\ze\**\s*'.a:var.'\s*'
return matchstr(line, matchstr)
endif
endfor
return ''
endif
endif
return matchstr(getline(line_found), matchstr.a:var)
endf
fun s:SearchList(list, regex)
for line in a:list
if line =~ a:regex
return line
endif
endfor
return ''
endf
" Returns the method name, ready to be searched by grep.
" The "base" word needs to be passed in separately, because
" Vim apparently removes it from the line during completions.
fun s:GetMethodName(lnum, col, base)
let line = getline(a:lnum)
let col = matchend(line, '\%'.a:col.'c\S\+\s\+') + 1 " Skip past class name.
if line =~ '\%'.col.'c\k\+:'
let base = a:base == '' ? '' : ' '.a:base
let method = matchstr(line, '\%'.col.'c.\{-}\ze]').base
return substitute(method, '\v\k+:\zs.{-}\ze(\s*\k+:|'.base.'$)', '[^:]*', 'g')
else
return a:base
endif
endf
" Completes Cocoa functions, using snippets for the parameters if possible.
fun s:CompleteFunction(word)
let files = s:cocoa_indexes.'functions.txt' " TODO: Add C functions.
let matches = split(system('zgrep -h "^'.a:word.'" '.files), "\n")
if exists('g:loaded_snips') " Use snipMate if it's installed
call objc#pum_snippet#Map()
else " Otherwise, just complete the function name
call map(matches, "{'word':matchstr(v:val, '^\\k\\+'), 'abbr':v:val}")
endif
return matches
endf
" Completes word for Cocoa "classes", "types", "notifications", or "constants".
" (supplied as the optional parameters).
fun s:CompleteCocoa(word, file, ...)
let files = ''
for file in [a:file] + a:000
let files .= ' '.s:cocoa_indexes.file.'.txt'
endfor
return split(system('grep -ho "^'.a:word.'[A-Za-z0-9_]*" '.files), "\n")
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -0,0 +1,160 @@
" File: objc#man.vim (part of the cocoa.vim plugin)
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Description: Allows you to look up Cocoa API docs in Vim.
" Last Updated: June 30, 2009
" NOTE: See http://mymacinations.com/2008/02/06/changing-the-systems-default-settings-for-html-files-safe/
" for removing the annoying security alert in Leopard.
" Return all matches in for ":CocoaDoc <tab>" sorted by length.
fun objc#man#Completion(ArgLead, CmdLine, CursorPos)
return system('grep -ho "^'.a:ArgLead.'\w*" ~/.vim/lib/cocoa_indexes/*.txt'.
\ "| perl -e 'print sort {length $a <=> length $b} <>'")
endf
let s:docsets = []
for path in ['/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset',
\ '/Developer/Platforms/iPhoneOS.platform/Developer/Documentation/DocSets/com.apple.adc.documentation.AppleiPhone3_0.iPhoneLibrary.docset']
if isdirectory(path)
call add(s:docsets, path)
endif
endfor
let s:docset_cmd = '/Developer/usr/bin/docsetutil search -skip-text -query '
fun s:OpenFile(file)
if a:file =~ '/.*/man/'
exe ':!'.substitute(&kp, '^man -s', 'man', '').' '.a:file
else
" /usr/bin/open strips the #fragments in file:// URLs, which we need,
" so I'm using applescript instead.
call system('osascript -e ''open location "file://'.a:file.'"'' &')
endif
endf
fun objc#man#ShowDoc(...)
let word = a:0 ? a:1 : matchstr(getline('.'), '\<\w*\%'.col('.').'c\w\+:\=')
" Look up the whole method if it takes multiple arguments.
if !a:0 && word[len(word) - 1] == ':'
let word = s:GetMethodName()
endif
if word == ''
if !a:0 " Mimic K if using it as such
echoh ErrorMsg
echo 'E349: No identifier under cursor'
echoh None
endif
return
endif
let references = {}
" First check Cocoa docs for word using docsetutil
for docset in s:docsets
let response = split(system(s:docset_cmd.word.' '.docset), "\n")
let docset .= '/Contents/Resources/Documents/' " Actual path of files
for line in response
" Format string is: " Language/type/class/word path"
let path = matchstr(line, '\S*$')
if path[0] != '/' | let path = docset.path | endif
if has_key(references, path) | continue | endif " Ignore duplicate entries
let [lang, type, class] = split(matchstr(line, '^ \zs*\S*'), '/')[:2]
" If no class if given use type instead
if class == '-' | let class = type | endif
let references[path] = {'lang': lang, 'class': class}
endfor
endfor
" Then try man
let man = system('man -S2:3 -aW '.word)
if man !~ '^No manual entry'
for path in split(man, "\n")
if !has_key(references, path)
let references[path] = {'lang': 'C', 'class': 'man'}
endif
endfor
endif
if len(references) == 1
return s:OpenFile(keys(references)[0])
elseif !empty(references)
echoh ModeMsg | echo word | echoh None
return s:ChooseFrom(references)
else
echoh WarningMsg
echo "Can't find documentation for ".word
echoh None
endif
endf
fun s:ChooseFrom(references)
let type_abbr = {'cl' : 'Class', 'intf' : 'Protocol', 'cat' : 'Category',
\ 'intfm' : 'Method', 'instm' : 'Method', 'econst' : 'Enum',
\ 'tdef' : 'Typedef', 'macro' : 'Macro', 'data' : 'Data',
\ 'func' : 'Function'}
let inputlist = []
" Don't display "Objective-C" if all items are objc
let show_lang = !AllKeysEqual(values(a:references), 'lang', 'Objective-C')
let i = 1
for ref in values(a:references)
let class = ref.class
if has_key(type_abbr, class) | let class = type_abbr[class] | endif
call add(inputlist, i.'. '.(show_lang ? ref['lang'].' ' : '').class)
let i += 1
endfor
let num = inputlist(inputlist)
return num ? s:OpenFile(keys(a:references)[num - 1]) : -1
endf
fun AllKeysEqual(list, key, item)
for item in a:list
if item[a:key] != a:item
return 0
endif
endfor
return 1
endf
fun s:GetMethodName()
let pos = [line('.'), col('.')]
let startpos = searchpos('\v^\s*-.{-}\w+:|\[\s*\w+\s+\w+:|\]\s*\w+:', 'cbW')
" Method declaration (- (foo) bar:)
if getline(startpos[0]) =~ '^\s*-.\{-}\w\+:'
let endpos = searchpos('{', 'W')
" Message inside brackets ([foo bar: baz])
else
let endpos = searchpairpos('\[', '', '\]', 'W')
endif
call cursor(pos)
if startpos[0] == 0 || endpos[0] == 0 | return '' | endif
let lines = getline(startpos[0], endpos[0])
let lines[0] = strpart(lines[0], startpos[1] - 1)
let lines[-1] = strpart(lines[-1], 0, endpos[1])
" Ignore outer brackets
let message = substitute(join(lines), '^\[\|\]$', '', '')
" Ignore nested messages [...]
let message = substitute(message, '\[.\{-}\]', '', 'g')
" Ignore strings (could contain colons)
let message = substitute(message, '".\{-}"', '', 'g')
" Ignore @selector(...)
let message = substitute(message, '@selector(.\{-})', '', 'g')
return s:MatchAll(message, '\w\+:')
endf
fun s:MatchAll(haystack, needle)
let matches = matchstr(a:haystack, a:needle)
let index = matchend(a:haystack, a:needle)
while index != -1
let matches .= matchstr(a:haystack, a:needle, index + 1)
let index = matchend(a:haystack, a:needle, index + 1)
endw
return matches
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -0,0 +1,124 @@
" File: objc#method_builder.vim (part of the cocoa.vim plugin)
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Description: Builds an empty implementation (*.m) file given a header (*.h)
" file. When called with no arguments (simply ":BuildMethods"),
" it looks for the corresponding header file of the current *.m
" file (e.g. "foo.m" -> "foo.h").
" Last Updated: June 03, 2009
" - make sure you're not in a comment
" TODO: Relative pathnames
fun objc#method_builder#Completion(ArgLead, CmdLine, CursorPos)
let dir = stridx(a:ArgLead, '/') == -1 ? getcwd() : fnamemodify(a:ArgLead, ':h')
let search = fnamemodify(a:ArgLead, ':t')
let files = split(glob(dir.'/'.search.'*.h')
\ ."\n".glob(dir.'/'.search.'*/'), "\n")
call map(files, 'fnameescape(fnamemodify(v:val, ":."))')
return files
endf
fun s:Error(msg)
echoh ErrorMsg | echo a:msg | echoh None
return -1
endf
fun s:GetDeclarations(file)
let header = readfile(a:file)
let template = []
let in_comment = 0
let in_header = 0
let looking_for_semi = 0
for line in header
if in_comment
if stridx(line, '*/') != -1 | let in_comment = 0 | endif
continue " Ignore declarations inside multi-line comments
elseif stridx(line, '/*') != -1
let in_comment = 1 | continue
endif
if stridx(line, '@interface') != -1
let in_header = 1
let template += ['@implementation'.matchstr(line, '@interface\zs\s\+\w\+'), '']
continue
elseif in_header && stridx(line, '@end') != -1
let in_header = 0
call add(template, '@end')
break " Only process one @interface at a time, for now.
endif
if !in_header | continue | endif
let first_char = strpart(line, 0, 1)
if first_char == '-' || first_char == '+' || looking_for_semi
let semi_pos = stridx(line, ';')
let looking_for_semi = semi_pos == -1
if looking_for_semi
call add(template, line)
else
call add(template, strpart(line, 0, semi_pos))
let template += ['{', "\t", '}', '']
endif
endif
endfor
return template
endf
fun objc#method_builder#Build(header)
let headerfile = a:header == '' ? expand('%:p:r').'.h' : a:header
if expand('%:e') != 'm'
return s:Error('Not in an implementation file.')
elseif !filereadable(headerfile)
return s:Error('Could not read header file.')
endif
let declarations = s:GetDeclarations(headerfile)
if empty(declarations)
return s:Error('Header file has no method declarations!')
endif
let len = len(declarations)
let last_change = line('.')
if search('\V'.substitute(declarations[0], '\s\+', '\\s\\+', ''))
if !searchpair('@implementation', '', '@end', 'W')
return s:Error('Missing @end declaration.')
endif
let i = 2 " Skip past the @implementation line & blank line
let len -= 1 " Skip past @end declaration
let lnum = line('.') - 1
else
let i = 0
let lnum = line('.')
endif
let start_line = lnum
while i < len
let is_method = declarations[i][0] =~ '@\|+\|-'
if !is_method || !search('\V'.substitute(escape(declarations[i], '\'),
\ 'void\|IBAction', '\\(void\\|IBAction\\)', 'g'), 'n')
call append(lnum, declarations[i])
let lnum += 1
if is_method | let last_change = lnum | endif
else " Skip method declaration if it is already declared.
if declarations[i][0] == '@'
let i += 1
else
while declarations[i] != '}' && i < len
let i += 1
endw
let i += 1
endif
endif
let i += 1
endw
call cursor(last_change, 1)
if lnum == start_line
echoh WarningMsg
let class = matchstr(declarations[0], '@implementation\s\+\zs.*')
echo 'The methods for the "'.class.'" class have already been declared.'
echoh None
endif
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -0,0 +1,115 @@
" File: objc#method_list.vim (part of the cocoa.vim plugin)
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Description: Opens a split window containing the methods of the current file.
" Last Updated: July 13, 2009
au WinLeave Method\ List call<SID>LeaveMethodList()
au WinEnter Method\ List call objc#method_list#Activate(0)
fun objc#method_list#Activate(update)
let s:opt = {'is':&is, 'hls': &hls} " Save current options.
let s:last_search = @/
set is nohls
" If methodlist has already been opened, reactivate it.
if exists('s:mlist_buffer') && bufexists(s:mlist_buffer)
let mlist_win = bufwinnr(s:mlist_buffer)
if mlist_win == -1
sil exe 'belowright sbuf '.s:mlist_buffer
if a:update | call s:UpdateMethodList() | endif
elseif winbufnr(2) == -1
quit " If no other windows are open, close the method list automatically.
else " If method list is out of focus, bring it back into focus.
exe mlist_win.'winc w'
endif
else " Otherwise, create the method list.
call s:CreateMethodList()
call s:UpdateMethodList()
endif
endf
fun s:CreateMethodList()
botright new
let s:sortPref = 0
let s:mlist_buffer = bufnr('%')
sil file Method\ List
setl bt=nofile bh=wipe noswf nobl nonu nowrap syn=objc
syn match objcPragmark '^[^-+@].*$'
hi objcPragmark gui=italic term=underline
nn <silent> <buffer> <cr> :cal<SID>SelectMethod()<cr>
nn <buffer> q <c-w>q
nn <buffer> p <c-w>p
nm <buffer> l p
nm <buffer> <2-leftmouse> <cr>
endf
" Returns the lines of all the matches in a dictionary
fun s:GetAllMatches(needle)
let startpos = [line('.'), col('.')]
call cursor(1, 1)
let results = {}
let line = search(a:needle, 'Wc')
let key = matchstr(getline(line), a:needle)
if !s:InComment(line, 1) && key != ''
let results[key] = line
endif
while 1
let line = search(a:needle, 'W')
if !line | break | endif
let key = matchstr(getline(line), a:needle)
if !s:InComment(line, 1) && key != ''
let results[key] = line
endif
endw
call cursor(startpos)
return results
endf
fun s:InComment(line, col)
return stridx(synIDattr(synID(a:line, a:col, 0), 'name'), 'omment') != -1
endf
fun s:UpdateMethodList()
winc p " Go to source file window
let s:methods = s:GetAllMatches('^\v(\@(implementation|interface) \w+|'.
\ '\s*(\+|-).*|#pragma\s+mark\s+\zs.+)')
winc p " Go to method window
if empty(s:methods)
winc q
echoh WarningMsg
echo 'There are no methods in this file!'
echoh None
return
endif
call setline(1, sort(keys(s:methods), 's:SortByLineNum'))
exe "norm! \<c-w>".line('$').'_'
endf
fun s:SortByLineNum(i1, i2)
let line1 = s:methods[a:i1]
let line2 = s:methods[a:i2]
return line1 == line2 ? 0 : line1 > line2 ? 1 : -1
endf
fun s:SelectMethod()
let number = s:methods[getline('.')]
winc q
winc p
call cursor(number, 1)
endf
fun s:LeaveMethodList()
for [option, value] in items(s:opt)
exe 'let &'.option.'='.value
endfor
let @/ = s:last_search == '' ? '' : s:last_search
unl s:opt s:last_search
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -0,0 +1,87 @@
" File: pum_snippet.vim
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Last Updated: June 12, 2009
" Description: Uses snipMate to jump through function or method objc
" parameters when autocompleting. Used in cocoacomplete.vim.
" This function is invoked whenever pum_snippet is to be used; the keys are
" only mapped when used as the trigger, and then immediately unmapped to avoid
" breaking abbreviations, as well as other things.
fun! objc#pum_snippet#Map()
ino <silent> <buffer> <space> <c-r>=objc#pum_snippet#Trigger(' ')<cr>
if !exists('g:SuperTabMappingForward') " Only map tab if not using supertab.
\ || (g:SuperTabMappingForward != '<tab>' && g:SuperTabMappingForward != '<tab>')
ino <silent> <buffer> <tab> <c-r>=objc#pum_snippet#Trigger("\t")<cr>
endif
ino <silent> <buffer> <return> <c-r>=objc#pum_snippet#Trigger("\n")<cr>
let s:start = col('.')
" Completion menu can only be detected when the popup menu is visible, so
" 'menuone' needs to be temporarily set:
let s:cot = &cot
set cot+=menuone
endf
fun! objc#pum_snippet#Unmap()
call s:UnmapKey('<space>')
call s:UnmapKey('<tab>')
call s:UnmapKey('<return>')
endf
fun s:UnmapKey(key)
if maparg(a:key, 'i') =~? '^<C-R>=objc#pum_snippet#Trigger('
sil exe 'iunmap <buffer> '.a:key
endif
endf
fun! objc#pum_snippet#Trigger(key)
call objc#pum_snippet#Unmap()
if pumvisible()
let line = getline('.')
let col = col('.')
let word = matchstr(line, '\%'.s:start.'c\k\+(.\{-})\%'.col.'c')
if word != ''
let ConvertWord = function('s:ConvertFunction')
elseif match(line, '\%'.s:start.'c\k\+[^()]*:[^()]*\%'.col.'c') != -1
let word = matchstr(line, '\%'.s:start.'c\k\+[^()]*\%'.col.'c')
let ConvertWord = function('s:ConvertMethod')
endif
if word != ''
call s:ResetOptions()
let col -= len(word)
sil exe 's/\V'.escape(word, '\/').'\%#//'
return snipMate#expandSnip(ConvertWord(word), col)
endif
endif
call s:ResetOptions()
return a:key
endf
fun s:ResetOptions()
let &cot = s:cot
unl s:start s:cot
endf
fun s:ConvertFunction(function)
let name = matchstr(a:function, '^\k\+')
let params = matchstr(a:function, '^\k\+(\zs.*')
let snippet = name.'('.substitute(params, '\v(.{-1})(, |\))', '${0:\1}\2', 'g').'${0}'
return s:OrderSnippet(snippet)
endf
fun s:ConvertMethod(method)
if stridx(a:method, ':') == -1 | return a:method | endif
let snippet = substitute(a:method, '\v\k+:\zs.{-}\ze(\s*\k+:|$)', '${0:&}', 'g')
return s:OrderSnippet(snippet)
endf
" Converts "${0} foo ${0} bar ..." to "${1} foo ${2} bar", etc.
fun s:OrderSnippet(snippet)
let snippet = a:snippet
let i = 1
while stridx(snippet, '${0') != -1
let snippet = substitute(snippet, '${0', '${'.i, '')
let i += 1
endw
return snippet
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -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:

2812
dot_vim/autoload/plug.vim Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,433 @@
fun! Filename(...)
let filename = expand('%:t:r')
if filename == '' | return a:0 == 2 ? a:2 : '' | endif
return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g')
endf
fun s:RemoveSnippet()
unl! g:snipPos s:curPos s:snipLen s:endCol s:endLine s:prevLen
\ s:lastBuf s:oldWord
if exists('s:update')
unl s:startCol s:origWordLen s:update
if exists('s:oldVars') | unl s:oldVars s:oldEndCol | endif
endif
aug! snipMateAutocmds
endf
fun snipMate#expandSnip(snip, col)
let lnum = line('.') | let col = a:col
let snippet = s:ProcessSnippet(a:snip)
" Avoid error if eval evaluates to nothing
if snippet == '' | return '' | endif
" Expand snippet onto current position with the tab stops removed
let snipLines = split(substitute(snippet, '$\d\+\|${\d\+.\{-}}', '', 'g'), "\n", 1)
let line = getline(lnum)
let afterCursor = strpart(line, col - 1)
" Keep text after the cursor
if afterCursor != "\t" && afterCursor != ' '
let line = strpart(line, 0, col - 1)
let snipLines[-1] .= afterCursor
else
let afterCursor = ''
" For some reason the cursor needs to move one right after this
if line != '' && col == 1 && &ve != 'all' && &ve != 'onemore'
let col += 1
endif
endif
call setline(lnum, line.snipLines[0])
" Autoindent snippet according to previous indentation
let indent = matchend(line, '^.\{-}\ze\(\S\|$\)') + 1
call append(lnum, map(snipLines[1:], "'".strpart(line, 0, indent - 1)."'.v:val"))
" Open any folds snippet expands into
if &fen | sil! exe lnum.','.(lnum + len(snipLines) - 1).'foldopen' | endif
let [g:snipPos, s:snipLen] = s:BuildTabStops(snippet, lnum, col - indent, indent)
if s:snipLen
aug snipMateAutocmds
au CursorMovedI * call s:UpdateChangedSnip(0)
au InsertEnter * call s:UpdateChangedSnip(1)
aug END
let s:lastBuf = bufnr(0) " Only expand snippet while in current buffer
let s:curPos = 0
let s:endCol = g:snipPos[s:curPos][1]
let s:endLine = g:snipPos[s:curPos][0]
call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
let s:prevLen = [line('$'), col('$')]
if g:snipPos[s:curPos][2] != -1 | return s:SelectWord() | endif
else
unl g:snipPos s:snipLen
" Place cursor at end of snippet if no tab stop is given
let newlines = len(snipLines) - 1
call cursor(lnum + newlines, indent + len(snipLines[-1]) - len(afterCursor)
\ + (newlines ? 0: col - 1))
endif
return ''
endf
" Prepare snippet to be processed by s:BuildTabStops
fun s:ProcessSnippet(snip)
let snippet = a:snip
" Evaluate eval (`...`) expressions.
" Using a loop here instead of a regex fixes a bug with nested "\=".
if stridx(snippet, '`') != -1
while match(snippet, '`.\{-}`') != -1
let snippet = substitute(snippet, '`.\{-}`',
\ substitute(eval(matchstr(snippet, '`\zs.\{-}\ze`')),
\ "\n\\%$", '', ''), '')
endw
let snippet = substitute(snippet, "\r", "\n", 'g')
endif
" Place all text after a colon in a tab stop after the tab stop
" (e.g. "${#:foo}" becomes "${:foo}foo").
" This helps tell the position of the tab stops later.
let snippet = substitute(snippet, '${\d\+:\(.\{-}\)}', '&\1', 'g')
" Update the a:snip so that all the $# become the text after
" the colon in their associated ${#}.
" (e.g. "${1:foo}" turns all "$1"'s into "foo")
let i = 1
while stridx(snippet, '${'.i) != -1
let s = matchstr(snippet, '${'.i.':\zs.\{-}\ze}')
if s != ''
let snippet = substitute(snippet, '$'.i, s.'&', 'g')
endif
let i += 1
endw
if &et " Expand tabs to spaces if 'expandtab' is set.
return substitute(snippet, '\t', repeat(' ', &sts ? &sts : &sw), 'g')
endif
return snippet
endf
" Counts occurences of haystack in needle
fun s:Count(haystack, needle)
let counter = 0
let index = stridx(a:haystack, a:needle)
while index != -1
let index = stridx(a:haystack, a:needle, index+1)
let counter += 1
endw
return counter
endf
" Builds a list of a list of each tab stop in the snippet containing:
" 1.) The tab stop's line number.
" 2.) The tab stop's column number
" (by getting the length of the string between the last "\n" and the
" tab stop).
" 3.) The length of the text after the colon for the current tab stop
" (e.g. "${1:foo}" would return 3). If there is no text, -1 is returned.
" 4.) If the "${#:}" construct is given, another list containing all
" the matches of "$#", to be replaced with the placeholder. This list is
" composed the same way as the parent; the first item is the line number,
" and the second is the column.
fun s:BuildTabStops(snip, lnum, col, indent)
let snipPos = []
let i = 1
let withoutVars = substitute(a:snip, '$\d\+', '', 'g')
while stridx(a:snip, '${'.i) != -1
let beforeTabStop = matchstr(withoutVars, '^.*\ze${'.i.'\D')
let withoutOthers = substitute(withoutVars, '${\('.i.'\D\)\@!\d\+.\{-}}', '', 'g')
let j = i - 1
call add(snipPos, [0, 0, -1])
let snipPos[j][0] = a:lnum + s:Count(beforeTabStop, "\n")
let snipPos[j][1] = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze${'.i.'\D'))
if snipPos[j][0] == a:lnum | let snipPos[j][1] += a:col | endif
" Get all $# matches in another list, if ${#:name} is given
if stridx(withoutVars, '${'.i.':') != -1
let snipPos[j][2] = len(matchstr(withoutVars, '${'.i.':\zs.\{-}\ze}'))
let dots = repeat('.', snipPos[j][2])
call add(snipPos[j], [])
let withoutOthers = substitute(a:snip, '${\d\+.\{-}}\|$'.i.'\@!\d\+', '', 'g')
while match(withoutOthers, '$'.i.'\(\D\|$\)') != -1
let beforeMark = matchstr(withoutOthers, '^.\{-}\ze'.dots.'$'.i.'\(\D\|$\)')
call add(snipPos[j][3], [0, 0])
let snipPos[j][3][-1][0] = a:lnum + s:Count(beforeMark, "\n")
let snipPos[j][3][-1][1] = a:indent + (snipPos[j][3][-1][0] > a:lnum
\ ? len(matchstr(beforeMark, '.*\n\zs.*'))
\ : a:col + len(beforeMark))
let withoutOthers = substitute(withoutOthers, '$'.i.'\ze\(\D\|$\)', '', '')
endw
endif
let i += 1
endw
return [snipPos, i - 1]
endf
fun snipMate#jumpTabStop(backwards)
let leftPlaceholder = exists('s:origWordLen')
\ && s:origWordLen != g:snipPos[s:curPos][2]
if leftPlaceholder && exists('s:oldEndCol')
let startPlaceholder = s:oldEndCol + 1
endif
if exists('s:update')
call s:UpdatePlaceholderTabStops()
else
call s:UpdateTabStops()
endif
" Don't reselect placeholder if it has been modified
if leftPlaceholder && g:snipPos[s:curPos][2] != -1
if exists('startPlaceholder')
let g:snipPos[s:curPos][1] = startPlaceholder
else
let g:snipPos[s:curPos][1] = col('.')
let g:snipPos[s:curPos][2] = 0
endif
endif
let s:curPos += a:backwards ? -1 : 1
" Loop over the snippet when going backwards from the beginning
if s:curPos < 0 | let s:curPos = s:snipLen - 1 | endif
if s:curPos == s:snipLen
let sMode = s:endCol == g:snipPos[s:curPos-1][1]+g:snipPos[s:curPos-1][2]
call s:RemoveSnippet()
return sMode ? "\<tab>" : TriggerSnippet()
endif
call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
let s:endLine = g:snipPos[s:curPos][0]
let s:endCol = g:snipPos[s:curPos][1]
let s:prevLen = [line('$'), col('$')]
return g:snipPos[s:curPos][2] == -1 ? '' : s:SelectWord()
endf
fun s:UpdatePlaceholderTabStops()
let changeLen = s:origWordLen - g:snipPos[s:curPos][2]
unl s:startCol s:origWordLen s:update
if !exists('s:oldVars') | return | endif
" Update tab stops in snippet if text has been added via "$#"
" (e.g., in "${1:foo}bar$1${2}").
if changeLen != 0
let curLine = line('.')
for pos in g:snipPos
if pos == g:snipPos[s:curPos] | continue | endif
let changed = pos[0] == curLine && pos[1] > s:oldEndCol
let changedVars = 0
let endPlaceholder = pos[2] - 1 + pos[1]
" Subtract changeLen from each tab stop that was after any of
" the current tab stop's placeholders.
for [lnum, col] in s:oldVars
if lnum > pos[0] | break | endif
if pos[0] == lnum
if pos[1] > col || (pos[2] == -1 && pos[1] == col)
let changed += 1
elseif col < endPlaceholder
let changedVars += 1
endif
endif
endfor
let pos[1] -= changeLen * changed
let pos[2] -= changeLen * changedVars " Parse variables within placeholders
" e.g., "${1:foo} ${2:$1bar}"
if pos[2] == -1 | continue | endif
" Do the same to any placeholders in the other tab stops.
for nPos in pos[3]
let changed = nPos[0] == curLine && nPos[1] > s:oldEndCol
for [lnum, col] in s:oldVars
if lnum > nPos[0] | break | endif
if nPos[0] == lnum && nPos[1] > col
let changed += 1
endif
endfor
let nPos[1] -= changeLen * changed
endfor
endfor
endif
unl s:endCol s:oldVars s:oldEndCol
endf
fun s:UpdateTabStops()
let changeLine = s:endLine - g:snipPos[s:curPos][0]
let changeCol = s:endCol - g:snipPos[s:curPos][1]
if exists('s:origWordLen')
let changeCol -= s:origWordLen
unl s:origWordLen
endif
let lnum = g:snipPos[s:curPos][0]
let col = g:snipPos[s:curPos][1]
" Update the line number of all proceeding tab stops if <cr> has
" been inserted.
if changeLine != 0
let changeLine -= 1
for pos in g:snipPos
if pos[0] >= lnum
if pos[0] == lnum | let pos[1] += changeCol | endif
let pos[0] += changeLine
endif
if pos[2] == -1 | continue | endif
for nPos in pos[3]
if nPos[0] >= lnum
if nPos[0] == lnum | let nPos[1] += changeCol | endif
let nPos[0] += changeLine
endif
endfor
endfor
elseif changeCol != 0
" Update the column of all proceeding tab stops if text has
" been inserted/deleted in the current line.
for pos in g:snipPos
if pos[1] >= col && pos[0] == lnum
let pos[1] += changeCol
endif
if pos[2] == -1 | continue | endif
for nPos in pos[3]
if nPos[0] > lnum | break | endif
if nPos[0] == lnum && nPos[1] >= col
let nPos[1] += changeCol
endif
endfor
endfor
endif
endf
fun s:SelectWord()
let s:origWordLen = g:snipPos[s:curPos][2]
let s:oldWord = strpart(getline('.'), g:snipPos[s:curPos][1] - 1,
\ s:origWordLen)
let s:prevLen[1] -= s:origWordLen
if !empty(g:snipPos[s:curPos][3])
let s:update = 1
let s:endCol = -1
let s:startCol = g:snipPos[s:curPos][1] - 1
endif
if !s:origWordLen | return '' | endif
let l = col('.') != 1 ? 'l' : ''
if &sel == 'exclusive'
return "\<esc>".l.'v'.s:origWordLen."l\<c-g>"
endif
return s:origWordLen == 1 ? "\<esc>".l.'gh'
\ : "\<esc>".l.'v'.(s:origWordLen - 1)."l\<c-g>"
endf
" This updates the snippet as you type when text needs to be inserted
" into multiple places (e.g. in "${1:default text}foo$1bar$1",
" "default text" would be highlighted, and if the user types something,
" UpdateChangedSnip() would be called so that the text after "foo" & "bar"
" are updated accordingly)
"
" It also automatically quits the snippet if the cursor is moved out of it
" while in insert mode.
fun s:UpdateChangedSnip(entering)
if exists('g:snipPos') && bufnr(0) != s:lastBuf
call s:RemoveSnippet()
elseif exists('s:update') " If modifying a placeholder
if !exists('s:oldVars') && s:curPos + 1 < s:snipLen
" Save the old snippet & word length before it's updated
" s:startCol must be saved too, in case text is added
" before the snippet (e.g. in "foo$1${2}bar${1:foo}").
let s:oldEndCol = s:startCol
let s:oldVars = deepcopy(g:snipPos[s:curPos][3])
endif
let col = col('.') - 1
if s:endCol != -1
let changeLen = col('$') - s:prevLen[1]
let s:endCol += changeLen
else " When being updated the first time, after leaving select mode
if a:entering | return | endif
let s:endCol = col - 1
endif
" If the cursor moves outside the snippet, quit it
if line('.') != g:snipPos[s:curPos][0] || col < s:startCol ||
\ col - 1 > s:endCol
unl! s:startCol s:origWordLen s:oldVars s:update
return s:RemoveSnippet()
endif
call s:UpdateVars()
let s:prevLen[1] = col('$')
elseif exists('g:snipPos')
if !a:entering && g:snipPos[s:curPos][2] != -1
let g:snipPos[s:curPos][2] = -2
endif
let col = col('.')
let lnum = line('.')
let changeLine = line('$') - s:prevLen[0]
if lnum == s:endLine
let s:endCol += col('$') - s:prevLen[1]
let s:prevLen = [line('$'), col('$')]
endif
if changeLine != 0
let s:endLine += changeLine
let s:endCol = col
endif
" Delete snippet if cursor moves out of it in insert mode
if (lnum == s:endLine && (col > s:endCol || col < g:snipPos[s:curPos][1]))
\ || lnum > s:endLine || lnum < g:snipPos[s:curPos][0]
call s:RemoveSnippet()
endif
endif
endf
" This updates the variables in a snippet when a placeholder has been edited.
" (e.g., each "$1" in "${1:foo} $1bar $1bar")
fun s:UpdateVars()
let newWordLen = s:endCol - s:startCol + 1
let newWord = strpart(getline('.'), s:startCol, newWordLen)
if newWord == s:oldWord || empty(g:snipPos[s:curPos][3])
return
endif
let changeLen = g:snipPos[s:curPos][2] - newWordLen
let curLine = line('.')
let startCol = col('.')
let oldStartSnip = s:startCol
let updateTabStops = changeLen != 0
let i = 0
for [lnum, col] in g:snipPos[s:curPos][3]
if updateTabStops
let start = s:startCol
if lnum == curLine && col <= start
let s:startCol -= changeLen
let s:endCol -= changeLen
endif
for nPos in g:snipPos[s:curPos][3][(i):]
" This list is in ascending order, so quit if we've gone too far.
if nPos[0] > lnum | break | endif
if nPos[0] == lnum && nPos[1] > col
let nPos[1] -= changeLen
endif
endfor
if lnum == curLine && col > start
let col -= changeLen
let g:snipPos[s:curPos][3][i][1] = col
endif
let i += 1
endif
" "Very nomagic" is used here to allow special characters.
call setline(lnum, substitute(getline(lnum), '\%'.col.'c\V'.
\ escape(s:oldWord, '\'), escape(newWord, '\&'), ''))
endfor
if oldStartSnip != s:startCol
call cursor(0, startCol + s:startCol - oldStartSnip)
endif
let s:oldWord = newWord
let g:snipPos[s:curPos][2] = newWordLen
endf
" vim:noet:sw=4:ts=4:ft=vim

309
dot_vim/buftabs.vim Normal file
View file

@ -0,0 +1,309 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" buftabs (C) 2006 Ico Doornekamp
"
" This program is free software; you can redistribute it and/or modify it
" under the terms of the GNU General Public License as published by the Free
" Software Foundation; either version 2 of the License, or (at your option)
" any later version.
"
" This program is distributed in the hope that it will be useful, but WITHOUT
" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
" more details.
"
" Introduction
" ------------
"
" This is a simple script that shows a tabs-like list of buffers in the bottom
" of the window. The biggest advantage of this script over various others is
" that it does not take any lines away from your terminal, leaving more space
" for the document you're editing. The tabs are only visible when you need
" them - when you are switchin between buffers.
"
" Usage
" -----
"
" This script draws buffer tabs on vim startup, when a new buffer is created
" and when switching between buffers.
"
" It might be handy to create a few maps for easy switching of buffers in your
" .vimrc file. For example, using F1 and F2 keys:
"
" noremap <f1> :bprev<CR>
" noremap <f2> :bnext<CR>
"
" or using control-left and control-right keys:
"
" :noremap <C-left> :bprev<CR>
" :noremap <C-right> :bnext<CR>
"
"
" The following extra configuration variables are availabe:
"
" * g:buftabs_only_basename
"
" Define this variable to make buftabs only print the filename of each buffer,
" omitting the preceding directory name. Add to your .vimrc:
"
" :let g:buftabs_only_basename=1
"
"
" * g:buftabs_in_statusline
"
" Define this variable to make the plugin show the buftabs in the statusline
" instead of the command line. It is a good idea to configure vim to show
" the statusline as well when only one window is open. Add to your .vimrc:
"
" set laststatus=2
" :let g:buftabs_in_statusline=1
"
"
" * g:buftabs_active_highlight_group
" * g:buftabs_inactive_highlight_group
"
" The name of a highlight group (:help highligh-groups) which is used to
" show the name of the current active buffer and of all other inactive
" buffers. If these variables are not defined, no highlighting is used.
" (Highlighting is only functional when g:buftabs_in_statusline is enabled)
"
" :let g:buftabs_active_highlight_group="Visual"
"
"
" * g:buftabs_marker_start [
" * g:buftabs_marker_end ]
" * g:buftabs_separator -
"
" These strings are drawn around each tab as separators.
"
" :let g:buftabs_separator = "."
" :let g:buftabs_marker_start = "("
" :let g:buftabs_marker_end = ")"
"
"
" Changelog
" ---------
"
" 0.1 2006-09-22 Initial version
"
" 0.2 2006-09-22 Better handling when the list of buffers is longer then the
" window width.
"
" 0.3 2006-09-27 Some cleanups, set 'hidden' mode by default
"
" 0.4 2007-02-26 Don't draw buftabs until VimEnter event to avoid clutter at
" startup in some circumstances
"
" 0.5 2007-02-26 Added option for showing only filenames without directories
" in tabs
"
" 0.6 2007-03-04 'only_basename' changed to a global variable. Removed
" functions and add event handlers instead. 'hidden' mode
" broke some things, so is disabled now. Fixed documentation
"
" 0.7 2007-03-07 Added configuration option to show tabs in statusline
" instead of cmdline
"
" 0.8 2007-04-02 Update buftabs when leaving insertmode
"
" 0.9 2007-08-22 Now compatible with older Vim versions < 7.0
"
" 0.10 2008-01-26 Added GPL license
"
" 0.11 2008-02-29 Added optional syntax highlighting to active buffer name
"
" 0.12 2009-03-18 Fixed support for split windows
"
" 0.13 2009-05-07 Store and reuse right-aligned part of original statusline
"
" 0.14 2010-01-28 Fixed bug that caused buftabs in command line being
" overwritten when 'hidden' mode is enabled.
"
" 0.15 2010-02-16 Fixed window width handling bug which caused strange
" behaviour in combination with the bufferlist plugin.
" Fixed wrong buffer display when deleting last window.
" Added extra options for tabs style and highlighting.
"
" 0.16 2010-02-28 Fixed bug causing errors when using buftabs in vim
" diff mode.
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let w:buftabs_enabled = 0
let w:original_statusline = matchstr(&statusline, "%=.*")
"
" Don't bother when in diff mode
"
if &diff
finish
endif
"
" Called on VimEnter event
"
function! Buftabs_enable()
let w:buftabs_enabled = 1
endfunction
"
" Persistent echo to avoid overwriting of status line when 'hidden' is enabled
"
function! Pecho(msg)
let s:hold_ut=&ut|let &ut=1
let s:Pecho=a:msg
aug Pecho
au CursorHold * ec s:Pecho
\|let &ut=s:hold_ut
\|aug Pecho|exe 'au!'|aug END|aug! Pecho
aug END
endf
"
" Draw the buftabs
"
function! Buftabs_show(deleted_buf)
let l:i = 1
let l:list = ''
let l:start = 0
let l:end = 0
if ! exists("w:from")
let w:from = 0
endif
if ! exists("w:buftabs_enabled")
return
endif
" Walk the list of buffers
while(l:i <= bufnr('$'))
" Only show buffers in the list, and omit help screens
if buflisted(l:i) && getbufvar(l:i, "&modifiable") && a:deleted_buf != l:i
" Get the name of the current buffer, and escape characters that might
" mess up the statusline
if exists("g:buftabs_only_basename")
let l:name = fnamemodify(bufname(l:i), ":t")
else
let l:name = bufname(l:i)
endif
let l:name = substitute(l:name, "%", "%%", "g")
" Append the current buffer number and name to the list. If the buffer
" is the active buffer, enclose it in some magick characters which will
" be replaced by markers later. If it is modified, it is appended with
" an exclaimation mark
if winbufnr(winnr()) == l:i
let l:start = strlen(l:list)
let l:list = l:list . "\x01"
else
let l:list = l:list . ' '
endif
let l:buftabs_separator = "-"
if exists("g:buftabs_separator")
let l:buftabs_separator = g:buftabs_separator
endif
let l:list = l:list . l:i . l:buftabs_separator
let l:list = l:list . l:name
if getbufvar(l:i, "&modified") == 1
let l:list = l:list . "!"
endif
if winbufnr(winnr()) == l:i
let l:list = l:list . "\x02"
let l:end = strlen(l:list)
else
let l:list = l:list . ' '
endif
end
let l:i = l:i + 1
endwhile
" If the resulting list is too long to fit on the screen, chop
" out the appropriate part
let l:width = winwidth(0) - 12
if(l:start < w:from)
let w:from = l:start - 1
endif
if l:end > w:from + l:width
let w:from = l:end - l:width
endif
let l:list = strpart(l:list, w:from, l:width)
" Replace the magic characters by visible markers for highlighting the
" current buffer. The markers can be simple characters like square brackets,
" but can also be special codes with highlight groups
let l:buftabs_marker_start = "["
if exists("g:buftabs_marker_start")
let l:buftabs_marker_start = g:buftabs_marker_start
endif
let l:buftabs_marker_end = "]"
if exists("g:buftabs_marker_end")
let l:buftabs_marker_end = g:buftabs_marker_end
endif
if exists("g:buftabs_active_highlight_group")
if exists("g:buftabs_in_statusline")
let l:buftabs_marker_start = "%#" . g:buftabs_active_highlight_group . "#" . l:buftabs_marker_start
let l:buftabs_marker_end = l:buftabs_marker_end . "%##"
end
end
if exists("g:buftabs_inactive_highlight_group")
if exists("g:buftabs_in_statusline")
let l:list = '%#' . g:buftabs_inactive_highlight_group . '#' . l:list
let l:list .= '%##'
let l:buftabs_marker_end = l:buftabs_marker_end . '%#' . g:buftabs_inactive_highlight_group . '#'
end
end
let l:list = substitute(l:list, "\x01", l:buftabs_marker_start, 'g')
let l:list = substitute(l:list, "\x02", l:buftabs_marker_end, 'g')
" Show the list. The buftabs_in_statusline variable determines of the list
" is displayed in the command line (volatile) or in the statusline
" (persistent)
if exists("g:buftabs_in_statusline")
let &l:statusline = l:list . w:original_statusline
else
redraw
call Pecho(l:list)
end
endfunction
" Hook to events to show buftabs at startup, when creating and when switching
" buffers
autocmd VimEnter * call Buftabs_enable()
autocmd VimEnter,BufNew,BufEnter,BufWritePost * call Buftabs_show(-1)
autocmd BufDelete * call Buftabs_show(expand('<abuf>'))
if version >= 700
autocmd InsertLeave,VimResized * call Buftabs_show(-1)
end
" vi: ts=2 sw=2

18
dot_vim/charm.vim Normal file
View file

@ -0,0 +1,18 @@
fu! SendToCharm(subject,mood)
if a:subject == ""
let subject=input("Subject: ")
else
let subject=a:subject
endif
if a:mood == ""
let mood=input("Mood: ")
else
let mood=a:mood
endif
exe "w!"
exe "!cat % | charm -q -s \"".subject."\" -m \"".mood."\""
endf
if !exists(":PostToLJ")
command PostToLJ :call SendToCharm("","")
endif

327
dot_vim/closetag.vim Normal file
View file

@ -0,0 +1,327 @@
" File: closetag.vim
" Summary: Functions and mappings to close open HTML/XML tags
" Uses: <C-_> -- close matching open tag
" Author: Steven Mueller <diffusor@ugcs.caltech.edu>
" Last Modified: Tue May 24 13:29:48 PDT 2005
" Version: 0.9.1
" XXX - breaks if close attempted while XIM is in preedit mode
" TODO - allow usability as a global plugin -
" Add g:unaryTagsStack - always contains html tags settings
" and g:closetag_default_xml - user should define this to default to xml
" When a close is attempted but b:unaryTagsStack undefined,
" use b:closetag_html_style to determine if the file is to be treated
" as html or xml. Failing that, check the filetype for xml or html.
" Finally, default to g:closetag_html_style.
" If the file is html, let b:unaryTagsStack=g:unaryTagsStack
" otherwise, let b:unaryTagsStack=""
" TODO - make matching work for all comments
" -- kinda works now, but needs syn sync minlines to be very long
" -- Only check whether in syntax in the beginning, then store comment tags
" in the tagstacks to determine whether to move into or out of comment mode
" TODO - The new normal mode mapping clears recent messages with its <ESC>, and
" it doesn't fix the null-undo issue for vim 5.7 anyway.
" TODO - make use of the following neat features:
" -- the ternary ?: operator
" -- :echomsg and :echoerr
" -- curly brace expansion for variables and function name definitions?
" -- check up on map <blah> \FuncName
"
" Description:
" This script eases redundant typing when writing html or xml files (even if
" you're very good with ctrl-p and ctrl-n :). Hitting ctrl-_ will initiate a
" search for the most recent open tag above that is not closed in the
" intervening space and then insert the matching close tag at the cursor. In
" normal mode, the close tag is inserted one character after cursor rather than
" at it, as if a<C-_> had been used. This allows putting close tags at the
" ends of lines while in normal mode, but disallows inserting them in the
" first column.
"
" For HTML, a configurable list of tags are ignored in the matching process.
" By default, the following tags will not be matched and thus not closed
" automatically: area, base, br, dd, dt, hr, img, input, link, meta, and
" param.
"
" For XML, all tags must have a closing match or be terminated by />, as in
" <empty-element/>. These empty element tags are ignored for matching.
"
" Comment checking is now handled by vim's internal syntax checking. If tag
" closing is initiated outside a comment, only tags outside of comments will
" be matched. When closing tags in comments, only tags within comments will
" be matched, skipping any non-commented out code (wee!). However, the
" process of determining the syntax ID of an arbitrary position can still be
" erroneous if a comment is not detected because the syntax highlighting is
" out of sync, or really slow if syn sync minlines is large.
" Set the b:closetag_disable_synID variable to disable this feature if you
" have really big chunks of comment in your code and closing tags is too slow.
"
" If syntax highlighting is not enabled, comments will not be handled very
" well. Commenting out HTML in certain ways may cause a "tag mismatch"
" message and no completion. For example, '<!--a href="blah">link!</a-->'
" between the cursor and the most recent unclosed open tag above causes
" trouble. Properly matched well formed tags in comments don't cause a
" problem.
"
" Install:
" To use, place this file in your standard vim scripts directory, and source
" it while editing the file you wish to close tags in. If the filetype is not
" set or the file is some sort of template with embedded HTML, you may force
" HTML style tag matching by first defining the b:closetag_html_style buffer
" variable. Otherwise, the default is XML style tag matching.
"
" Example:
" :let b:closetag_html_style=1
" :source ~/.vim/scripts/closetag.vim
"
" For greater convenience, load this script in an autocommand:
" :au Filetype html,xml,xsl source ~/.vim/scripts/closetag.vim
"
" Also, set noignorecase for html files or edit b:unaryTagsStack to match your
" capitalization style. You may set this variable before or after loading the
" script, or simply change the file itself.
"
" Configuration Variables:
"
" b:unaryTagsStack Buffer local string containing a whitespace
" seperated list of element names that should be
" ignored while finding matching closetags. Checking
" is done according to the current setting of the
" ignorecase option.
"
" b:closetag_html_style Define this (as with let b:closetag_html_style=1)
" and source the script again to set the
" unaryTagsStack to its default value for html.
"
" b:closetag_disable_synID Define this to disable comment checking if tag
" closing is too slow. This can be set or unset
" without having to source again.
"
" Changelog:
" May 24, 2005 Tuesday
" * Changed function names to be script-local to avoid conflicts with other
" scripts' stack implementations.
"
" June 07, 2001 Thursday
" * Added comment handling. Currently relies on synID, so if syn sync
" minlines is small, the chance for failure is high, but if minlines is
" large, tagclosing becomes rather slow...
"
" * Changed normal mode closetag mapping to use <C-R> in insert mode
" rather than p in normal mode. This has 2 implications:
" - Tag closing no longer clobbers the unnamed register
" - When tag closing fails or finds no match, no longer adds to the undo
" buffer for recent vim 6.0 development versions.
" - However, clears the last message when closing tags in normal mode
"
" * Changed the closetag_html_style variable to be buffer-local rather than
" global.
"
" * Expanded documentation
"------------------------------------------------------------------------------
" User configurable settings
"------------------------------------------------------------------------------
" if html, don't close certain tags. Works best if ignorecase is set.
" otherwise, capitalize these elements according to your html editing style
if !exists("b:unaryTagsStack") || exists("b:closetag_html_style")
if &filetype == "html" || exists("b:closetag_html_style")
let b:unaryTagsStack="area base br dd dt hr img input link meta param"
else " for xsl and xsl
let b:unaryTagsStack=""
endif
endif
" Has this already been loaded?
if exists("loaded_closetag")
finish
endif
let loaded_closetag=1
" set up mappings for tag closing
inoremap <C-_> <C-R>=GetCloseTag()<CR>
map <C-_> a<C-_><ESC>
"------------------------------------------------------------------------------
" Tag closer - uses the stringstack implementation below
"------------------------------------------------------------------------------
" Returns the most recent unclosed tag-name
" (ignores tags in the variable referenced by a:unaryTagsStack)
function! GetLastOpenTag(unaryTagsStack)
" Search backwards through the file line by line using getline()
" Overall strategy (moving backwards through the file from the cursor):
" Push closing tags onto a stack.
" On an opening tag, if the tag matches the stack top, discard both.
" -- if the tag doesn't match, signal an error.
" -- if the stack is empty, use this tag
let linenum=line(".")
let lineend=col(".") - 1 " start: cursor position
let first=1 " flag for first line searched
let b:TagStack="" " main stack of tags
let startInComment=s:InComment()
let tagpat='</\=\(\k\|[-:]\)\+\|/>'
" Search for: closing tags </tag, opening tags <tag, and unary tag ends />
while (linenum>0)
" Every time we see an end-tag, we push it on the stack. When we see an
" open tag, if the stack isn't empty, we pop it and see if they match.
" If no, signal an error.
" If yes, continue searching backwards.
" If stack is empty, return this open tag as the one that needs closing.
let line=getline(linenum)
if first
let line=strpart(line,0,lineend)
else
let lineend=strlen(line)
endif
let b:lineTagStack=""
let mpos=0
let b:TagCol=0
" Search the current line in the forward direction, pushing any tags
" onto a special stack for the current line
while (mpos > -1)
let mpos=matchend(line,tagpat)
if mpos > -1
let b:TagCol=b:TagCol+mpos
let tag=matchstr(line,tagpat)
if exists("b:closetag_disable_synID") || startInComment==s:InCommentAt(linenum, b:TagCol)
let b:TagLine=linenum
call s:Push(matchstr(tag,'[^<>]\+'),"b:lineTagStack")
endif
"echo "Tag: ".tag." ending at position ".mpos." in '".line."'."
let lineend=lineend-mpos
let line=strpart(line,mpos,lineend)
endif
endwhile
" Process the current line stack
while (!s:EmptystackP("b:lineTagStack"))
let tag=s:Pop("b:lineTagStack")
if match(tag, "^/") == 0 "found end tag
call s:Push(tag,"b:TagStack")
"echo linenum." ".b:TagStack
elseif s:EmptystackP("b:TagStack") && !s:Instack(tag, a:unaryTagsStack) "found unclosed tag
return tag
else
let endtag=s:Peekstack("b:TagStack")
if endtag == "/".tag || endtag == "/"
call s:Pop("b:TagStack") "found a open/close tag pair
"echo linenum." ".b:TagStack
elseif !s:Instack(tag, a:unaryTagsStack) "we have a mismatch error
echohl Error
echon "\rError:"
echohl None
echo " tag mismatch: <".tag."> doesn't match <".endtag.">. (Line ".linenum." Tagstack: ".b:TagStack.")"
return ""
endif
endif
endwhile
let linenum=linenum-1 | let first=0
endwhile
" At this point, we have exhausted the file and not found any opening tag
echo "No opening tags."
return ""
endfunction
" Returns closing tag for most recent unclosed tag, respecting the
" current setting of b:unaryTagsStack for tags that should not be closed
function! GetCloseTag()
let tag=GetLastOpenTag("b:unaryTagsStack")
if tag == ""
return ""
else
return "</".tag.">"
endif
endfunction
" return 1 if the cursor is in a syntactically identified comment field
" (fails for empty lines: always returns not-in-comment)
function! s:InComment()
return synIDattr(synID(line("."), col("."), 0), "name") =~ 'Comment'
endfunction
" return 1 if the position specified is in a syntactically identified comment field
function! s:InCommentAt(line, col)
return synIDattr(synID(a:line, a:col, 0), "name") =~ 'Comment'
endfunction
"------------------------------------------------------------------------------
" String Stacks
"------------------------------------------------------------------------------
" These are strings of whitespace-separated elements, matched using the \< and
" \> patterns after setting the iskeyword option.
"
" The sname argument should contain a symbolic reference to the stack variable
" on which method should operate on (i.e., sname should be a string containing
" a fully qualified (ie: g:, b:, etc) variable name.)
" Helper functions
function! s:SetKeywords()
let g:IsKeywordBak=&iskeyword
let &iskeyword="33-255"
endfunction
function! s:RestoreKeywords()
let &iskeyword=g:IsKeywordBak
endfunction
" Push el onto the stack referenced by sname
function! s:Push(el, sname)
if !s:EmptystackP(a:sname)
exe "let ".a:sname."=a:el.' '.".a:sname
else
exe "let ".a:sname."=a:el"
endif
endfunction
" Check whether the stack is empty
function! s:EmptystackP(sname)
exe "let stack=".a:sname
if match(stack,"^ *$") == 0
return 1
else
return 0
endif
endfunction
" Return 1 if el is in stack sname, else 0.
function! s:Instack(el, sname)
exe "let stack=".a:sname
call s:SetKeywords()
let m=match(stack, "\\<".a:el."\\>")
call s:RestoreKeywords()
if m < 0
return 0
else
return 1
endif
endfunction
" Return the first element in the stack
function! s:Peekstack(sname)
call s:SetKeywords()
exe "let stack=".a:sname
let top=matchstr(stack, "\\<.\\{-1,}\\>")
call s:RestoreKeywords()
return top
endfunction
" Remove and return the first element in the stack
function! s:Pop(sname)
if s:EmptystackP(a:sname)
echo "Error! Stack ".a:sname." is empty and can't be popped."
return ""
endif
exe "let stack=".a:sname
" Find the first space, loc is 0-based. Marks the end of 1st elt in stack.
call s:SetKeywords()
let loc=matchend(stack,"\\<.\\{-1,}\\>")
exe "let ".a:sname."=strpart(stack, loc+1, strlen(stack))"
let top=strpart(stack, match(stack, "\\<"), loc)
call s:RestoreKeywords()
return top
endfunction
function! s:Clearstack(sname)
exe "let ".a:sname."=''"
endfunction

34
dot_vim/coc-settings.json Normal file
View file

@ -0,0 +1,34 @@
{
"suggest.timeout": 5000,
"suggest.enablePreview": true,
"suggest.maxPreviewWidth": 70,
"diagnostic.displayByAle": false,
"diagnostic.checkCurrentLine": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true,
"python.linting.mypyArgs": ["--ignore-missing-imports"],
"python.venvPath": "~/.virtualenvs",
"python.analysis.typeCheckingMode": "off",
"suggest.detailField": "abbr",
"suggest.snippetIndicator": "",
"rust-analyzer.server.path": "rust-analyzer",
"rust-analyzer.inlayHints.enable": false,
"languageserver": {
"ccls": {
"command": "ccls",
"filetypes": ["c", "cc", "cpp", "cuda", "objc", "objcpp"],
"rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"],
"initializationOptions": {
"cache": {
"directory": ".ccls-cache"
}
}
},
"golang": {
"command": "gopls",
"rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"],
"filetypes": ["go"]
}
}
}

110
dot_vim/colors/barak.vim Normal file
View file

@ -0,0 +1,110 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" File: "/home/michener/.vim/barak.vim"
" Copyright (C) 2008, Barak Michener <barak@photonzero.com>
" Modified from colorscheme "dante":
" Copyright (C) 2002, Caciano Machado <caciano@inf.ufrgs.br>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colorscheme Option:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
hi clear
if exists("syntax on")
syntax reset
endif
let g:colors_name = "barak"
" General colors
hi Normal ctermfg=gray guifg=grey75 guibg=black
hi Directory term=bold ctermfg=blue guifg=royalblue
hi ErrorMsg term=standout ctermfg=white ctermbg=red guifg=white guibg=red3
"hi NonText term=bold ctermfg=darkgray guibg=gray3 guifg=gray20
hi NonText term=bold ctermfg=gray guibg=gray3 guifg=gray40
hi SpecialKey term=bold ctermfg=darkgray guifg=gray30
hi LineNr term=underline ctermfg=darkgray guifg=ivory4 guibg=gray4
hi IncSearch term=reverse cterm=reverse gui=reverse,bold guifg=darkgoldenrod2
hi Search term=reverse ctermfg=black ctermbg=yellow guifg=gray10 guibg=gold2
hi Visual term=bold,reverse cterm=bold,reverse ctermfg=gray ctermbg=black gui=bold,reverse guifg=gray40 guibg=black
hi VisualNOS term=bold,underline cterm=bold,underline gui=bold,underline
hi MoreMsg term=bold ctermfg=green gui=bold guifg=olivedrab1
hi ModeMsg term=bold ctermfg=red cterm=bold gui=bold guifg=red
hi Question term=standout ctermfg=green gui=bold guifg=olivedrab1
hi WarningMsg term=standout ctermfg=red gui=bold guifg=red3
hi WildMenu term=standout ctermfg=black ctermbg=yellow guifg=black guibg=gold2
hi Folded term=standout ctermfg=blue ctermbg=white guifg=royalblue1 guibg=white
hi FoldColumn term=standout ctermfg=blue ctermbg=white guifg=royalblue3 guibg=white
hi DiffAdd term=bold ctermbg=blue guibg=royalblue2
hi DiffChange term=bold ctermbg=darkmagenta guibg=maroon
hi DiffDelete term=bold cterm=bold ctermfg=lightblue ctermbg=cyan gui=bold guifg=lightblue guibg=cyan4
hi DiffText term=reverse cterm=bold ctermbg=red gui=bold guibg=red3
hi Cursor guifg=bg guibg=fg
hi CursorLine term=NONE cterm=bold guibg=grey20
"hi lCursor guifg=bg guibg=fg
hi StatusLine term=reverse cterm=reverse gui=reverse guifg=gray60
hi StatusLineNC term=reverse cterm=reverse gui=reverse guifg=gray40
hi VertSplit term=reverse cterm=reverse gui=bold,reverse guifg=gray40
hi Title term=bold ctermfg=magenta gui=bold guifg=aquamarine
if version >= 700
hi Pmenu ctermfg=white ctermbg=blue guifg=white guibg=MidnightBlue
hi PmenuSel ctermfg=darkblue ctermbg=white guibg=white guifg=MidnightBlue
hi PmenuSbar ctermfg=lightgray ctermbg=darkgray
hi PmenuThumb cterm=reverse
hi WildMenu term=standout ctermfg=white ctermbg=blue
endif
" syntax hi colors
hi Comment term=bold ctermfg=darkgreen guifg=ForestGreen
hi PreProc term=underline ctermfg=darkmagenta guifg=magenta3
hi makoDelim term=underline ctermfg=darkyellow guifg=goldenrod1 guibg=gray25
hi makoAttributeKey term=underline ctermfg=darkcyan gui=bold guifg=turquoise3 guibg=gray25
hi makoAttributeValue term=underline ctermfg=red guifg=firebrick3 guibg=gray25
hi makoText ctermfg=gray guifg=gray55 guibg=gray25
hi makoEnd term=bold ctermfg=blue gui=bold guifg=RoyalBlue1 guibg=gray25
hi makoComment term=bold ctermfg=darkgreen guifg=ForestGreen guibg=gray25
hi makoEscape term=underline ctermfg=brown guifg=khaki3 guibg=gray25
hi Constant term=underline ctermfg=red guifg=#b62f61
hi String term=underline ctermfg=red guifg=firebrick3
hi Boolean term=underline ctermfg=magenta guifg=LightSalmon1
"hi Type term=underline ctermfg=darkcyan gui=none guifg=CadetBlue3
hi Type term=underline ctermfg=darkcyan gui=bold guifg=turquoise3
hi Statement term=bold ctermfg=blue gui=bold guifg=RoyalBlue1
hi Identifier term=underline ctermfg=darkcyan guifg=DeepSkyBlue
hi Function ctermfg=darkcyan gui=bold guifg=MediumPurple2
hi Ignore term=bold ctermfg=darkgray gui=bold guifg=gray45
hi Special term=underline ctermfg=brown guifg=khaki3
hi Error term=reverse ctermfg=gray ctermbg=red guifg=gray guibg=red3
hi Todo term=standout ctermfg=black ctermbg=yellow gui=bold guifg=gray10 guibg=yellow4
hi Underlined term=underline cterm=underline ctermfg=blue gui=underline guifg=slateblue
hi Number term=underline ctermfg=darkyellow guifg=goldenrod1
" syntax hi links
hi link String Constant
hi link Character Constant
hi link Number Constant
"hi link Boolean Constant
hi link javaScriptNull Special
hi link Float Number
"hi link Function Identifier
hi link Number Constant
hi link Conditional Statement
hi link Repeat Statement
hi link Label Statement
hi link Keyword Statement
hi link Exception Statement
hi link Operator Statement
hi link Include PreProc
"hi link Define PreProc
hi link Define Statement
hi link Macro PreProc
hi link PreCondit PreProc
"hi link StorageClass Type
hi link StorageClass Statement
"hi link Structure Type
hi link Structure Statement
hi link Typedef Type
hi link Tag Special
hi link SpecialChar Special
hi link Delimiter Special
hi link SpecialComment Special
hi link Debug Special
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

434
dot_vim/colors/baraknew.vim Normal file
View file

@ -0,0 +1,434 @@
" Vim color file
" Maintainer: Barak Michener <me@barakmich.com>
" Modified From: "lucius.vim" by Jonathan Filip <jfilip1024@gmail.com>
" Last Modified: Tue Mar 16 18:11:08 PDT 2010
" Version: 1.0
"
" GUI / 256 color terminal
"
" I started out trying to combine my favorite parts of other schemes and ended
" up with this (oceandeep, moria, peaksea, wombat, zenburn).
"
" This file also tries to have descriptive comments for each higlighting group
" so it is easy to understand what each part does.
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name="baraknew"
" Some other colors to save
" blue: 3eb8e5
" green: 92d400
" c green: d5f876, cae682
" new blue: 002D62
" new gray: CCCCCC
" Base color
" ----------
hi Normal guifg=#e0e0e0 guibg=#121212
hi Normal ctermfg=253 ctermbg=NONE
" Comment Group
" -------------
" any comment
hi Comment guifg=#238e23 gui=italic
hi Comment ctermfg=34 cterm=italic
" Constant Group
" --------------
" any constant
hi Constant guifg=#e3ac3d gui=none
hi Constant ctermfg=172 cterm=none
" strings
hi String guifg=#f05656 gui=none
hi String ctermfg=203 cterm=none
" character constant
hi Character guifg=#e3ac3d gui=none
hi Character ctermfg=172 cterm=none
" numbers decimal/hex
hi Number guifg=#eead0e gui=none
hi Number ctermfg=214 cterm=none
" true, false
hi Boolean guifg=#e1634f gui=none
hi Boolean ctermfg=203 cterm=none
" float
hi Float guifg=#8cd0d3 gui=none
hi Float ctermfg=116 cterm=none
" Identifier Group
" ----------------
" any variable name
hi Identifier guifg=#00bfff gui=none
hi Identifier ctermfg=39 cterm=none
" function, method, class
"hi Function guifg=#8e72c7 gui=none
"hi Function ctermfg=98 cterm=none
hi Function guifg=#c5a6ff gui=none
hi Function ctermfg=141 cterm=none
" Statement Group
" ---------------
" any statement
hi Statement guifg=#4876ff gui=bold
hi Statement ctermfg=33 cterm=bold
" if, then, else
"XXX Test this out
"hi Conditional guifg=#b3d38c gui=none
"hi Conditional ctermfg=150 cterm=none
hi Conditional guifg=#5fa6e8 gui=bold
hi Conditional ctermfg=75 cterm=bold
" try, catch, throw, raise
"XXX Test this out
"hi Exception guifg=#b3d38c gui=none
"hi Exception ctermfg=150 cterm=none
hi Exception guifg=#5fa6e8 gui=bold
hi Exception ctermfg=75 cterm=bold
" for, while, do
"XXX Test this out
"hi Repeat guifg=#b3d38c gui=none
"hi Repeat ctermfg=150 cterm=none
hi Repeat guifg=#5fa6e8 gui=bold
hi Repeat ctermfg=75 cterm=bold
" case, default
hi Label guifg=#4876ff gui=bold
hi Label ctermfg=69 cterm=bold
" sizeof, +, *
"hi Operator guifg=#b3d38c gui=none
"hi Operator ctermfg=150 cterm=none
hi Operator guifg=#5fa6e8 gui=bold
hi Operator ctermfg=75 cterm=bold
" any other keyword
hi Keyword guifg=#b3d38c gui=none
hi Keyword ctermfg=150 cterm=none
" Preprocessor Group
" ------------------
" generic preprocessor
hi PreProc guifg=#e9dfaf gui=none
hi PreProc ctermfg=223 cterm=none
" #include
hi Include guifg=#e9dfaf gui=none
hi Include ctermfg=223 cterm=none
" #define
hi Define guifg=#e9dfaf gui=none
hi Define ctermfg=223 cterm=none
" same as define
hi Macro guifg=#e9dfaf gui=none
hi Macro ctermfg=223 cterm=none
" #if, #else, #endif
hi PreCondit guifg=#e9dfaf gui=none
hi PreCondit ctermfg=223 cterm=none
" Type Group
" ----------
" int, long, char
hi Type guifg=#73e1e6 gui=none
hi Type ctermfg=116 cterm=none
" static, register, volative
hi StorageClass guifg=#66b7e1 gui=none
hi StorageClass ctermfg=116 cterm=none
" struct, union, enum
hi Structure guifg=#73e1e6 gui=none
hi Structure ctermfg=116 cterm=none
" typedef
hi Typedef guifg=#73e1e6 gui=none
hi Typedef ctermfg=116 cterm=none
" classes? b2ad50/143
hi Class guifg=#00afff gui=none
hi Class ctermfg=39 cterm=none
hi link cCustomClass Class
hi link javaCustomClass Class
" Special Group
" -------------
" any special symbol
"hi Special guifg=#cca3b3 gui=none
"hi Special ctermfg=227 cterm=none
hi Special guifg=#c2b742 gui=none
hi Special ctermfg=179 cterm=none
" special character in a constant
hi SpecialChar guifg=#c2b742 gui=none
hi SpecialChar ctermfg=179 cterm=none
" things you can CTRL-]
hi Tag guifg=#c2b742 gui=none
hi Tag ctermfg=179 cterm=none
" character that needs attention
hi Delimiter guifg=#c2b742 gui=none
hi Delimiter ctermfg=179 cterm=none
" special things inside a comment
hi SpecialComment guifg=#c2b742 gui=none
hi SpecialComment ctermfg=179 cterm=none
" debugging statements
hi Debug guifg=#c2b742 guibg=NONE gui=none
hi Debug ctermfg=179 ctermbg=NONE cterm=none
" Underlined Group
" ----------------
" text that stands out, html links
hi Underlined guifg=fg gui=underline
hi Underlined ctermfg=fg cterm=underline
" Ignore Group
" ------------
" left blank, hidden
hi Ignore guifg=bg
hi Ignore ctermfg=0
" Error Group
" -----------
" any erroneous construct
hi Error guifg=#e37170 guibg=#432323 gui=none
hi Error ctermfg=167 ctermbg=52 cterm=none
" Todo Group
" ----------
" todo, fixme, note, xxx
hi Todo guifg=#efefaf guibg=#434323 gui=bold
hi Todo ctermfg=229 ctermbg=58 cterm=bold
" Spelling
" --------
" word not recognized
hi SpellBad guisp=#ee0000 gui=undercurl
hi SpellBad ctermbg=9 cterm=undercurl
" word not capitalized
hi SpellCap guisp=#eeee00 gui=undercurl
hi SpellCap ctermbg=12 cterm=undercurl
" rare word
hi SpellRare guisp=#ffa500 gui=undercurl
hi SpellRare ctermbg=13 cterm=undercurl
" wrong spelling for selected region
hi SpellLocal guisp=#ffa500 gui=undercurl
hi SpellLocal ctermbg=14 cterm=undercurl
" Cursor
" ------
" character under the cursor
hi Cursor guifg=bg guibg=#a3e3ed
hi Cursor ctermfg=0 ctermbg=153
" like cursor, but used when in IME mode
hi CursorIM guifg=bg guibg=#96cdcd
hi CursorIM ctermfg=0 ctermbg=116
" cursor column
hi CursorColumn guifg=NONE guibg=#202438 gui=none
hi CursorColumn ctermfg=NONE ctermbg=236 cterm=none
" cursor line/row
hi CursorLine gui=NONE guibg=#202438 gui=none
hi CursorLine cterm=NONE ctermbg=236 cterm=none
" Misc
" ----
" directory names and other special names in listings
hi Directory guifg=#c0e0b0 gui=none
hi Directory ctermfg=151 cterm=none
" error messages on the command line
hi ErrorMsg guifg=#ee0000 guibg=NONE gui=none
hi ErrorMsg ctermfg=196 ctermbg=NONE cterm=none
" column separating vertically split windows
hi VertSplit guifg=#777777 guibg=#363946 gui=none
hi VertSplit ctermfg=242 ctermbg=237 cterm=none
" columns where signs are displayed (used in IDEs)
hi SignColumn guifg=#9fafaf guibg=#181818 gui=none
hi SignColumn ctermfg=145 ctermbg=233 cterm=none
" line numbers
hi LineNr guifg=#818698 guibg=#363946
hi LineNr ctermfg=102 ctermbg=237
" match parenthesis, brackets
hi MatchParen guifg=#00ff00 guibg=NONE gui=bold
hi MatchParen ctermfg=46 ctermbg=NONE cterm=bold
" the 'more' prompt when output takes more than one line
hi MoreMsg guifg=#2e8b57 gui=none
hi MoreMsg ctermfg=29 cterm=none
" text showing what mode you are in
hi ModeMsg guifg=#76d5f8 guibg=NONE gui=none
hi ModeMsg ctermfg=117 ctermbg=NONE cterm=none
" the '~' and '@' and showbreak, '>' double wide char doesn't fit on line
hi NonText guifg=#404040 gui=none
hi NonText ctermfg=235 cterm=none
" the hit-enter prompt (show more output) and yes/no questions
hi Question guifg=fg gui=none
hi Question ctermfg=fg cterm=none
" meta and special keys used with map, unprintable characters
hi SpecialKey guifg=#405060
hi SpecialKey ctermfg=237
" titles for output from :set all, :autocmd, etc
hi Title guifg=#62bdde gui=none
hi Title ctermfg=74 cterm=none
"hi Title guifg=#5ec8e5 gui=none
" warning messages
hi WarningMsg guifg=#e5786d gui=none
hi WarningMsg ctermfg=173 cterm=none
" current match in the wildmenu completion
hi WildMenu guifg=#cae682 guibg=#363946 gui=bold,underline
hi WildMenu ctermfg=16 ctermbg=186 cterm=bold
" Diff
" ----
" added line
hi DiffAdd guifg=#80a090 guibg=#313c36 gui=none
hi DiffAdd ctermfg=fg ctermbg=22 cterm=none
" changed line
hi DiffChange guifg=NONE guibg=#4a343a gui=none
hi DiffChange ctermfg=fg ctermbg=58 cterm=none
" deleted line
hi DiffDelete guifg=#6c6661 guibg=#3c3631 gui=none
hi DiffDelete ctermfg=fg ctermbg=52 cterm=none
" changed text within line
hi DiffText guifg=#f05060 guibg=#4a343a gui=bold
hi DiffText ctermfg=203 ctermbg=52 cterm=bold
" Folds
" -----
" line used for closed folds
hi Folded guifg=#91d6f8 guibg=#363946 gui=none
hi Folded ctermfg=117 ctermbg=238 cterm=none
" column on side used to indicated open and closed folds
hi FoldColumn guifg=#91d6f8 guibg=#363946 gui=none
hi FoldColumn ctermfg=117 ctermbg=238 cterm=none
" Search
" ------
" highlight incremental search text; also highlight text replaced with :s///c
hi IncSearch guifg=#66ffff gui=reverse
hi IncSearch ctermfg=87 cterm=reverse
" hlsearch (last search pattern), also used for quickfix
hi Search guibg=#e0e096 gui=none
hi Search ctermbg=214 cterm=none
" Popup Menu
" ----------
" normal item in popup
"hi Pmenu guifg=#e0e0e0 guibg=#303840 gui=none
"hi Pmenu ctermfg=253 ctermbg=233 cterm=none
hi Pmenu guifg=#e0e0e0 guibg=#303840 gui=none
hi Pmenu ctermfg=253 ctermbg=237 cterm=none
" selected item in popup
hi PmenuSel guifg=#cae682 guibg=#505860 gui=none
hi PmenuSel ctermfg=186 ctermbg=239 cterm=none
" scrollbar in popup
hi PMenuSbar guibg=#505860 gui=none
hi PMenuSbar ctermbg=59 cterm=none
" thumb of the scrollbar in the popup
hi PMenuThumb guibg=#808890 gui=none
hi PMenuThumb ctermbg=102 cterm=none
" Status Line
" -----------
" status line for current window
hi StatusLine guifg=#e0e0e0 guibg=#363946 gui=bold
hi StatusLine ctermfg=254 ctermbg=237 cterm=bold
" status line for non-current windows
hi StatusLineNC guifg=#767986 guibg=#363946 gui=none
hi StatusLineNC ctermfg=244 ctermbg=237 cterm=none
" Tab Lines
" ---------
" tab pages line, not active tab page label
hi TabLine guifg=#b6bf98 guibg=#363946 gui=none
hi TabLine ctermfg=244 ctermbg=236 cterm=none
" tab pages line, where there are no labels
hi TabLineFill guifg=#cfcfaf guibg=#363946 gui=none
hi TabLineFill ctermfg=187 ctermbg=236 cterm=none
" tab pages line, active tab page label
hi TabLineSel guifg=#efefef guibg=#414658 gui=bold
hi TabLineSel ctermfg=254 ctermbg=236 cterm=bold
" Visual
" ------
" visual mode selection
hi Visual guifg=NONE guibg=#364458
hi Visual ctermfg=NONE ctermbg=24
" visual mode selection when vim is not owning the selection (x11 only)
hi VisualNOS guifg=fg gui=underline
hi VisualNOS ctermfg=fg cterm=underline
" Specials for Languages
" ----------------------
"hi makoLine guibg=#111111 gui=none
"hi makoLine ctermbg=234 cterm=none
hi makoAttributeKey term=underline ctermfg=darkcyan gui=bold guifg=turquoise3 guibg=gray25 ctermbg=234
hi makoAttributeValue term=underline ctermfg=red guifg=firebrick3 guibg=gray25 ctermbg=234
"hi makoText ctermfg=gray guifg=gray55 guibg=gray25 ctermbg=234
hi makoEnd guifg=#b3d38c gui=bold guibg=gray25
hi makoEnd ctermfg=150 cterm=bold ctermbg=234
hi makoDelim guifg=#e9dfaf gui=none guibg=gray25
hi makoDelim ctermfg=223 cterm=none ctermbg=234
hi makoEscape term=underline guibg=gray25 ctermbg=234
" Specials for org-mode
" ---------------------
" define foreground colors for ****UNfolded**** outline heading levels
hi OL1 guifg=#7744ff ctermfg=blue
hi OL2 guifg=#aaaa22 ctermfg=brown
hi OL3 guifg=#00ccff ctermfg=cyan
hi OL4 guifg=#999999 gui=italic ctermfg=gray
hi OL5 guifg=#eeaaee ctermfg=lightgray
hi OL6 guifg=#9966ff ctermfg=yellow
hi OL7 guifg=#dd99dd ctermfg=red
hi OL8 guifg=cyan ctermfg=grey
hi OL9 guifg=magenta ctermfg=blue
" various text item highlightings are below
hi Properties guifg=pink ctermfg=lightred
hi Tags guifg=pink ctermfg=lightred
hi Dates guifg=magenta ctermfg=magenta
hi stars guifg=#444444 ctermfg=darkgray
hi Props guifg=#ffa0a0 ctermfg=lightred
hi code guifg=orange gui=bold ctermfg=14
hi itals gui=italic guifg=#aaaaaa ctermfg=lightgray
hi boldtext gui=bold guifg=#aaaaaa ctermfg=lightgray
hi undertext gui=underline guifg=#aaaaaa ctermfg=lightgray
hi lnumber guifg=#999999 ctermfg=gray
hi TODO guifg=orange guibg=NONE ctermfg=14 ctermbg=NONE
hi CANCELED guifg=red guibg=NONE ctermfg=red ctermbg=NONE
hi STARTED guifg=yellow guibg=NONE ctermfg=yellow ctermbg=NONE
hi NEXT guifg=cyan guibg=NONE ctermfg=cyan ctermbg=NONE
hi DONE guifg=green guibg=NONE ctermfg=green ctermbg=NONE
" For denite.nvim
"
hi deniteMatchedChar guifg=#FFFFFF guibg=#5F87FF ctermfg=15 ctermbg=27
hi link NormalFloat Pmenu
" Vim-Signify
" ----
hi SignifySignAdd guifg=#80a090 guibg=#181818 gui=none
hi SignifySignAdd ctermfg=29 ctermbg=233 cterm=none
hi SignifySignChange guifg=#4a343a guibg=#181818 gui=none
hi SignifySignChange ctermfg=100 ctermbg=233 cterm=none
hi SignifySignDelete guifg=#6c6661 guibg=#181818 gui=none
hi SignifySignDelete ctermfg=124 ctermbg=233 cterm=none

83
dot_vim/colors/dante.vim Normal file
View file

@ -0,0 +1,83 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" File: "/home/caciano/.vim/dante.vim"
" Created: "Thu, 23 May 2002 00:12:20 -0300 (caciano)"
" Updated: "Sat, 24 Aug 2002 14:04:21 -0300 (caciano)"
" Copyright (C) 2002, Caciano Machado <caciano@inf.ufrgs.br>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colorscheme Option:
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
hi clear
if exists("syntax on")
syntax reset
endif
let g:colors_name = "dante"
" General colors
hi Normal ctermfg=gray guifg=peachpuff3 guibg=black
hi Directory term=bold ctermfg=blue guifg=royalblue
hi ErrorMsg term=standout ctermfg=white ctermbg=red guifg=white guibg=red3
hi NonText term=bold ctermfg=darkgray guibg=gray3 guifg=gray20
hi SpecialKey term=bold ctermfg=darkgray guifg=gray30
hi LineNr term=underline ctermfg=darkgray guifg=ivory4 guibg=gray4
hi IncSearch term=reverse cterm=reverse gui=reverse,bold guifg=darkgoldenrod2
hi Search term=reverse ctermfg=black ctermbg=yellow guifg=gray10 guibg=gold2
hi Visual term=bold,reverse cterm=bold,reverse ctermfg=gray ctermbg=black gui=bold,reverse guifg=gray40 guibg=black
hi VisualNOS term=bold,underline cterm=bold,underline gui=bold,underline
hi MoreMsg term=bold ctermfg=green gui=bold guifg=olivedrab1
hi ModeMsg term=bold cterm=bold gui=bold
hi Question term=standout ctermfg=green gui=bold guifg=olivedrab1
hi WarningMsg term=standout ctermfg=red gui=bold guifg=red3
hi WildMenu term=standout ctermfg=black ctermbg=yellow guifg=black guibg=gold2
hi Folded term=standout ctermfg=blue ctermbg=white guifg=royalblue1 guibg=white
hi FoldColumn term=standout ctermfg=blue ctermbg=white guifg=royalblue3 guibg=white
hi DiffAdd term=bold ctermbg=blue guibg=royalblue2
hi DiffChange term=bold ctermbg=darkmagenta guibg=maroon
hi DiffDelete term=bold cterm=bold ctermfg=lightblue ctermbg=cyan gui=bold guifg=lightblue guibg=cyan4
hi DiffText term=reverse cterm=bold ctermbg=red gui=bold guibg=red3
hi Cursor guifg=bg guibg=fg
hi lCursor guifg=bg guibg=fg
hi StatusLine term=reverse cterm=reverse gui=reverse guifg=gray60
hi StatusLineNC term=reverse cterm=reverse gui=reverse guifg=gray40
hi VertSplit term=reverse cterm=reverse gui=bold,reverse guifg=gray40
hi Title term=bold ctermfg=magenta gui=bold guifg=aquamarine
" syntax hi colors
hi Comment term=bold ctermfg=darkcyan guifg=cyan4
hi PreProc term=underline ctermfg=darkblue guifg=dodgerblue4
hi Constant term=underline ctermfg=darkred guifg=firebrick3
hi Type term=underline ctermfg=darkgreen gui=none guifg=chartreuse3
hi Statement term=bold ctermfg=darkyellow gui=none guifg=gold3
hi Identifier term=underline ctermfg=darkgreen guifg=darkolivegreen4
hi Ignore term=bold ctermfg=darkgray guifg=gray45
hi Special term=underline ctermfg=brown guifg=sienna
hi Error term=reverse ctermfg=gray ctermbg=red guifg=gray guibg=red3
hi Todo term=standout ctermfg=black ctermbg=yellow gui=bold guifg=gray10 guibg=yellow4
hi Underlined term=underline cterm=underline ctermfg=darkblue gui=underline guifg=slateblue
hi Number term=underline ctermfg=darkred guifg=red2
" syntax hi links
hi link String Constant
hi link Character Constant
hi link Number Constant
hi link Boolean Constant
hi link Float Number
hi link Function Identifier
hi link Number Constant
hi link Conditional Statement
hi link Repeat Statement
hi link Label Statement
hi link Keyword Statement
hi link Exception Statement
hi link Operator Statement
hi link Include PreProc
hi link Define PreProc
hi link Macro PreProc
hi link PreCondit PreProc
hi link StorageClass Type
hi link Structure Type
hi link Typedef Type
hi link Tag Special
hi link SpecialChar Special
hi link Delimiter Special
hi link SpecialComment Special
hi link Debug Special
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

212
dot_vim/colors/ir_black.vim Normal file
View file

@ -0,0 +1,212 @@
" ir_black color scheme
" More at: http://blog.infinitered.com/entries/show/8
" ********************************************************************************
" Standard colors used in all ir_black themes:
" Note, x:x:x are RGB values
"
" normal: #f6f3e8
"
" string: #A8FF60 168:255:96
" string inner (punc, code, etc): #00A0A0 0:160:160
" number: #FF73FD 255:115:253
" comments: #7C7C7C 124:124:124
" keywords: #96CBFE 150:203:254
" operators: white
" class: #FFFFB6 255:255:182
" method declaration name: #FFD2A7 255:210:167
" regular expression: #E9C062 233:192:98
" regexp alternate: #FF8000 255:128:0
" regexp alternate 2: #B18A3D 177:138:61
" variable: #C6C5FE 198:197:254
"
" Misc colors:
" red color (used for whatever): #FF6C60 255:108:96
" light red: #FFB6B0 255:182:176
"
" brown: #E18964 good for special
"
" lightpurpleish: #FFCCFF
"
" Interface colors:
" background color: black
" cursor (where underscore is used): #FFA560 255:165:96
" cursor (where block is used): white
" visual selection: #1D1E2C
" current line: #151515 21:21:21
" search selection: #07281C 7:40:28
" line number: #3D3D3D 61:61:61
" ********************************************************************************
" The following are the preferred 16 colors for your terminal
" Colors Bright Colors
" Black #4E4E4E #7C7C7C
" Red #FF6C60 #FFB6B0
" Green #A8FF60 #CEFFAB
" Yellow #FFFFB6 #FFFFCB
" Blue #96CBFE #FFFFCB
" Magenta #FF73FD #FF9CFE
" Cyan #C6C5FE #DFDFFE
" White #EEEEEE #FFFFFF
" ********************************************************************************
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "ir_black"
"hi Example guifg=NONE guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
" General colors
hi Normal guifg=#f6f3e8 guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi NonText guifg=#070707 guibg=black gui=NONE ctermfg=black ctermbg=NONE cterm=NONE
hi Cursor guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=reverse
hi LineNr guifg=#3D3D3D guibg=black gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
hi VertSplit guifg=#202020 guibg=#202020 gui=NONE ctermfg=darkgray ctermbg=darkgray cterm=NONE
hi StatusLine guifg=#CCCCCC guibg=#202020 gui=italic ctermfg=white ctermbg=darkgray cterm=NONE
hi StatusLineNC guifg=black guibg=#202020 gui=NONE ctermfg=blue ctermbg=darkgray cterm=NONE
hi Folded guifg=#a0a8b0 guibg=#384048 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title guifg=#f6f3e8 guibg=NONE gui=bold ctermfg=NONE ctermbg=NONE cterm=NONE
hi Visual guifg=NONE guibg=#262D51 gui=NONE ctermfg=NONE ctermbg=darkgray cterm=NONE
hi SpecialKey guifg=#808080 guibg=#343434 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi WildMenu guifg=green guibg=yellow gui=NONE ctermfg=black ctermbg=yellow cterm=NONE
hi PmenuSbar guifg=black guibg=white gui=NONE ctermfg=black ctermbg=white cterm=NONE
"hi Ignore guifg=gray guibg=black gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Error guifg=NONE guibg=NONE gui=undercurl ctermfg=white ctermbg=red cterm=NONE guisp=#FF6C60 " undercurl color
hi ErrorMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE
hi WarningMsg guifg=white guibg=#FF6C60 gui=BOLD ctermfg=white ctermbg=red cterm=NONE
" Message displayed in lower left, such as --INSERT--
hi ModeMsg guifg=black guibg=#C6C5FE gui=BOLD ctermfg=black ctermbg=cyan cterm=BOLD
if version >= 700 " Vim 7.x specific colors
hi CursorLine guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
hi CursorColumn guifg=NONE guibg=#121212 gui=NONE ctermfg=NONE ctermbg=NONE cterm=BOLD
hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=BOLD ctermfg=white ctermbg=darkgray cterm=NONE
hi Pmenu guifg=#f6f3e8 guibg=#444444 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi PmenuSel guifg=#000000 guibg=#cae682 gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE
hi Search guifg=NONE guibg=NONE gui=underline ctermfg=NONE ctermbg=NONE cterm=underline
endif
" Syntax highlighting
hi Comment guifg=#7C7C7C guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
hi String guifg=#A8FF60 guibg=NONE gui=NONE ctermfg=green ctermbg=NONE cterm=NONE
hi Number guifg=#FF73FD guibg=NONE gui=NONE ctermfg=magenta ctermbg=NONE cterm=NONE
hi Keyword guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi PreProc guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi Conditional guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE " if else end
hi Todo guifg=#8f8f8f guibg=NONE gui=NONE ctermfg=red ctermbg=NONE cterm=NONE
hi Constant guifg=#99CC99 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi Identifier guifg=#C6C5FE guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi Function guifg=#FFD2A7 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
hi Type guifg=#FFFFB6 guibg=NONE gui=NONE ctermfg=yellow ctermbg=NONE cterm=NONE
hi Statement guifg=#6699CC guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE
hi Special guifg=#E18964 guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
hi Delimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi Operator guifg=white guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
hi link Character Constant
hi link Boolean Constant
hi link Float Number
hi link Repeat Statement
hi link Label Statement
hi link Exception Statement
hi link Include PreProc
hi link Define PreProc
hi link Macro PreProc
hi link PreCondit PreProc
hi link StorageClass Type
hi link Structure Type
hi link Typedef Type
hi link Tag Special
hi link SpecialChar Special
hi link SpecialComment Special
hi link Debug Special
" Special for Ruby
hi rubyRegexp guifg=#B18A3D guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
hi rubyRegexpDelimiter guifg=#FF8000 guibg=NONE gui=NONE ctermfg=brown ctermbg=NONE cterm=NONE
hi rubyEscape guifg=white guibg=NONE gui=NONE ctermfg=cyan ctermbg=NONE cterm=NONE
hi rubyInterpolationDelimiter guifg=#00A0A0 guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE
hi rubyControl guifg=#6699CC guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE "and break, etc
"hi rubyGlobalVariable guifg=#FFCCFF guibg=NONE gui=NONE ctermfg=lightblue ctermbg=NONE cterm=NONE "yield
hi rubyStringDelimiter guifg=#336633 guibg=NONE gui=NONE ctermfg=lightgreen ctermbg=NONE cterm=NONE
"rubyInclude
"rubySharpBang
"rubyAccess
"rubyPredefinedVariable
"rubyBoolean
"rubyClassVariable
"rubyBeginEnd
"rubyRepeatModifier
"hi link rubyArrayDelimiter Special " [ , , ]
"rubyCurlyBlock { , , }
hi link rubyClass Keyword
hi link rubyModule Keyword
hi link rubyKeyword Keyword
hi link rubyOperator Operator
hi link rubyIdentifier Identifier
hi link rubyInstanceVariable Identifier
hi link rubyGlobalVariable Identifier
hi link rubyClassVariable Identifier
hi link rubyConstant Type
" Special for Java
" hi link javaClassDecl Type
hi link javaScopeDecl Identifier
hi link javaCommentTitle javaDocSeeTag
hi link javaDocTags javaDocSeeTag
hi link javaDocParam javaDocSeeTag
hi link javaDocSeeTagParam javaDocSeeTag
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
hi javaDocSeeTag guifg=#CCCCCC guibg=NONE gui=NONE ctermfg=darkgray ctermbg=NONE cterm=NONE
"hi javaClassDecl guifg=#CCFFCC guibg=NONE gui=NONE ctermfg=white ctermbg=NONE cterm=NONE
" Special for XML
hi link xmlTag Keyword
hi link xmlTagName Conditional
hi link xmlEndTag Identifier
" Special for HTML
hi link htmlTag Keyword
hi link htmlTagName Conditional
hi link htmlEndTag Identifier
" Special for Javascript
hi link javaScriptNumber Number
" Special for Python
"hi link pythonEscape Keyword
" Special for CSharp
hi link csXmlTag Keyword
" Special for PHP

346
dot_vim/colors/lucius.vim Normal file
View file

@ -0,0 +1,346 @@
" Vim color file
" Maintainer: Jonathan Filip <jfilip1024@gmail.com>
" Last Modified: Thu Jan 21, 2010 10:57AM
" Version: 3.2
"
" GUI / 256 color terminal
"
" I started out trying to combine my favorite parts of other schemes and ended
" up with this (oceandeep, moria, peaksea, wombat, zenburn).
"
" This file also tries to have descriptive comments for each higlighting group
" so it is easy to understand what each part does.
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name="lucius"
" Some other colors to save
" blue: 3eb8e5
" green: 92d400
" c green: d5f876, cae682
" new blue: 002D62
" new gray: CCCCCC
" Base color
" ----------
hi Normal guifg=#e0e0e0 guibg=#202020
hi Normal ctermfg=253 ctermbg=235
" Comment Group
" -------------
" any comment
hi Comment guifg=#606060 gui=none
hi Comment ctermfg=240 cterm=none
" Constant Group
" --------------
" any constant
hi Constant guifg=#8cd0d3 gui=none
hi Constant ctermfg=116 cterm=none
" strings
hi String guifg=#80c0d9 gui=none
hi String ctermfg=110 cterm=none
" character constant
hi Character guifg=#80c0d9 gui=none
hi Character ctermfg=110 cterm=none
" numbers decimal/hex
hi Number guifg=#8cd0d3 gui=none
hi Number ctermfg=116 cterm=none
" true, false
hi Boolean guifg=#8cd0d3 gui=none
hi Boolean ctermfg=116 cterm=none
" float
hi Float guifg=#8cd0d3 gui=none
hi Float ctermfg=116 cterm=none
" Identifier Group
" ----------------
" any variable name
hi Identifier guifg=#e6c080 gui=none
hi Identifier ctermfg=216 cterm=none
" function, method, class
hi Function guifg=#e6c080 gui=none
hi Function ctermfg=216 cterm=none
" Statement Group
" ---------------
" any statement
hi Statement guifg=#b3d38c gui=none
hi Statement ctermfg=150 cterm=none
" if, then, else
hi Conditional guifg=#b3d38c gui=none
hi Conditional ctermfg=150 cterm=none
" try, catch, throw, raise
hi Exception guifg=#b3d38c gui=none
hi Exception ctermfg=150 cterm=none
" for, while, do
hi Repeat guifg=#b3d38c gui=none
hi Repeat ctermfg=150 cterm=none
" case, default
hi Label guifg=#b3d38c gui=none
hi Label ctermfg=150 cterm=none
" sizeof, +, *
hi Operator guifg=#b3d38c gui=none
hi Operator ctermfg=150 cterm=none
" any other keyword
hi Keyword guifg=#b3d38c gui=none
hi Keyword ctermfg=150 cterm=none
" Preprocessor Group
" ------------------
" generic preprocessor
hi PreProc guifg=#e9dfaf gui=none
hi PreProc ctermfg=223 cterm=none
" #include
hi Include guifg=#e9dfaf gui=none
hi Include ctermfg=223 cterm=none
" #define
hi Define guifg=#e9dfaf gui=none
hi Define ctermfg=223 cterm=none
" same as define
hi Macro guifg=#e9dfaf gui=none
hi Macro ctermfg=223 cterm=none
" #if, #else, #endif
hi PreCondit guifg=#e9dfaf gui=none
hi PreCondit ctermfg=223 cterm=none
" Type Group
" ----------
" int, long, char
hi Type guifg=#93d6a9 gui=none
hi Type ctermfg=115 cterm=none
" static, register, volative
hi StorageClass guifg=#93d6a9 gui=none
hi StorageClass ctermfg=115 cterm=none
" struct, union, enum
hi Structure guifg=#93d6a9 gui=none
hi Structure ctermfg=115 cterm=none
" typedef
hi Typedef guifg=#93d6a9 gui=none
hi Typedef ctermfg=115 cterm=none
" Special Group
" -------------
" any special symbol
hi Special guifg=#cca3b3 gui=none
hi Special ctermfg=181 cterm=none
" special character in a constant
hi SpecialChar guifg=#cca3b3 gui=none
hi SpecialChar ctermfg=181 cterm=none
" things you can CTRL-]
hi Tag guifg=#cca3b3 gui=none
hi Tag ctermfg=181 cterm=none
" character that needs attention
hi Delimiter guifg=#cca3b3 gui=none
hi Delimiter ctermfg=181 cterm=none
" special things inside a comment
hi SpecialComment guifg=#cca3b3 gui=none
hi SpecialComment ctermfg=181 cterm=none
" debugging statements
hi Debug guifg=#cca3b3 guibg=NONE gui=none
hi Debug ctermfg=181 ctermbg=NONE cterm=none
" Underlined Group
" ----------------
" text that stands out, html links
hi Underlined guifg=fg gui=underline
hi Underlined ctermfg=fg cterm=underline
" Ignore Group
" ------------
" left blank, hidden
hi Ignore guifg=bg
hi Ignore ctermfg=bg
" Error Group
" -----------
" any erroneous construct
hi Error guifg=#e37170 guibg=#432323 gui=none
hi Error ctermfg=167 ctermbg=52 cterm=none
" Todo Group
" ----------
" todo, fixme, note, xxx
hi Todo guifg=#efef8f guibg=NONE gui=underline
hi Todo ctermfg=228 ctermbg=NONE cterm=underline
" Spelling
" --------
" word not recognized
hi SpellBad guisp=#ee0000 gui=undercurl
hi SpellBad ctermbg=9 cterm=undercurl
" word not capitalized
hi SpellCap guisp=#eeee00 gui=undercurl
hi SpellCap ctermbg=12 cterm=undercurl
" rare word
hi SpellRare guisp=#ffa500 gui=undercurl
hi SpellRare ctermbg=13 cterm=undercurl
" wrong spelling for selected region
hi SpellLocal guisp=#ffa500 gui=undercurl
hi SpellLocal ctermbg=14 cterm=undercurl
" Cursor
" ------
" character under the cursor
hi Cursor guifg=bg guibg=#a3e3ed
hi Cursor ctermfg=bg ctermbg=153
" like cursor, but used when in IME mode
hi CursorIM guifg=bg guibg=#96cdcd
hi CursorIM ctermfg=bg ctermbg=116
" cursor column
hi CursorColumn guifg=NONE guibg=#202438 gui=none
hi CursorColumn ctermfg=NONE ctermbg=236 cterm=none
" cursor line/row
hi CursorLine gui=NONE guibg=#202438 gui=none
hi CursorLine cterm=NONE ctermbg=236 cterm=none
" Misc
" ----
" directory names and other special names in listings
hi Directory guifg=#c0e0b0 gui=none
hi Directory ctermfg=151 cterm=none
" error messages on the command line
hi ErrorMsg guifg=#ee0000 guibg=NONE gui=none
hi ErrorMsg ctermfg=196 ctermbg=NONE cterm=none
" column separating vertically split windows
hi VertSplit guifg=#777777 guibg=#363946 gui=none
hi VertSplit ctermfg=242 ctermbg=237 cterm=none
" columns where signs are displayed (used in IDEs)
hi SignColumn guifg=#9fafaf guibg=#181818 gui=none
hi SignColumn ctermfg=145 ctermbg=233 cterm=none
" line numbers
hi LineNr guifg=#818698 guibg=#363946
hi LineNr ctermfg=102 ctermbg=237
" match parenthesis, brackets
hi MatchParen guifg=#00ff00 guibg=NONE gui=bold
hi MatchParen ctermfg=46 ctermbg=NONE cterm=bold
" the 'more' prompt when output takes more than one line
hi MoreMsg guifg=#2e8b57 gui=none
hi MoreMsg ctermfg=29 cterm=none
" text showing what mode you are in
hi ModeMsg guifg=#76d5f8 guibg=NONE gui=none
hi ModeMsg ctermfg=117 ctermbg=NONE cterm=none
" the '~' and '@' and showbreak, '>' double wide char doesn't fit on line
hi NonText guifg=#404040 gui=none
hi NonText ctermfg=235 cterm=none
" the hit-enter prompt (show more output) and yes/no questions
hi Question guifg=fg gui=none
hi Question ctermfg=fg cterm=none
" meta and special keys used with map, unprintable characters
hi SpecialKey guifg=#405060
hi SpecialKey ctermfg=237
" titles for output from :set all, :autocmd, etc
hi Title guifg=#62bdde gui=none
hi Title ctermfg=74 cterm=none
"hi Title guifg=#5ec8e5 gui=none
" warning messages
hi WarningMsg guifg=#e5786d gui=none
hi WarningMsg ctermfg=173 cterm=none
" current match in the wildmenu completion
hi WildMenu guifg=#cae682 guibg=#363946 gui=bold,underline
hi WildMenu ctermfg=16 ctermbg=186 cterm=bold
" Diff
" ----
" added line
hi DiffAdd guifg=#80a090 guibg=#313c36 gui=none
hi DiffAdd ctermfg=108 ctermbg=22 cterm=none
" changed line
hi DiffChange guifg=NONE guibg=#4a343a gui=none
hi DiffChange ctermfg=fg ctermbg=52 cterm=none
" deleted line
hi DiffDelete guifg=#6c6661 guibg=#3c3631 gui=none
hi DiffDelete ctermfg=59 ctermbg=58 cterm=none
" changed text within line
hi DiffText guifg=#f05060 guibg=#4a343a gui=bold
hi DiffText ctermfg=203 ctermbg=52 cterm=bold
" Folds
" -----
" line used for closed folds
hi Folded guifg=#91d6f8 guibg=#363946 gui=none
hi Folded ctermfg=117 ctermbg=238 cterm=none
" column on side used to indicated open and closed folds
hi FoldColumn guifg=#91d6f8 guibg=#363946 gui=none
hi FoldColumn ctermfg=117 ctermbg=238 cterm=none
" Search
" ------
" highlight incremental search text; also highlight text replaced with :s///c
hi IncSearch guifg=#66ffff gui=reverse
hi IncSearch ctermfg=87 cterm=reverse
" hlsearch (last search pattern), also used for quickfix
hi Search guibg=#ffaa33 gui=none
hi Search ctermbg=214 cterm=none
" Popup Menu
" ----------
" normal item in popup
hi Pmenu guifg=#e0e0e0 guibg=#303840 gui=none
hi Pmenu ctermfg=253 ctermbg=233 cterm=none
" selected item in popup
hi PmenuSel guifg=#cae682 guibg=#505860 gui=none
hi PmenuSel ctermfg=186 ctermbg=237 cterm=none
" scrollbar in popup
hi PMenuSbar guibg=#505860 gui=none
hi PMenuSbar ctermbg=59 cterm=none
" thumb of the scrollbar in the popup
hi PMenuThumb guibg=#808890 gui=none
hi PMenuThumb ctermbg=102 cterm=none
" Status Line
" -----------
" status line for current window
hi StatusLine guifg=#e0e0e0 guibg=#363946 gui=bold
hi StatusLine ctermfg=254 ctermbg=237 cterm=bold
" status line for non-current windows
hi StatusLineNC guifg=#767986 guibg=#363946 gui=none
hi StatusLineNC ctermfg=244 ctermbg=237 cterm=none
" Tab Lines
" ---------
" tab pages line, not active tab page label
hi TabLine guifg=#b6bf98 guibg=#363946 gui=none
hi TabLine ctermfg=244 ctermbg=236 cterm=none
" tab pages line, where there are no labels
hi TabLineFill guifg=#cfcfaf guibg=#363946 gui=none
hi TabLineFill ctermfg=187 ctermbg=236 cterm=none
" tab pages line, active tab page label
hi TabLineSel guifg=#efefef guibg=#414658 gui=bold
hi TabLineSel ctermfg=254 ctermbg=236 cterm=bold
" Visual
" ------
" visual mode selection
hi Visual guifg=NONE guibg=#364458
hi Visual ctermfg=NONE ctermbg=24
" visual mode selection when vim is not owning the selection (x11 only)
hi VisualNOS guifg=fg gui=underline
hi VisualNOS ctermfg=fg cterm=underline

469
dot_vim/colors/ps_color.vim Normal file
View file

@ -0,0 +1,469 @@
" Vim colour file --- PSC
" Maintainer: Pan, Shi Zhu <Go to the following URL for my email>
" URL: http://vim.sourceforge.net/scripts/script.php?script_id=760
" Last Change: 18 July 2006
" Version: 2.9
"
" Please prepend [VIM] in the title when writing e-mail to me, or it will
" be automatically treated as spam and removed.
"
" See the help document for all details, the help document will be
" installed after the script has been sourced once, do not open the
" script when you source it for the first time.
"
" Initializations: {{{1
"
" without user_commands, all these are not possible
if !has("user_commands")
finish
end
function! s:init_option(var, value)
if !exists("g:psc_".a:var)
execute "let s:".a:var." = ".a:value
else
let s:{a:var} = g:psc_{a:var}
endif
endfunction
command! -nargs=+ InitOpt call s:init_option(<f-args>)
function! s:multi_hi(setting, ...)
let l:idx = a:0
while l:idx > 0
let l:hlgroup = a:{l:idx}
execute "highlight ".l:hlgroup." ".a:setting
let l:idx = l:idx - 1
endwhile
endfunction
command! -nargs=+ MultiHi call s:multi_hi(<f-args>)
InitOpt style 'cool'
InitOpt inversed_todo 0
InitOpt use_default_for_cterm 0
InitOpt statement_different_from_type 0
if s:style == 'warm'
InitOpt fontface 'mixed'
else
InitOpt fontface 'plain'
endif
if !has("gui_running")
call s:init_option("cterm_style", "'".s:style."'")
" Forces 'cool' style when gui is not present Since the 'warm' style for
" terminal isn't available now, and probably never will be.
if s:cterm_style=='warm' | let s:cterm_style = 'cool'
endif
if s:use_default_for_cterm==1 | let s:cterm_style = 'default'
elseif s:use_default_for_cterm==2 | let s:cterm_style = 'defdark'
endif
endif
InitOpt other_style 0
if has("gui_running")
if s:style=='warm' || s:style=='default'
set background=light
elseif s:style=='cool' || s:style=='defdark'
set background=dark
else | let s:other_style = 1
endif
else
if s:cterm_style=='cool' || s:cterm_style=='defdark'
set background=dark
elseif s:cterm_style=='default'
set background=light
else | let s:other_style = 1
endif
endif
highlight clear
if exists("syntax_on")
syntax reset
endif
let s:color_name = expand("<sfile>:t:r")
if s:other_style==0 | let g:colors_name = s:color_name
" Go from console version to gui, the color scheme should be sourced again
execute "autocmd TermChanged * if g:colors_name == '".s:color_name."' | "
\."colo ".s:color_name." | endif"
else
execute "runtime colors/".s:style.".vim"
endif
" Command to go different schemes easier.
execute "command! -nargs=1 Colo if '".s:color_name."'!=\"<args>\" | "
\'let g:psc_style = "<args>"| endif | colo '.s:color_name
" Give control to 'reloaded' scheme if possible
if s:style == 'reloaded'
finish
endif
" }}}1
" Relevant Help:
" :h highlight-groups
" :h psc-cterm-color-table
" :ru syntax/hitest.vim
"
" Hardcoded Colors Comment:
" #aabbcc = Red aa, Green bb, Blue cc
" we must use hard-coded colours to get more 'tender' colours
"
" GUI:
"
" I don't want to abuse folding, but here folding is used to avoid confusion.
if s:style=='warm'
" Warm style for gui here {{{2
" LIGHT COLOR DEFINE START
highlight Normal guifg=#000000 guibg=#e0e0e0
highlight Search guifg=#902000 guibg=#f8f8f8
highlight Visual guifg=fg guibg=#a6caf0
highlight Cursor guifg=#f0f0f0 guibg=#008000
" The idea of CursorIM is pretty good, however, the feature is still buggy
" in the current version (Vim 7.0).
" The following line will be kept commented until the bug fixed.
"
" highlight CursorIM guifg=#f0f0f0 guibg=#800080
highlight Special guifg=#907000 guibg=bg
highlight Comment guifg=#606000 guibg=bg
highlight Number guifg=#907000 guibg=bg
highlight Constant guifg=#007068 guibg=bg
highlight StatusLine guifg=fg guibg=#a6caf0
highlight LineNr guifg=#686868 guibg=bg
highlight Question guifg=fg guibg=#d0d090
highlight PreProc guifg=#009030 guibg=bg
if s:statement_different_from_type==1
highlight Statement guifg=#4020a0 guibg=bg
else
highlight Statement guifg=#2060a8 guibg=bg
endif
highlight Type guifg=#0850a0 guibg=bg
if s:inversed_todo==1
highlight Todo guifg=#e0e090 guibg=#000080
else
highlight Todo guifg=#800000 guibg=#e0e090
endif
" NOTE THIS IS IN THE WARM SECTION
highlight Error guifg=#c03000 guibg=bg
highlight Identifier guifg=#a030a0 guibg=bg
highlight ModeMsg guifg=fg guibg=#b0b0e0
highlight VisualNOS guifg=fg guibg=#b0b0e0
highlight SpecialKey guifg=#1050a0 guibg=bg
highlight NonText guifg=#002090 guibg=#d0d0d0
highlight Directory guifg=#a030a0 guibg=bg
highlight ErrorMsg guifg=fg guibg=#f0b090
highlight MoreMsg guifg=#489000 guibg=bg
highlight Title guifg=#a030a0 guibg=bg
highlight WarningMsg guifg=#b02000 guibg=bg
highlight WildMenu guifg=fg guibg=#d0d090
highlight Folded guifg=fg guibg=#b0e0b0
highlight FoldColumn guifg=fg guibg=#90e090
highlight DiffAdd guifg=fg guibg=#b0b0e0
highlight DiffChange guifg=fg guibg=#e0b0e0
highlight DiffDelete guifg=#002090 guibg=#d0d0d0
highlight DiffText guifg=fg guibg=#c0e080
highlight SignColumn guifg=fg guibg=#90e090
highlight IncSearch guifg=#f0f0f0 guibg=#806060
highlight StatusLineNC guifg=fg guibg=#c0c0c0
highlight VertSplit guifg=fg guibg=#c0c0c0
highlight Underlined guifg=#6a5acd guibg=bg gui=underline
highlight Ignore guifg=bg guibg=bg
" NOTE THIS IS IN THE WARM SECTION
if v:version >= 700
highlight SpellBad guifg=NONE guibg=NONE guisp=#c03000
highlight SpellCap guifg=NONE guibg=NONE guisp=#2060a8
highlight SpellRare guifg=NONE guibg=NONE guisp=#a030a0
highlight SpellLocal guifg=NONE guibg=NONE guisp=#007068
highlight Pmenu guifg=fg guibg=#e0b0e0
highlight PmenuSel guifg=#f0f0f0 guibg=#806060
highlight PmenuSbar guifg=fg guibg=#c0c0c0
highlight PmenuThumb guifg=fg guibg=#c0e080
highlight TabLine guifg=fg guibg=#c0c0c0 gui=underline
highlight TabLineFill guifg=fg guibg=#c0c0c0 gui=underline
highlight TabLineSel guifg=fg guibg=bg
highlight CursorColumn guifg=NONE guibg=#f0b090
highlight CursorLine guifg=NONE guibg=NONE gui=underline
highlight MatchParen guifg=NONE guibg=#c0e080
endif
" LIGHT COLOR DEFINE END
" }}}2
elseif s:style=='cool'
" Cool style for gui here {{{2
" DARK COLOR DEFINE START
highlight Normal guifg=#d0d0d0 guibg=#202020
highlight Comment guifg=#d0d090 guibg=bg
highlight Constant guifg=#80c0e0 guibg=bg
highlight Number guifg=#e0c060 guibg=bg
highlight Identifier guifg=#f0c0f0 guibg=bg
if s:statement_different_from_type==1
highlight Statement guifg=#98a8f0 guibg=bg
else
highlight Statement guifg=#c0d8f8 guibg=bg
endif
highlight PreProc guifg=#60f080 guibg=bg
highlight Type guifg=#b0d0f0 guibg=bg
highlight Special guifg=#e0c060 guibg=bg
highlight Error guifg=#f08060 guibg=bg
if s:inversed_todo==1
highlight Todo guifg=#d0d090 guibg=#000080
else
highlight Todo guifg=#800000 guibg=#d0d090
endif
highlight Search guifg=#e0e0e0 guibg=#800000
highlight Visual guifg=#000000 guibg=#a6caf0
highlight Cursor guifg=#000000 guibg=#00f000
" NOTE THIS IS IN THE COOL SECTION
" highlight CursorIM guifg=#000000 guibg=#f000f0
highlight StatusLine guifg=#000000 guibg=#a6caf0
highlight LineNr guifg=#b0b0b0 guibg=bg
highlight Question guifg=#000000 guibg=#d0d090
highlight ModeMsg guifg=fg guibg=#000080
highlight VisualNOS guifg=fg guibg=#000080
highlight SpecialKey guifg=#b0d0f0 guibg=bg
highlight NonText guifg=#6080f0 guibg=#101010
highlight Directory guifg=#80c0e0 guibg=bg
highlight ErrorMsg guifg=#d0d090 guibg=#800000
highlight MoreMsg guifg=#c0e080 guibg=bg
highlight Title guifg=#f0c0f0 guibg=bg
highlight WarningMsg guifg=#f08060 guibg=bg
highlight WildMenu guifg=#000000 guibg=#d0d090
highlight Folded guifg=#d0d0d0 guibg=#004000
highlight FoldColumn guifg=#e0e0e0 guibg=#008000
highlight DiffAdd guifg=fg guibg=#000080
highlight DiffChange guifg=fg guibg=#800080
highlight DiffDelete guifg=#6080f0 guibg=#202020
highlight DiffText guifg=#000000 guibg=#c0e080
highlight SignColumn guifg=#e0e0e0 guibg=#008000
highlight IncSearch guifg=#000000 guibg=#d0d0d0
highlight StatusLineNC guifg=#000000 guibg=#c0c0c0
highlight VertSplit guifg=#000000 guibg=#c0c0c0
highlight Underlined guifg=#80a0ff guibg=bg gui=underline
highlight Ignore guifg=#000000 guibg=bg
" NOTE THIS IS IN THE COOL SECTION
if v:version >= 700
highlight SpellBad guifg=NONE guibg=NONE guisp=#f08060
highlight SpellCap guifg=NONE guibg=NONE guisp=#6080f0
highlight SpellRare guifg=NONE guibg=NONE guisp=#f0c0f0
highlight SpellLocal guifg=NONE guibg=NONE guisp=#c0d8f8
highlight Pmenu guifg=fg guibg=#800080
highlight PmenuSel guifg=#000000 guibg=#d0d0d0
highlight PmenuSbar guifg=fg guibg=#000080
highlight PmenuThumb guifg=fg guibg=#008000
highlight TabLine guifg=fg guibg=#008000 gui=underline
highlight TabLineFill guifg=fg guibg=#008000 gui=underline
highlight TabLineSel guifg=fg guibg=bg
highlight CursorColumn guifg=NONE guibg=#800000
highlight CursorLine guifg=NONE guibg=NONE gui=underline
highlight MatchParen guifg=NONE guibg=#800080
endif
" DARK COLOR DEFINE END
" }}}2
elseif s:style=='defdark'
highlight Normal guifg=#f0f0f0 guibg=#000000
endif
" Take NT gui for example, If you want to use a console font such as
" Lucida_Console with font size larger than 14, the font looks already thick,
" and the bold font for that will be too thick, you may not want it be bolded.
" The following code does this.
"
" All of the bold font may be disabled, since continuously switching between
" bold and plain font hurts consistency and will inevitably fatigue your eye!
" Maximum 20 parameters for vim script function
"
MultiHi gui=NONE ModeMsg Search Cursor Special Comment Constant Number LineNr Question PreProc Statement Type Todo Error Identifier Normal
MultiHi gui=NONE VisualNOS SpecialKey NonText Directory ErrorMsg MoreMsg Title WarningMsg WildMenu Folded FoldColumn DiffAdd DiffChange DiffDelete DiffText SignColumn
" Vim 7 added stuffs
if v:version >= 700
MultiHi gui=NONE Ignore PmenuSel PmenuSel PmenuSbar PmenuThumb TabLine TabLineFill TabLineSel
" the gui=undercurl guisp could only support in Vim 7
MultiHi gui=undercurl SpellBad SpellCap SpellRare SpellLocal
if s:style=="cool" || s:style=="warm"
MultiHi gui=underline TabLine TabLineFill Underlined CursorLine
else
MultiHi gui=underline TabLine Underlined
endif
endif
" For reversed stuffs
MultiHi gui=NONE IncSearch StatusLine StatusLineNC VertSplit Visual
if s:style=="cool" || s:style=="warm"
if s:fontface=="mixed"
MultiHi gui=bold IncSearch StatusLine StatusLineNC VertSplit Visual
endif
else
if s:fontface=="mixed"
hi StatusLine gui=bold,reverse
else
hi StatusLine gui=reverse
endif
MultiHi gui=reverse IncSearch StatusLineNC VertSplit Visual
endif
" Enable the bold style
if s:fontface=="mixed"
MultiHi gui=bold Question DiffText Statement Type MoreMsg ModeMsg NonText Title VisualNOS DiffDelete TabLineSel
endif
" Color Term:
" It's not quite possible to support 'cool' and 'warm' simultaneously, since
" we cannot expect a terminal to have more than 16 color names.
"
" I assume Vim will never go to cterm mode when has("gui_running") returns 1,
" Please enlighten me if I am wrong.
"
if !has('gui_running')
" cterm settings {{{1
if s:cterm_style=='cool'
highlight Normal ctermfg=LightGrey ctermbg=Black
highlight Search ctermfg=White ctermbg=DarkRed
highlight Visual ctermfg=Black ctermbg=DarkCyan
highlight Cursor ctermfg=Black ctermbg=Green
highlight Special ctermfg=Yellow ctermbg=Black
highlight Comment ctermfg=DarkYellow ctermbg=Black
highlight Constant ctermfg=Blue ctermbg=Black
highlight Number ctermfg=Yellow ctermbg=Black
highlight StatusLine ctermfg=Black ctermbg=DarkCyan
highlight LineNr ctermfg=DarkGrey ctermbg=Black
highlight Question ctermfg=Black ctermbg=DarkYellow
highlight PreProc ctermfg=Green ctermbg=Black
highlight Statement ctermfg=Cyan ctermbg=Black
highlight Type ctermfg=Cyan ctermbg=Black
if s:inversed_todo==0
highlight Todo ctermfg=DarkRed ctermbg=DarkYellow
else
highlight Todo ctermfg=DarkYellow ctermbg=DarkBlue
endif
highlight Error ctermfg=Red ctermbg=Black
highlight Identifier ctermfg=Magenta ctermbg=Black
highlight Folded ctermfg=White ctermbg=DarkGreen
highlight ModeMsg ctermfg=Grey ctermbg=DarkBlue
highlight VisualNOS ctermfg=Grey ctermbg=DarkBlue
highlight SpecialKey ctermfg=Cyan ctermbg=Black
highlight NonText ctermfg=Blue ctermbg=Black
highlight Directory ctermfg=Blue ctermbg=Black
highlight ErrorMsg ctermfg=DarkYellow ctermbg=DarkRed
highlight MoreMsg ctermfg=Green ctermbg=Black
highlight Title ctermfg=Magenta ctermbg=Black
highlight WarningMsg ctermfg=Red ctermbg=Black
highlight WildMenu ctermfg=Black ctermbg=DarkYellow
highlight FoldColumn ctermfg=White ctermbg=DarkGreen
highlight SignColumn ctermfg=White ctermbg=DarkGreen
highlight DiffText ctermfg=Black ctermbg=DarkYellow
highlight DiffDelete ctermfg=Blue ctermbg=Black
if v:version >= 700
highlight SpellBad ctermfg=NONE ctermbg=DarkRed
highlight SpellCap ctermfg=NONE ctermbg=DarkBlue
highlight SpellRare ctermfg=NONE ctermbg=DarkMagenta
highlight SpellLocal ctermfg=NONE ctermbg=DarkGreen
highlight Pmenu ctermfg=fg ctermbg=DarkMagenta
highlight PmenuSel ctermfg=bg ctermbg=fg
highlight PmenuSbar ctermfg=fg ctermbg=DarkBlue
highlight PmenuThumb ctermfg=fg ctermbg=DarkGreen
highlight TabLine ctermfg=fg ctermbg=DarkGreen cterm=underline
highlight TabLineFill ctermfg=fg ctermbg=DarkGreen cterm=underline
highlight TabLineSel ctermfg=fg ctermbg=bg
highlight CursorColumn ctermfg=NONE ctermbg=DarkRed
highlight CursorLine ctermfg=NONE ctermbg=NONE cterm=underline
highlight MatchParen ctermfg=NONE ctermbg=DarkMagenta
endif
if &t_Co==8
" 8 colour terminal support, this assumes 16 colour is available through
" setting the 'bold' attribute, will get bright foreground colour.
" However, the bright background color is not available for 8-color terms.
"
" You can manually set t_Co=16 in your .vimrc to see if your terminal
" supports 16 colours,
MultiHi cterm=none DiffText Visual Cursor Comment Todo StatusLine Question DiffChange ModeMsg VisualNOS ErrorMsg WildMenu DiffAdd Folded DiffDelete Normal PmenuThumb
MultiHi cterm=bold Search Special Constant Number LineNr PreProc Statement Type Error Identifier SpecialKey NonText MoreMsg Title WarningMsg FoldColumn SignColumn Directory DiffDelete
else
" Background > 7 is only available with 16 or more colors
" Only use the s:fontface option when there is 16-colour(or more)
" terminal support
MultiHi cterm=none WarningMsg Search Visual Cursor Special Comment Constant Number LineNr PreProc Todo Error Identifier Folded SpecialKey Directory ErrorMsg Normal PmenuThumb
MultiHi cterm=none WildMenu FoldColumn SignColumn DiffAdd DiffChange Question StatusLine DiffText
MultiHi cterm=reverse IncSearch StatusLineNC VertSplit
" Well, well, bold font with color 0-7 is not possible.
" So, the Question, StatusLine, DiffText cannot act as expected.
call s:multi_hi("cterm=".((s:fontface=="plain") ? "none" : "bold"), "Statement", "Type", "MoreMsg", "ModeMsg", "NonText", "Title", "VisualNOS", "DiffDelete", "TabLineSel")
endif
elseif s:cterm_style=='defdark'
highlight Normal ctermfg=LightGrey ctermbg=Black
endif
" }}}1
endif
" Term:
" For console with only 4 colours (term, not cterm), we'll use the default.
" ...
" The default colorscheme is good enough for terms with no more than 4 colours
"
" Links:
"
if (s:style=='cool') || (s:style == 'warm')
" COLOR LINKS DEFINE START
highlight link String Constant
" Character must be different from strings because in many languages
" (especially C, C++) a 'char' variable is scalar while 'string' is pointer,
" mistaken a 'char' for a 'string' will cause disaster!
highlight link Character Number
highlight link SpecialChar LineNr
highlight link Tag Identifier
" The following are not standard hi links,
" these are used by DrChip
highlight link Warning MoreMsg
highlight link Notice Constant
" these are used by Calendar
highlight link CalToday PreProc
" these are used by TagList
highlight link MyTagListTagName IncSearch
highlight link MyTagListTagScope Constant
" COLOR LINKS DEFINE END
endif
" Clean:
"
delcommand InitOpt
delcommand MultiHi
" vim:et:nosta:sw=2:ts=8:
" vim600:fdm=marker:fdl=1:

245
dot_vim/colors/zenburn.vim Normal file
View file

@ -0,0 +1,245 @@
" Vim color file
" Maintainer: Jani Nurminen <jani.nurminen@pp4.inet.fi>
" Last Change: $Id: zenburn.vim,v 1.15 2006/09/07 15:57:46 jnurmine Exp $
" URL: http://slinky.imukuppi.org/zenburn/
" License: GPL
"
" Nothing too fancy, just some alien fruit salad to keep you in the zone.
" This syntax file was designed to be used with dark environments and
" low light situations. Of course, if it works during a daybright office, go
" ahead :)
"
" Owes heavily to other Vim color files! With special mentions
" to "BlackDust", "Camo" and "Desert".
"
" To install, copy to ~/.vim/colors directory. Then :colorscheme zenburn.
" See also :help syntax
"
" Credits:
" - Jani Nurminen - original Zenburn
" - Steve Hall & Cream posse - higher-contrast Visual selection
" - Kurt Maier - 256 color console coloring, low and high contrast toggle,
" bug fixing
"
" CONFIGURABLE PARAMETERS:
"
" You can use the default (don't set any parameters), or you can
" set some parameters to tweak the Zenburn colours.
"
" * You can now set a darker background for bright environments. To activate, use:
" contrast Zenburn, use:
"
" let g:zenburn_high_Contrast = 1
"
" * To get more contrast to the Visual selection, use
"
" let g:zenburn_alternate_Visual = 1
"
" * To use alternate colouring for Error message, use
"
" let g:zenburn_alternate_Error = 1
"
" * The new default for Include is a duller orange. To use the original
" colouring for Include, use
"
" let g:zenburn_alternate_Include = 1
"
" * To turn the parameter(s) back to defaults, use UNLET:
"
" unlet g:zenburn_alternate_Include
"
" Setting to 0 won't work!
"
" That's it, enjoy!
"
" TODO
" - Visual alternate color is broken? Try GVim >= 7.0.66 if you have trouble
" - IME colouring (CursorIM)
" - obscure syntax groups: check and colourize
" - add more groups if necessary
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name="zenburn"
hi Boolean guifg=#dca3a3
hi Character guifg=#dca3a3 gui=bold
hi Comment guifg=#7f9f7f gui=italic
hi Conditional guifg=#f0dfaf gui=bold
hi Constant guifg=#dca3a3 gui=bold
hi Cursor guifg=#000d18 guibg=#8faf9f gui=bold
hi Debug guifg=#bca3a3 gui=bold
hi Define guifg=#ffcfaf gui=bold
hi Delimiter guifg=#8f8f8f
hi DiffAdd guifg=#709080 guibg=#313c36 gui=bold
hi DiffChange guibg=#333333
hi DiffDelete guifg=#333333 guibg=#464646
hi DiffText guifg=#ecbcbc guibg=#41363c gui=bold
hi Directory guifg=#dcdccc gui=bold
hi ErrorMsg guifg=#80d4aa guibg=#2f2f2f gui=bold
hi Exception guifg=#c3bf9f gui=bold
hi Float guifg=#c0bed1
hi FoldColumn guifg=#93b3a3 guibg=#3f4040
hi Folded guifg=#93b3a3 guibg=#3f4040
hi Function guifg=#efef8f
hi Identifier guifg=#efdcbc
hi IncSearch guibg=#f8f893 guifg=#385f38
hi Keyword guifg=#f0dfaf gui=bold
hi Label guifg=#dfcfaf gui=underline
hi LineNr guifg=#9fafaf guibg=#262626
hi Macro guifg=#ffcfaf gui=bold
hi ModeMsg guifg=#ffcfaf gui=none
hi MoreMsg guifg=#ffffff gui=bold
hi NonText guifg=#404040
hi Number guifg=#8cd0d3
hi Operator guifg=#f0efd0
hi PreCondit guifg=#dfaf8f gui=bold
hi PreProc guifg=#ffcfaf gui=bold
hi Question guifg=#ffffff gui=bold
hi Repeat guifg=#ffd7a7 gui=bold
hi Search guifg=#ffffe0 guibg=#284f28
hi SpecialChar guifg=#dca3a3 gui=bold
hi SpecialComment guifg=#82a282 gui=bold
hi Special guifg=#cfbfaf
hi SpecialKey guifg=#9ece9e
hi Statement guifg=#e3ceab gui=none
hi StatusLine guifg=#2e4340 guibg=#ccdc90
hi StatusLineNC guifg=#2e3330 guibg=#88b090
hi StorageClass guifg=#c3bf9f gui=bold
hi String guifg=#cc9393
hi Structure guifg=#efefaf gui=bold
hi Tag guifg=#e89393 gui=bold
hi Title guifg=#efefef gui=bold
hi Todo guifg=#dfdfdf guibg=bg gui=bold
hi Typedef guifg=#dfe4cf gui=bold
hi Type guifg=#dfdfbf gui=bold
hi Underlined guifg=#dcdccc gui=underline
hi VertSplit guifg=#303030 guibg=#688060
hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline
hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold
hi WildMenu guibg=#2c302d guifg=#cbecd0 gui=underline
" Entering Kurt zone
if &t_Co > 255
hi Boolean ctermfg=181
hi Character ctermfg=181 cterm=bold
hi Comment ctermfg=108
hi Conditional ctermfg=223 cterm=bold
hi Constant ctermfg=181 cterm=bold
hi Cursor ctermfg=233 ctermbg=109 cterm=bold
hi Debug ctermfg=181 cterm=bold
hi Define ctermfg=223 cterm=bold
hi Delimiter ctermfg=245
hi DiffAdd ctermfg=66 ctermbg=237 cterm=bold
hi DiffChange ctermbg=236
hi DiffDelete ctermfg=236 ctermbg=238
hi DiffText ctermfg=217 ctermbg=237 cterm=bold
hi Directory ctermfg=188 cterm=bold
hi ErrorMsg ctermfg=115 ctermbg=236 cterm=bold
hi Exception ctermfg=249 cterm=bold
hi Float ctermfg=251
hi FoldColumn ctermfg=109 ctermbg=238
hi Folded ctermfg=109 ctermbg=238
hi Function ctermfg=228
hi Identifier ctermfg=223
hi IncSearch ctermbg=228 ctermfg=238
hi Keyword ctermfg=223 cterm=bold
hi Label ctermfg=187 cterm=underline
hi LineNr ctermfg=248 ctermbg=235
hi Macro ctermfg=223 cterm=bold
hi ModeMsg ctermfg=223 cterm=none
hi MoreMsg ctermfg=15 cterm=bold
hi NonText ctermfg=238
hi Number ctermfg=116
hi Operator ctermfg=230
hi PreCondit ctermfg=180 cterm=bold
hi PreProc ctermfg=223 cterm=bold
hi Question ctermfg=15 cterm=bold
hi Repeat ctermfg=223 cterm=bold
hi Search ctermfg=230 ctermbg=236
hi SpecialChar ctermfg=181 cterm=bold
hi SpecialComment ctermfg=108 cterm=bold
hi Special ctermfg=181
hi SpecialKey ctermfg=151
hi Statement ctermfg=187 ctermbg=234 cterm=none
hi StatusLine ctermfg=237 ctermbg=186
hi StatusLineNC ctermfg=236 ctermbg=108
hi StorageClass ctermfg=249 cterm=bold
hi String ctermfg=174
hi Structure ctermfg=229 cterm=bold
hi Tag ctermfg=181 cterm=bold
hi Title ctermfg=7 ctermbg=234 cterm=bold
hi Todo ctermfg=108 ctermbg=234 cterm=bold
hi Typedef ctermfg=253 cterm=bold
hi Type ctermfg=187 cterm=bold
hi Underlined ctermfg=188 ctermbg=234 cterm=bold
hi VertSplit ctermfg=236 ctermbg=65
hi VisualNOS ctermfg=236 ctermbg=210 cterm=bold
hi WarningMsg ctermfg=15 ctermbg=236 cterm=bold
hi WildMenu ctermbg=236 ctermfg=194 cterm=bold
if exists("g:zenburn_high_Contrast")
hi Normal ctermfg=188 ctermbg=234
else
hi Normal ctermfg=188 ctermbg=237
hi Cursor ctermbg=109
hi diffadd ctermbg=237
hi diffdelete ctermbg=238
hi difftext ctermbg=237
hi errormsg ctermbg=237
hi foldcolumn ctermbg=238
hi folded ctermbg=238
hi incsearch ctermbg=228
hi linenr ctermbg=238
hi search ctermbg=238
hi statement ctermbg=237
hi statusline ctermbg=144
hi statuslinenc ctermbg=108
hi title ctermbg=237
hi todo ctermbg=237
hi underlined ctermbg=237
hi vertsplit ctermbg=65
hi visualnos ctermbg=210
hi warningmsg ctermbg=236
hi wildmenu ctermbg=236
endif
endif
if exists("g:zenburn_high_Contrast")
" use new darker background
hi Normal guifg=#dcdccc guibg=#1f1f1f
else
" Original, lighter background
hi Normal guifg=#dcdccc guibg=#3f3f3f
endif
if exists("g:zenburn_alternate_Visual")
" Visual with more contrast, thanks to Steve Hall & Cream posse
" gui=none fixes weird highlight problem in at least GVim 7.0.66, thanks to Kurt Maier
hi Visual guifg=#000000 guibg=#71d3b4 gui=none
hi VisualNOS guifg=#000000 guibg=#71d3b4 gui=none
else
" use default visual
hi Visual guifg=#233323 guibg=#71d3b4 gui=none
hi VisualNOS guifg=#233323 guibg=#71d3b4 gui=none
endif
if exists("g:zenburn_alternate_Error")
" use a bit different Error
hi Error guifg=#ef9f9f guibg=#201010 gui=bold
else
" default
hi Error guifg=#e37170 guibg=#332323 gui=none
endif
if exists("g:zenburn_alternate_Include")
" original setting
hi Include guifg=#ffcfaf gui=bold
else
" new, less contrasted one
hi Include guifg=#dfaf8f gui=bold
endif
" TODO check every syntax group that they're ok

1077
dot_vim/doc/NERD_tree.txt Normal file

File diff suppressed because it is too large Load diff

442
dot_vim/doc/bufexplorer.txt Normal file
View file

@ -0,0 +1,442 @@
*bufexplorer.txt* Buffer Explorer Last Change: 19 Nov 2008
Buffer Explorer *buffer-explorer* *bufexplorer*
Version 7.2.2
Plugin for easily exploring (or browsing) Vim |:buffers|.
|bufexplorer-usage| Usage
|bufexplorer-installation| Installation
|bufexplorer-customization| Customization
|bufexplorer-changelog| Change Log
|bufexplorer-todo| Todo
|bufexplorer-credits| Credits
For Vim version 7.0 and above.
This plugin is only available if 'compatible' is not set.
{Vi does not have any of this}
==============================================================================
INSTALLATION *bufexplorer-installation*
To install:
- Download the bufexplorer.zip.
- Extract the zip archive into your runtime directory.
The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt.
- Start Vim or goto an existing instance of Vim.
- Execute the following command:
>
:helptag <your runtime directory/doc
<
This will generate all the help tags for any file located in the doc
directory.
==============================================================================
USAGE *bufexplorer-usage*
To start exploring in the current window, use: >
\be OR :BufExplorer
To start exploring in a newly split horizontal window, use: >
\bs or :HSBufExplorer
To start exploring in a newly split vertical window, use: >
\bv or :VSBufExplorer
If you would like to use something other than '\', you may simply change the
leader (see |mapleader|).
Note: If the current buffer is modified when bufexplorer started, the current
window is always split and the new bufexplorer is displayed in that new
window.
Commands to use once exploring:
<enter> Opens the buffer that is under the cursor into the current
window.
<F1> Toggle help information.
<leftmouse> Opens the buffer that is under the cursor into the current
window.
<shift-enter> Opens the buffer that is under the cursor in another tab.
d |:wipeout| the buffer under the cursor from the list.
When a buffers is wiped, it will not be shown when unlisted
buffer are displayed.
D |:delete| the buffer under the cursor from the list.
The buffer's 'buflisted' is cleared. This allows for the buffer
to be displayed again using the 'show unlisted' command.
f Toggles whether you are taken to the active window when
selecting a buffer or not.
p Toggles the showing of a split filename/pathname.
q Quit exploring.
r Reverses the order the buffers are listed in.
R Toggles relative path/absolute path.
s Selects the order the buffers are listed in. Either by buffer
number, file name, file extension, most recently used (MRU), or
full path.
t Opens the buffer that is under the cursor in another tab.
u Toggles the showing of "unlisted" buffers.
Once invoked, Buffer Explorer displays a sorted list (MRU is the default
sort method) of all the buffers that are currently opened. You are then
able to move the cursor to the line containing the buffer's name you are
wanting to act upon. Once you have selected the buffer you would like,
you can then either open it, close it(delete), resort the list, reverse
the sort, quit exploring and so on...
===============================================================================
CUSTOMIZATION *bufexplorer-customization*
*g:bufExplorerDefaultHelp*
To control whether the default help is displayed or not, use: >
let g:bufExplorerDefaultHelp=0 " Do not show default help.
let g:bufExplorerDefaultHelp=1 " Show default help.
The default is to show the default help.
*g:bufExplorerDetailedHelp*
To control whether detailed help is display by, use: >
let g:bufExplorerDetailedHelp=0 " Do not show detailed help.
let g:bufExplorerDetailedHelp=1 " Show detailed help.
The default is NOT to show detailed help.
*g:bufExplorerFindActive*
To control whether you are taken to the active window when selecting a buffer,
use: >
let g:bufExplorerFindActive=0 " Do not go to active window.
let g:bufExplorerFindActive=1 " Go to active window.
The default is to be taken to the active window.
*g:bufExplorerReverseSort*
To control whether to sort the buffer in reverse order or not, use: >
let g:bufExplorerReverseSort=0 " Do not sort in reverse order.
let g:bufExplorerReverseSort=1 " Sort in reverse order.
The default is NOT to sort in reverse order.
*g:bufExplorerShowDirectories*
Directories usually show up in the list from using a command like ":e .".
To control whether to show directories in the buffer list or not, use: >
let g:bufExplorerShowDirectories=1 " Show directories.
let g:bufExplorerShowDirectories=0 " Don't show directories.
The default is to show directories.
*g:bufExplorerShowRelativePath*
To control whether to show absolute paths or relative to the current
directory, use: >
let g:bufExplorerShowRelativePath=0 " Show absolute paths.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
The default is to show absolute paths.
*g:bufExplorerShowUnlisted*
To control whether to show unlisted buffer or not, use: >
let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers.
let g:bufExplorerShowUnlisted=1 " Show unlisted buffers.
The default is to NOT show unlisted buffers.
*g:bufExplorerSortBy*
To control what field the buffers are sorted by, use: >
let g:bufExplorerSortBy='extension' " Sort by file extension.
let g:bufExplorerSortBy='fullpath' " Sort by full file path name.
let g:bufExplorerSortBy='mru' " Sort by most recently used.
let g:bufExplorerSortBy='name' " Sort by the buffer's name.
let g:bufExplorerSortBy='number' " Sort by the buffer's number.
The default is to sort by mru.
*g:bufExplorerSplitBelow*
To control where the new split window will be placed above or below the
current window, use: >
let g:bufExplorerSplitBelow=1 " Split new window below current.
let g:bufExplorerSplitBelow=0 " Split new window above current.
The default is to use what ever is set by the global &splitbelow
variable.
*g:bufExplorerSplitOutPathName*
To control whether to split out the path and file name or not, use: >
let g:bufExplorerSplitOutPathName=1 " Split the path and file name.
let g:bufExplorerSplitOutPathName=0 " Don't split the path and file
" name.
The default is to split the path and file name.
*g:bufExplorerSplitRight*
To control where the new vsplit window will be placed to the left or right of
current window, use: >
let g:bufExplorerSplitRight=0 " Split left.
let g:bufExplorerSplitRight=1 " Split right.
The default is to use the global &splitright.
===============================================================================
CHANGE LOG *bufexplorer-changelog*
7.2.2 - Fix:
* Thanks to David L. Dight for spotting and fixing an issue when
using ctrl^. bufexplorer would incorrectly handle the previous
buffer so that when ctrl^ was pressed the incorrect file was opened.
7.2.1 - Fix:
* Thanks to Dimitar for spotting and fixing a feature that was
inadvertently left out of the previous version. The feature was
when bufexplorer was used together with WinManager, you could use
the tab key to open a buffer in a split window.
7.2.0 - Enhancements:
* For all those missing the \bs and \bv commands, these have now
returned. Thanks to Phil O'Connell for asking for the return of
these missing features and helping test out this version.
Fixes:
* Fixed problem with the bufExplorerFindActive code not working
correctly.
* Fixed an incompatibility between bufexplorer and netrw that caused
buffers to be incorrectly removed from the MRU list.
7.1.7 - Fixes:
* TaCahiroy fixed several issues related to opening a buffer in a
tab.
7.1.6 - Fixes:
* Removed ff=unix from modeline in bufexplorer.txt. Found by Bill
McCarthy.
7.1.5 - Fixes:
* Could not open unnamed buffers. Fixed by TaCahiroy.
7.1.4 - Fixes:
* Sometimes when a file's path has 'white space' in it, extra buffers
would be created containing each piece of the path. i.e:
opening c:\document and settings\test.txt would create a buffer
named "and" and a buffer named "Documents". This was reported and
fixed by TaCa Yoss.
7.1.3 - Fixes:
* Added code to allow only one instance of the plugin to run at a
time. Thanks Dennis Hostetler.
7.1.2 - Fixes:
* Fixed a jumplist issue spotted by JiangJun. I overlooked the
'jumplist' and with a couple calls to 'keepjumps', everything is
fine again.
* Went back to just having a plugin file, no autoload file. By having
the autoload, WinManager was no longer working and without really
digging into the cause, it was easier to go back to using just a
plugin file.
7.1.1 - Fixes:
* A problem spotted by Thomas Arendsen Hein.
When running Vim (7.1.94), error E493 was being thrown.
Enhancements:
* Added 'D' for 'delete' buffer as the 'd' command was a 'wipe'
buffer.
7.1.0 - Another 'major' update, some by Dave Larson, some by me.
* Making use of 'autoload' now to make the plugin load quicker.
* Removed '\bs' and '\bv'. These are now controlled by the user. The
user can issue a ':sp' or ':vs' to create a horizontal or vertical
split window and then issue a '\be'
* Added handling of tabs.
7.0.17 - Fixed issue with 'drop' command.
Various enhancements and improvements.
7.0.16 - Fixed issue reported by Liu Jiaping on non Windows systems, which was
...
Open file1, open file2, modify file1, open bufexplorer, you get the
following error:
--------8<--------
Error detected while processing function
<SNR>14_StartBufExplorer..<SNR>14_SplitOpen:
line 4:
E37: No write since last change (add ! to override)
But the worse thing is, when I want to save the current buffer and
type ':w', I get another error message:
E382: Cannot write, 'buftype' option is set
--------8<--------
7.0.15 - Thanks to Mark Smithfield for suggesting bufexplorer needed to handle
the ':args' command.
7.0.14 - Thanks to Randall Hansen for removing the requirement of terminal
versions to be recompiled with 'gui' support so the 'drop' command
would work. The 'drop' command is really not needed in terminal
versions.
7.0.13 - Fixed integration with WinManager.
Thanks to Dave Eggum for another update.
- Fix: The detailed help didn't display the mapping for toggling
the split type, even though the split type is displayed.
- Fixed incorrect description in the detailed help for toggling
relative or full paths.
- Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same
thing.
- Created a s:Set() function that sets a variable only if it hasn't
already been defined. It's useful for initializing all those
default settings.
- Removed checks for repetitive command definitions. They were
unnecessary.
- Made the help highlighting a little more fancy.
- Minor reverse compatibility issue: Changed ambiguous setting
names to be more descriptive of what they do (also makes the code
easier to follow):
Changed bufExplorerSortDirection to bufExplorerReverseSort
Changed bufExplorerSplitType to bufExplorerSplitVertical
Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow
- When the BufExplorer window closes, all the file-local marks are
now deleted. This may have the benefit of cleaning up some of the
jumplist.
- Changed the name of the parameter for StartBufExplorer from
"split" to "open". The parameter is a string which specifies how
the buffer will be open, not if it is split or not.
- Deprecated DoAnyMoreBuffersExist() - it is a one line function
only used in one spot.
- Created four functions (SplitOpen(), RebuildBufferList(),
UpdateHelpStatus() and ReSortListing()) all with one purpose - to
reduce repeated code.
- Changed the name of AddHeader() to CreateHelp() to be more
descriptive of what it does. It now returns an array instead of
updating the window directly. This has the benefit of making the
code more efficient since the text the function returns is used a
little differently in the two places the function is called.
- Other minor simplifications.
7.0.12 - MAJOR Update.
This version will ONLY run with Vim version 7.0 or greater.
Dave Eggum has made some 'significant' updates to this latest
version:
- Added BufExplorerGetAltBuf() global function to be used in the
users rulerformat.
- Added g:bufExplorerSplitRight option.
- Added g:bufExplorerShowRelativePath option with mapping.
- Added current line highlighting.
- The split type can now be changed whether bufexplorer is opened
in split mode or not.
- Various major and minor bug fixes and speed improvements.
- Sort by extension.
Other improvements/changes:
- Changed the help key from '?' to <F1> to be more 'standard'.
- Fixed splitting of vertical bufexplorer window.
Hopefully I have not forgot something :)
7.0.11 - Fixed a couple of highlighting bugs, reported by David Eggum. He also
changed passive voice to active on a couple of warning messages.
7.0.10 - Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set,
the slash character used when displaying the path was incorrect.
7.0.9 - Martin Grenfell found and eliminated an annoying bug in the
bufexplorer/winmanager integration. The bug was were an
annoying message would be displayed when a window was split or
a new file was opened in a new window. Thanks Martin!
7.0.8 - Thanks to Mike Li for catching a bug in the WinManager integration.
The bug was related to the incorrect displaying of the buffer
explorer's window title.
7.0.7 - Thanks to Jeremy Cowgar for adding a new enhancement. This
enhancement allows the user to press 'S', that is capital S, which
will open the buffer under the cursor in a newly created split
window.
7.0.6 - Thanks to Larry Zhang for finding a bug in the "split" buffer code.
If you force set g:bufExplorerSplitType='v' in your vimrc, and if you
tried to do a \bs to split the bufexplorer window, it would always
split horizontal, not vertical. He also found that I had a typeo in
that the variable g:bufExplorerSplitVertSize was all lower case in
the documentation which was incorrect.
7.0.5 - Thanks to Mun Johl for pointing out a bug that if a buffer was
modified, the '+' was not showing up correctly.
7.0.4 - Fixed a problem discovered first by Xiangjiang Ma. Well since I've
been using vim 7.0 and not 6.3, I started using a function (getftype)
that is not in 6.3. So for backward compatibility, I conditionaly use
this function now. Thus, the g:bufExplorerShowDirectories feature is
only available when using vim 7.0 and above.
7.0.3 - Thanks to Erwin Waterlander for finding a problem when the last
buffer was deleted. This issue got me to rewrite the buffer display
logic (which I've wanted to do for sometime now).
Also great thanks to Dave Eggum for coming up with idea for
g:bufExplorerShowDirectories. Read the above information about this
feature.
7.0.2 - Thanks to Thomas Arendsen Hein for finding a problem when a user
has the default help turned off and then brought up the explorer. An
E493 would be displayed.
7.0.1 - Thanks to Erwin Waterlander for finding a couple problems.
The first problem allowed a modified buffer to be deleted. Opps! The
second problem occurred when several files were opened, BufExplorer
was started, the current buffer was deleted using the 'd' option, and
then BufExplorer was exited. The deleted buffer was still visible
while it is not in the buffers list. Opps again!
7.0.0 - Thanks to Shankar R. for suggesting to add the ability to set
the fixed width (g:bufExplorerSplitVertSize) of a new window
when opening bufexplorer vertically and fixed height
(g:bufExplorerSplitHorzSize) of a new window when opening
bufexplorer horizontally. By default, the windows are normally
split to use half the existing width or height.
6.3.0 - Added keepjumps so that the jumps list would not get cluttered with
bufexplorer related stuff.
6.2.3 - Thanks to Jay Logan for finding a bug in the vertical split position
of the code. When selecting that the window was to be split
vertically by doing a '\bv', from then on, all splits, i.e. '\bs',
were split vertically, even though g:bufExplorerSplitType was not set
to 'v'.
6.2.2 - Thanks to Patrik Modesto for adding a small improvement. For some
reason his bufexplorer window was always showing up folded. He added
'setlocal nofoldenable' and it was fixed.
6.2.1 - Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting
logic and option.
6.2.0 - Thanks goes out to Simon Johann-Ganter for spotting and fixing a
problem in that the last search pattern is overridden by the search
pattern for blank lines.
6.1.6 - Thanks to Artem Chuprina for finding a pesky bug that has been around
for sometime now. The <esc> key mapping was causing the buffer
explored to close prematurely when vim was run in an xterm. The <esc>
key mapping is now removed.
6.1.5 - Thanks to Khorev Sergey. Added option to show default help or not.
6.1.4 - Thanks goes out to Valery Kondakoff for suggesting the addition of
setlocal nonumber and foldcolumn=0. This allows for line numbering
and folding to be turned off temporarily while in the explorer.
6.1.3 - Added folding. Did some code cleanup. Added the ability to force the
newly split window to be temporarily vertical, which was suggested by
Thomas Glanzmann.
6.1.2 - Now pressing the <esc> key will quit, just like 'q'.
Added folds to hide winmanager configuration.
If anyone had the 'C' option in their cpoptions they would receive
a E10 error on startup of BufExplorer. cpo is now saved, updated and
restored. Thanks to Charles E Campbell, Jr.
Attempted to make sure there can only be one BufExplorer window open
at a time.
6.1.1 - Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This
way buffers sorted by name will be in the correct order regardless of
case.
6.0.16 - Thanks to Andre Pang for the original patch/idea to get bufexplorer
to work in insertmode/modeless mode (evim). Added Initialize
and Cleanup autocommands to handle commands that need to be
performed when starting or leaving bufexplorer.
6.0.15 - Srinath Avadhanulax added a patch for winmanager.vim.
6.0.14 - Fix a few more bug that I thought I already had fixed. Thanks
to Eric Bloodworth for adding 'Open Mode/Edit in Place'. Added
vertical splitting.
6.0.13 - Thanks to Charles E Campbell, Jr. for pointing out some embarrassing
typos that I had in the documentation. I guess I need to run
the spell checker more :o)
6.0.12 - Thanks to Madoka Machitani, for the tip on adding the augroup command
around the MRUList autocommands.
6.0.11 - Fixed bug report by Xiangjiang Ma. '"=' was being added to the
search history which messed up hlsearch.
6.0.10 - Added the necessary hooks so that the Srinath Avadhanula's
winmanager.vim script could more easily integrate with this script.
Tried to improve performance.
6.0.9 - Added MRU (Most Recently Used) sort ordering.
6.0.8 - Was not resetting the showcmd command correctly.
Added nifty help file.
6.0.7 - Thanks to Brett Carlane for some great enhancements. Some are added,
some are not, yet. Added highlighting of current and alternate
filenames. Added splitting of path/filename toggle. Reworked
ShowBuffers().
Changed my email address.
6.0.6 - Copyright notice added. Needed this so that it could be distributed
with Debian Linux. Fixed problem with the SortListing() function
failing when there was only one buffer to display.
6.0.5 - Fixed problems reported by David Pascoe, in that you where unable to
hit 'd' on a buffer that belonged to a files that no longer existed
and that the 'yank' buffer was being overridden by the help text when
the bufexplorer was opened.
6.0.4 - Thanks to Charles Campbell, Jr. for making this plugin more plugin
*compliant*, adding default keymappings of <Leader>be and <Leader>bs
as well as fixing the 'w:sortDirLabel not being defined' bug.
6.0.3 - Added sorting capabilities. Sort taken from explorer.vim.
6.0.2 - Can't remember.
6.0.1 - Initial release.
===============================================================================
TODO *bufexplorer-todo*
- The issuing of a ':bd' command does not always remove the buffer number from
the MRU list.
===============================================================================
CREDITS *bufexplorer-credits*
Author: Jeff Lanzarotta <delux256-vim at yahoo dot com>
Credit must go out to Bram Moolenaar and all the Vim developers for
making the world's best editor (IMHO). I also want to thank everyone who
helped and gave me suggestions. I wouldn't want to leave anyone out so I
won't list names.
===============================================================================
vim:tw=78:noet:wrap:ts=8:ft=help:norl:

151
dot_vim/doc/cocoa.txt Normal file
View file

@ -0,0 +1,151 @@
*cocoa.txt* Plugin for Cocoa/Objective-C development.
cocoa.vim *cocoa*
Last Change: September 08, 2009
Author: Michael Sanders
|cocoa-introduction| Introduction
|cocoa-installation| Installation
|cocoa-overview| Overview of features
|cocoa-mappings| Mappings
|cocoa-commands| Commands
|cocoa-license| License
|cocoa-contact| Contact
For Vim version 7.0 or later.
This plugin only works if 'compatible' is not set.
{Vi does not have any of these features.}
==============================================================================
INTRODUCTION *cocoa-intro*
Cocoa.vim is a collection of scripts designed to make it easier to develop
Cocoa/Objective-C applications. It includes enhanced syntax highlighting, code
completion, documentation lookup, as well as a number of other features that
can be used to integrate Vim with Xcode, allowing you to essentially replace
Xcode's editor with Vim.
==============================================================================
INSTALLATION *cocoa-installation*
Documentation lookup and code completion for Cocoa.vim are currently
Leopard-only (although the other parts should work on any platform). To
install, simply unzip cocoa.zip to your home vim directory (typically ~/.vim).
*cocoa-suggested-plugins*
The code completion in cocoa.vim uses snipMate, if you have it installed, to
allow you to conveniently <tab> over the parameters in functions and
methods. If you like cocoa.vim, you may also find objc_matchbracket.vim
useful.
*leopard-security-alert*
Documentation works by showing the page in your default browser, which
apparently causes Leopard to warn you of opening an html file for every word
you look up. To fix this, see this page: http://tinyurl.com/remove-annoying-alert
==============================================================================
FEATURE OVERVIEW *cocoa-features*
1. Enhanced syntax highlighting; Vim's syntax highlighting for
Objective-C seemed a bit incomplete to me, so I have added a few
niceties, such as highlighting Cocoa keywords and differentiating
the method name and passed objects in method calls and definitions.
2. Xcode-like mappings; mappings such as <d-r> (where "d" is "command")
to build & run and <d-0> to switch to the project window help to
integrate Xcode and Vim. For a complete list of the mappings in
cocoa.vim, see |cocoa-mappings|.
3. Methods for the current file can be listed and navigated to with
the |:ListMethods| command.
4. A template of methods declared in a header file (.h) can be built
in an implementation file (.m) with |:BuildMethods|.
5. Cocoa/C Documentation can be looked up with the |:CocoaDoc| command,
or simply with Vim's |K|.
6. Code completion for classes, methods, functions, constants, types,
and notifications can be invoked with <c-x><c-o>. Parameters for
methods and functions are automatically converted to snippets to
<tab> over if you have snipMate installed.
==============================================================================
MAPPINGS *cocoa-mappings* *g:objc_man_key*
Cocoa.vim maps the following keys, some for convenience and others to
integrate with Xcode:
(Disclaimer: Sorry, I could not use the swirly symbols because vim/git was
having encoding issues. Just pretend that e.g. <d-r> means cmd-r.)
|<Leader>|A - Alternate between header (.h) and implementation (.m) file
K - Look up documentation for word under cursor[1]
<d-m-up> - <Leader>A
<d-r> - Build & Run (Go)
<d-cr> - CMD-R
<d-b> - Build
<shift-k> - Clean
<d-0> - Go to Project
<d-2> - :ListMethods
<F5> (in insert mode) - Show omnicompletion menu
([1] This can be customized by the variable g:objc_man_key.)
==============================================================================
COMMANDS *cocoa-commands*
*:ListMethods*
:ListMethods Open a split window containing the methods, functions,
and #pragma marks of the current file.
*:BuildMethods*
:BuildMethods [headerfile]
Build a template of methods in an implementation (.m)
from a list declared in a header file (.h). If no
argument is given, the corresponding header file is
used (e.g. "foo.m" -> "foo.h").
==============================================================================
CODE COMPLETION *cocoa-completion*
When cocoa.vim is installed the 'omnifunc' is automatically set to
'cocoacomplete#Complete'. This allows you to complete classes, functions,
methods, etc. with <c-x><c-o>. These keywords are saved from header files in
~/.vim/lib/cocoa_indexes; they have been built for you, although you can build
them again by running ~/.vim/lib/extras/cocoa_definitions.py.
Completions with parameters (i.e., functions and methods) are automatically
converted to |snipMate| if it is installed. To invoke the snippet, simply
press a whitespace character (space, tab, or return), and then navigate the
snippet as you would in snipMate.
==============================================================================
LICENSE *cocoa-license*
Cocoa.vim is released under the MIT license:
Copyright © 2009 Michael Sanders. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The software is provided "as is", without warranty of any kind, express or
implied, including but not limited to the warranties of merchantability,
fitness for a particular purpose and noninfringement. In no event shall the
authors or copyright holders be liable for any claim, damages or other
liability, whether in an action of contract, tort or otherwise, arising from,
out of or in connection with the software or the use or other dealings in the
software.
==============================================================================
CONTACT *cocoa-contact* *cocoa-author*
To contact the author (Michael Sanders), you may email:
msanders42+cocoa.vim <at> gmail <dot> com
Thanks for your interest in the script!
==============================================================================
vim:tw=78:ts=8:ft=help:norl:enc=utf-8:

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

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

710
dot_vim/doc/project.txt Normal file

File diff suppressed because it is too large Load diff

603
dot_vim/doc/ps_color.txt Normal file

File diff suppressed because it is too large Load diff

286
dot_vim/doc/snipMate.txt Normal file
View file

@ -0,0 +1,286 @@
*snipMate.txt* Plugin for using TextMate-style snippets in Vim.
snipMate *snippet* *snippets* *snipMate*
Last Change: July 13, 2009
|snipMate-description| Description
|snipMate-syntax| Snippet syntax
|snipMate-usage| Usage
|snipMate-settings| Settings
|snipMate-features| Features
|snipMate-disadvantages| Disadvantages to TextMate
|snipMate-contact| Contact
For Vim version 7.0 or later.
This plugin only works if 'compatible' is not set.
{Vi does not have any of these features.}
==============================================================================
DESCRIPTION *snipMate-description*
snipMate.vim implements some of TextMate's snippets features in Vim. A
snippet is a piece of often-typed text that you can insert into your
document using a trigger word followed by a <tab>.
For instance, in a C file using the default installation of snipMate.vim, if
you type "for<tab>" in insert mode, it will expand a typical for loop in C: >
for (i = 0; i < count; i++) {
}
To go to the next item in the loop, simply <tab> over to it; if there is
repeated code, such as the "i" variable in this example, you can simply
start typing once it's highlighted and all the matches specified in the
snippet will be updated. To go in reverse, use <shift-tab>.
==============================================================================
SYNTAX *snippet-syntax*
Snippets can be defined in two ways. They can be in their own file, named
after their trigger in 'snippets/<filetype>/<trigger>.snippet', or they can be
defined together in a 'snippets/<filetype>.snippets' file. Note that dotted
'filetype' syntax is supported -- e.g., you can use >
:set ft=html.eruby
to activate snippets for both HTML and eRuby for the current file.
The syntax for snippets in *.snippets files is the following: >
snippet trigger
expanded text
more expanded text
Note that the first hard tab after the snippet trigger is required, and not
expanded in the actual snippet. The syntax for *.snippet files is the same,
only without the trigger declaration and starting indentation.
Also note that snippets must be defined using hard tabs. They can be expanded
to spaces later if desired (see |snipMate-indenting|).
"#" is used as a line-comment character in *.snippets files; however, they can
only be used outside of a snippet declaration. E.g.: >
# this is a correct comment
snippet trigger
expanded text
snippet another_trigger
# this isn't a comment!
expanded text
<
This should hopefully be obvious with the included syntax highlighting.
*snipMate-${#}*
Tab stops ~
By default, the cursor is placed at the end of a snippet. To specify where the
cursor is to be placed next, use "${#}", where the # is the number of the tab
stop. E.g., to place the cursor first on the id of a <div> tag, and then allow
the user to press <tab> to go to the middle of it:
>
snippet div
<div id="${1}">
${2}
</div>
<
*snipMate-placeholders* *snipMate-${#:}* *snipMate-$#*
Placeholders ~
Placeholder text can be supplied using "${#:text}", where # is the number of
the tab stop. This text then can be copied throughout the snippet using "$#",
given # is the same number as used before. So, to make a C for loop: >
snippet for
for (${2:i}; $2 < ${1:count}; $1++) {
${4}
}
This will cause "count" to first be selected and change if the user starts
typing. When <tab> is pressed, the "i" in ${2}'s position will be selected;
all $2 variables will default to "i" and automatically be updated if the user
starts typing.
NOTE: "$#" syntax is used only for variables, not for tab stops as in TextMate.
Variables within variables are also possible. For instance: >
snippet opt
<option value="${1:option}">${2:$1}</option>
Will, as usual, cause "option" to first be selected and update all the $1
variables if the user starts typing. Since one of these variables is inside of
${2}, this text will then be used as a placeholder for the next tab stop,
allowing the user to change it if he wishes.
To copy a value throughout a snippet without supplying default text, simply
use the "${#:}" construct without the text; e.g.: >
snippet foo
${1:}bar$1
< *snipMate-commands*
Interpolated Vim Script ~
Snippets can also contain Vim script commands that are executed (via |eval()|)
when the snippet is inserted. Commands are given inside backticks (`...`); for
TextMates's functionality, use the |system()| function. E.g.: >
snippet date
`system("date +%Y-%m-%d")`
will insert the current date, assuming you are on a Unix system. Note that you
can also (and should) use |strftime()| for this example.
Filename([{expr}] [, {defaultText}]) *snipMate-filename* *Filename()*
Since the current filename is used often in snippets, a default function
has been defined for it in snipMate.vim, appropriately called Filename().
With no arguments, the default filename without an extension is returned;
the first argument specifies what to place before or after the filename,
and the second argument supplies the default text to be used if the file
has not been named. "$1" in the first argument is replaced with the filename;
if you only want the filename to be returned, the first argument can be left
blank. Examples: >
snippet filename
`Filename()`
snippet filename_with_default
`Filename('', 'name')`
snippet filename_foo
`filename('$1_foo')`
The first example returns the filename if it the file has been named, and an
empty string if it hasn't. The second returns the filename if it's been named,
and "name" if it hasn't. The third returns the filename followed by "_foo" if
it has been named, and an empty string if it hasn't.
*multi_snip*
To specify that a snippet can have multiple matches in a *.snippets file, use
this syntax: >
snippet trigger A description of snippet #1
expand this text
snippet trigger A description of snippet #2
expand THIS text!
In this example, when "trigger<tab>" is typed, a numbered menu containing all
of the descriptions of the "trigger" will be shown; when the user presses the
corresponding number, that snippet will then be expanded.
To create a snippet with multiple matches using *.snippet files,
simply place all the snippets in a subdirectory with the trigger name:
'snippets/<filetype>/<trigger>/<name>.snippet'.
==============================================================================
USAGE *snipMate-usage*
*'snippets'* *g:snippets_dir*
Snippets are by default looked for any 'snippets' directory in your
'runtimepath'. Typically, it is located at '~/.vim/snippets/' on *nix or
'$HOME\vimfiles\snippets\' on Windows. To change that location or add another
one, change the g:snippets_dir variable in your |.vimrc| to your preferred
directory, or use the |ExtractSnips()|function. This will be used by the
|globpath()| function, and so accepts the same syntax as it (e.g.,
comma-separated paths).
ExtractSnipsFile({directory}, {filetype}) *ExtractSnipsFile()* *.snippets*
ExtractSnipsFile() extracts the specified *.snippets file for the given
filetype. A .snippets file contains multiple snippet declarations for the
filetype. It is further explained above, in |snippet-syntax|.
ExtractSnips({directory}, {filetype}) *ExtractSnips()* *.snippet*
ExtractSnips() extracts *.snippet files from the specified directory and
defines them as snippets for the given filetype. The directory tree should
look like this: 'snippets/<filetype>/<trigger>.snippet'. If the snippet has
multiple matches, it should look like this:
'snippets/<filetype>/<trigger>/<name>.snippet' (see |multi_snip|).
*ResetSnippets()*
The ResetSnippets() function removes all snippets from memory. This is useful
to put at the top of a snippet setup file for if you would like to |:source|
it multiple times.
*list-snippets* *i_CTRL-R_<Tab>*
If you would like to see what snippets are available, simply type <c-r><tab>
in the current buffer to show a list via |popupmenu-completion|.
==============================================================================
SETTINGS *snipMate-settings* *g:snips_author*
The g:snips_author string (similar to $TM_FULLNAME in TextMate) should be set
to your name; it can then be used in snippets to automatically add it. E.g.: >
let g:snips_author = 'Hubert Farnsworth'
snippet name
`g:snips_author`
<
*snipMate-expandtab* *snipMate-indenting*
If you would like your snippets to be expanded using spaces instead of tabs,
just enable 'expandtab' and set 'softtabstop' to your preferred amount of
spaces. If 'softtabstop' is not set, 'shiftwidth' is used instead.
*snipMate-remap*
snipMate does not come with a setting to customize the trigger key, but you
can remap it easily in the two lines it's defined in the 'after' directory
under 'plugin/snipMate.vim'. For instance, to change the trigger key
to CTRL-J, just change this: >
ino <tab> <c-r>=TriggerSnippet()<cr>
snor <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
to this: >
ino <c-j> <c-r>=TriggerSnippet()<cr>
snor <c-j> <esc>i<right><c-r>=TriggerSnippet()<cr>
==============================================================================
FEATURES *snipMate-features*
snipMate.vim has the following features among others:
- The syntax of snippets is very similar to TextMate's, allowing
easy conversion.
- The position of the snippet is kept transparently (i.e. it does not use
markers/placeholders written to the buffer), which allows you to escape
out of an incomplete snippet, something particularly useful in Vim.
- Variables in snippets are updated as-you-type.
- Snippets can have multiple matches.
- Snippets can be out of order. For instance, in a do...while loop, the
condition can be added before the code.
- [New] File-based snippets are supported.
- [New] Triggers after non-word delimiters are expanded, e.g. "foo"
in "bar.foo".
- [New] <shift-tab> can now be used to jump tab stops in reverse order.
==============================================================================
DISADVANTAGES *snipMate-disadvantages*
snipMate.vim currently has the following disadvantages to TextMate's snippets:
- There is no $0; the order of tab stops must be explicitly stated.
- Placeholders within placeholders are not possible. E.g.: >
'<div${1: id="${2:some_id}}">${3}</div>'
<
In TextMate this would first highlight ' id="some_id"', and if
you hit delete it would automatically skip ${2} and go to ${3}
on the next <tab>, but if you didn't delete it it would highlight
"some_id" first. You cannot do this in snipMate.vim.
- Regex cannot be performed on variables, such as "${1/.*/\U&}"
- Placeholders cannot span multiple lines.
- Activating snippets in different scopes of the same file is
not possible.
Perhaps some of these features will be added in a later release.
==============================================================================
CONTACT *snipMate-contact* *snipMate-author*
To contact the author (Michael Sanders), please email:
msanders42+snipmate <at> gmail <dot> com
I greatly appreciate any suggestions or improvements offered for the script.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

354
dot_vim/doc/tags Normal file
View file

@ -0,0 +1,354 @@
'NERDChristmasTree' NERD_tree.txt /*'NERDChristmasTree'*
'NERDTreeAutoCenter' NERD_tree.txt /*'NERDTreeAutoCenter'*
'NERDTreeAutoCenterThreshold' NERD_tree.txt /*'NERDTreeAutoCenterThreshold'*
'NERDTreeBookmarksFile' NERD_tree.txt /*'NERDTreeBookmarksFile'*
'NERDTreeCaseSensitiveSort' NERD_tree.txt /*'NERDTreeCaseSensitiveSort'*
'NERDTreeChDirMode' NERD_tree.txt /*'NERDTreeChDirMode'*
'NERDTreeHighlightCursorline' NERD_tree.txt /*'NERDTreeHighlightCursorline'*
'NERDTreeHijackNetrw' NERD_tree.txt /*'NERDTreeHijackNetrw'*
'NERDTreeIgnore' NERD_tree.txt /*'NERDTreeIgnore'*
'NERDTreeMouseMode' NERD_tree.txt /*'NERDTreeMouseMode'*
'NERDTreeQuitOnOpen' NERD_tree.txt /*'NERDTreeQuitOnOpen'*
'NERDTreeShowBookmarks' NERD_tree.txt /*'NERDTreeShowBookmarks'*
'NERDTreeShowFiles' NERD_tree.txt /*'NERDTreeShowFiles'*
'NERDTreeShowHidden' NERD_tree.txt /*'NERDTreeShowHidden'*
'NERDTreeShowLineNumbers' NERD_tree.txt /*'NERDTreeShowLineNumbers'*
'NERDTreeSortOrder' NERD_tree.txt /*'NERDTreeSortOrder'*
'NERDTreeStatusline' NERD_tree.txt /*'NERDTreeStatusline'*
'NERDTreeWinPos' NERD_tree.txt /*'NERDTreeWinPos'*
'NERDTreeWinSize' NERD_tree.txt /*'NERDTreeWinSize'*
'loaded_nerd_tree' NERD_tree.txt /*'loaded_nerd_tree'*
'snippets' snipMate.txt /*'snippets'*
.snippet snipMate.txt /*.snippet*
.snippets snipMate.txt /*.snippets*
:BuildMethods cocoa.txt /*:BuildMethods*
:CVSEdit vcscommand.txt /*:CVSEdit*
:CVSEditors vcscommand.txt /*:CVSEditors*
:CVSUnedit vcscommand.txt /*:CVSUnedit*
:CVSWatch vcscommand.txt /*:CVSWatch*
:CVSWatchAdd vcscommand.txt /*:CVSWatchAdd*
:CVSWatchOff vcscommand.txt /*:CVSWatchOff*
:CVSWatchOn vcscommand.txt /*:CVSWatchOn*
:CVSWatchRemove vcscommand.txt /*:CVSWatchRemove*
:CVSWatchers vcscommand.txt /*:CVSWatchers*
:ListMethods cocoa.txt /*:ListMethods*
:MatchDebug matchit.txt /*:MatchDebug*
:NERDTree NERD_tree.txt /*:NERDTree*
:NERDTreeClose NERD_tree.txt /*:NERDTreeClose*
:NERDTreeFromBookmark NERD_tree.txt /*:NERDTreeFromBookmark*
:NERDTreeMirror NERD_tree.txt /*:NERDTreeMirror*
:NERDTreeToggle NERD_tree.txt /*:NERDTreeToggle*
:VCSAdd vcscommand.txt /*:VCSAdd*
:VCSAnnotate vcscommand.txt /*:VCSAnnotate*
:VCSBlame vcscommand.txt /*:VCSBlame*
:VCSCommit vcscommand.txt /*:VCSCommit*
:VCSDelete vcscommand.txt /*:VCSDelete*
:VCSDiff vcscommand.txt /*:VCSDiff*
:VCSGotoOriginal vcscommand.txt /*:VCSGotoOriginal*
:VCSInfo vcscommand.txt /*:VCSInfo*
:VCSLock vcscommand.txt /*:VCSLock*
:VCSLog vcscommand.txt /*:VCSLog*
:VCSRemove vcscommand.txt /*:VCSRemove*
:VCSRevert vcscommand.txt /*:VCSRevert*
:VCSReview vcscommand.txt /*:VCSReview*
:VCSStatus vcscommand.txt /*:VCSStatus*
:VCSUnlock vcscommand.txt /*:VCSUnlock*
:VCSUpdate vcscommand.txt /*:VCSUpdate*
:VCSVimDiff vcscommand.txt /*:VCSVimDiff*
ExtractSnips() snipMate.txt /*ExtractSnips()*
ExtractSnipsFile() snipMate.txt /*ExtractSnipsFile()*
Filename() snipMate.txt /*Filename()*
MatchError matchit.txt /*MatchError*
NERDTree NERD_tree.txt /*NERDTree*
NERDTree-! NERD_tree.txt /*NERDTree-!*
NERDTree-? NERD_tree.txt /*NERDTree-?*
NERDTree-B NERD_tree.txt /*NERDTree-B*
NERDTree-C NERD_tree.txt /*NERDTree-C*
NERDTree-D NERD_tree.txt /*NERDTree-D*
NERDTree-F NERD_tree.txt /*NERDTree-F*
NERDTree-I NERD_tree.txt /*NERDTree-I*
NERDTree-J NERD_tree.txt /*NERDTree-J*
NERDTree-K NERD_tree.txt /*NERDTree-K*
NERDTree-O NERD_tree.txt /*NERDTree-O*
NERDTree-P NERD_tree.txt /*NERDTree-P*
NERDTree-R NERD_tree.txt /*NERDTree-R*
NERDTree-T NERD_tree.txt /*NERDTree-T*
NERDTree-U NERD_tree.txt /*NERDTree-U*
NERDTree-X NERD_tree.txt /*NERDTree-X*
NERDTree-c-j NERD_tree.txt /*NERDTree-c-j*
NERDTree-c-k NERD_tree.txt /*NERDTree-c-k*
NERDTree-contents NERD_tree.txt /*NERDTree-contents*
NERDTree-e NERD_tree.txt /*NERDTree-e*
NERDTree-f NERD_tree.txt /*NERDTree-f*
NERDTree-gi NERD_tree.txt /*NERDTree-gi*
NERDTree-go NERD_tree.txt /*NERDTree-go*
NERDTree-gs NERD_tree.txt /*NERDTree-gs*
NERDTree-i NERD_tree.txt /*NERDTree-i*
NERDTree-m NERD_tree.txt /*NERDTree-m*
NERDTree-o NERD_tree.txt /*NERDTree-o*
NERDTree-p NERD_tree.txt /*NERDTree-p*
NERDTree-q NERD_tree.txt /*NERDTree-q*
NERDTree-r NERD_tree.txt /*NERDTree-r*
NERDTree-s NERD_tree.txt /*NERDTree-s*
NERDTree-t NERD_tree.txt /*NERDTree-t*
NERDTree-u NERD_tree.txt /*NERDTree-u*
NERDTree-x NERD_tree.txt /*NERDTree-x*
NERDTreeAbout NERD_tree.txt /*NERDTreeAbout*
NERDTreeBookmarkCommands NERD_tree.txt /*NERDTreeBookmarkCommands*
NERDTreeBookmarkTable NERD_tree.txt /*NERDTreeBookmarkTable*
NERDTreeBookmarks NERD_tree.txt /*NERDTreeBookmarks*
NERDTreeChangelog NERD_tree.txt /*NERDTreeChangelog*
NERDTreeCredits NERD_tree.txt /*NERDTreeCredits*
NERDTreeFilesysMenu NERD_tree.txt /*NERDTreeFilesysMenu*
NERDTreeFunctionality NERD_tree.txt /*NERDTreeFunctionality*
NERDTreeGlobalCommands NERD_tree.txt /*NERDTreeGlobalCommands*
NERDTreeHacking NERD_tree.txt /*NERDTreeHacking*
NERDTreeInvalidBookmarks NERD_tree.txt /*NERDTreeInvalidBookmarks*
NERDTreeLicense NERD_tree.txt /*NERDTreeLicense*
NERDTreeMappings NERD_tree.txt /*NERDTreeMappings*
NERDTreeOptionDetails NERD_tree.txt /*NERDTreeOptionDetails*
NERDTreeOptionSummary NERD_tree.txt /*NERDTreeOptionSummary*
NERDTreeOptions NERD_tree.txt /*NERDTreeOptions*
NERD_tree.txt NERD_tree.txt /*NERD_tree.txt*
ResetSnippets() snipMate.txt /*ResetSnippets()*
VCSCommandCVSDiffOpt vcscommand.txt /*VCSCommandCVSDiffOpt*
VCSCommandCVSExec vcscommand.txt /*VCSCommandCVSExec*
VCSCommandCommitOnWrite vcscommand.txt /*VCSCommandCommitOnWrite*
VCSCommandDeleteOnHide vcscommand.txt /*VCSCommandDeleteOnHide*
VCSCommandDiffSplit vcscommand.txt /*VCSCommandDiffSplit*
VCSCommandDisableAll vcscommand.txt /*VCSCommandDisableAll*
VCSCommandDisableExtensionMappings vcscommand.txt /*VCSCommandDisableExtensionMappings*
VCSCommandDisableMappings vcscommand.txt /*VCSCommandDisableMappings*
VCSCommandEdit vcscommand.txt /*VCSCommandEdit*
VCSCommandEnableBufferSetup vcscommand.txt /*VCSCommandEnableBufferSetup*
VCSCommandMapPrefix vcscommand.txt /*VCSCommandMapPrefix*
VCSCommandMappings vcscommand.txt /*VCSCommandMappings*
VCSCommandResultBufferNameExtension vcscommand.txt /*VCSCommandResultBufferNameExtension*
VCSCommandResultBufferNameFunction vcscommand.txt /*VCSCommandResultBufferNameFunction*
VCSCommandSVKExec vcscommand.txt /*VCSCommandSVKExec*
VCSCommandSVNDiffExt vcscommand.txt /*VCSCommandSVNDiffExt*
VCSCommandSVNDiffOpt vcscommand.txt /*VCSCommandSVNDiffOpt*
VCSCommandSVNExec vcscommand.txt /*VCSCommandSVNExec*
VCSCommandSplit vcscommand.txt /*VCSCommandSplit*
VCSCommandVCSTypeOverride vcscommand.txt /*VCSCommandVCSTypeOverride*
[% matchit.txt /*[%*
]% matchit.txt /*]%*
b:VCSCommandCommand vcscommand.txt /*b:VCSCommandCommand*
b:VCSCommandOriginalBuffer vcscommand.txt /*b:VCSCommandOriginalBuffer*
b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile*
b:VCSCommandVCSType vcscommand.txt /*b:VCSCommandVCSType*
b:match_col matchit.txt /*b:match_col*
b:match_debug matchit.txt /*b:match_debug*
b:match_ignorecase matchit.txt /*b:match_ignorecase*
b:match_ini matchit.txt /*b:match_ini*
b:match_iniBR matchit.txt /*b:match_iniBR*
b:match_match matchit.txt /*b:match_match*
b:match_pat matchit.txt /*b:match_pat*
b:match_skip matchit.txt /*b:match_skip*
b:match_table matchit.txt /*b:match_table*
b:match_tail matchit.txt /*b:match_tail*
b:match_wholeBR matchit.txt /*b:match_wholeBR*
b:match_word matchit.txt /*b:match_word*
b:match_words matchit.txt /*b:match_words*
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.txt bufexplorer.txt /*bufexplorer.txt*
buffer-explorer bufexplorer.txt /*buffer-explorer*
cocoa cocoa.txt /*cocoa*
cocoa-author cocoa.txt /*cocoa-author*
cocoa-commands cocoa.txt /*cocoa-commands*
cocoa-completion cocoa.txt /*cocoa-completion*
cocoa-contact cocoa.txt /*cocoa-contact*
cocoa-features cocoa.txt /*cocoa-features*
cocoa-installation cocoa.txt /*cocoa-installation*
cocoa-intro cocoa.txt /*cocoa-intro*
cocoa-license cocoa.txt /*cocoa-license*
cocoa-mappings cocoa.txt /*cocoa-mappings*
cocoa-suggested-plugins cocoa.txt /*cocoa-suggested-plugins*
cocoa.txt cocoa.txt /*cocoa.txt*
cs surround.txt /*cs*
cvscommand-changes vcscommand.txt /*cvscommand-changes*
drawit DrawIt.txt /*drawit*
drawit-a DrawIt.txt /*drawit-a*
drawit-b DrawIt.txt /*drawit-b*
drawit-brush DrawIt.txt /*drawit-brush*
drawit-c DrawIt.txt /*drawit-c*
drawit-contents DrawIt.txt /*drawit-contents*
drawit-drawing DrawIt.txt /*drawit-drawing*
drawit-e DrawIt.txt /*drawit-e*
drawit-erase DrawIt.txt /*drawit-erase*
drawit-example DrawIt.txt /*drawit-example*
drawit-f DrawIt.txt /*drawit-f*
drawit-history DrawIt.txt /*drawit-history*
drawit-l DrawIt.txt /*drawit-l*
drawit-manual DrawIt.txt /*drawit-manual*
drawit-modes DrawIt.txt /*drawit-modes*
drawit-move DrawIt.txt /*drawit-move*
drawit-moving DrawIt.txt /*drawit-moving*
drawit-options DrawIt.txt /*drawit-options*
drawit-protect DrawIt.txt /*drawit-protect*
drawit-s DrawIt.txt /*drawit-s*
drawit-setbrush DrawIt.txt /*drawit-setbrush*
drawit-setdrawit DrawIt.txt /*drawit-setdrawit*
drawit-start DrawIt.txt /*drawit-start*
drawit-stop DrawIt.txt /*drawit-stop*
drawit-usage DrawIt.txt /*drawit-usage*
drawit-visblock DrawIt.txt /*drawit-visblock*
drawit.txt DrawIt.txt /*drawit.txt*
ds surround.txt /*ds*
g% matchit.txt /*g%*
g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp*
g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp*
g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive*
g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort*
g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories*
g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath*
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*
g:drawit_insertmode DrawIt.txt /*g:drawit_insertmode*
g:objc_man_key cocoa.txt /*g:objc_man_key*
g:snippets_dir snipMate.txt /*g:snippets_dir*
g:snips_author snipMate.txt /*g:snips_author*
i_CTRL-G_S surround.txt /*i_CTRL-G_S*
i_CTRL-G_s surround.txt /*i_CTRL-G_s*
i_CTRL-R_<Tab> snipMate.txt /*i_CTRL-R_<Tab>*
leopard-security-alert cocoa.txt /*leopard-security-alert*
list-snippets snipMate.txt /*list-snippets*
matchit matchit.txt /*matchit*
matchit-% matchit.txt /*matchit-%*
matchit-\1 matchit.txt /*matchit-\\1*
matchit-activate matchit.txt /*matchit-activate*
matchit-backref matchit.txt /*matchit-backref*
matchit-bugs matchit.txt /*matchit-bugs*
matchit-choose matchit.txt /*matchit-choose*
matchit-configure matchit.txt /*matchit-configure*
matchit-debug matchit.txt /*matchit-debug*
matchit-details matchit.txt /*matchit-details*
matchit-highlight matchit.txt /*matchit-highlight*
matchit-hl matchit.txt /*matchit-hl*
matchit-intro matchit.txt /*matchit-intro*
matchit-languages matchit.txt /*matchit-languages*
matchit-modes matchit.txt /*matchit-modes*
matchit-newlang matchit.txt /*matchit-newlang*
matchit-o_% matchit.txt /*matchit-o_%*
matchit-parse matchit.txt /*matchit-parse*
matchit-s:notend matchit.txt /*matchit-s:notend*
matchit-s:sol matchit.txt /*matchit-s:sol*
matchit-spaces matchit.txt /*matchit-spaces*
matchit-troubleshoot matchit.txt /*matchit-troubleshoot*
matchit-v_% matchit.txt /*matchit-v_%*
matchit.txt matchit.txt /*matchit.txt*
matchit.vim matchit.txt /*matchit.vim*
multi_snip snipMate.txt /*multi_snip*
o_[% matchit.txt /*o_[%*
o_]% matchit.txt /*o_]%*
o_g% matchit.txt /*o_g%*
project project.txt /*project*
project-adding-mappings project.txt /*project-adding-mappings*
project-example project.txt /*project-example*
project-flags project.txt /*project-flags*
project-inheritance project.txt /*project-inheritance*
project-invoking project.txt /*project-invoking*
project-mappings project.txt /*project-mappings*
project-plugin project.txt /*project-plugin*
project-settings project.txt /*project-settings*
project-syntax project.txt /*project-syntax*
project-tips project.txt /*project-tips*
project.txt project.txt /*project.txt*
ps_color.txt ps_color.txt /*ps_color.txt*
ps_colour ps_color.txt /*ps_colour*
psc ps_color.txt /*psc*
psc-about-background ps_color.txt /*psc-about-background*
psc-change-background ps_color.txt /*psc-change-background*
psc-contents ps_color.txt /*psc-contents*
psc-cterm ps_color.txt /*psc-cterm*
psc-cterm-color-table ps_color.txt /*psc-cterm-color-table*
psc-cterm-incompatible ps_color.txt /*psc-cterm-incompatible*
psc-cterm-nt ps_color.txt /*psc-cterm-nt*
psc-cterm-others ps_color.txt /*psc-cterm-others*
psc-cterm-xterm ps_color.txt /*psc-cterm-xterm*
psc-faq ps_color.txt /*psc-faq*
psc-faq-ffothers ps_color.txt /*psc-faq-ffothers*
psc-features ps_color.txt /*psc-features*
psc-options ps_color.txt /*psc-options*
psc-overview ps_color.txt /*psc-overview*
psc-release-notes ps_color.txt /*psc-release-notes*
psc-tips ps_color.txt /*psc-tips*
psc-todo ps_color.txt /*psc-todo*
psc-usage ps_color.txt /*psc-usage*
psc_cterm_style ps_color.txt /*psc_cterm_style*
psc_fontface ps_color.txt /*psc_fontface*
psc_inversed_todo ps_color.txt /*psc_inversed_todo*
psc_statement_different_from_type ps_color.txt /*psc_statement_different_from_type*
psc_style ps_color.txt /*psc_style*
psc_use_default_for_cterm ps_color.txt /*psc_use_default_for_cterm*
pscolor ps_color.txt /*pscolor*
snipMate snipMate.txt /*snipMate*
snipMate-$# snipMate.txt /*snipMate-$#*
snipMate-${#:} snipMate.txt /*snipMate-${#:}*
snipMate-${#} snipMate.txt /*snipMate-${#}*
snipMate-author snipMate.txt /*snipMate-author*
snipMate-commands snipMate.txt /*snipMate-commands*
snipMate-contact snipMate.txt /*snipMate-contact*
snipMate-description snipMate.txt /*snipMate-description*
snipMate-disadvantages snipMate.txt /*snipMate-disadvantages*
snipMate-expandtab snipMate.txt /*snipMate-expandtab*
snipMate-features snipMate.txt /*snipMate-features*
snipMate-filename snipMate.txt /*snipMate-filename*
snipMate-indenting snipMate.txt /*snipMate-indenting*
snipMate-placeholders snipMate.txt /*snipMate-placeholders*
snipMate-remap snipMate.txt /*snipMate-remap*
snipMate-settings snipMate.txt /*snipMate-settings*
snipMate-usage snipMate.txt /*snipMate-usage*
snipMate.txt snipMate.txt /*snipMate.txt*
snippet snipMate.txt /*snippet*
snippet-syntax snipMate.txt /*snippet-syntax*
snippets snipMate.txt /*snippets*
surround surround.txt /*surround*
surround-author surround.txt /*surround-author*
surround-customizing surround.txt /*surround-customizing*
surround-issues surround.txt /*surround-issues*
surround-mappings surround.txt /*surround-mappings*
surround-replacements surround.txt /*surround-replacements*
surround-targets surround.txt /*surround-targets*
surround.txt surround.txt /*surround.txt*
v_[% matchit.txt /*v_[%*
v_]% matchit.txt /*v_]%*
v_a% matchit.txt /*v_a%*
v_g% matchit.txt /*v_g%*
vcscommand vcscommand.txt /*vcscommand*
vcscommand-buffer-management vcscommand.txt /*vcscommand-buffer-management*
vcscommand-buffer-variables vcscommand.txt /*vcscommand-buffer-variables*
vcscommand-bugs vcscommand.txt /*vcscommand-bugs*
vcscommand-commands vcscommand.txt /*vcscommand-commands*
vcscommand-config vcscommand.txt /*vcscommand-config*
vcscommand-contents vcscommand.txt /*vcscommand-contents*
vcscommand-customize vcscommand.txt /*vcscommand-customize*
vcscommand-events vcscommand.txt /*vcscommand-events*
vcscommand-install vcscommand.txt /*vcscommand-install*
vcscommand-intro vcscommand.txt /*vcscommand-intro*
vcscommand-manual vcscommand.txt /*vcscommand-manual*
vcscommand-mappings vcscommand.txt /*vcscommand-mappings*
vcscommand-mappings-override vcscommand.txt /*vcscommand-mappings-override*
vcscommand-naming vcscommand.txt /*vcscommand-naming*
vcscommand-options vcscommand.txt /*vcscommand-options*
vcscommand-ssh vcscommand.txt /*vcscommand-ssh*
vcscommand-ssh-config vcscommand.txt /*vcscommand-ssh-config*
vcscommand-ssh-env vcscommand.txt /*vcscommand-ssh-env*
vcscommand-ssh-other vcscommand.txt /*vcscommand-ssh-other*
vcscommand-ssh-wrapper vcscommand.txt /*vcscommand-ssh-wrapper*
vcscommand-statusline vcscommand.txt /*vcscommand-statusline*
vcscommand.txt vcscommand.txt /*vcscommand.txt*
vs surround.txt /*vs*
yS surround.txt /*yS*
ySS surround.txt /*ySS*
ys surround.txt /*ys*
yss surround.txt /*yss*

819
dot_vim/doc/vcscommand.txt Normal file

File diff suppressed because it is too large Load diff

147
dot_vim/filetype.vim Normal file
View file

@ -0,0 +1,147 @@
" general per-language filetype file
if exists("g:did_load_personal_filetypes")
finish
endif
let g:did_load_personal_filetypes = 1
" Filetype mappingss
augroup markdown
au! BufRead,BufNewFile *.mkd setfiletype markdown
au! BufRead,BufNewFile *.md setfiletype markdown
augroup END
augroup mako
au! BufRead,BufNewFile *.mak,*.mako setfiletype mako
augroup END
augroup csv
au! BufNewFile,BufRead *.csv setf csv
augroup END
augroup lilypond
au! BufNewFile,BufRead *.ly,*.ily setf lilypond
augroup END
augroup java
autocmd BufRead *.java set efm=%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#
autocmd BufRead *.java set makeprg=ant\ -find\ build.xml
autocmd FileType java let b:auto_trim_whitespace=1
augroup END
augroup less
autocmd BufNewFile,BufRead *.less set filetype=less
augroup END
augroup pcal
au BufNewFile,BufRead *.pcal setf tla
augroup END
augroup ragel
au BufNewFile,BufRead *.rl setf ragel
augroup END
au! BufNewFile,BufRead *.pde setf arduino
"augroup org
"" leave these as is:
"au! BufRead,BufWrite,BufWritePost,BufNewFile *.org
""au BufRead,BufNewFile *.org call org#SetOrgFileType()
""au BufRead,BufNewFile *.org :GitGutterDisable
"au BufRead *.org :PreLoadTags
"au BufWrite *.org :PreWriteTags
"au BufWritePost *.org :PostWriteTags
"augroup END
au BufNewFile,BufRead motd.public,/tmp/motd.public.r.* setf motd
au Filetype html,xml,xsl source ~/.vim/closetag.vim
au BufRead,BufNewFile *.go set filetype=go
au FileType cpp let b:delimitMate_matchpairs = "(:),[:],{:}"
autocmd FileType vue syntax sync fromstart
au Filetype vue let b:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`', '<':'>'}
au Filetype html let b:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"', '`':'`', '<':'>'}
"Settings per filetype
augroup python
""autocmd FileType python set omnifunc=pythoncomplete#Complete
""autocmd FileType python call SuperTabSetCompletionType("<C-X><C-O>")
""autocmd FileType python set completeopt-=preview
autocmd FileType python set ts=4
autocmd FileType python set softtabstop=4
autocmd FileType python set shiftwidth=4
autocmd FileType python set expandtab
autocmd FileType python set nosmartindent
"autocmd FileType python let b:auto_trim_whitespace=1
augroup END
"augroup javascript
"autocmd FileType javascript set ts=4
"autocmd FileType javascript set softtabstop=4
"autocmd FileType javascript set shiftwidth=4
"autocmd FileType javascript set expandtab
"autocmd FileType javascript let b:auto_trim_whitespace=1
"augroup END
augroup hs
autocmd FileType hs nnoremap <Leader>ii :GhcModInfo!<CR>
augroup END
augroup mkd
autocmd FileType mkd set ai formatoptions=tcroqn2 comments=n:&gt;
augroup END
augroup mediawiki
autocmd BufRead,BufNewFile *.wiki setfiletype mediawiki
autocmd BufRead,BufNewFile *.wikipedia.org* setfiletype mediawiki
augroup END
augroup go
autocmd FileType go set ts=2
autocmd FileType go set softtabstop=2
autocmd FileType go set shiftwidth=2
autocmd FileType go set noexpandtab
autocmd FileType go imap <buffer> <silent> <Leader>rr <C-o>:GoIfErr<cr>
autocmd FileType go nmap <buffer> <silent> <Leader>rr :GoIfErr<cr>
autocmd FileType go nnoremap <silent> <Leader>im <cmd>lua require('telescope').extensions.goimpl.goimpl{theme = "ivy", layout_config = {height = 10}}<cr>
"autocmd FileType go nmap <Leader>gd <Plug>(go-doc)
"autocmd FileType go nmap gd <Plug>(go-def)
augroup END
augroup idris
autocmd FileType idris nmap <buffer> <LocalLeader>a a?hole<Esc><LocalLeader>t
augroup end
augroup markdown
autocmd FileType markdown imap <buffer> <S-Tab> <C-o><<
augroup end
autocmd FileType go let b:auto_trim_whitespace=1
autocmd FileType cpp let b:auto_trim_whitespace=1
autocmd FileType perl let b:auto_trim_whitespace=1
autocmd FileType borg let b:auto_trim_whitespace=1
autocmd FileType javascript let b:auto_trim_whitespace=1
autocmd FileType python let b:auto_trim_whitespace=1
autocmd FileType proto let b:auto_trim_whitespace=1
autocmd FileType hy let b:auto_trim_whitespace=1
autocmd FileType idris let b:auto_trim_whitespace=1
autocmd FileType java let b:auto_trim_whitespace=1
autocmd FileType lua let b:auto_trim_whitespace=1
augroup templates
autocmd BufNewFile *.vue 0r ~/.vim/skeletons/vue.skel
autocmd BufNewFile *.svelte 0r ~/.vim/skeletons/svelte.skel
augroup end
augroup rust
autocmd FileType rust nnoremap <Leader>lg <cmd>lua rust_where_at_line()<CR>
augroup end
function DetectGoHtmlTmpl()
if expand('%:e') == "html" && search("{{") != 0
setfiletype gohtmltmpl
endif
endfunction
augroup filetypedetect
" gohtmltmpl
au BufRead,BufNewFile *.html call DetectGoHtmlTmpl()
augroup END

View file

@ -0,0 +1 @@
autocmd BufNewFile,BufRead *.proto setfiletype proto

View file

@ -0,0 +1,3 @@
" $URL$
au BufRead,BufNewFile *.scala set filetype=scala

View file

@ -0,0 +1,10 @@
" Helper function for (x)html snippets
if exists('s:did_snip_helper') || &cp || !exists('loaded_snips')
finish
endif
let s:did_snip_helper = 1
" Automatically closes tag if in xhtml
fun! Close()
return stridx(&ft, 'xhtml') == -1 ? '' : ' /'
endf

View file

@ -0,0 +1,70 @@
" File: objc_cocoa_mappings.vim
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Description: Sets up mappings for cocoa.vim.
" Last Updated: September 08, 2009
if exists('b:cocoa_proj') || &cp || version < 700
finish
endif
let b:cocoa_proj = fnameescape(globpath(expand('<afile>:p:h'), '*.xcodeproj'))
com! -buffer ListMethods call objc#method_list#Activate(1)
com! -buffer -nargs=? -complete=customlist,objc#method_builder#Completion BuildMethods call objc#method_builder#Build('<args>')
com! -buffer -nargs=? -complete=custom,objc#man#Completion CocoaDoc call objc#man#ShowDoc('<args>')
com! -buffer -nargs=? Alternate call <SID>AlternateFile()
let objc_man_key = exists('objc_man_key') ? objc_man_key : 'K'
exe 'nn <buffer> <silent> '.objc_man_key.' :<c-u>call objc#man#ShowDoc()<cr>'
nn <buffer> <silent> <leader>A :cal<SID>AlternateFile()<cr>
" Mimic some of Xcode's mappings.
nn <buffer> <silent> <d-r> :w<bar>cal<SID>BuildAnd('launch')<cr>
nn <buffer> <silent> <d-b> :w<bar>cal<SID>XcodeRun('build')<cr>
nn <buffer> <silent> <d-K> :w<bar>cal<SID>XcodeRun('clean')<cr>
" TODO: Add this
" nn <buffer> <silent> <d-y> :w<bar>cal<SID>BuildAnd('debug')<cr>
nn <buffer> <silent> <d-m-up> :cal<SID>AlternateFile()<cr>
nn <buffer> <silent> <d-0> :call system('open -a Xcode '.b:cocoa_proj)<cr>
nn <buffer> <silent> <d-2> :<c-u>ListMethods<cr>
nm <buffer> <silent> <d-cr> <d-r>
ino <buffer> <silent> <f5> <c-x><c-o>
if exists('*s:AlternateFile') | finish | endif
" Switch from header file to implementation file (and vice versa).
fun s:AlternateFile()
let path = expand('%:p:r').'.'
if expand('%:e') == 'h'
if filereadable(path.'m')
exe 'e'.fnameescape(path.'m')
return
elseif filereadable(path.'c')
exe 'e'.fnameescape(path.'c')
return
endif
else
if filereadable(path.'h')
exe 'e'.fnameescape(path.'h')
return
endif
endif
echoh ErrorMsg | echo 'Alternate file not readable.' | echoh None
endf
" Opens Xcode and runs Applescript commands, splitting them onto newlines
" if needed.
fun s:XcodeRun(command)
call system("open -a Xcode ".b:cocoa_proj." && osascript -e 'tell app "
\ .'"Xcode" to '.a:command."' &")
endf
fun s:BuildAnd(command)
call system("open -a Xcode ".b:cocoa_proj." && osascript -e 'tell app "
\ ."\"Xcode\"' -e '"
\ .'set target_ to project of active project document '
\ ."' -e '"
\ .'if (build target_) starts with "Build succeeded" then '
\ .a:command.' target_'
\ ."' -e 'end tell'")
endf

92
dot_vim/indent/cpp.vim Normal file
View file

@ -0,0 +1,92 @@
" Vim indent file
" Language: C++
" Maintainer: Konstantin Lepa <konstantin.lepa@gmail.com>
" Last Change: 2010 May 20
" License: MIT
" Version: 1.1.0
"
" Changes {{{
" 1.1.0 2011-01-17
" Refactored source code.
" Some fixes.
"
" 1.0.1 2010-05-20
" Added some changes. Thanks to Eric Rannaud <eric.rannaud@gmail.com>
"
"}}}
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
function! GoogleCppIndent()
let l:cline_num = line('.')
let l:orig_indent = cindent(l:cline_num)
if l:orig_indent == 0 | return 0 | endif
let l:pline_num = prevnonblank(l:cline_num - 1)
let l:pline = getline(l:pline_num)
if l:pline =~# '^\s*template' | return l:pline_indent | endif
" TODO: I don't know to correct it:
" namespace test {
" void
" ....<-- invalid cindent pos
"
" void test() {
" }
"
" void
" <-- cindent pos
if l:orig_indent != &shiftwidth | return l:orig_indent | endif
let l:in_comment = 0
let l:pline_num = prevnonblank(l:cline_num - 1)
while l:pline_num > -1
let l:pline = getline(l:pline_num)
let l:pline_indent = indent(l:pline_num)
if l:in_comment == 0 && l:pline =~ '^.\{-}\(/\*.\{-}\)\@<!\*/'
let l:in_comment = 1
elseif l:in_comment == 1
if l:pline =~ '/\*\(.\{-}\*/\)\@!'
let l:in_comment = 0
endif
elseif l:pline_indent == 0
if l:pline !~# '\(#define\)\|\(^\s*//\)\|\(^\s*{\)'
if l:pline =~# '^\s*namespace.*'
return 0
else
return l:orig_indent
endif
elseif l:pline =~# '\\$'
return l:orig_indent
endif
else
return l:orig_indent
endif
let l:pline_num = prevnonblank(l:pline_num - 1)
endwhile
return l:orig_indent
endfunction
setlocal shiftwidth=2
setlocal tabstop=2
setlocal softtabstop=2
setlocal expandtab
setlocal textwidth=80
setlocal wrap
setlocal cindent
setlocal cinoptions=h1,l1,g1,t0,i4,+4,(0,w1,W4
setlocal indentexpr=GoogleCppIndent()
let b:undo_indent = "setl sw< ts< sts< et< tw< wrap< cin< cino< inde<"

View file

@ -0,0 +1,54 @@
if exists("b:did_indent")
finish
endif
runtime! indent/html.vim
" Indent Golang HTML templates
setlocal indentexpr=GetGoHTMLTmplIndent(v:lnum)
setlocal indentkeys+==else,=end
" Only define the function once.
if exists("*GetGoHTMLTmplIndent")
finish
endif
" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
function! GetGoHTMLTmplIndent(lnum)
" Get HTML indent
if exists('*HtmlIndent')
let ind = HtmlIndent()
else
let ind = HtmlIndentGet(a:lnum)
endif
" The value of a single shift-width
if exists('*shiftwidth')
let sw = shiftwidth()
else
let sw = &sw
endif
" If need to indent based on last line
let last_line = getline(a:lnum-1)
if last_line =~ '^\s*{{-\=\s*\%(if\|else\|range\|with\|define\|block\).*}}'
let ind += sw
endif
" End of FuncMap block
let current_line = getline(a:lnum)
if current_line =~ '^\s*{{-\=\s*\%(else\|end\).*}}'
let ind -= sw
endif
return ind
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et

View file

@ -0,0 +1,96 @@
" Vim indent file
" Language: Haskell
" Author: motemen <motemen@gmail.com>
" Version: 0.1
" Last Change: 2007-07-25
"
" Modify g:haskell_indent_if and g:haskell_indent_case to
" change indentation for `if'(default 3) and `case'(default 5).
" Example (in .vimrc):
" > let g:haskell_indent_if = 2
if exists('b:did_indent')
finish
endif
let b:did_indent = 1
if !exists('g:haskell_indent_if')
" if bool
" >>>then ...
" >>>else ...
let g:haskell_indent_if = 3
endif
if !exists('g:haskell_indent_do')
" do [optional]
" >>>more..
" >>>stuff...
let g:haskell_indent_do = 4
endif
if !exists('g:haskell_indent_case')
" case xs of
" >>>>>[] -> ...
" >>>>>(y:ys) -> ...
let g:haskell_indent_case = 5
endif
setlocal indentexpr=GetHaskellIndent()
setlocal indentkeys=!^F,o,O
function! GetHaskellIndent()
let line = substitute(getline(getpos('.')[1] - 1), '\t', repeat(' ', &tabstop), 'g')
if line =~ '[!#$%&*+./<=>?@\\^|~-]$'
return match(line, '\s*where \zs\|\S') + &shiftwidth
endif
if line =~ '\<do\s*$'
return match(line, '\s*where \zs\|\S') + g:haskell_indent_do
endif
if line =~ '{$'
return match(line, '\s*where \zs\|\S') + &shiftwidth
endif
if line =~ '^\(instance\|class\).*\&.*where$'
return &shiftwidth
endif
if line =~ ')$'
let pos = getpos('.')
normal k$
let paren_end = getpos('.')
normal %
let paren_begin = getpos('.')
call setpos('.', pos)
if paren_begin[1] != paren_end[1]
return paren_begin[2] - 1
endif
endif
if line !~ '\<else\>'
let s = match(line, '\<if\>.*\&.*\zs\<then\>')
if s > 0
return s
endif
let s = match(line, '\<if\>')
if s > 0
return s + g:haskell_indent_if
endif
endif
let s = match(line, '\<do\s\+\zs[^{]\|\<where\s\+\zs\w\|\<let\s\+\zs\S\|^\s*\zs|\s')
if s > 0
return s
endif
let s = match(line, '\<case\>')
if s > 0
return s + g:haskell_indent_case
endif
return match(line, '\S')
endfunction

View file

@ -0,0 +1,330 @@
" Vim indent file
" Language: Javascript
" Maintainer: Darrick Wiebe <darrick at innatesoftware.com>
" URL: http://github.com/pangloss/vim-javascript
" Version: 1.0.0
" Last Change: August 31, 2009
" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org
" 0. Initialization {{{1
" =================
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nosmartindent
" Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetJavascriptIndent()
setlocal indentkeys=0{,0},0),0],!^F,o,O,e
" Only define the function once.
if exists("*GetJavascriptIndent")
finish
endif
let s:cpo_save = &cpo
set cpo&vim
" 1. Variables {{{1
" ============
" Regex of syntax group names that are or delimit string or are comments.
let s:syng_strcom = '\<javaScript\%(RegexpString\|CommentTodo\|LineComment\|Comment\|DocComment\)\>'
" Regex of syntax group names that are strings.
let s:syng_string =
\ '\<javaScript\%(RegexpString\)\>'
" Regex of syntax group names that are strings or documentation.
let s:syng_stringdoc =
\'\<javaScriptDocComment\>'
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'"
let s:line_term = '\s*\%(\%(\/\/\).*\)\=$'
" Regex that defines continuation lines, not including (, {, or [.
let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)' . s:line_term
" Regex that defines continuation lines.
" TODO: this needs to deal with if ...: and so on
let s:msl_regex = '\%([\\*+/.:([]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\)' . s:line_term
let s:one_line_scope_regex = '\<\%(if\|else\|for\|while\)\>[^{;]*' . s:line_term
" Regex that defines blocks.
let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term
" 2. Auxiliary Functions {{{1
" ======================
" Check if the character at lnum:col is inside a string, comment, or is ascii.
function s:IsInStringOrComment(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom
endfunction
" Check if the character at lnum:col is inside a string.
function s:IsInString(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string
endfunction
" Check if the character at lnum:col is inside a string or documentation.
function s:IsInStringOrDocumentation(lnum, col)
return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc
endfunction
" Find line above 'lnum' that isn't empty, in a comment, or in a string.
function s:PrevNonBlankNonString(lnum)
let in_block = 0
let lnum = prevnonblank(a:lnum)
while lnum > 0
" Go in and out of blocks comments as necessary.
" If the line isn't empty (with opt. comment) or in a string, end search.
let line = getline(lnum)
if line =~ '/\*'
if in_block
let in_block = 0
else
break
endif
elseif !in_block && line =~ '\*/'
let in_block = 1
elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line)))
break
endif
let lnum = prevnonblank(lnum - 1)
endwhile
return lnum
endfunction
" Find line above 'lnum' that started the continuation 'lnum' may be part of.
function s:GetMSL(lnum, in_one_line_scope)
" Start on the line we're at and use its indent.
let msl = a:lnum
let lnum = s:PrevNonBlankNonString(a:lnum - 1)
while lnum > 0
" If we have a continuation line, or we're in a string, use line as MSL.
" Otherwise, terminate search as we have found our MSL already.
let line = getline(lnum)
let col = match(line, s:msl_regex) + 1
if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line))
let msl = lnum
else
" Don't use lines that are part of a one line scope as msl unless the
" flag in_one_line_scope is set to 1
"
if a:in_one_line_scope
break
end
let msl_one_line = s:Match(lnum, s:one_line_scope_regex)
if msl_one_line == 0
break
endif
endif
let lnum = s:PrevNonBlankNonString(lnum - 1)
endwhile
return msl
endfunction
" Check if line 'lnum' has more opening brackets than closing ones.
function s:LineHasOpeningBrackets(lnum)
let open_0 = 0
let open_2 = 0
let open_4 = 0
let line = getline(a:lnum)
let pos = match(line, '[][(){}]', 0)
while pos != -1
if !s:IsInStringOrComment(a:lnum, pos + 1)
let idx = stridx('(){}[]', line[pos])
if idx % 2 == 0
let open_{idx} = open_{idx} + 1
else
let open_{idx - 1} = open_{idx - 1} - 1
endif
endif
let pos = match(line, '[][(){}]', pos + 1)
endwhile
return (open_0 > 0) . (open_2 > 0) . (open_4 > 0)
endfunction
function s:Match(lnum, regex)
let col = match(getline(a:lnum), a:regex) + 1
return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0
endfunction
function s:IndentWithContinuation(lnum, ind, width)
" Set up variables to use and search for MSL to the previous line.
let p_lnum = a:lnum
let lnum = s:GetMSL(a:lnum, 1)
let line = getline(line)
" If the previous line wasn't a MSL and is continuation return its indent.
" TODO: the || s:IsInString() thing worries me a bit.
if p_lnum != lnum
if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line))
return a:ind + a:width
endif
endif
" Set up more variables now that we know we aren't continuation bound.
let msl_ind = indent(lnum)
" If the previous line ended with [*+/.-=], start a continuation that
" indents an extra level.
if s:Match(lnum, s:continuation_regex)
if lnum == p_lnum
return msl_ind + a:width
else
return msl_ind
endif
endif
return a:ind
endfunction
function s:InOneLineScope(lnum)
let msl = s:GetMSL(a:lnum, 1)
if msl > 0 && s:Match(msl, s:one_line_scope_regex)
return msl
endif
return 0
endfunction
function s:ExitingOneLineScope(lnum)
let msl = s:GetMSL(a:lnum, 1)
if msl > 0
" if the current line is in a one line scope ..
if s:Match(msl, s:one_line_scope_regex)
return 0
else
let prev_msl = s:GetMSL(msl - 1, 1)
if s:Match(prev_msl, s:one_line_scope_regex)
return prev_msl
endif
endif
endif
return 0
endfunction
" 3. GetJavascriptIndent Function {{{1
" =========================
function GetJavascriptIndent()
" 3.1. Setup {{{2
" ----------
" Set up variables for restoring position in file. Could use v:lnum here.
let vcol = col('.')
" 3.2. Work on the current line {{{2
" -----------------------------
" Get the current line.
let line = getline(v:lnum)
let ind = -1
" If we got a closing bracket on an empty line, find its match and indent
" according to it. For parentheses we indent to its column - 1, for the
" others we indent to the containing line's MSL's level. Return -1 if fail.
let col = matchend(line, '^\s*[]})]')
if col > 0 && !s:IsInStringOrComment(v:lnum, col)
call cursor(v:lnum, col)
let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2)
if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0
if line[col-1]==')' && col('.') != col('$') - 1
let ind = virtcol('.')-1
else
let ind = indent(s:GetMSL(line('.'), 0))
endif
endif
return ind
endif
" If we have a /* or */ set indent to first column.
if match(line, '^\s*\%(/\*\|\*/\)$') != -1
return 0
endif
" If we are in a multi-line string or line-comment, don't do anything to it.
if s:IsInStringOrDocumentation(v:lnum, matchend(line, '^\s*') + 1)
return indent('.')
endif
" 3.3. Work on the previous line. {{{2
" -------------------------------
" Find a non-blank, non-multi-line string line above the current line.
let lnum = s:PrevNonBlankNonString(v:lnum - 1)
" If the line is empty and inside a string, use the previous line.
if line =~ '^\s*$' && lnum != prevnonblank(v:lnum - 1)
return indent(prevnonblank(v:lnum))
endif
" At the start of the file use zero indent.
if lnum == 0
return 0
endif
" Set up variables for current line.
let line = getline(lnum)
let ind = indent(lnum)
" If the previous line ended with a block opening, add a level of indent.
if s:Match(lnum, s:block_regex)
return indent(s:GetMSL(lnum, 0)) + &sw
endif
" If the previous line contained an opening bracket, and we are still in it,
" add indent depending on the bracket type.
if line =~ '[[({]'
let counts = s:LineHasOpeningBrackets(lnum)
if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if col('.') + 1 == col('$')
return ind + &sw
else
return virtcol('.')
endif
elseif counts[1] == '1' || counts[2] == '1'
return ind + &sw
else
call cursor(v:lnum, vcol)
end
endif
" 3.4. Work on the MSL line. {{{2
" --------------------------
let ind_con = ind
let ind = s:IndentWithContinuation(lnum, ind_con, &sw)
" }}}2
"
"
let ols = s:InOneLineScope(lnum)
if ols > 0
let ind = ind + &sw
else
let ols = s:ExitingOneLineScope(lnum)
while ols > 0 && ind > 0
let ind = ind - &sw
let ols = s:InOneLineScope(ols - 1)
endwhile
endif
return ind
endfunction
" }}}1
let &cpo = s:cpo_save
unlet s:cpo_save
" vim:set sw=2 sts=2 ts=8 noet:

353
dot_vim/indent/mako.vim Normal file
View file

@ -0,0 +1,353 @@
" Vim indent file
" Language: Mako
" Author: Scott Torborg <storborg@mit.edu>
" Version: 0.4
" License: Do What The Fuck You Want To Public License (WTFPL)
"
" ---------------------------------------------------------------------------
"
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
" Version 2, December 2004
"
" Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
"
" Everyone is permitted to copy and distribute verbatim or modified
" copies of this license document, and changing it is allowed as long
" as the name is changed.
"
" DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
"
" 0. You just DO WHAT THE FUCK YOU WANT TO.
"
" ---------------------------------------------------------------------------
"
" This script does more useful indenting for Mako HTML templates. It indents
" inside of control blocks, defs, etc. Note that this indenting style will
" sacrifice readability of the output text for the sake of readability of the
" template.
"
" We'll use HTML indenting globally, python inside <% %> blocks. Inspired by
" the excellent PHP + HTML indentation files such as php.vim by Pim Snel.
"
" Changelog:
" 0.4 - 5 March 2010
" - Added license information
" 0.3 - 15 September 2009
" - Added explicit indenting for ## comments, fixed unindenting count,
" thanks to Mike Lewis (@MikeRLewis) for this
" 0.2 - 15 June 2009
" - Fixed issue where opening and closing mako tags on the same line
" would cause incorrect indenting
" 0.1 - 06 June 2009
" - Initial public release of mako indent file
let sw=2 " default shiftwidth of 2 spaces
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal nosmartindent
setlocal noautoindent
setlocal nocindent
setlocal nolisp
setlocal indentexpr=GetMakoIndent()
setlocal indentkeys+=*<Return>,<>>,<bs>,end,:
" Only define the function once.
if exists("*GetMakoIndent")
finish
endif
if exists('g:html_indent_tags')
unlet g:html_indent_tags
endif
function IsInsidePythonBlock(startline)
" Loop until we get a line that's either <% or %>
let lnum = a:startline
while getline(lnum) !~ '\(%>\|<%\)$' && lnum > 0
let lnum = lnum - 1
endwhile
" lnum points to the last control. If it's a <% then we're inside an
" embedded python block, otherwise we're not.
return getline(lnum) =~ '<%$'
endfunction
function GetMakoIndent()
" Find a non-empty line above the current line
let lnum = prevnonblank(v:lnum - 1)
" Hit the start of the file, use zero indent.
if lnum == 0
return 0
endif
let line = getline(lnum) " last line
let cline = getline(v:lnum) " current line
let pline = getline(lnum - 1) " previous to last line
let ind = indent(lnum)
if line =~ '^\s*##'
return indent(lnum)
end
let restore_ic=&ic
let &ic=1 " ignore case
let ind = <SID>HtmlIndentSum(lnum, -1)
let ind = <SID>HtmlIndentSum(lnum, -1)
let ind = ind + <SID>HtmlIndentSum(v:lnum, 0)
let &ic=restore_ic
let ind = indent(lnum) + (&sw * ind)
" Indent after %anything: or <%anything NOT ending in />
if line =~ '^\s*%.*:\s*$'
let ind = ind + &sw
endif
" Unindent before %end* or </%anything
if cline =~ '^\s*%\s*end'
let ind = ind - &sw
endif
"
" Unindent before %else, %except, and %elif
if cline =~ '^\s*%\s*else' || cline =~ '^\s*%\s*except' || cline =~ '^\s*%\s*elif'
let ind = ind - &sw
endif
" Indent at the beginning of a python control block
if line =~ '<%$'
let ind = ind + &sw
endif
"
" Unindent at the end of the python block.
if cline =~ '^\s*%>$'
let scanlnum = lnum
" Scan backwards until we find the beginning of this python block.
while getline(scanlnum) !~ '<%$' && scanlnum > 0
let scanlnum = scanlnum - 1
endwhile
let ind = indent(scanlnum)
endif
" If we're inside a python block and the previous line ends in a colon,
" indent.
if IsInsidePythonBlock(lnum - 1)
" Indent after :
if line =~ '\:$'
let ind = ind + &sw
endif
endif
return ind
endfunction
" [-- helper function to assemble tag list --]
fun! <SID>HtmlIndentPush(tag)
if exists('g:html_indent_tags')
let g:html_indent_tags = g:html_indent_tags.'\|'.a:tag
else
let g:html_indent_tags = a:tag
endif
endfun
fun! <SID>MakoIndentPush(tag)
if exists('g:mako_indent_tags')
let g:mako_indent_tags = g:mako_indent_tags.'\|'.a:tag
else
let g:mako_indent_tags = a:tag
endif
endfun
" [-- <ELEMENT ? - - ...> --]
call <SID>HtmlIndentPush('a')
call <SID>HtmlIndentPush('abbr')
call <SID>HtmlIndentPush('acronym')
call <SID>HtmlIndentPush('address')
call <SID>HtmlIndentPush('b')
call <SID>HtmlIndentPush('bdo')
call <SID>HtmlIndentPush('big')
call <SID>HtmlIndentPush('blockquote')
call <SID>HtmlIndentPush('button')
call <SID>HtmlIndentPush('caption')
call <SID>HtmlIndentPush('center')
call <SID>HtmlIndentPush('cite')
call <SID>HtmlIndentPush('code')
call <SID>HtmlIndentPush('colgroup')
call <SID>HtmlIndentPush('del')
call <SID>HtmlIndentPush('dfn')
call <SID>HtmlIndentPush('dir')
call <SID>HtmlIndentPush('div')
call <SID>HtmlIndentPush('dl')
call <SID>HtmlIndentPush('em')
call <SID>HtmlIndentPush('fieldset')
call <SID>HtmlIndentPush('font')
call <SID>HtmlIndentPush('form')
call <SID>HtmlIndentPush('frameset')
call <SID>HtmlIndentPush('h1')
call <SID>HtmlIndentPush('h2')
call <SID>HtmlIndentPush('h3')
call <SID>HtmlIndentPush('h4')
call <SID>HtmlIndentPush('h5')
call <SID>HtmlIndentPush('h6')
call <SID>HtmlIndentPush('i')
call <SID>HtmlIndentPush('iframe')
call <SID>HtmlIndentPush('ins')
call <SID>HtmlIndentPush('kbd')
call <SID>HtmlIndentPush('label')
call <SID>HtmlIndentPush('legend')
call <SID>HtmlIndentPush('map')
call <SID>HtmlIndentPush('menu')
call <SID>HtmlIndentPush('noframes')
call <SID>HtmlIndentPush('noscript')
call <SID>HtmlIndentPush('object')
call <SID>HtmlIndentPush('ol')
call <SID>HtmlIndentPush('optgroup')
call <SID>HtmlIndentPush('pre')
call <SID>HtmlIndentPush('q')
call <SID>HtmlIndentPush('s')
call <SID>HtmlIndentPush('samp')
call <SID>HtmlIndentPush('script')
call <SID>HtmlIndentPush('select')
call <SID>HtmlIndentPush('small')
call <SID>HtmlIndentPush('span')
call <SID>HtmlIndentPush('strong')
call <SID>HtmlIndentPush('style')
call <SID>HtmlIndentPush('sub')
call <SID>HtmlIndentPush('sup')
call <SID>HtmlIndentPush('table')
call <SID>HtmlIndentPush('textarea')
call <SID>HtmlIndentPush('title')
call <SID>HtmlIndentPush('tt')
call <SID>HtmlIndentPush('u')
call <SID>HtmlIndentPush('ul')
call <SID>HtmlIndentPush('var')
" For some reason the default HTML indentation script doesn't consider these
" elements to be worthy of indentation.
call <SID>HtmlIndentPush('p')
call <SID>HtmlIndentPush('dt')
call <SID>HtmlIndentPush('dd')
" [-- <ELEMENT ? O O ...> --]
if !exists('g:html_indent_strict')
call <SID>HtmlIndentPush('body')
call <SID>HtmlIndentPush('head')
call <SID>HtmlIndentPush('html')
call <SID>HtmlIndentPush('tbody')
endif
" [-- <ELEMENT ? O - ...> --]
if !exists('g:html_indent_strict_table')
call <SID>HtmlIndentPush('th')
call <SID>HtmlIndentPush('td')
call <SID>HtmlIndentPush('tr')
call <SID>HtmlIndentPush('tfoot')
call <SID>HtmlIndentPush('thead')
endif
" [-- <Mako Elements> --]
call <SID>MakoIndentPush('%def')
call <SID>MakoIndentPush('%call')
call <SID>MakoIndentPush('%doc')
call <SID>MakoIndentPush('%text')
call <SID>MakoIndentPush('%.\+:.\+')
delfun <SID>HtmlIndentPush
delfun <SID>MakoIndentPush
set cpo-=C
" [-- get number of regex matches in a string --]
fun! <SID>MatchCount(expr, pat)
let mpos = 0
let mcount = 0
let expr = a:expr
while (mpos > -1)
let mend = matchend(expr, a:pat)
if mend > -1
let mcount = mcount + 1
endif
if mend == mpos
let mpos = mpos + 1
else
let mpos = mend
endif
let expr = strpart(expr, mpos)
endwhile
return mcount
endfun
" [-- count indent-increasing tags of line a:lnum --]
fun! <SID>HtmlIndentOpen(lnum)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)\('.g:html_indent_tags.'\)\>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-decreasing tags of line a:lnum --]
fun! <SID>HtmlIndentClose(lnum)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)/\('.g:html_indent_tags.'\)\>>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-increasing mako tags of line a:lnum --]
fun! <SID>MakoIndentOpen(lnum)
let s = substitute('x'.getline(a:lnum),
\ '.\{-}\(\(<\)\('.g:mako_indent_tags.'\)\>\)', "\1", 'g')
let s = substitute(s, "[^\1].*$", '', '')
return strlen(s)
endfun
" [-- count indent-decreasing mako tags of line a:lnum --]
fun! <SID>MakoIndentClose(lnum)
let mcount = <SID>MatchCount(getline(a:lnum), '</\('.g:mako_indent_tags.'\)>')
let mcount = mcount + <SID>MatchCount(getline(a:lnum), '<\('.g:mako_indent_tags.'\)[^>]*/>')
return mcount
endfun
" [-- count indent-increasing '{' of (java|css) line a:lnum --]
fun! <SID>HtmlIndentOpenAlt(lnum)
return strlen(substitute(getline(a:lnum), '[^{]\+', '', 'g'))
endfun
" [-- count indent-decreasing '}' of (java|css) line a:lnum --]
fun! <SID>HtmlIndentCloseAlt(lnum)
return strlen(substitute(getline(a:lnum), '[^}]\+', '', 'g'))
endfun
" [-- return the sum of indents respecting the syntax of a:lnum --]
fun! <SID>HtmlIndentSum(lnum, style)
let open = <SID>HtmlIndentOpen(a:lnum) + <SID>MakoIndentOpen(a:lnum)
let close = <SID>HtmlIndentClose(a:lnum) + <SID>MakoIndentClose(a:lnum)
if a:style == match(getline(a:lnum), '^\s*</')
if a:style == match(getline(a:lnum), '^\s*</\('.g:html_indent_tags.'\|'.g:mako_indent_tags.'\)')
if 0 != open || 0 != close
return open - close
endif
endif
endif
if '' != &syntax &&
\ synIDattr(synID(a:lnum, 1, 1), 'name') =~ '\(css\|java\).*' &&
\ synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name')
\ =~ '\(css\|java\).*'
if a:style == match(getline(a:lnum), '^\s*}')
return <SID>HtmlIndentOpenAlt(a:lnum) - <SID>HtmlIndentCloseAlt(a:lnum)
endif
endif
return 0
endfun
" vim: set ts=4 sw=4:

196
dot_vim/indent/python.vim Normal file
View file

@ -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

85
dot_vim/indent/scala.vim Normal file
View file

@ -0,0 +1,85 @@
" Vim indent file
" Language : Scala (http://scala-lang.org/)
" Maintainer : Stefan Matthias Aust
" Last Change: 2006 Apr 13
" Revision : $Id$
" $URL$
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal indentexpr=GetScalaIndent()
setlocal indentkeys=0{,0},0),!^F,<>>,<CR>
setlocal autoindent sw=2 et
if exists("*GetScalaIndent")
finish
endif
function! CountParens(line)
let line = substitute(a:line, '"\(.\|\\"\)*"', '', 'g')
let open = substitute(line, '[^(]', '', 'g')
let close = substitute(line, '[^)]', '', 'g')
return strlen(open) - strlen(close)
endfunction
function! GetScalaIndent()
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
" Hit the start of the file, use zero indent.
if lnum == 0
return 0
endif
let ind = indent(lnum)
let prevline = getline(lnum)
"Indent html literals
if prevline !~ '/>\s*$' && prevline =~ '^\s*<[a-zA-Z][^>]*>\s*$'
return ind + &shiftwidth
endif
" Add a 'shiftwidth' after lines that start a block
" If if, for or while end with ), this is a one-line block
" If val, var, def end with =, this is a one-line block
if prevline =~ '^\s*\<\(\(else\s\+\)\?if\|for\|while\|va[lr]\|def\)\>.*[)=]\s*$'
\ || prevline =~ '^\s*\<else\>\s*$'
\ || prevline =~ '{\s*$'
let ind = ind + &shiftwidth
endif
" If parenthesis are unbalanced, indent or dedent
let c = CountParens(prevline)
echo c
if c > 0
let ind = ind + &shiftwidth
elseif c < 0
let ind = ind - &shiftwidth
endif
" Dedent after if, for, while and val, var, def without block
let pprevline = getline(prevnonblank(lnum - 1))
if pprevline =~ '^\s*\<\(\(else\s\+\)\?if\|for\|while\|va[lr]\|def\)\>.*[)=]\s*$'
\ || pprevline =~ '^\s*\<else\>\s*$'
let ind = ind - &shiftwidth
endif
" Align 'for' clauses nicely
if prevline =~ '^\s*\<for\> (.*;\s*$'
let ind = ind - &shiftwidth + 5
endif
" Subtract a 'shiftwidth' on '}' or html
let thisline = getline(v:lnum)
if thisline =~ '^\s*[})]'
\ || thisline =~ '^\s*</[a-zA-Z][^>]*>'
let ind = ind - &shiftwidth
endif
return ind
endfunction

3
dot_vim/init.vim Normal file
View file

@ -0,0 +1,3 @@
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc

88
dot_vim/lua/lir_setup.lua Normal file
View file

@ -0,0 +1,88 @@
local actions = require 'lir.actions'
local mark_actions = require 'lir.mark.actions'
local clipboard_actions = require 'lir.clipboard.actions'
require 'lir'.setup {
show_hidden_files = false,
ignore = { ".DS_Store" }, -- { ".DS_Store", "node_modules" } etc.
devicons = {
enable = true,
highlight_dirname = true
},
mappings = {
['l'] = actions.edit,
['<CR>'] = actions.edit,
['<C-s>'] = actions.split,
['<C-v>'] = actions.vsplit,
['<C-t>'] = actions.tabedit,
['h'] = actions.up,
['q'] = actions.quit,
['K'] = actions.mkdir,
['N'] = actions.newfile,
['R'] = actions.rename,
['@'] = actions.cd,
['Y'] = actions.yank_path,
['.'] = actions.toggle_show_hidden,
['D'] = actions.delete,
['J'] = function()
mark_actions.toggle_mark()
vim.cmd('normal! j')
end,
['C'] = clipboard_actions.copy,
['X'] = clipboard_actions.cut,
['P'] = clipboard_actions.paste,
},
float = {
winblend = 0,
curdir_window = {
enable = false,
highlight_dirname = false
},
-- -- You can define a function that returns a table to be passed as the third
-- -- argument of nvim_open_win().
-- win_opts = function()
-- local width = math.floor(vim.o.columns * 0.8)
-- local height = math.floor(vim.o.lines * 0.8)
-- return {
-- border = {
-- "+", "─", "+", "│", "+", "─", "+", "│",
-- },
-- width = width,
-- height = height,
-- row = 1,
-- col = math.floor((vim.o.columns - width) / 2),
-- }
-- end,
},
hide_cursor = true
}
vim.api.nvim_create_autocmd({ 'FileType' }, {
pattern = { "lir" },
callback = function()
-- use visual mode
vim.api.nvim_buf_set_keymap(
0,
"x",
"J",
':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
{ noremap = true, silent = true }
)
-- echo cwd
-- vim.api.nvim_echo({ { vim.fn.expand("%:p"), "Normal" } }, false, {})
end
})
-- custom folder icon
require 'nvim-web-devicons'.set_icon({
lir_folder_icon = {
icon = "",
color = "#7ebae4",
name = "LirFolderNode"
}
})

View file

@ -0,0 +1,28 @@
require('lsp-progress').setup({
})
local config = {
sections = {
lualine_c = {
'filename',
function()
return require('lsp-progress').progress()
end,
},
lualine_x = {
'filetype',
}
}
}
--local function ins_left(component)
--table.insert(config.sections.lualine_c, component)
--end
--ins_left({
--'lsp_progress',
--display_components = { 'lsp_client_name', { 'percentage' } }
--})
require('lualine').setup(config)

View file

@ -0,0 +1,376 @@
vim: set syntax=markdown:
This is intended as a quick reference and showcase. For more complete info, see [John Gruber's original spec](http://daringfireball.net/projects/markdown/) and the [Github-flavored Markdown info page](http://github.github.com/github-flavored-markdown/).
Note that there is also a [Cheatsheet specific to Markdown Here](./Markdown-Here-Cheatsheet) if that's what you're looking for.
You can play around with Markdown on our [live demo page](http://www.markdown-here.com/livedemo.html).
##### Table of Contents
[Headers](#headers)
[Emphasis](#emphasis)
[Lists](#lists)
[Links](#links)
[Images](#images)
[Code and Syntax Highlighting](#code)
[Tables](#tables)
[Blockquotes](#blockquotes)
[Inline HTML](#html)
[Horizontal Rule](#hr)
[Line Breaks](#lines)
[Youtube videos](#videos)
<a name="headers"/>
## Headers
```no-highlight
# H1
## H2
### H3
#### H4
##### H5
###### H6
Alternatively, for H1 and H2, an underline-ish style:
Alt-H1
======
Alt-H2
------
```
# H1
## H2
### H3
#### H4
##### H5
###### H6
Alternatively, for H1 and H2, an underline-ish style:
Alt-H1
======
Alt-H2
------
<a name="emphasis"/>
## Emphasis
```no-highlight
Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
```
Emphasis, aka italics, with *asterisks* or _underscores_.
Strong emphasis, aka bold, with **asterisks** or __underscores__.
Combined emphasis with **asterisks and _underscores_**.
Strikethrough uses two tildes. ~~Scratch this.~~
<a name="lists"/>
## Lists
```no-highlight
1. First ordered list item
2. Another item
* Unordered sub-list.
1. Actual numbers don't matter, just that it's a number
1. Ordered sub-list
4. And another item.
Some text that should be aligned with the above item.
* Unordered list can use asterisks
- Or minuses
+ Or pluses
```
1. First ordered list item
2. Another item
* Unordered sub-list.
1. Actual numbers don't matter, just that it's a number
1. Ordered sub-list
4. And another item.
Some text that should be aligned with the above item.
* Unordered list can use asterisks
- Or minuses
+ Or pluses
<a name="links"/>
## Links
There are two ways to create links.
```no-highlight
[I'm an inline-style link](https://www.google.com)
[I'm a reference-style link][Arbitrary case-insensitive reference text]
[I'm a relative reference to a repository file](../blob/master/LICENSE)
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself][]
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
```
[I'm an inline-style link](https://www.google.com)
[I'm a reference-style link][Arbitrary case-insensitive reference text]
[I'm a relative reference to a repository file](../blob/master/LICENSE)
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself][]
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
<a name="images"/>
## Images
```no-highlight
Here's our logo (hover to see the title text):
Inline-style:
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
Reference-style:
![alt text][logo]
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
```
Here's our logo (hover to see the title text):
Inline-style:
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
Reference-style:
![alt text][logo]
[logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 2"
<a name="code"/>
## Code and Syntax Highlighting
Code blocks are part of the Markdown spec, but syntax highlighting isn't. However, many renderers -- like Github's and *Markdown Here* -- support syntax highlighting. *Markdown Here* supports highlighting for dozens of languages (and not-really-languages, like diffs and HTTP headers); to see the complete list, and how to write the language names, see the [highlight.js demo page](http://softwaremaniacs.org/media/soft/highlight/test.html).
```no-highlight
Inline `code` has `back-ticks around` it.
```
Inline `code` has `back-ticks around` it.
Blocks of code are either fenced by lines with three back-ticks <code>```</code>, or are indented with four spaces. I recommend only using the fenced code blocks -- they're easier and only they support syntax highlighting.
```no-highlight
```javascript
var s = "JavaScript syntax highlighting";
alert(s);
```
```python
s = "Python syntax highlighting"
print s
```
```
No language indicated, so no syntax highlighting.
But let's throw in a <b>tag</b>.
```
```
```javascript
var s = "JavaScript syntax highlighting";
alert(s);
```
```python
s = "Python syntax highlighting"
print s
```
```
No language indicated, so no syntax highlighting in Markdown Here (varies on Github).
But let's throw in a <b>tag</b>.
```
(Github Wiki pages don't seem to support syntax highlighting, so the above won't be colourful (the strings are not red, for example). Try it out in a *Markdown Here* email or a Github Markdown README or Github Issue -- you can preview a new Issue without submitting it.)
Again, to see what languages are available for highlighting, and how to write those language names, see the [highlight.js demo page](http://softwaremaniacs.org/media/soft/highlight/test.html).
<a name="tables"/>
## Tables
Tables aren't part of the core Markdown spec, but they are part of GFM and *Markdown Here* supports them. They are an easy way of adding tables to your email -- a task that would otherwise require copy-pasting from another application.
```no-highlight
Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3
```
Colons can be used to align columns.
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
Markdown | Less | Pretty
--- | --- | ---
*Still* | `renders` | **nicely**
1 | 2 | 3
<a name="blockquotes"/>
## Blockquotes
```no-highlight
> Blockquotes are very handy in email to emulate reply text.
> This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
```
> Blockquotes are very handy in email to emulate reply text.
> This line is part of the same quote.
Quote break.
> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote.
<a name="html"/>
## Inline HTML
You can also use raw HTML in your Markdown, and it'll mostly work pretty well.
```no-highlight
<dl>
<dt>Definition list</dt>
<dd>Is something people use sometimes.</dd>
<dt>Markdown in HTML</dt>
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
```
<dl>
<dt>Definition list</dt>
<dd>Is something people use sometimes.</dd>
<dt>Markdown in HTML</dt>
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
<a name="hr"/>
## Horizontal Rule
```
Three or more...
---
Hyphens
***
Asterisks
___
Underscores
```
Three or more...
---
Hyphens
***
Asterisks
___
Underscores
<a name="lines"/>
## Line Breaks
My basic recommendation for learning how line breaks work is to experiment and discover -- hit &lt;Enter&gt; once (i.e., insert one newline), then hit it twice (i.e., insert two newlines), see what happens. You'll soon learn to get what you want. "Markdown Toggle" is your friend.
Here are some things to try out:
```
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
This line is also a separate paragraph, but...
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
```
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
This line is also begins a separate paragraph, but...
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
(Technical note: *Markdown Here* uses GFM line breaks, so there's no need to use MD's two-space line breaks.)
<a name="videos"/>
## Youtube videos
They can't be added directly but you can add an image with a link to the video like this:
```no-highlight
<a href="http://www.youtube.com/watch?feature=player_embedded&v=YOUTUBE_VIDEO_ID_HERE
" target="_blank"><img src="http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg"
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>
```
Or, in pure Markdown, but losing the image sizing and border:
```no-highlight
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/YOUTUBE_VIDEO_ID_HERE/0.jpg)](http://www.youtube.com/watch?v=YOUTUBE_VIDEO_ID_HERE)
```

678
dot_vim/nvim.lua Normal file

File diff suppressed because it is too large Load diff

73
dot_vim/plugin/AppleT.vim Normal file
View file

@ -0,0 +1,73 @@
function! AppleT(name)
python << EOF
import sys
import os
import re
import vim
def walkIt(search):
fullpath = os.path.expanduser(set_path)
fullsearch = ".*%s.*" % ".*".join(search)
fullsearch = re.sub(" ","[/.]", fullsearch)
bsearch = re.sub(" ",".*[/.].*", search)
exactsearch = "%s" % bsearch
exclude = re.compile("\.quer$|\.resp$|\.pyc$")
ignoredirs = [".svn", "_site-packages"]
fullmatch = re.compile(fullsearch, re.I)
exactmatch = re.compile(exactsearch, re.I)
length = len(fullpath)
results = []
exactresults = []
for root, dirs, files in os.walk(set_path):
for x in ignoredirs:
if x in dirs:
dirs.remove(x)
for f in files:
filename = os.path.join(root,f)
if exclude.search(filename):
pass
elif exactmatch.search(filename):
exactresults.append("%s" % filename)
elif fullmatch.search(filename):
results.append("%s" % filename)
if len(results) == 0:
return
def cmplen(x,y):
return cmp(len(x), len(y))
results.sort(cmplen)
exactresults.sort(cmplen)
results = exactresults + results
for i, a in enumerate(results):
print "%d: %s" % (i + 1, a[length:])
which = vim.eval('input("Which? ")')
if re.match("^[0-9]+$", which) == None:
return
which = int(which) - 1
vim.command("tabnew " + results[which])
thingtosearch = vim.eval("expand(a:name)")
walkIt(thingtosearch)
EOF
endfunction
function! AppleTSetPath(path)
python << EOF
import vim
set_path = vim.eval("expand(a:path)")
EOF
endfunction
if !exists(":AppleTSetPath")
command! -nargs=+ AppleTSetPath :call AppleTSetPath(<q-args>)
endif
if !exists(":CmdT")
command! -nargs=+ CmdT :call AppleT(<q-args>)
endif

840
dot_vim/plugin/a.vim Normal file

File diff suppressed because it is too large Load diff

70
dot_vim/plugin/bclose.vim Normal file
View file

@ -0,0 +1,70 @@
if exists("loaded_bclosePlugin")
finish
endif
if (v:progname == "ex")
finish
endif
let loaded_bclosePlugin = 1
"here is a more exotic version of my original Kwbd script
"delete the buffer; keep windows; create a scratch buffer if no buffers left
function s:Kwbd(kwbdStage)
if(a:kwbdStage == 1)
if(!buflisted(winbufnr(0)))
bd!
return
endif
let s:kwbdBufNum = bufnr("%")
let s:kwbdWinNum = winnr()
windo call s:Kwbd(2)
execute s:kwbdWinNum . 'wincmd w'
let s:buflistedLeft = 0
let s:bufFinalJump = 0
let l:nBufs = bufnr("$")
let l:i = 1
while(l:i <= l:nBufs)
if(l:i != s:kwbdBufNum)
if(buflisted(l:i))
let s:buflistedLeft = s:buflistedLeft + 1
else
if(bufexists(l:i) && !strlen(bufname(l:i)) && !s:bufFinalJump)
let s:bufFinalJump = l:i
endif
endif
endif
let l:i = l:i + 1
endwhile
if(!s:buflistedLeft)
if(s:bufFinalJump)
windo if(buflisted(winbufnr(0))) | execute "b! " . s:bufFinalJump | endif
else
enew
let l:newBuf = bufnr("%")
windo if(buflisted(winbufnr(0))) | execute "b! " . l:newBuf | endif
endif
execute s:kwbdWinNum . 'wincmd w'
endif
if(buflisted(s:kwbdBufNum) || s:kwbdBufNum == bufnr("%"))
execute "bd! " . s:kwbdBufNum
endif
if(!s:buflistedLeft)
set buflisted
set bufhidden=delete
set buftype=nofile
setlocal noswapfile
endif
else
if(bufnr("%") == s:kwbdBufNum)
let prevbufvar = bufnr("#")
if(prevbufvar > 0 && buflisted(prevbufvar) && prevbufvar != s:kwbdBufNum)
b #
else
bn
endif
endif
endif
endfunction
command! Kwbd call <SID>Kwbd(1)
nnoremap <silent> <Plug>Kwbd :<C-u>Kwbd<CR>

View file

@ -0,0 +1,449 @@
" camelcasemotion.vim: Mappings for motion through CamelCaseWords and
" underscore_notation.
"
" DESCRIPTION: {{{1
" 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 text object called 'inner word' ('iw'), 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:
" Use the new motions ',w', ',b' and ',e' in normal mode, operator-pending
" mode (cp. :help 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: {{{1
" Put the script into your user or system VIM plugin directory (e.g.
" ~/.vim/plugin).
"
" DEPENDENCIES:
" - Requires VIM 7.0 or higher.
"
" 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
"
" Example: Replace default 'iw' text-object and define 'ib' and 'ie' motions:
" omap <silent> iw <Plug>CamelCaseMotion_iw
" vmap <silent> iw <Plug>CamelCaseMotion_iw
" omap <silent> ib <Plug>CamelCaseMotion_ib
" vmap <silent> ib <Plug>CamelCaseMotion_ib
" omap <silent> ie <Plug>CamelCaseMotion_ie
" vmap <silent> ie <Plug>CamelCaseMotion_ie
"
" LIMITATIONS:
"
" ASSUMPTIONS:
"
" 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:
"
" Copyright: (C) 2007-2008 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
" 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 analoguous 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("loaded_camelcasemotion") || (v:version < 700)
finish
endif
let loaded_camelcasemotion = 1
" }}}1
"- functions ------------------------------------------------------------------"
function! s:CamelCaseMove( direction, count, mode ) " {{{1
" 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
" }}}1
function! s:CamelCaseMotion( direction, count, mode ) " {{{1
"*******************************************************************************
"* 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:CamelCaseMove().
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:CamelCaseMove( 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
end
endif
endfunction
" }}}1
function! s:CamelCaseInnerMotion( direction, count ) " {{{1
" 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 s:CamelCaseMotion( '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 s:CamelCaseMotion( 'e', a:count, 'iv' )
else
call s:CamelCaseMotion( 'b', 1, 'n' )
normal! v
call s:CamelCaseMotion( a:direction, a:count, 'iv' )
endif
endfunction
" }}}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() "{{{1
" Create mappings according to this template:
" (* stands for the mode [nov], ? for the underlying motion [wbe].)
"
" *noremap <script> <Plug>CamelCaseMotion_? :<C-U>call <SID>CamelCaseMotion('?',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 <script> ' . l:targetMapping . ' :<C-U>call <SID>CamelCaseMotion(''' . l:motion . ''',v:count1,''' . l:mode . ''')<CR>'
if ! hasmapto(l:targetMapping, l:mode)
execute l:mode . 'map <silent> ,' . l:motion . ' ' . l:targetMapping
endif
endfor
endfor
endfunction
" }}}1
" 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() "{{{1
" Create mappings according to this template:
" (* stands for the mode [ov], ? for the underlying motion [wbe].)
"
" *noremap <script> <Plug>CamelCaseMotion_i? :<C-U>call <SID>CamelCaseInnerMotion('?',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 <script> ' . l:targetMapping . ' :<C-U>call <SID>CamelCaseInnerMotion(''' . l:motion . ''',v:count1)<CR>'
if ! hasmapto(l:targetMapping, l:mode)
execute l:mode . 'map <silent> i,' . l:motion . ' ' . l:targetMapping
endif
endfor
endfor
endfunction
" }}}1
call s:CreateMotionMappings()
call s:CreateInnerMotionMappings()
" vim: set sts=4 sw=4 noexpandtab ff=unix fdm=marker :

16
dot_vim/plugin/cocoa.vim Normal file
View file

@ -0,0 +1,16 @@
" File: cocoa.vim
" Author: Michael Sanders msanders [at] gmail [dot] com
if exists('s:did_cocoa') || &cp || version < 700
finish
endif
let s:did_cocoa = 1
" These have to load after the normal ftplugins to override the defaults; I'd
" like to put this in ftplugin/objc_cocoa_mappings.vim, but that doesn't seem
" to work..
au FileType objc ru after/syntax/objc_enhanced.vim
\| let b:match_words = '@\(implementation\|interface\):@end'
\| setl inc=^\s*#\s*import omnifunc=objc#cocoacomplete#Complete
\| if globpath(expand('<afile>:p:h'), '*.xcodeproj') != '' |
\ setl makeprg=open\ -a\ xcode\ &&\ osascript\ -e\ 'tell\ app\ \"Xcode\"\ to\ build'
\| endif

View file

@ -0,0 +1,166 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CSCOPE settings for vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This file contains some boilerplate settings for vim's cscope interface,
" plus some keyboard mappings that I've found useful.
"
" USAGE:
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
" 'plugin' directory in some other directory that is in your
" 'runtimepath'.
"
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
" your ~/.vimrc file (or cut and paste it into your .vimrc).
"
" NOTE:
" These key maps use multiple keystrokes (2 or 3 keys). If you find that vim
" keeps timing you out before you can complete them, try changing your timeout
" settings, as explained below.
"
" Happy cscoping,
"
" Jason Duell jduell@alumni.princeton.edu 2002/3/7
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" This tests to see if vim was configured with the '--enable-cscope' option
" when it was compiled. If it wasn't, time to recompile vim...
if has("cscope")
""""""""""""" Standard cscope/vim boilerplate
set nocsverb
" use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
set cscopetag
" check cscope for definition of a symbol before checking ctags: set to 1
" if you want the reverse search order.
set csto=0
" add any cscope database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add the database pointed to by environment variable
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
" show msg when any other cscope db added
set cscopeverbose
""""""""""""" My cscope/vim key mappings
"
" The following maps all invoke one of the following cscope search types:
"
" 's' symbol: find all references to the token under cursor
" 'g' global: find global definition(s) of the token under cursor
" 'c' calls: find all calls to the function name under cursor
" 't' text: find all instances of the text under cursor
" 'e' egrep: egrep search for the word under cursor
" 'f' file: open the filename under cursor
" 'i' includes: find files that include the filename under cursor
" 'd' called: find functions that function under cursor calls
"
" Below are three sets of the maps: one set that just jumps to your
" search result, one that splits the existing vim window horizontally and
" diplays your search result in the new window, and one that does the same
" thing, but does a vertical split instead (vim 6 only).
"
" I've used CTRL-\ and CTRL-@ as the starting keys for these maps, as it's
" unlikely that you need their default mappings (CTRL-\'s default use is
" as part of CTRL-\ CTRL-N typemap, which basically just does the same
" thing as hitting 'escape': CTRL-@ doesn't seem to have any default use).
" If you don't like using 'CTRL-@' or CTRL-\, , you can change some or all
" of these maps to use other keys. One likely candidate is 'CTRL-_'
" (which also maps to CTRL-/, which is easier to type). By default it is
" used to switch between Hebrew and English keyboard mode.
"
" All of the maps involving the <cfile> macro use '^<cfile>$': this is so
" that searches over '#include <time.h>" return only references to
" 'time.h', and not 'sys/time.h', etc. (by default cscope will return all
" files that contain 'time.h' as part of their name).
" To do the first type of search, hit 'CTRL-\', followed by one of the
" cscope search types above (s,g,c,t,e,f,i,d). The result of your cscope
" search will be displayed in the current window. You can use CTRL-T to
" go back to where you were before the search.
"
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" Using 'CTRL-spacebar' (intepreted as CTRL-@ by vim) then a search type
" makes the vim window split horizontally, with search result displayed in
" the new window.
"
" (Note: earlier versions of vim may not have the :scs command, but it
" can be simulated roughly via:
" nmap <C-@>s <C-W><C-S> :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@>d :scs find d <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one (vim 6 and up only)
"
" (Note: you may wish to put a 'set splitright' in your .vimrc
" if you prefer the new window on the right instead of the left
nmap <C-@><C-@>s :vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>g :vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>c :vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>t :vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>e :vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-@><C-@>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-@><C-@>i :vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-@><C-@>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>
""""""""""""" key map timeouts
"
" By default Vim will only wait 1 second for each keystroke in a mapping.
" You may find that too short with the above typemaps. If so, you should
" either turn off mapping timeouts via 'notimeout'.
"
"set notimeout
"
" Or, you can keep timeouts, by uncommenting the timeoutlen line below,
" with your own personal favorite value (in milliseconds):
"
"set timeoutlen=4000
"
" Either way, since mapping timeout settings by default also set the
" timeouts for multicharacter 'keys codes' (like <F1>), you should also
" set ttimeout and ttimeoutlen: otherwise, you will experience strange
" delays as vim waits for a keystroke after you hit ESC (it will be
" waiting to see if the ESC is actually part of a key code like <F1>).
"
"set ttimeout
"
" personally, I find a tenth of a second to work well for key code
" timeouts. If you experience problems and have a slow terminal or network
" connection, set it higher. If you don't set ttimeoutlen, the value for
" timeoutlent (default: 1000 = 1 second, which is sluggish) is used.
"
"set ttimeoutlen=100
endif

View file

@ -0,0 +1,24 @@
" Add_Cscope_Menu
" Adds a cscope menu
" All the commands work on the word that is under the cursor
function! s:Add_CScope_Menu(menu_clear)
if has("gui_running")
if (a:menu_clear)
silent! unmenu &Cscope
silent! unmenu! &Cscope
amenu <silent> &Cscope.Find\ functions\ calling\ this\ function :cs find c <C-R>=expand("<cword>") <CR><CR>
amenu <silent> &Cscope.Find\ functions\ called\ by\ this\ function :cs find d <C-R>=expand("<cword>") <CR><CR>
amenu <silent> &Cscope.Find\ this\ egrep\ pattern :cs find e <C-R>=expand("<cword>") <CR><CR>
amenu <silent> &Cscope.Find\ this\ file :cs find f <C-R>=expand("<cword>") <CR><CR>
amenu <silent> &Cscope.Find\ this\ definition :cs find g <C-R>=expand("<cword>") <CR><CR>
amenu <silent> &Cscope.Find\ files\ #including\ this\ file :cs find i <C-R>=expand("<cfile>") <CR><CR>
amenu <silent> &Cscope.Find\ this\ Symbol :cs find s <C-R>=expand("<cword>") <CR><CR>
amenu <silent> &Cscope.Find\ assignments\ to :cs find t <C-R>=expand("<cword>") <CR><CR>
endif
endif
endfunction
autocmd BufEnter * call s:Add_CScope_Menu(1)

996
dot_vim/plugin/genutils.vim Executable file

File diff suppressed because it is too large Load diff

27
dot_vim/plugin/gotags.vim Normal file
View file

@ -0,0 +1,27 @@
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }

812
dot_vim/plugin/matchit.vim Executable file

File diff suppressed because it is too large Load diff

257
dot_vim/plugin/vcsbzr.vim Normal file
View file

@ -0,0 +1,257 @@
" vim600: set foldmethod=marker:
"
" BZR extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2009 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandBZRExec
" This variable specifies the BZR executable. If not set, it defaults to
" 'bzr' executed from the user's executable path.
" Section: Plugin header {{{1
if exists('VCSCommandDisableAll')
finish
endif
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
" BZR is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:bzrFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke bzr suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the BZR executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'BZR'
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'BZR VCSCommand plugin called on non-BZR item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:bzrFunctions.Identify(buffer) {{{2
function! s:bzrFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . fileName . '"')
if(v:shell_error)
return 0
else
return 1
endif
endfunction
" Function: s:bzrFunctions.Add() {{{2
function! s:bzrFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:bzrFunctions.Annotate(argList) {{{2
function! s:bzrFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'BZRannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
else
let caption = ''
let options = ''
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ' -r' . caption
else
let caption = join(a:argList, ' ')
let options = ' ' . caption
endif
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
endif
return resultBuffer
endfunction
" Function: s:bzrFunctions.Commit(argList) {{{2
function! s:bzrFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
endfunction
" Function: s:bzrFunctions.Delete() {{{2
function! s:bzrFunctions.Delete(argList)
return s:DoCommand(join(['rm'] + a:argList, ' '), 'rm', join(a:argList, ' '), {})
endfunction
" Function: s:bzrFunctions.Diff(argList) {{{2
function! s:bzrFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, '..')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a:argList, ' ')
let revOptions = a:argList
endif
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
endfunction
" Function: s:bzrFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin.
" Returns: List of results: [revision, repository]
function! s:bzrFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = resolve(bufname(originalBuffer))
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -S -- "' . fileName . '"')
let revision = s:VCSCommandUtility.system(s:Executable() . ' revno -- "' . fileName . '"')
if(v:shell_error)
return []
endif
" File not under BZR control.
if statusText =~ '^?'
return ['Unknown']
endif
let [flags, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)')[1:2]
if revision == ''
" Error
return ['Unknown']
elseif flags =~ '^A'
return ['New', 'New']
else
return [revision, repository]
endif
endfunction
" Function: s:bzrFunctions.Info(argList) {{{2
function! s:bzrFunctions.Info(argList)
return s:DoCommand(join(['version-info'] + a:argList, ' '), 'version-info', join(a:argList, ' '), {})
endfunction
" Function: s:bzrFunctions.Lock(argList) {{{2
function! s:bzrFunctions.Lock(argList)
echomsg 'bzr lock is not necessary'
endfunction
" Function: s:bzrFunctions.Log() {{{2
function! s:bzrFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a:argList
let caption = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
return resultBuffer
endfunction
" Function: s:bzrFunctions.Revert(argList) {{{2
function! s:bzrFunctions.Revert(argList)
return s:DoCommand('revert', 'revert', '', {})
endfunction
" Function: s:bzrFunctions.Review(argList) {{{2
function! s:bzrFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
let versionOption = ' -r ' . versiontag . ' '
endif
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:bzrFunctions.Status(argList) {{{2
function! s:bzrFunctions.Status(argList)
let options = ['-S']
if len(a:argList) == 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
endfunction
" Function: s:bzrFunctions.Unlock(argList) {{{2
function! s:bzrFunctions.Unlock(argList)
echomsg 'bzr unlock is not necessary'
endfunction
" Function: s:bzrFunctions.Update(argList) {{{2
function! s:bzrFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Annotate setting {{{2
let s:bzrFunctions.AnnotateSplitRegex = '^[^|]\+ | '
" Section: Plugin Registration {{{1
let s:VCSCommandUtility = VCSCommandRegisterModule('BZR', expand('<sfile>'), s:bzrFunctions, [])
let &cpo = s:save_cpo

File diff suppressed because it is too large Load diff

445
dot_vim/plugin/vcscvs.vim Normal file
View file

@ -0,0 +1,445 @@
" vim600: set foldmethod=marker:
"
" CVS extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
"
" Section: Documentation {{{1
"
" Command documentation {{{2
"
" The following commands only apply to files under CVS source control.
"
" CVSEdit Performs "cvs edit" on the current file.
"
" CVSEditors Performs "cvs editors" on the current file.
"
" CVSUnedit Performs "cvs unedit" on the current file.
"
" CVSWatch Takes an argument which must be one of [on|off|add|remove].
" Performs "cvs watch" with the given argument on the current
" file.
"
" CVSWatchers Performs "cvs watchers" on the current file.
"
" CVSWatchAdd Alias for "CVSWatch add"
"
" CVSWatchOn Alias for "CVSWatch on"
"
" CVSWatchOff Alias for "CVSWatch off"
"
" CVSWatchRemove Alias for "CVSWatch remove"
"
" Mapping documentation: {{{2
"
" By default, a mapping is defined for each command. User-provided mappings
" can be used instead by mapping to <Plug>CommandName, for instance:
"
" nnoremap ,ce <Plug>CVSEdit
"
" The default mappings are as follow:
"
" <Leader>ce CVSEdit
" <Leader>cE CVSEditors
" <Leader>ct CVSUnedit
" <Leader>cwv CVSWatchers
" <Leader>cwa CVSWatchAdd
" <Leader>cwn CVSWatchOn
" <Leader>cwf CVSWatchOff
" <Leader>cwr CVSWatchRemove
"
" Options documentation: {{{2
"
" VCSCommandCVSExec
" This variable specifies the CVS executable. If not set, it defaults to
" 'cvs' executed from the user's executable path.
"
" VCSCommandCVSDiffOpt
" This variable, if set, determines the options passed to the cvs diff
" command. If not set, it defaults to 'u'.
" Section: Plugin header {{{1
if exists('VCSCommandDisableAll')
finish
endif
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
" CVS is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:cvsFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke cvs suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the CVS executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'CVS'
let fullCmd = s:Executable() . ' ' . a:cmd
let ret = VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
if ret > 0
if getline(line('$')) =~ '^cvs \w\+: closing down connection'
$d
1
endif
endif
return ret
else
throw 'CVS VCSCommand plugin called on non-CVS item.'
endif
endfunction
" Function: s:GetRevision() {{{2
" Function for retrieving the current buffer's revision number.
" Returns: Revision number or an empty string if an error occurs.
function! s:GetRevision()
if !exists('b:VCSCommandBufferInfo')
let b:VCSCommandBufferInfo = s:cvsFunctions.GetBufferInfo()
endif
if len(b:VCSCommandBufferInfo) > 0
return b:VCSCommandBufferInfo[0]
else
return ''
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:cvsFunctions.Identify(buffer) {{{2
function! s:cvsFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
if isdirectory(fileName)
let directoryName = fileName
else
let directoryName = fnamemodify(fileName, ':h')
endif
if strlen(directoryName) > 0
let CVSRoot = directoryName . '/CVS/Root'
else
let CVSRoot = 'CVS/Root'
endif
if filereadable(CVSRoot)
return 1
else
return 0
endif
endfunction
" Function: s:cvsFunctions.Add(argList) {{{2
function! s:cvsFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:cvsFunctions.Annotate(argList) {{{2
function! s:cvsFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'CVSannotate'
" This is a CVSAnnotate buffer. Perform annotation of the version
" indicated by the current line.
let caption = matchstr(getline('.'),'\v^[0-9.]+')
if VCSCommandGetOption('VCSCommandCVSAnnotateParent', 0) != 0
if caption != '1.1'
let revmaj = matchstr(caption,'\v[0-9.]+\ze\.[0-9]+')
let revmin = matchstr(caption,'\v[0-9.]+\.\zs[0-9]+') - 1
if revmin == 0
" Jump to ancestor branch
let caption = matchstr(revmaj,'\v[0-9.]+\ze\.[0-9]+')
else
let caption = revmaj . "." . revmin
endif
endif
endif
let options = ['-r' . caption]
else
" CVS defaults to pulling HEAD, regardless of current branch.
" Therefore, always pass desired revision.
let caption = ''
let options = ['-r' . s:GetRevision()]
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ['-r' . caption]
else
let caption = join(a:argList)
let options = a:argList
endif
let resultBuffer = s:DoCommand(join(['-q', 'annotate'] + options), 'annotate', caption, {})
if resultBuffer > 0
" Remove header lines from standard error
silent v/^\d\+\%(\.\d\+\)\+/d
endif
return resultBuffer
endfunction
" Function: s:cvsFunctions.Commit(argList) {{{2
function! s:cvsFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
return resultBuffer
endfunction
" Function: s:cvsFunctions.Delete() {{{2
" By default, use the -f option to remove the file first. If options are
" passed in, use those instead.
function! s:cvsFunctions.Delete(argList)
let options = ['-f']
let caption = ''
if len(a:argList) > 0
let options = a:argList
let caption = join(a:argList, ' ')
endif
return s:DoCommand(join(['remove'] + options, ' '), 'delete', caption, {})
endfunction
" Function: s:cvsFunctions.Diff(argList) {{{2
function! s:cvsFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ' -r')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a:argList, ' ')
let revOptions = a:argList
endif
let cvsDiffOpt = VCSCommandGetOption('VCSCommandCVSDiffOpt', 'u')
if cvsDiffOpt == ''
let diffOptions = []
else
let diffOptions = ['-' . cvsDiffOpt]
endif
return s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
endfunction
" Function: s:cvsFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin. This CVS extension adds branch name to the return
" list as well.
" Returns: List of results: [revision, repository, branch]
function! s:cvsFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
if isdirectory(fileName)
let tag = ''
if filereadable(fileName . '/CVS/Tag')
let tagFile = readfile(fileName . '/CVS/Tag')
if len(tagFile) == 1
let tag = substitute(tagFile[0], '^T', '', '')
endif
endif
return [tag]
endif
let realFileName = fnamemodify(resolve(fileName), ':t')
if !filereadable(fileName)
return ['Unknown']
endif
let oldCwd = VCSCommandChangeToCurrentFileDir(fileName)
try
let statusText=s:VCSCommandUtility.system(s:Executable() . ' status -- "' . realFileName . '"')
if(v:shell_error)
return []
endif
let revision=substitute(statusText, '^\_.*Working revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\)\_.*$', '\1', '')
" We can still be in a CVS-controlled directory without this being a CVS
" file
if match(revision, '^New file!$') >= 0
let revision='New'
elseif match(revision, '^\d\+\.\d\+\%(\.\d\+\.\d\+\)*$') <0
return ['Unknown']
endif
let branch=substitute(statusText, '^\_.*Sticky Tag:\s\+\(\d\+\%(\.\d\+\)\+\|\a[A-Za-z0-9-_]*\|(none)\).*$', '\1', '')
let repository=substitute(statusText, '^\_.*Repository revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\|No revision control file\)\_.*$', '\1', '')
let repository=substitute(repository, '^New file!\|No revision control file$', 'New', '')
return [revision, repository, branch]
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction
" Function: s:cvsFunctions.Log() {{{2
function! s:cvsFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a:argList
let caption = join(a:argList, ' ')
endif
return s:DoCommand(join(['log'] + options), 'log', caption, {})
endfunction
" Function: s:cvsFunctions.Revert(argList) {{{2
function! s:cvsFunctions.Revert(argList)
return s:DoCommand('update -C', 'revert', '', {})
endfunction
" Function: s:cvsFunctions.Review(argList) {{{2
function! s:cvsFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
let versionOption = ' -r ' . versiontag . ' '
endif
return s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:cvsFunctions.Status(argList) {{{2
function! s:cvsFunctions.Status(argList)
return s:DoCommand(join(['status'] + a:argList, ' '), 'status', join(a:argList, ' '), {})
endfunction
" Function: s:cvsFunctions.Update(argList) {{{2
function! s:cvsFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Section: CVS-specific functions {{{1
" Function: s:CVSEdit() {{{2
function! s:CVSEdit()
return s:DoCommand('edit', 'cvsedit', '', {})
endfunction
" Function: s:CVSEditors() {{{2
function! s:CVSEditors()
return s:DoCommand('editors', 'cvseditors', '', {})
endfunction
" Function: s:CVSUnedit() {{{2
function! s:CVSUnedit()
return s:DoCommand('unedit', 'cvsunedit', '', {})
endfunction
" Function: s:CVSWatch(onoff) {{{2
function! s:CVSWatch(onoff)
if a:onoff !~ '^\c\%(on\|off\|add\|remove\)$'
echoerr 'Argument to CVSWatch must be one of [on|off|add|remove]'
return -1
end
return s:DoCommand('watch ' . tolower(a:onoff), 'cvswatch', '', {})
endfunction
" Function: s:CVSWatchers() {{{2
function! s:CVSWatchers()
return s:DoCommand('watchers', 'cvswatchers', '', {})
endfunction
" Annotate setting {{{2
let s:cvsFunctions.AnnotateSplitRegex = '): '
" Section: Command definitions {{{1
" Section: Primary commands {{{2
com! CVSEdit call s:CVSEdit()
com! CVSEditors call s:CVSEditors()
com! CVSUnedit call s:CVSUnedit()
com! -nargs=1 CVSWatch call s:CVSWatch(<f-args>)
com! CVSWatchAdd call s:CVSWatch('add')
com! CVSWatchOn call s:CVSWatch('on')
com! CVSWatchOff call s:CVSWatch('off')
com! CVSWatchRemove call s:CVSWatch('remove')
com! CVSWatchers call s:CVSWatchers()
" Section: Plugin command mappings {{{1
let s:cvsExtensionMappings = {}
let mappingInfo = [
\['CVSEdit', 'CVSEdit', 'e'],
\['CVSEditors', 'CVSEditors', 'E'],
\['CVSUnedit', 'CVSUnedit', 't'],
\['CVSWatchers', 'CVSWatchers', 'wv'],
\['CVSWatchAdd', 'CVSWatch add', 'wa'],
\['CVSWatchOff', 'CVSWatch off', 'wf'],
\['CVSWatchOn', 'CVSWatch on', 'wn'],
\['CVSWatchRemove', 'CVSWatch remove', 'wr']
\]
for [pluginName, commandText, shortCut] in mappingInfo
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
if !hasmapto('<Plug>' . pluginName)
let s:cvsExtensionMappings[shortCut] = commandText
endif
endfor
" Section: Menu items {{{1
amenu <silent> &Plugin.VCS.CVS.&Edit <Plug>CVSEdit
amenu <silent> &Plugin.VCS.CVS.Ed&itors <Plug>CVSEditors
amenu <silent> &Plugin.VCS.CVS.Unedi&t <Plug>CVSUnedit
amenu <silent> &Plugin.VCS.CVS.&Watchers <Plug>CVSWatchers
amenu <silent> &Plugin.VCS.CVS.WatchAdd <Plug>CVSWatchAdd
amenu <silent> &Plugin.VCS.CVS.WatchOn <Plug>CVSWatchOn
amenu <silent> &Plugin.VCS.CVS.WatchOff <Plug>CVSWatchOff
amenu <silent> &Plugin.VCS.CVS.WatchRemove <Plug>CVSWatchRemove
" Section: Plugin Registration {{{1
let s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
let &cpo = s:save_cpo

248
dot_vim/plugin/vcsgit.vim Normal file
View file

@ -0,0 +1,248 @@
" vim600: set foldmethod=marker:
"
" git extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2008 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandGitExec
" This variable specifies the git executable. If not set, it defaults to
" 'git' executed from the user's executable path.
"
" VCSCommandGitDiffOpt
" This variable, if set, determines the default options passed to the
" VCSDiff command. If any options (starting with '-') are passed to the
" command, this variable is not used.
" Section: Plugin header {{{1
if exists('VCSCommandDisableAll')
finish
endif
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git'))
" git is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:gitFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke git suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandGitExec', 'git'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the git executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'git'
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'git VCSCommand plugin called on non-git item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:gitFunctions.Identify(buffer) {{{2
" This function only returns an inexact match due to the detection method used
" by git, which simply traverses the directory structure upward.
function! s:gitFunctions.Identify(buffer)
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
try
call s:VCSCommandUtility.system(s:Executable() . ' rev-parse --is-inside-work-tree')
if(v:shell_error)
return 0
else
return g:VCSCOMMAND_IDENTIFY_INEXACT
endif
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction
" Function: s:gitFunctions.Add(argList) {{{2
function! s:gitFunctions.Add(argList)
return s:DoCommand(join(['add'] + ['-v'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:gitFunctions.Annotate(argList) {{{2
function! s:gitFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'gitannotate'
" Perform annotation of the version indicated by the current line.
let options = matchstr(getline('.'),'^\x\+')
else
let options = ''
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let options = a:argList[0]
else
let options = join(a:argList, ' ')
endif
return s:DoCommand('blame ' . options, 'annotate', options, {})
endfunction
" Function: s:gitFunctions.Commit(argList) {{{2
function! s:gitFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
return resultBuffer
endfunction
" Function: s:gitFunctions.Delete() {{{2
" All options are passed through.
function! s:gitFunctions.Delete(argList)
let options = a:argList
let caption = join(a:argList, ' ')
return s:DoCommand(join(['rm'] + options, ' '), 'delete', caption, {})
endfunction
" Function: s:gitFunctions.Diff(argList) {{{2
" Pass-through call to git-diff. If no options (starting with '-') are found,
" then the options in the 'VCSCommandGitDiffOpt' variable are added.
function! s:gitFunctions.Diff(argList)
let gitDiffOpt = VCSCommandGetOption('VCSCommandGitDiffOpt', '')
if gitDiffOpt == ''
let diffOptions = []
else
let diffOptions = [gitDiffOpt]
for arg in a:argList
if arg =~ '^-'
let diffOptions = []
break
endif
endfor
endif
return s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
endfunction
" Function: s:gitFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin. This CVS extension adds branch name to the return
" list as well.
" Returns: List of results: [revision, repository, branch]
function! s:gitFunctions.GetBufferInfo()
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
try
let branch = substitute(s:VCSCommandUtility.system(s:Executable() . ' symbolic-ref -q HEAD'), '\n$', '', '')
if v:shell_error
let branch = 'DETACHED'
else
let branch = substitute(branch, '^refs/heads/', '', '')
endif
let info = [branch]
for method in split(VCSCommandGetOption('VCSCommandGitDescribeArgList', (',tags,all,always')), ',', 1)
if method != ''
let method = ' --' . method
endif
let tag = substitute(s:VCSCommandUtility.system(s:Executable() . ' describe' . method), '\n$', '', '')
if !v:shell_error
call add(info, tag)
break
endif
endfor
return info
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction
" Function: s:gitFunctions.Log() {{{2
function! s:gitFunctions.Log(argList)
return s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
endfunction
" Function: s:gitFunctions.Revert(argList) {{{2
function! s:gitFunctions.Revert(argList)
return s:DoCommand('checkout', 'revert', '', {})
endfunction
" Function: s:gitFunctions.Review(argList) {{{2
function! s:gitFunctions.Review(argList)
if len(a:argList) == 0
let revision = 'HEAD'
else
let revision = a:argList[0]
endif
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(VCSCommandGetOriginalBuffer('%'))))
try
let prefix = s:VCSCommandUtility.system(s:Executable() . ' rev-parse --show-prefix')
finally
call VCSCommandChdir(oldCwd)
endtry
let prefix = substitute(prefix, '\n$', '', '')
let blob = '"' . revision . ':' . prefix . '<VCSCOMMANDFILE>"'
return s:DoCommand('show ' . blob, 'review', revision, {})
endfunction
" Function: s:gitFunctions.Status(argList) {{{2
function! s:gitFunctions.Status(argList)
return s:DoCommand(join(['status'] + a:argList), 'status', join(a:argList), {'allowNonZeroExit': 1})
endfunction
" Function: s:gitFunctions.Update(argList) {{{2
function! s:gitFunctions.Update(argList)
throw "This command is not implemented for git because file-by-file update doesn't make much sense in that context. If you have an idea for what it should do, please let me know."
endfunction
" Annotate setting {{{2
let s:gitFunctions.AnnotateSplitRegex = ') '
" Section: Plugin Registration {{{1
let s:VCSCommandUtility = VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
let &cpo = s:save_cpo

273
dot_vim/plugin/vcshg.vim Executable file
View file

@ -0,0 +1,273 @@
" vim600: set foldmethod=marker:
"
" Mercurial extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2009 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandHGExec
" This variable specifies the mercurial executable. If not set, it defaults
" to 'hg' executed from the user's executable path.
"
" VCSCommandHGDiffExt
" This variable, if set, sets the external diff program used by Subversion.
"
" VCSCommandHGDiffOpt
" This variable, if set, determines the options passed to the hg diff
" command (such as 'u', 'w', or 'b').
" Section: Plugin header {{{1
if exists('VCSCommandDisableAll')
finish
endif
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
" HG is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:hgFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke hg suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the HG executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'HG'
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'HG VCSCommand plugin called on non-HG item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:hgFunctions.Identify(buffer) {{{2
function! s:hgFunctions.Identify(buffer)
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
try
call s:VCSCommandUtility.system(s:Executable() . ' root')
if(v:shell_error)
return 0
else
return g:VCSCOMMAND_IDENTIFY_INEXACT
endif
finally
call VCSCommandChdir(oldCwd)
endtry
endfunction
" Function: s:hgFunctions.Add() {{{2
function! s:hgFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:hgFunctions.Annotate(argList) {{{2
function! s:hgFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'HGannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
else
let caption = ''
let options = ' -un'
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ' -un -r' . caption
else
let caption = join(a:argList, ' ')
let options = ' ' . caption
endif
return s:DoCommand('blame' . options, 'annotate', caption, {})
endfunction
" Function: s:hgFunctions.Commit(argList) {{{2
function! s:hgFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -l "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
endfunction
" Function: s:hgFunctions.Delete() {{{2
function! s:hgFunctions.Delete(argList)
return s:DoCommand(join(['remove'] + a:argList, ' '), 'remove', join(a:argList, ' '), {})
endfunction
" Function: s:hgFunctions.Diff(argList) {{{2
function! s:hgFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ':')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a:argList, ' ')
let revOptions = a:argList
endif
let hgDiffExt = VCSCommandGetOption('VCSCommandHGDiffExt', '')
if hgDiffExt == ''
let diffExt = []
else
let diffExt = ['--diff-cmd ' . hgDiffExt]
endif
let hgDiffOpt = VCSCommandGetOption('VCSCommandHGDiffOpt', '')
if hgDiffOpt == ''
let diffOptions = []
else
let diffOptions = ['-x -' . hgDiffOpt]
endif
return s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
endfunction
" Function: s:hgFunctions.Info(argList) {{{2
function! s:hgFunctions.Info(argList)
return s:DoCommand(join(['log --limit 1'] + a:argList, ' '), 'log', join(a:argList, ' '), {})
endfunction
" Function: s:hgFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin.
" Returns: List of results: [revision, repository, branch]
function! s:hgFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -- "' . fileName . '"')
if(v:shell_error)
return []
endif
" File not under HG control.
if statusText =~ '^?'
return ['Unknown']
endif
let parentsText = s:VCSCommandUtility.system(s:Executable() . ' parents -- "' . fileName . '"')
let revision = matchlist(parentsText, '^changeset:\s\+\(\S\+\)\n')[1]
let logText = s:VCSCommandUtility.system(s:Executable() . ' log -- "' . fileName . '"')
let repository = matchlist(logText, '^changeset:\s\+\(\S\+\)\n')[1]
if revision == ''
" Error
return ['Unknown']
elseif statusText =~ '^A'
return ['New', 'New']
else
return [revision, repository]
endif
endfunction
" Function: s:hgFunctions.Log(argList) {{{2
function! s:hgFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a:argList
let caption = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
return resultBuffer
endfunction
" Function: s:hgFunctions.Revert(argList) {{{2
function! s:hgFunctions.Revert(argList)
return s:DoCommand('revert', 'revert', '', {})
endfunction
" Function: s:hgFunctions.Review(argList) {{{2
function! s:hgFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
let versionOption = ' -r ' . versiontag . ' '
endif
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:hgFunctions.Status(argList) {{{2
function! s:hgFunctions.Status(argList)
let options = ['-u', '-v']
if len(a:argList) == 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
endfunction
" Function: s:hgFunctions.Update(argList) {{{2
function! s:hgFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Annotate setting {{{2
let s:hgFunctions.AnnotateSplitRegex = '\d\+: '
" Section: Plugin Registration {{{1
let s:VCSCommandUtility = VCSCommandRegisterModule('HG', expand('<sfile>'), s:hgFunctions, [])
let &cpo = s:save_cpo

258
dot_vim/plugin/vcssvk.vim Normal file
View file

@ -0,0 +1,258 @@
" vim600: set foldmethod=marker:
"
" SVK extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandSVKExec
" This variable specifies the SVK executable. If not set, it defaults to
" 'svk' executed from the user's executable path.
" Section: Plugin header {{{1
if exists('VCSCommandDisableAll')
finish
endif
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
" SVK is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:svkFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke SVK suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the SVK executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'SVK'
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'SVK VCSCommand plugin called on non-SVK item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:svkFunctions.Identify(buffer) {{{2
function! s:svkFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
if isdirectory(fileName)
let directoryName = fileName
else
let directoryName = fnamemodify(fileName, ':p:h')
endif
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . directoryName . '"', "no")
if(v:shell_error)
return 0
else
return 1
endif
endfunction
" Function: s:svkFunctions.Add() {{{2
function! s:svkFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Annotate(argList) {{{2
function! s:svkFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'SVKannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
else
let caption = ''
let options = ''
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ' -r' . caption
else
let caption = join(a:argList, ' ')
let options = ' ' . caption
endif
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
if resultBuffer > 0
normal 1G2dd
endif
return resultBuffer
endfunction
" Function: s:svkFunctions.Commit(argList) {{{2
function! s:svkFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
endfunction
" Function: s:svkFunctions.Delete() {{{2
function! s:svkFunctions.Delete(argList)
return s:DoCommand(join(['delete'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Diff(argList) {{{2
function! s:svkFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ':')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a:argList, ' ')
let revOptions = a:argList
endif
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
endfunction
" Function: s:svkFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin.
" Returns: List of results: [revision, repository]
function! s:svkFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = resolve(bufname(originalBuffer))
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -v -- "' . fileName . '"')
if(v:shell_error)
return []
endif
" File not under SVK control.
if statusText =~ '^?'
return ['Unknown']
endif
let [flags, revision, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s')[1:3]
if revision == ''
" Error
return ['Unknown']
elseif flags =~ '^A'
return ['New', 'New']
else
return [revision, repository]
endif
endfunction
" Function: s:svkFunctions.Info(argList) {{{2
function! s:svkFunctions.Info(argList)
return s:DoCommand(join(['info'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Lock(argList) {{{2
function! s:svkFunctions.Lock(argList)
return s:DoCommand(join(['lock'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Log() {{{2
function! s:svkFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a:argList
let caption = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
return resultBuffer
endfunction
" Function: s:svkFunctions.Revert(argList) {{{2
function! s:svkFunctions.Revert(argList)
return s:DoCommand('revert', 'revert', '', {})
endfunction
" Function: s:svkFunctions.Review(argList) {{{2
function! s:svkFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
let versionOption = ' -r ' . versiontag . ' '
endif
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:svkFunctions.Status(argList) {{{2
function! s:svkFunctions.Status(argList)
let options = ['-v']
if len(a:argList) == 0
let options = a:argList
endif
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
endfunction
" Function: s:svkFunctions.Unlock(argList) {{{2
function! s:svkFunctions.Unlock(argList)
return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
endfunction
" Function: s:svkFunctions.Update(argList) {{{2
function! s:svkFunctions.Update(argList)
return s:DoCommand('update', 'update', '', {})
endfunction
" Section: Plugin Registration {{{1
let s:VCSCommandUtility = VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
let &cpo = s:save_cpo

283
dot_vim/plugin/vcssvn.vim Normal file
View file

@ -0,0 +1,283 @@
" vim600: set foldmethod=marker:
"
" SVN extension for VCSCommand.
"
" Version: VCS development
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" License:
" Copyright (c) 2007 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
"
" Section: Documentation {{{1
"
" Options documentation: {{{2
"
" VCSCommandSVNExec
" This variable specifies the SVN executable. If not set, it defaults to
" 'svn' executed from the user's executable path.
"
" VCSCommandSVNDiffExt
" This variable, if set, sets the external diff program used by Subversion.
"
" VCSCommandSVNDiffOpt
" This variable, if set, determines the options passed to the svn diff
" command (such as 'u', 'w', or 'b').
" Section: Plugin header {{{1
if exists('VCSCommandDisableAll')
finish
endif
if v:version < 700
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
finish
endif
runtime plugin/vcscommand.vim
if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
" SVN is not installed
finish
endif
let s:save_cpo=&cpo
set cpo&vim
" Section: Variable initialization {{{1
let s:svnFunctions = {}
" Section: Utility functions {{{1
" Function: s:Executable() {{{2
" Returns the executable used to invoke git suitable for use in a shell
" command.
function! s:Executable()
return shellescape(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
endfunction
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
" Wrapper to VCSCommandDoCommand to add the name of the SVN executable to the
" command argument.
function! s:DoCommand(cmd, cmdName, statusText, options)
if VCSCommandGetVCSType(expand('%')) == 'SVN'
let fullCmd = s:Executable() . ' ' . a:cmd
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
else
throw 'SVN VCSCommand plugin called on non-SVN item.'
endif
endfunction
" Section: VCS function implementations {{{1
" Function: s:svnFunctions.Identify(buffer) {{{2
function! s:svnFunctions.Identify(buffer)
let fileName = resolve(bufname(a:buffer))
if isdirectory(fileName)
let directoryName = fileName
else
let directoryName = fnamemodify(fileName, ':h')
endif
if strlen(directoryName) > 0
let svnDir = directoryName . '/.svn'
else
let svnDir = '.svn'
endif
if isdirectory(svnDir)
return 1
else
return 0
endif
endfunction
" Function: s:svnFunctions.Add() {{{2
function! s:svnFunctions.Add(argList)
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Annotate(argList) {{{2
function! s:svnFunctions.Annotate(argList)
if len(a:argList) == 0
if &filetype == 'SVNannotate'
" Perform annotation of the version indicated by the current line.
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
let options = ' -r' . caption
else
let caption = ''
let options = ''
endif
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
let caption = a:argList[0]
let options = ' -r' . caption
else
let caption = join(a:argList, ' ')
let options = ' ' . caption
endif
return s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {})
endfunction
" Function: s:svnFunctions.Commit(argList) {{{2
function! s:svnFunctions.Commit(argList)
let resultBuffer = s:DoCommand('commit --non-interactive -F "' . a:argList[0] . '"', 'commit', '', {})
if resultBuffer == 0
echomsg 'No commit needed.'
endif
endfunction
" Function: s:svnFunctions.Delete() {{{2
function! s:svnFunctions.Delete(argList)
return s:DoCommand(join(['delete --non-interactive'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Diff(argList) {{{2
function! s:svnFunctions.Diff(argList)
if len(a:argList) == 0
let revOptions = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let revOptions = ['-r' . join(a:argList, ':')]
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
else
" Pass-through
let caption = join(a:argList, ' ')
let revOptions = a:argList
endif
let svnDiffExt = VCSCommandGetOption('VCSCommandSVNDiffExt', '')
if svnDiffExt == ''
let diffExt = []
else
let diffExt = ['--diff-cmd ' . svnDiffExt]
endif
let svnDiffOpt = VCSCommandGetOption('VCSCommandSVNDiffOpt', '')
if svnDiffOpt == ''
let diffOptions = []
else
let diffOptions = ['-x -' . svnDiffOpt]
endif
return s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
endfunction
" Function: s:svnFunctions.GetBufferInfo() {{{2
" Provides version control details for the current file. Current version
" number and current repository version number are required to be returned by
" the vcscommand plugin.
" Returns: List of results: [revision, repository, branch]
function! s:svnFunctions.GetBufferInfo()
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
let fileName = bufname(originalBuffer)
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status --non-interactive -vu -- "' . fileName . '"')
if(v:shell_error)
return []
endif
" File not under SVN control.
if statusText =~ '^?'
return ['Unknown']
endif
let [flags, revision, repository] = matchlist(statusText, '^\(.\{8}\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s')[1:3]
if revision == ''
" Error
return ['Unknown']
elseif flags =~ '^A'
return ['New', 'New']
else
return [revision, repository]
endif
endfunction
" Function: s:svnFunctions.Info(argList) {{{2
function! s:svnFunctions.Info(argList)
return s:DoCommand(join(['info --non-interactive'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Lock(argList) {{{2
function! s:svnFunctions.Lock(argList)
return s:DoCommand(join(['lock --non-interactive'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Log(argList) {{{2
function! s:svnFunctions.Log(argList)
if len(a:argList) == 0
let options = []
let caption = ''
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
let options = ['-r' . join(a:argList, ':')]
let caption = options[0]
else
" Pass-through
let options = a:argList
let caption = join(a:argList, ' ')
endif
let resultBuffer = s:DoCommand(join(['log --non-interactive', '-v'] + options), 'log', caption, {})
return resultBuffer
endfunction
" Function: s:svnFunctions.Revert(argList) {{{2
function! s:svnFunctions.Revert(argList)
return s:DoCommand('revert', 'revert', '', {})
endfunction
" Function: s:svnFunctions.Review(argList) {{{2
function! s:svnFunctions.Review(argList)
if len(a:argList) == 0
let versiontag = '(current)'
let versionOption = ''
else
let versiontag = a:argList[0]
let versionOption = ' -r ' . versiontag . ' '
endif
return s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
endfunction
" Function: s:svnFunctions.Status(argList) {{{2
function! s:svnFunctions.Status(argList)
let options = ['-u', '-v']
if len(a:argList) == 0
let options = a:argList
endif
return s:DoCommand(join(['status --non-interactive'] + options, ' '), 'status', join(options, ' '), {})
endfunction
" Function: s:svnFunctions.Unlock(argList) {{{2
function! s:svnFunctions.Unlock(argList)
return s:DoCommand(join(['unlock --non-interactive'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
endfunction
" Function: s:svnFunctions.Update(argList) {{{2
function! s:svnFunctions.Update(argList)
return s:DoCommand('update --non-interactive', 'update', '', {})
endfunction
" Annotate setting {{{2
let s:svnFunctions.AnnotateSplitRegex = '\s\+\S\+\s\+\S\+ '
" Section: Plugin Registration {{{1
let s:VCSCommandUtility = VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
let &cpo = s:save_cpo

View file

@ -0,0 +1,24 @@
2008-09-20
* Changed the default diff key from C-d to <Leader>d (default would be \d)
2008-09-03
* Add Enabled/Disabled messages when scmdiff is toggled
* Fix highlighting on error messages so subsequent messages aren't highlighted
2008-08-25
* Move Highlight colors out of code so they can be customized by user in .vimrc
2008-08-18
* Initial support for mercurial auto-detection
2008-08-17
* fix bug: Look for SCM directories based on path of file in current buffer, not on getcwd()
2008-08-15
* Add auto-detection of svn, git, and cvs SCMs
2008-08-10
* Make C-d a toggle to turn the diff on/off
* Avoid deleting unrelated buffers when turning diff off
* Autorefresh now works properly

View file

@ -0,0 +1,22 @@
vim-scmdiff: A Vim script to show the differences from a base version in SCM.
Supported SCMs:
* CVS
* SVN
* GIT
* Mercurial
* Bitkeeper
Installation:
copy the scmdiff.vim script to your vim plugin path ie: "~/.vim/plugins". (system paths may vary)
Default commands:
\d Toggle diff view on/off
:D rev Difference between current and rev
This script is an evolution from the scripts posted at the following places:
http://tekrat.com/2008/02/21/vim-diff/
http://www.vim.org/scripts/script.php?script_id=2201
http://playground.audioscrobbler.com/jonty/scmdiff.vim

View file

@ -0,0 +1,11 @@
Bugs
* After exiting (:q) a buffer that has diff enabled, subsequent diffs appear to fail.
* Should restore options like 'wrap' to their original state when turning diff off
* winsaveview() and winrestview() require Vim 7.x. Autodetect and degrade gracefully.
Features
* Option to show side-by-side diff (ie. don't hide original buffer)
* Make it easier to customize colors and commands
* Add a refresh or enable an auto-update feature so diff highlighting changes as changes are made.

View file

@ -0,0 +1,160 @@
" Vim script to show file differences from a base version in SCM.
" Home: http://github.com/ghewgill/vim-scmdiff
" Default commands:
" \d Toggle diff view on/off
" :D rev Difference between current and rev
"
" You can change the highlighting by adding the following to your
" .vimrc file and customizing as necessary. (or just uncomment them here):
" highlight DiffAdd ctermbg=DarkBlue ctermfg=white cterm=NONE
" highlight DiffChange ctermbg=DarkBlue ctermfg=white cterm=NONE
" highlight DiffText ctermbg=DarkBlue ctermfg=white cterm=underline
" highlight DiffDelete ctermbg=red ctermfg=white
if exists("loadedScmDiff") || &cp
finish
endif
let loadedScmDiff = 1
map <silent> <Leader>d :call <SID>scmToggle()<CR>
noremap <unique> <script> <plug>Dh :call <SID>scmDiff("h")<CR>
com! -bar -nargs=? D :call s:scmDiff(<f-args>)
let g:scmDiffRev = ''
function! s:scmToggle()
if exists('b:scmDiffOn') && b:scmDiffOn == 1
let b:scmDiffOn = 0
set nodiff
exe 'bdelete ' . b:scmDiffTmpfile
echohl DiffDelete | echon "scmdiff Disabled" | echohl None
else
call s:scmDiff()
if exists('b:scmDiffOn') && b:scmDiffOn == 1
echohl DiffAdd | echon "scmdiff Enabled" | echohl None
endif
endif
endfunction
function! s:scmRefresh()
if exists('b:scmDiffOn') && b:scmDiffOn == 1
call s:scmDiff()
endif
endfunction
function! s:detectSCM()
" Cache the results we find here to save time
if exists("g:scmBufPath") && g:scmBufPath == expand("%:p:h") && exists("g:scmDiffCommand")
return
endif
let g:scmBufPath = expand("%:p:h")
" Detect CVS, SCCS(bitkeeper) or .svn directories in current path
if !exists("g:scmDiffCommand") && isdirectory(g:scmBufPath."/.svn")
let g:scmDiffCommand = "svn diff"
return
endif
if !exists("g:scmDiffCommand") && isdirectory(g:scmBufPath."/CVS")
let g:scmDiffCommand = "cvs diff"
return
endif
if !exists("g:scmDiffCommand") && isdirectory(g:scmBufPath."/SCCS")
let g:scmDiffCommand = "bk diffs"
return
endif
" Detect .git, SCCS(bitkeeper), .hg(mercurial) directories recursively in reverse
let my_path = g:scmBufPath
while my_path != "/"
if !exists("g:scmDiffCommand") && isdirectory(my_path."/.git")
let g:scmDiffCommand = "git diff"
return
endif
if !exists("g:scmDiffCommand") && isdirectory(my_path."/.hg")
let g:scmDiffCommand = "hg diff"
return
endif
let my_path = simplify(my_path."/../")
endwhile
endfunction
function! s:scmDiff(...)
call s:detectSCM()
if (!exists("g:scmDiffCommand"))
echohl WarningMsg | echon "Could not find .git, .svn, .hg, SCCS, or CVS directories, are you under a supported SCM repository path?" | echohl None
return
endif
if exists('b:scmDiffOn') && b:scmDiffOn == 1
let b:scmDiffOn = 0
set nodiff
exe 'bdelete ' . b:scmDiffTmpfile
endif
let b:scmDiffOn = 1
let view = winsaveview()
if a:0 == 1
if a:1 == 'none'
let g:scmDiffRev = ''
else
let g:scmDiffRev = a:1
endif
endif
let ftype = &filetype
let b:scmDiffTmpfile = tempname()
let cmd = 'cat ' . bufname('%') . ' > ' . b:scmDiffTmpfile
let cmdOutput = system(cmd)
let tmpdiff = tempname()
let cmd = 'cd ' . g:scmBufPath . ' && ' . g:scmDiffCommand . ' ' . g:scmDiffRev . ' ' . expand('%:p') . ' > ' . tmpdiff
let cmdOutput = system(cmd)
if v:shell_error && cmdOutput != ''
echohl WarningMsg | echon cmdOutput | echohl None
return
endif
let cmd = 'patch -R -p0 ' . b:scmDiffTmpfile . ' ' . tmpdiff
let cmdOutput = system(cmd)
if v:shell_error && cmdOutput != ''
echohl WarningMsg | echon cmdOutput | echohl None
return
endif
if a:0 > 0 && a:1 == 'h'
exe 'diffsplit' . b:scmDiffTmpfile
else
exe 'vert diffsplit' . b:scmDiffTmpfile
endif
exe 'set filetype=' . ftype
hide
set foldcolumn=0
set foldlevel=100
set diffopt= " removed filler so we don't show deleted lines
set noscrollbind
call winrestview(view)
endfunction
autocmd CursorHold * call s:scmRefresh()
" vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker
" vim<600: expandtab sw=4 ts=4 sts=4

View file

@ -0,0 +1,9 @@
<script lang="ts">
import { onMount, onDestroy } from "svelte";
</script>
<div>
</div>
<style>
</style>

View file

@ -0,0 +1,19 @@
<template>
</template>
<script>
//import header from './header.vue'
export default {
name: 'components',
data () {
return {
msg: 'Hello World'
}
}
}
</script>
<style>
</style>

377
dot_vim/syntax/c.vim Normal file
View file

@ -0,0 +1,377 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2008 Mar 19
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif
" A bunch of useful C keywords
syn keyword cStatement goto break return continue asm
syn keyword cLabel case default
syn keyword cConditional if else switch
syn keyword cRepeat while for do
syn keyword cTodo contained TODO FIXME XXX
" cCommentGroup allows adding matches for special things in comments
syn cluster cCommentGroup contains=cTodo
" String and Character constants
" Highlight special characters (those which have a backslash) differently
syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
if !exists("c_no_utf")
syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)"
endif
if exists("c_no_cformat")
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell
" cCppString: same as cString, but ends at end of line
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,@Spell
else
if !exists("c_no_c99") " ISO C99
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
else
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
endif
syn match cFormat display "%%" contained
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell
" cCppString: same as cString, but ends at end of line
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
endif
syn match cCharacter "L\='[^\\]'"
syn match cCharacter "L'[^']*'" contains=cSpecial
if exists("c_gnu")
syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'"
syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'"
else
syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'"
syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
endif
syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
syn match cSpecialCharacter display "'\\x\x\{1,2}'"
syn match cSpecialCharacter display "L'\\x\x\+'"
"when wanted, highlight trailing white space
if exists("c_space_errors")
if !exists("c_no_trail_space_error")
syn match cSpaceError display excludenl "\s\+$"
endif
if !exists("c_no_tab_space_error")
syn match cSpaceError display " \+\t"me=e-1
endif
endif
" This should be before cErrInParen to avoid problems with #define ({ xxx })
if exists("c_curly_error")
syntax match cCurlyError "}"
syntax region cBlock start="{" end="}" contains=ALLBUT,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell fold
else
syntax region cBlock start="{" end="}" transparent fold
endif
"catch errors caused by wrong parenthesis and brackets
" also accept <% for {, %> for }, <: for [ and :> for ] (C99)
" But avoid matching <::.
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
if exists("c_no_curly_error")
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
syn match cParenError display ")"
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
elseif exists("c_no_bracket_error")
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
syn match cParenError display ")"
syn match cErrInParen display contained "[{}]\|<%\|%>"
else
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
syn match cParenError display "[\])]"
syn match cErrInParen display contained "[\]{}]\|<%\|%>"
syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
" cCppBracket: same as cParen but ends at end-of-line; used in cDefine
syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
endif
"integer number, or floating point number without a dot and with "f".
syn case ignore
syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctalError,cOctal
" Same, but without octal error (for comments)
syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctal
syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
"hex number
syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
" Flag the first zero of an octal number as something special
syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
syn match cOctalZero display contained "\<0"
syn match cFloat display contained "\d\+f"
"floating point number, with dot, optional exponent
syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
"floating point number, starting with a dot, optional exponent
syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
"floating point number, without dot, with exponent
syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
if !exists("c_no_c99")
"hexadecimal floating point number, optional leading digits, with dot, with exponent
syn match cFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>"
"hexadecimal floating point number, with leading digits, optional dot, with exponent
syn match cFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>"
endif
" flag an octal number with wrong digits
syn match cOctalError display contained "0\o*[89]\d*"
syn case match
if exists("c_comment_strings")
" A comment can contain cString, cCharacter and cNumber.
" But a "*/" inside a cString in a cComment DOES end the comment! So we
" need to use a special type of cString: cCommentString, which also ends on
" "*/", and sees a "*" at the start of the line as comment again.
" Unfortunately this doesn't very well work for // type of comments :-(
syntax match cCommentSkip contained "^\s*\*\($\|\s\+\)"
syntax region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
syntax region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
syntax region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
if exists("c_no_comment_fold")
" Use "extend" here to have preprocessor lines not terminate halfway a
" comment.
syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
else
syntax region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
endif
else
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell
if exists("c_no_comment_fold")
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend
else
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold extend
endif
endif
" keep a // comment separately, it terminates a preproc. conditional
syntax match cCommentError display "\*/"
syntax match cCommentStartError display "/\*"me=e-1 contained
syn keyword cOperator sizeof
if exists("c_gnu")
syn keyword cStatement __asm__
syn keyword cOperator typeof __real__ __imag__
endif
syn keyword cType int long short char void
syn keyword cType signed unsigned float double
if !exists("c_no_ansi") || exists("c_ansi_typedefs")
syn keyword cType size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t
syn keyword cType clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t
syn keyword cType mbstate_t wctrans_t wint_t wctype_t
endif
if !exists("c_no_c99") " ISO C99
syn keyword cType bool complex
syn keyword cType int8_t int16_t int32_t int64_t
syn keyword cType uint8_t uint16_t uint32_t uint64_t
syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t
syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t
syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t
syn keyword cType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
syn keyword cType intptr_t uintptr_t
syn keyword cType intmax_t uintmax_t
endif
if exists("c_gnu")
syn keyword cType __label__ __complex__ __volatile__
endif
syn keyword cStructure struct union enum typedef
syn keyword cStorageClass static register auto volatile extern const
if exists("c_gnu")
syn keyword cStorageClass inline __attribute__
endif
if !exists("c_no_c99")
syn keyword cStorageClass inline restrict
endif
if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
if exists("c_gnu")
syn keyword cConstant __GNUC__ __FUNCTION__ __PRETTY_FUNCTION__ __func__
endif
syn keyword cConstant __LINE__ __FILE__ __DATE__ __TIME__ __STDC__
syn keyword cConstant __STDC_VERSION__
syn keyword cConstant CHAR_BIT MB_LEN_MAX MB_CUR_MAX
syn keyword cConstant UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
syn keyword cConstant CHAR_MIN INT_MIN LONG_MIN SHRT_MIN
syn keyword cConstant CHAR_MAX INT_MAX LONG_MAX SHRT_MAX
syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN
syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX
if !exists("c_no_c99")
syn keyword cConstant __func__
syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX
syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN
syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX
syn keyword cConstant UINT8_MAX UINT16_MAX UINT32_MAX UINT64_MAX
syn keyword cConstant INT_LEAST8_MIN INT_LEAST16_MIN INT_LEAST32_MIN INT_LEAST64_MIN
syn keyword cConstant INT_LEAST8_MAX INT_LEAST16_MAX INT_LEAST32_MAX INT_LEAST64_MAX
syn keyword cConstant UINT_LEAST8_MAX UINT_LEAST16_MAX UINT_LEAST32_MAX UINT_LEAST64_MAX
syn keyword cConstant INT_FAST8_MIN INT_FAST16_MIN INT_FAST32_MIN INT_FAST64_MIN
syn keyword cConstant INT_FAST8_MAX INT_FAST16_MAX INT_FAST32_MAX INT_FAST64_MAX
syn keyword cConstant UINT_FAST8_MAX UINT_FAST16_MAX UINT_FAST32_MAX UINT_FAST64_MAX
syn keyword cConstant INTPTR_MIN INTPTR_MAX UINTPTR_MAX
syn keyword cConstant INTMAX_MIN INTMAX_MAX UINTMAX_MAX
syn keyword cConstant PTRDIFF_MIN PTRDIFF_MAX SIG_ATOMIC_MIN SIG_ATOMIC_MAX
syn keyword cConstant SIZE_MAX WCHAR_MIN WCHAR_MAX WINT_MIN WINT_MAX
endif
syn keyword cConstant FLT_RADIX FLT_ROUNDS
syn keyword cConstant FLT_DIG FLT_MANT_DIG FLT_EPSILON
syn keyword cConstant DBL_DIG DBL_MANT_DIG DBL_EPSILON
syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON
syn keyword cConstant FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP
syn keyword cConstant FLT_MIN_10_EXP FLT_MAX_10_EXP
syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP
syn keyword cConstant DBL_MIN_10_EXP DBL_MAX_10_EXP
syn keyword cConstant LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP
syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP
syn keyword cConstant HUGE_VAL CLOCKS_PER_SEC NULL
syn keyword cConstant LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY
syn keyword cConstant LC_NUMERIC LC_TIME
syn keyword cConstant SIG_DFL SIG_ERR SIG_IGN
syn keyword cConstant SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM
" Add POSIX signals as well...
syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP
syn keyword cConstant SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV
syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU
syn keyword cConstant SIGUSR1 SIGUSR2
syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF WEOF
syn keyword cConstant FOPEN_MAX FILENAME_MAX L_tmpnam
syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET
syn keyword cConstant TMP_MAX stderr stdin stdout
syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX
" Add POSIX errors as well
syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY
syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT
syn keyword cConstant EFBIG EILSEQ EINPROGRESS EINTR EINVAL EIO EISDIR
syn keyword cConstant EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENFILE ENODEV
syn keyword cConstant ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS
syn keyword cConstant ENOTDIR ENOTEMPTY ENOTSUP ENOTTY ENXIO EPERM
syn keyword cConstant EPIPE ERANGE EROFS ESPIPE ESRCH ETIMEDOUT EXDEV
" math.h
syn keyword cConstant M_E M_LOG2E M_LOG10E M_LN2 M_LN10 M_PI M_PI_2 M_PI_4
syn keyword cConstant M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2
endif
if !exists("c_no_c99") " ISO C99
syn keyword cConstant true false
endif
" Accept %: for # (C99)
syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
if !exists("c_no_if0")
if !exists("c_no_if0_fold")
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2 fold
else
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2
endif
syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip
syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip
endif
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match cIncluded display contained "<[^>]*>"
syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
"syn match cLineSkip "\\$"
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti
syn region cDefine start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 keepend contains=ALLBUT,@cPreProcGroup,@Spell
syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
" Highlight User Labels
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
syn cluster cLabelGroup contains=cUserLabel
syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup
syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup
syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
syn match cUserLabel display "\I\i*" contained
" Avoid recognizing most bitfields as labels
syn match cBitField display "^\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
syn match cBitField display ";\s*\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
" Highlight Class and Function names
syn match cCustomParen "(" contains=cParen contains=cCppParen
syn match cCustomFunc "\w\+\s*(" contains=cCustomParen
syn match cCustomScope "::"
syn match cCustomClass "\w\+\s*::" contains=cCustomScope
hi def link cCustomFunc Function
hi def link cCustomClass Function
if exists("c_minlines")
let b:c_minlines = c_minlines
else
if !exists("c_no_if0")
let b:c_minlines = 50 " #if 0 constructs can be long
else
let b:c_minlines = 15 " mostly for () constructs
endif
endif
if exists("c_curly_error")
syn sync fromstart
else
exec "syn sync ccomment cComment minlines=" . b:c_minlines
endif
" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link cFormat cSpecial
hi def link cCppString cString
hi def link cCommentL cComment
hi def link cCommentStart cComment
hi def link cLabel Label
hi def link cUserLabel Label
hi def link cConditional Conditional
hi def link cRepeat Repeat
hi def link cCharacter Character
hi def link cSpecialCharacter cSpecial
hi def link cNumber Number
hi def link cOctal Number
hi def link cOctalZero PreProc " link this to Error if you want
hi def link cFloat Float
hi def link cOctalError cError
hi def link cParenError cError
hi def link cErrInParen cError
hi def link cErrInBracket cError
hi def link cCommentError cError
hi def link cCommentStartError cError
hi def link cSpaceError cError
hi def link cSpecialError cError
hi def link cCurlyError cError
hi def link cOperator Operator
hi def link cStructure Structure
hi def link cStorageClass StorageClass
hi def link cInclude Include
hi def link cPreProc PreProc
hi def link cDefine Macro
hi def link cIncluded cString
hi def link cError Error
hi def link cStatement Statement
hi def link cPreCondit PreCondit
hi def link cType Type
hi def link cConstant Constant
hi def link cCommentString cString
hi def link cComment2String cString
hi def link cCommentSkip cComment
hi def link cString String
hi def link cComment Comment
hi def link cSpecial SpecialChar
hi def link cTodo Todo
hi def link cCppSkip cCppOut
hi def link cCppOut2 cCppOut
hi def link cCppOut Comment
let b:current_syntax = "c"
" vim: ts=8

View file

@ -0,0 +1,45 @@
" Vim syntax file
" Language: CVS annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the cvscommand plugin. Originally written by Mathieu
" Clabaut
" License:
" Copyright (c) 2007 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn match cvsDate /\d\d-...-\d\d/ contained
syn match cvsName /(\S* /hs=s+1,he=e-1 contained nextgroup=cvsDate
syn match cvsVer /^\d\+\(\.\d\+\)\+/ contained nextgroup=cvsName
syn region cvsHead start="^\d\+\.\d\+" end="):" contains=cvsVer,cvsName,cvsDate
if !exists("did_cvsannotate_syntax_inits")
let did_cvsannotate_syntax_inits = 1
hi link cvsDate Comment
hi link cvsName Type
hi link cvsVer Statement
endif
let b:current_syntax="CVSAnnotate"

View file

@ -0,0 +1,44 @@
" Vim syntax file
" Language: git annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the vcscommand plugin.
" License:
" Copyright (c) 2009 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
if exists("b:current_syntax")
finish
endif
syn region gitName start="(\@<=" end="\( \d\d\d\d-\)\@=" contained
syn match gitCommit /^\^\?\x\+/ contained
syn match gitDate /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d [+-]\d\d\d\d/ contained
syn match gitLineNumber /\d\+)\@=/ contained
syn region gitAnnotation start="^" end=") " oneline keepend contains=gitCommit,gitLineNumber,gitDate,gitName
if !exists("did_gitannotate_syntax_inits")
let did_gitannotate_syntax_inits = 1
hi link gitName Type
hi link gitCommit Statement
hi link gitDate Comment
hi link gitLineNumber Label
endif
let b:current_syntax="gitAnnotate"

355
dot_vim/syntax/haskell.vim Normal file
View file

@ -0,0 +1,355 @@
" Vim syntax file
"
" Modification of vims Haskell syntax file:
" - match types using regular expression
" - highlight toplevel functions
" - use "syntax keyword" instead of "syntax match" where appropriate
" - functions and types in import and module declarations are matched
" - removed hs_highlight_more_types (just not needed anymore)
" - enable spell checking in comments and strings only
" - FFI highlighting
" - QuasiQuotation
" - top level Template Haskell slices
" - PackageImport
"
" TODO: find out which vim versions are still supported
"
" From Original file:
" ===================
"
" Language: Haskell
" Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org>
" Last Change: 2010 Feb 21
" Original Author: John Williams <jrw@pobox.com>
"
" Thanks to Ryan Crumley for suggestions and John Meacham for
" pointing out bugs. Also thanks to Ian Lynagh and Donald Bruce Stewart
" for providing the inspiration for the inclusion of the handling
" of C preprocessor directives, and for pointing out a bug in the
" end-of-line comment handling.
"
" Options-assign a value to these variables to turn the option on:
"
" hs_highlight_delimiters - Highlight delimiter characters--users
" with a light-colored background will
" probably want to turn this on.
" hs_highlight_boolean - Treat True and False as keywords.
" hs_highlight_types - Treat names of primitive types as keywords.
" hs_highlight_debug - Highlight names of debugging functions.
" hs_allow_hash_operator - Don't highlight seemingly incorrect C
" preprocessor directives but assume them to be
" operators
"
"
if version < 600
syn clear
elseif exists("b:current_syntax")
finish
endif
"syntax sync fromstart "mmhhhh.... is this really ok to do so?
syntax sync linebreaks=15 minlines=50 maxlines=500
syn match hsSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)"
syn match hsSpecialChar contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)"
syn match hsSpecialCharError contained "\\&\|'''\+"
sy region hsString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=hsSpecialChar,@Spell
sy match hsCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=hsSpecialChar,hsSpecialCharError
sy match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hsSpecialCharError
" (Qualified) identifiers (no default highlighting)
syn match ConId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[A-Z][a-zA-Z0-9_']*\>"
syn match VarId "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=\<[a-z][a-zA-Z0-9_']*\>"
" Infix operators--most punctuation characters and any (qualified) identifier
" enclosed in `backquotes`. An operator starting with : is a constructor,
" others are variables (e.g. functions).
syn match hsVarSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[-!#$%&\*\+/<=>\?@\\^|~.][-!#$%&\*\+/<=>\?@\\^|~:.]*"
syn match hsConSym "\(\<[A-Z][a-zA-Z0-9_']*\.\)\=:[-!#$%&\*\+./<=>\?@\\^|~:]*"
syn match hsVarSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[a-z][a-zA-Z0-9_']*`"
syn match hsConSym "`\(\<[A-Z][a-zA-Z0-9_']*\.\)\=[A-Z][a-zA-Z0-9_']*`"
" Toplevel Template Haskell support
"sy match hsTHTopLevel "^[a-z]\(\(.\&[^=]\)\|\(\n[^a-zA-Z0-9]\)\)*"
sy match hsTHIDTopLevel "^[a-z]\S*"
sy match hsTHTopLevel "^\$(\?" nextgroup=hsTHTopLevelName
sy match hsTHTopLevelName "[a-z]\S*" contained
" Reserved symbols--cannot be overloaded.
syn match hsDelimiter "(\|)\|\[\|\]\|,\|;\|_\|{\|}"
sy region hsInnerParen start="(" end=")" contained contains=hsInnerParen,hsConSym,hsType,hsVarSym
sy region hs_InfixOpFunctionName start="^(" end=")\s*[^:`]\(\W\&\S\&[^'\"`()[\]{}@]\)\+"re=s
\ contained keepend contains=hsInnerParen,hs_HlInfixOp
sy match hs_hlFunctionName "[a-z_]\(\S\&[^,\(\)\[\]]\)*" contained
sy match hs_FunctionName "^[a-z_]\(\S\&[^,\(\)\[\]]\)*" contained contains=hs_hlFunctionName
sy match hs_HighliteInfixFunctionName "`[a-z_][^`]*`" contained
sy match hs_InfixFunctionName "^\S[^=]*`[a-z_][^`]*`"me=e-1 contained contains=hs_HighliteInfixFunctionName,hsType,hsConSym,hsVarSym,hsString,hsCharacter
sy match hs_HlInfixOp "\(\W\&\S\&[^`(){}'[\]]\)\+" contained contains=hsString
sy match hs_InfixOpFunctionName "^\(\(\w\|[[\]{}]\)\+\|\(\".*\"\)\|\('.*'\)\)\s*[^:]=*\(\W\&\S\&[^='\"`()[\]{}@]\)\+"
\ contained contains=hs_HlInfixOp,hsCharacter
sy match hs_OpFunctionName "(\(\W\&[^(),\"]\)\+)" contained
"sy region hs_Function start="^["'a-z_([{]" end="=\(\s\|\n\|\w\|[([]\)" keepend extend
sy region hs_Function start="^["'a-zA-Z_([{]\(\(.\&[^=]\)\|\(\n\s\)\)*=" end="\(\s\|\n\|\w\|[([]\)"
\ contains=hs_OpFunctionName,hs_InfixOpFunctionName,hs_InfixFunctionName,hs_FunctionName,hsType,hsConSym,hsVarSym,hsString,hsCharacter
sy match hs_DeclareFunction "^[a-z_(]\S*\(\s\|\n\)*::" contains=hs_FunctionName,hs_OpFunctionName
" hi hs_InfixOpFunctionName guibg=yellow
" hi hs_Function guibg=green
" hi hs_InfixFunctionName guibg=red
" hi hs_DeclareFunction guibg=red
sy keyword hsStructure data family class where instance default deriving
sy keyword hsTypedef type newtype
sy keyword hsInfix infix infixl infixr
sy keyword hsStatement do case of let in
sy keyword hsConditional if then else
"if exists("hs_highlight_types")
" Primitive types from the standard prelude and libraries.
sy match hsType "\<[A-Z]\(\S\&[^,.]\)*\>"
sy match hsType "()"
"endif
" Not real keywords, but close.
if exists("hs_highlight_boolean")
" Boolean constants from the standard prelude.
syn keyword hsBoolean True False
endif
syn region hsPackageString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained
sy match hsModuleName excludenl "\([A-Z]\w*\.\?\)*" contained
sy match hsImport "\<import\>\s\+\(qualified\s\+\)\?\(\<\(\w\|\.\)*\>\)"
\ contains=hsModuleName,hsImportLabel
\ nextgroup=hsImportParams,hsImportIllegal skipwhite
sy keyword hsImportLabel import qualified contained
sy match hsImportIllegal "\w\+" contained
sy keyword hsAsLabel as contained
sy keyword hsHidingLabel hiding contained
sy match hsImportParams "as\s\+\(\w\+\)" contained
\ contains=hsModuleName,hsAsLabel
\ nextgroup=hsImportParams,hsImportIllegal skipwhite
sy match hsImportParams "hiding" contained
\ contains=hsHidingLabel
\ nextgroup=hsImportParams,hsImportIllegal skipwhite
sy region hsImportParams start="(" end=")" contained
\ contains=hsBlockComment,hsLineComment, hsType,hsDelimTypeExport,hs_hlFunctionName,hs_OpFunctionName
\ nextgroup=hsImportIllegal skipwhite
" hi hsImport guibg=red
"hi hsImportParams guibg=bg
"hi hsImportIllegal guibg=bg
"hi hsModuleName guibg=bg
"sy match hsImport "\<import\>\(.\|[^(]\)*\((.*)\)\?"
" \ contains=hsPackageString,hsImportLabel,hsImportMod,hsModuleName,hsImportList
"sy keyword hsImportLabel import contained
"sy keyword hsImportMod as qualified hiding contained
"sy region hsImportListInner start="(" end=")" contained keepend extend contains=hs_OpFunctionName
"sy region hsImportList matchgroup=hsImportListParens start="("rs=s+1 end=")"re=e-1
" \ contained
" \ keepend extend
" \ contains=hsType,hsLineComment,hsBlockComment,hs_hlFunctionName,hsImportListInner
" new module highlighting
syn region hsDelimTypeExport start="\<[A-Z]\(\S\&[^,.]\)*\>(" end=")" contained
\ contains=hsType
sy keyword hsExportModuleLabel module contained
sy match hsExportModule "\<module\>\(\s\|\t\|\n\)*\([A-Z]\w*\.\?\)*" contained contains=hsExportModuleLabel,hsModuleName
sy keyword hsModuleStartLabel module contained
sy keyword hsModuleWhereLabel where contained
syn match hsModuleStart "^module\(\s\|\n\)*\(\<\(\w\|\.\)*\>\)\(\s\|\n\)*"
\ contains=hsModuleStartLabel,hsModuleName
\ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel
syn region hsModuleCommentA start="{-" end="-}"
\ contains=hsModuleCommentA,hsCommentTodo,@Spell contained
\ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel skipwhite skipnl
syn match hsModuleCommentA "--.*\n"
\ contains=hsCommentTodo,@Spell contained
\ nextgroup=hsModuleCommentA,hsModuleExports,hsModuleWhereLabel skipwhite skipnl
syn region hsModuleExports start="(" end=")" contained
\ nextgroup=hsModuleCommentB,hsModuleWhereLabel skipwhite skipnl
\ contains=hsBlockComment,hsLineComment,hsType,hsDelimTypeExport,hs_hlFunctionName,hs_OpFunctionName,hsExportModule
syn match hsModuleCommentB "--.*\n"
\ contains=hsCommentTodo,@Spell contained
\ nextgroup=hsModuleCommentB,hsModuleWhereLabel skipwhite skipnl
syn region hsModuleCommentB start="{-" end="-}"
\ contains=hsModuleCommentB,hsCommentTodo,@Spell contained
\ nextgroup=hsModuleCommentB,hsModuleWhereLabel skipwhite skipnl
" end module highlighting
" FFI support
sy keyword hsFFIForeign foreign contained
"sy keyword hsFFIImportExport import export contained
sy keyword hsFFIImportExport export contained
sy keyword hsFFICallConvention ccall stdcall contained
sy keyword hsFFISafety safe unsafe contained
sy region hsFFIString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=hsSpecialChar
sy match hsFFI excludenl "\<foreign\>\(.\&[^\"]\)*\"\(.\)*\"\(\s\|\n\)*\(.\)*::"
\ keepend
\ contains=hsFFIForeign,hsFFIImportExport,hsFFICallConvention,hsFFISafety,hsFFIString,hs_OpFunctionName,hs_hlFunctionName
sy match hsNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
sy match hsFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
" Comments
sy keyword hsCommentTodo TODO FIXME XXX TBD contained
sy match hsLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$" contains=hsCommentTodo,@Spell
sy region hsBlockComment start="{-" end="-}" contains=hsBlockComment,hsCommentTodo,@Spell
sy region hsPragma start="{-#" end="#-}"
" QuasiQuotation
sy region hsQQ start="\[\$" end="|\]"me=e-2 keepend contains=hsQQVarID,hsQQContent nextgroup=hsQQEnd
sy region hsQQNew start="\[\(.\&[^|]\&\S\)*|" end="|\]"me=e-2 keepend contains=hsQQVarIDNew,hsQQContent nextgroup=hsQQEnd
sy match hsQQContent ".*" contained
sy match hsQQEnd "|\]" contained
sy match hsQQVarID "\[\$\(.\&[^|]\)*|" contained
sy match hsQQVarIDNew "\[\(.\&[^|]\)*|" contained
if exists("hs_highlight_debug")
" Debugging functions from the standard prelude.
syn keyword hsDebug undefined error trace
endif
" C Preprocessor directives. Shamelessly ripped from c.vim and trimmed
" First, see whether to flag directive-like lines or not
if (!exists("hs_allow_hash_operator"))
syn match cError display "^\s*\(%:\|#\).*$"
endif
" Accept %: for # (C99)
syn region cPreCondit start="^\s*\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCommentError
syn match cPreCondit display "^\s*\(%:\|#\)\s*\(else\|endif\)\>"
syn region cCppOut start="^\s*\(%:\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=cCppOut2
syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cCppSkip
syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cCppSkip
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match cIncluded display contained "<[^>]*>"
syn match cInclude display "^\s*\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cCppOut,cCppOut2,cCppSkip,cCommentStartError
syn region cDefine matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$"
syn region cPreProc matchgroup=cPreCondit start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=cCommentStartError,cSpaceError contained
syntax match cCommentError display "\*/" contained
syntax match cCommentStartError display "/\*"me=e-1 contained
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial contained
if version >= 508 || !exists("did_hs_syntax_inits")
if version < 508
let did_hs_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink hs_hlFunctionName Function
HiLink hs_HighliteInfixFunctionName Function
HiLink hs_HlInfixOp Function
HiLink hs_OpFunctionName Function
HiLink hsTypedef Typedef
HiLink hsVarSym hsOperator
HiLink hsConSym hsOperator
if exists("hs_highlight_delimiters")
" Some people find this highlighting distracting.
HiLink hsDelimiter Delimiter
endif
HiLink hsModuleStartLabel Structure
HiLink hsExportModuleLabel Keyword
HiLink hsModuleWhereLabel Structure
HiLink hsModuleName Normal
HiLink hsImportIllegal Error
HiLink hsAsLabel hsImportLabel
HiLink hsHidingLabel hsImportLabel
HiLink hsImportLabel Include
HiLink hsImportMod Include
HiLink hsPackageString hsString
HiLink hsOperator Operator
HiLink hsInfix Keyword
HiLink hsStructure Structure
HiLink hsStatement Statement
HiLink hsConditional Conditional
HiLink hsSpecialCharError Error
HiLink hsSpecialChar SpecialChar
HiLink hsString String
HiLink hsFFIString String
HiLink hsCharacter Character
HiLink hsNumber Number
HiLink hsFloat Float
HiLink hsLiterateComment hsComment
HiLink hsBlockComment hsComment
HiLink hsLineComment hsComment
HiLink hsModuleCommentA hsComment
HiLink hsModuleCommentB hsComment
HiLink hsComment Comment
HiLink hsCommentTodo Todo
HiLink hsPragma SpecialComment
HiLink hsBoolean Boolean
if exists("hs_highlight_types")
HiLink hsDelimTypeExport hsType
HiLink hsType Type
endif
HiLink hsDebug Debug
HiLink cCppString hsString
HiLink cCommentStart hsComment
HiLink cCommentError hsError
HiLink cCommentStartError hsError
HiLink cInclude Include
HiLink cPreProc PreProc
HiLink cDefine Macro
HiLink cIncluded hsString
HiLink cError Error
HiLink cPreCondit PreCondit
HiLink cComment Comment
HiLink cCppSkip cCppOut
HiLink cCppOut2 cCppOut
HiLink cCppOut Comment
HiLink hsFFIForeign Keyword
HiLink hsFFIImportExport Structure
HiLink hsFFICallConvention Keyword
HiLink hsFFISafety Keyword
HiLink hsTHIDTopLevel Macro
HiLink hsTHTopLevelName Macro
HiLink hsQQVarID Keyword
HiLink hsQQVarIDNew Keyword
HiLink hsQQEnd Keyword
HiLink hsQQContent String
delcommand HiLink
endif
let b:current_syntax = "haskell"

40
dot_vim/syntax/hgannotate.vim Executable file
View file

@ -0,0 +1,40 @@
" Vim syntax file
" Language: HG annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the vcscommand plugin.
" License:
" Copyright (c) 2010 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
if exists("b:current_syntax")
finish
endif
syn match hgVer /\d\+/ contained
syn match hgName /^\s*\S\+/ contained
syn match hgHead /^\s*\S\+\s\+\d\+:/ contains=hgVer,hgName
if !exists("did_hgannotate_syntax_inits")
let did_hgannotate_syntax_inits = 1
hi link hgName Type
hi link hgVer Statement
endif
let b:current_syntax="hgAnnotate"

9
dot_vim/syntax/java.vim Normal file
View file

@ -0,0 +1,9 @@
" Highlight Class and Function names
syn match javaCustomParen "(" contains=javaParenT
syn match javaCustomFunc "\w\+\s*(" contains=javaCustomParen
syn match javaCustomScope "::"
syn match javaCustomClass "\w\+\s*::" contains=cCustomScope
hi def link javaCustomFunc Function
hi def link javaCustomClass Function

View file

@ -0,0 +1,247 @@
" Vim syntax file
" Language: JavaScript
" Maintainer: Yi Zhao (ZHAOYI) <zzlinux AT hotmail DOT com>
" Last Change: June 4, 2009
" Version: 0.7.7
" Changes: Add "undefined" as a type keyword
"
" TODO:
" - Add the HTML syntax inside the JSDoc
if !exists("main_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let main_syntax = 'javascript'
endif
"" Drop fold if it set but VIM doesn't support it.
let b:javascript_fold='true'
if version < 600 " Don't support the old version
unlet! b:javascript_fold
endif
"" dollar sigh is permittd anywhere in an identifier
setlocal iskeyword+=$
syntax sync fromstart
"" JavaScript comments
syntax keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
syntax region javaScriptLineComment start=+\/\/+ end=+$+ keepend contains=javaScriptCommentTodo,@Spell
syntax region javaScriptLineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend contains=javaScriptCommentTodo,@Spell fold
syntax region javaScriptCvsTag start="\$\cid:" end="\$" oneline contained
syntax region javaScriptComment start="/\*" end="\*/" contains=javaScriptCommentTodo,javaScriptCvsTag,@Spell fold
"" JSDoc support start
if !exists("javascript_ignore_javaScriptdoc")
syntax case ignore
"" syntax coloring for javadoc comments (HTML)
"syntax include @javaHtml <sfile>:p:h/html.vim
"unlet b:current_syntax
syntax region javaScriptDocComment matchgroup=javaScriptComment start="/\*\*\s*$" end="\*/" contains=javaScriptDocTags,javaScriptCommentTodo,javaScriptCvsTag,@javaScriptHtml,@Spell fold
syntax match javaScriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\)\>" nextgroup=javaScriptDocParam,javaScriptDocSeeTag skipwhite
syntax match javaScriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|returns\=\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"
syntax match javaScriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
syntax region javaScriptDocSeeTag contained matchgroup=javaScriptDocSeeTag start="{" end="}" contains=javaScriptDocTags
syntax case match
endif "" JSDoc end
syntax case match
"" Syntax in the JavaScript code
syntax match javaScriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
syntax region javaScriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=javaScriptSpecial,@htmlPreproc
syntax region javaScriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=javaScriptSpecial,@htmlPreproc
syntax region javaScriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{,3}+ contains=javaScriptSpecial,@htmlPreproc oneline
syntax match javaScriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
syntax match javaScriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
syntax match javaScriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/
"" JavaScript Prototype
syntax keyword javaScriptPrototype prototype
"" Programm Keywords
syntax keyword javaScriptSource import export
syntax keyword javaScriptType const this undefined var void yield
syntax keyword javaScriptOperator delete new in instanceof let typeof
syntax keyword javaScriptBoolean true false
syntax keyword javaScriptNull null
"" Statement Keywords
syntax keyword javaScriptConditional if else
syntax keyword javaScriptRepeat do while for
syntax keyword javaScriptBranch break continue switch case default return
syntax keyword javaScriptStatement try catch throw with finally
syntax keyword javaScriptGlobalObjects Array Boolean Date Function Infinity JavaArray JavaClass JavaObject JavaPackage Math Number NaN Object Packages RegExp String Undefined java netscape sun
syntax keyword javaScriptExceptions Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
syntax keyword javaScriptFutureKeys abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public
"" DOM/HTML/CSS specified things
" DOM2 Objects
syntax keyword javaScriptGlobalObjects DOMImplementation DocumentFragment Document Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction
syntax keyword javaScriptExceptions DOMException
" DOM2 CONSTANT
syntax keyword javaScriptDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR
syntax keyword javaScriptDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE
" HTML events and internal variables
syntax case ignore
syntax keyword javaScriptHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
syntax case match
" Follow stuff should be highligh within a special context
" While it can't be handled with context depended with Regex based highlight
" So, turn it off by default
if exists("javascript_enable_domhtmlcss")
" DOM2 things
syntax match javaScriptDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/
syntax match javaScriptDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementsByTagName\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=javaScriptParen skipwhite
" HTML things
syntax match javaScriptHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/
syntax match javaScriptHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=javaScriptParen skipwhite
" CSS Styles in JavaScript
syntax keyword javaScriptCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition
syntax keyword javaScriptCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition
syntax keyword javaScriptCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode
syntax keyword javaScriptCssStyles contained bottom height left position right top width zIndex
syntax keyword javaScriptCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout
syntax keyword javaScriptCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop
syntax keyword javaScriptCssStyles contained listStyle listStyleImage listStylePosition listStyleType
syntax keyword javaScriptCssStyles contained background backgroundAttachment backgroundColor backgroundImage gackgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat
syntax keyword javaScriptCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType
syntax keyword javaScriptCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText
syntax keyword javaScriptCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor
" Highlight ways
syntax match javaScriptDotNotation "\." nextgroup=javaScriptPrototype,javaScriptDomElemAttrs,javaScriptDomElemFuncs,javaScriptHtmlElemAttrs,javaScriptHtmlElemFuncs
syntax match javaScriptDotNotation "\.style\." nextgroup=javaScriptCssStyles
endif "DOM/HTML/CSS
"" end DOM/HTML/CSS specified things
"" Code blocks
syntax cluster javaScriptAll contains=javaScriptComment,javaScriptLineComment,javaScriptDocComment,javaScriptStringD,javaScriptStringS,javaScriptRegexpString,javaScriptNumber,javaScriptFloat,javaScriptLabel,javaScriptSource,javaScriptType,javaScriptOperator,javaScriptBoolean,javaScriptNull,javaScriptFunction,javaScriptConditional,javaScriptRepeat,javaScriptBranch,javaScriptStatement,javaScriptGlobalObjects,javaScriptExceptions,javaScriptFutureKeys,javaScriptDomErrNo,javaScriptDomNodeConsts,javaScriptHtmlEvents,javaScriptDotNotation
syntax region javaScriptBracket matchgroup=javaScriptBracket transparent start="\[" end="\]" contains=@javaScriptAll,javaScriptParensErrB,javaScriptParensErrC,javaScriptBracket,javaScriptParen,javaScriptBlock,@htmlPreproc
syntax region javaScriptParen matchgroup=javaScriptParen transparent start="(" end=")" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrC,javaScriptParen,javaScriptBracket,javaScriptBlock,@htmlPreproc
syntax region javaScriptBlock matchgroup=javaScriptBlock transparent start="{" end="}" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrB,javaScriptParen,javaScriptBracket,javaScriptBlock,@htmlPreproc
"" catch errors caused by wrong parenthesis
syntax match javaScriptParensError ")\|}\|\]"
syntax match javaScriptParensErrA contained "\]"
syntax match javaScriptParensErrB contained ")"
syntax match javaScriptParensErrC contained "}"
if main_syntax == "javascript"
syntax sync clear
syntax sync ccomment javaScriptComment minlines=200
syntax sync match javaScriptHighlight grouphere javaScriptBlock /{/
endif
"" Fold control
if exists("b:javascript_fold")
syntax match javaScriptFunction /\<function\>/ nextgroup=javaScriptFuncName skipwhite
syntax match javaScriptOpAssign /=\@<!=/ nextgroup=javaScriptFuncBlock skipwhite skipempty
syntax region javaScriptFuncName contained matchgroup=javaScriptFuncName start=/\%(\$\|\w\)*\s*(/ end=/)/ contains=javaScriptLineComment,javaScriptComment nextgroup=javaScriptFuncBlock skipwhite skipempty
syntax region javaScriptFuncBlock contained matchgroup=javaScriptFuncBlock start="{" end="}" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrB,javaScriptParen,javaScriptBracket,javaScriptBlock fold
if &l:filetype=='javascript' && !&diff
" Fold setting
" Redefine the foldtext (to show a JS function outline) and foldlevel
" only if the entire buffer is JavaScript, but not if JavaScript syntax
" is embedded in another syntax (e.g. HTML).
setlocal foldmethod=syntax
setlocal foldlevel=4
endif
else
syntax keyword javaScriptFunction function
setlocal foldmethod<
setlocal foldlevel<
endif
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_javascript_syn_inits")
if version < 508
let did_javascript_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink javaScriptComment Comment
HiLink javaScriptLineComment Comment
HiLink javaScriptDocComment Comment
HiLink javaScriptCommentTodo Todo
HiLink javaScriptCvsTag Function
HiLink javaScriptDocTags Special
HiLink javaScriptDocSeeTag Function
HiLink javaScriptDocParam Function
HiLink javaScriptStringS String
HiLink javaScriptStringD String
HiLink javaScriptRegexpString String
HiLink javaScriptCharacter Character
HiLink javaScriptPrototype Type
HiLink javaScriptConditional Conditional
HiLink javaScriptBranch Conditional
HiLink javaScriptRepeat Repeat
HiLink javaScriptStatement Statement
" HiLink javaScriptFunction Function
HiLink javaScriptFunction Keyword
HiLink javaScriptError Error
HiLink javaScriptParensError Error
HiLink javaScriptParensErrA Error
HiLink javaScriptParensErrB Error
HiLink javaScriptParensErrC Error
HiLink javaScriptOperator Operator
HiLink javaScriptType Type
HiLink javaScriptNull Type
HiLink javaScriptNumber Number
HiLink javaScriptFloat Number
HiLink javaScriptBoolean Boolean
HiLink javaScriptLabel Label
HiLink javaScriptSpecial Special
HiLink javaScriptSource Special
HiLink javaScriptGlobalObjects Special
HiLink javaScriptExceptions Special
HiLink javaScriptDomErrNo Constant
HiLink javaScriptDomNodeConsts Constant
HiLink javaScriptDomElemAttrs Label
HiLink javaScriptDomElemFuncs PreProc
HiLink javaScriptHtmlEvents Special
HiLink javaScriptHtmlElemAttrs Label
HiLink javaScriptHtmlElemFuncs PreProc
HiLink javaScriptCssStyles Label
delcommand HiLink
endif
" Define the htmlJavaScript for HTML syntax html.vim
"syntax clear htmlJavaScript
"syntax clear javaScriptExpression
syntax cluster htmlJavaScript contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError
syntax cluster javaScriptExpression contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError,@htmlPreproc
let b:current_syntax = "javascript"
if main_syntax == 'javascript'
unlet main_syntax
endif
" vim: ts=4

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,83 @@
" LilyPond syntax file
" Language: LilyPond
" Maintainer: Heikki Junes <hjunes@cc.hut.fi>
" Created: Oct 17, 2002
" Last Change: Sep 23, 2003
" Version: 6.1-1
"
" Installed As: vim/syntax/lilypond.vim
" Uses Generated File: vim/syntax/lilypond-words.vim
"
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" Read the LilyPond syntax match groups:
" lilyKeyword, lilyReservedWord, lilyNote
if version < 600
so <sfile>:p:h/lilypond-words.vim
else
runtime! syntax/lilypond-words.vim
if exists("b:current_syntax")
unlet b:current_syntax
endif
endif
" Match also parethesis of angle type
setlocal mps+=<:>
" Case matters
syn case match
syn cluster lilyMatchGroup contains=lilyMatcher,lilyString,lilyComment,lilyStatement,lilyNumber,lilyEquation,lilySlur,lilySpecial,lilyNote,lilyKeyword,lilyArticulation,lilyReservedWord
syn region lilyMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[<>]" end="}" contains=@lilyMatchGroup fold
syn region lilyMatcher matchgroup=Delimiter start="\[" end="]" contains=@lilyMatchGroup fold
syn region lilyMatcher matchgroup=Delimiter start="<" skip="\\\\\|\\[{<>}]" end=">" contains=@lilyMatchGroup fold
syn region lilyString start=/"/ end=/"/ skip=/\\"/
syn region lilyComment start="%{" skip="%$" end="%}"
syn region lilyComment start="%\([^{]\|$\)" end="$"
syn match lilyNumber "[-_^.]\?\d\+[.]\?"
syn match lilyEquation "\(#['`]\)\?\(\a*[-]\)*\a*\s*=\s*\(#[#'`]\?\)\?\a*"
syn match lilySlur "[(~)]"
syn match lilySlur "\\[()]"
syn match lilySpecial "\\[<!>\\]"
" avoid highlighting the extra character in situations like
" c--\mf c^^\mf c__\mf
syn match lilyArticulation "[-_^][-_^+|>.]"
" Rest of syntax highlighting rules start here
"
" " Define the default highlighting.
" " For version 5.7 and earlier: only when not done already
" " For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_lily_syn_inits")
if version < 508
let did_lily_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink Delimiter Identifier
HiLink lilyString String
HiLink lilyComment Comment
HiLink lilyNote Identifier
HiLink lilyArticulation PreProc
HiLink lilyKeyword Keyword
HiLink lilyReservedWord Type
HiLink lilyNumber Constant
HiLink lilySpecial Special
HiLink lilySlur ModeMsg
delcommand HiLink
endif

83
dot_vim/syntax/mako.vim Normal file
View file

@ -0,0 +1,83 @@
" Vim syntax file
" Language: Mako
" Maintainer: Armin Ronacher <armin.ronacher@active-4.com>
" URL: http://lucumr.pocoo.org/
" Last Change: 2007 April 8
" Version: 0.6
"
" Known Limitations
" the <%text> block does not have correct attributes
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = "html"
endif
"Source the html syntax file
ru! syntax/html.vim
unlet b:current_syntax
"Put the python syntax file in @pythonTop
syn include @pythonTop syntax/python.vim
" End keywords
syn keyword makoEnd contained endfor endwhile endif endtry enddef
" Block rules
syn region makoLine matchgroup=makoDelim start=#%\s*# end=#$# keepend contains=@pythonTop,makoEnd
syn region makoBlock matchgroup=makoDelim start=#<%!\?# end=#%># keepend contains=@pythonTop,makoEnd
" Variables
syn region makoNested start="{" end="}" transparent display contained contains=makoNested,@pythonTop
syn region makoVariable matchgroup=makoDelim start=#\${# end=#}# contains=makoNested,@pythonTop
" Comments
syn region makoComment start="##" end="$"
syn region makoDocComment matchgroup=makoDelim start="<%doc>" end="</%doc>" keepend
" Literal Blocks
syn region makoText matchgroup=makoDelim start="<%text[^>]*>" end="</%text>"
" Attribute Sublexing
syn match makoAttributeKey containedin=makoTag contained "[a-zA-Z_][a-zA-Z0-9_]*="
syn region makoAttributeValue containedin=makoTag contained start=/"/ skip=/\\"/ end=/"/
syn region makoAttributeValue containedin=MakoTag contained start=/'/ skip=/\\'/ end=/'/
" Tags
syn region makoTag matchgroup=makoDelim start="<%\(def\|call\|page\|include\|namespace\|inherit\)\>\s*" end="/\?>"
syn match makoDelim "</%\(def\|call\)>"
" Newline Escapes
syn match makoEscape /\\$/
" Default highlighting links
if version >= 508 || !exists("did_mako_syn_inits")
if version < 508
let did_mako_syn_inits = 1
com -nargs=+ HiLink hi link <args>
else
com -nargs=+ HiLink hi def link <args>
endif
HiLink makoDocComment makoComment
HiLink makoDefEnd makoDelim
HiLink makoAttributeKey Type
HiLink makoAttributeValue String
HiLink makoText Normal
HiLink makoDelim Preproc
HiLink makoEnd Keyword
HiLink makoComment Comment
HiLink makoEscape Special
delc HiLink
endif
let b:current_syntax = "mako"

View file

@ -0,0 +1,304 @@
" Taken from http://en.wikipedia.org/wiki/Wikipedia:Text_editor_support#Vim
" Wikipedia syntax file for Vim
" Published on Wikipedia in 2003-04 and declared authorless.
"
" Based on the HTML syntax file. Probably too closely based, in fact. There
" may well be name collisions everywhere, but ignorance is bliss, so they say.
"
" To do: plug-in support for downloading and uploading to the server.
if !exists("main_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let main_syntax = 'html'
endif
if version < 508
command! -nargs=+ HtmlHiLink hi link <args>
else
command! -nargs=+ HtmlHiLink hi def link <args>
endif
syn case ignore
if v:version >= 700
syn spell toplevel
endif
" tags
syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar
syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar
syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1
syn region htmlEndTag start=+</+ end=+>+ contains=htmlTagN
syn region htmlTag start=+<[^/]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlBadArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster
syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,htmlBadTag,@htmlTagNameCluster
syn match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,htmlBadTag,@htmlTagNameCluster
syn match htmlTagError contained "[^>]<"ms=s+1
" This would highlight all tags and <whatevertext> fragments that are not allowed.
"syn match htmlBadTag contained +<\s*[-a-zA-Z0-9]\++ms=s+1
" Highlight only known disallowed HTML tags, so that not every "<whatevertext>"
" fragment is flagged.
syn keyword htmlBadTag contained a acronym address applet area base basefont bdo body button col colgroup dfn dir fieldset form frame frameset head html iframe img input isindex kbd label legend link map menu meta noframes noscript object optgroup option param q script select style tbody textarea tfoot thead title
syn match htmlBadArg contained "\s\+[-a-zA-Z0-9]\+\s*="ms=s+1,me=e-1
" allowed HTML tag names
syn keyword htmlTagName contained b big blockquote br caption center cite code dd del div dl dt em font h1 h2 h3 h4 h5 h6 hr i ins li ol p pre rb rp rt ruby s small span strike strong sub sup table td th tr tt u ul var
" allowed Wiki tag names
syn keyword htmlTagName contained nowiki math references
" allowed arg names
syn keyword htmlArg contained title align lang dir width height nowrap
syn keyword htmlArg contained bgcolor clear noshade
syn keyword htmlArg contained cite datetime size face color
syn keyword htmlArg contained type start value compact
syn keyword htmlArg contained summary border frame rules
syn keyword htmlArg contained cellspacing cellpadding valign char
syn keyword htmlArg contained charoff colgroup col span abbr axis
syn keyword htmlArg contained headers scope rowspan colspan
syn keyword htmlArg contained id class name style
" special characters
syn match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};"
" comments
syn region htmlComment start=+<!+ end=+>+ contains=htmlCommentPart,htmlCommentError
syn match htmlCommentError contained "[^><!]"
syn region htmlCommentPart contained start=+--+ end=+--\s*+ contains=@htmlPreProc
syn region htmlComment start=+<!DOCTYPE+ keepend end=+>+
" HTML formatting
syn cluster htmlTop contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlComment,htmlLink
syn region htmlBold start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic
syn region htmlBold start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic
syn region htmlBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic
syn region htmlBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlBoldItalicUnderline
syn region htmlBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlBoldItalicUnderline
syn region htmlBoldUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop
syn region htmlBoldUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop
syn region htmlBoldItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic
syn region htmlUnderline start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlUnderlineBold,htmlUnderlineItalic
syn region htmlUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlUnderlineBoldItalic
syn region htmlUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlUnderlineBoldItalic
syn region htmlUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmUnderlineItalicBold
syn region htmlUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmUnderlineItalicBold
syn region htmlUnderlineItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop
syn region htmlUnderlineItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop
syn region htmlUnderlineBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop
syn region htmlUnderlineBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop
syn region htmlItalic start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlItalicBold,htmlItalicUnderline
syn region htmlItalic start="<em\>" end="</em>"me=e-5 contains=@htmlTop
syn region htmlItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlItalicBoldUnderline
syn region htmlItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlItalicBoldUnderline
syn region htmlItalicBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop
syn region htmlItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlItalicUnderlineBold
syn region htmlItalicUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop
syn region htmlItalicUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop
syn region htmlH1 start="<h1\>" end="</h1>"me=e-5 contains=@htmlTop
syn region htmlH2 start="<h2\>" end="</h2>"me=e-5 contains=@htmlTop
syn region htmlH3 start="<h3\>" end="</h3>"me=e-5 contains=@htmlTop
syn region htmlH4 start="<h4\>" end="</h4>"me=e-5 contains=@htmlTop
syn region htmlH5 start="<h5\>" end="</h5>"me=e-5 contains=@htmlTop
syn region htmlH6 start="<h6\>" end="</h6>"me=e-5 contains=@htmlTop
syn region htmlHead start="<head\>" end="</head>"me=e-7 end="<body\>"me=e-5 end="<h[1-6]\>"me=e-3 contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLink,htmlTitle,cssStyle
syn region htmlTitle start="<title\>" end="</title>"me=e-8 contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment
" No htmlTop and wikiPre inside HTML preformatted areas, because Wikipedia
" renders everything in there literally (HTML tags and entities, too):
" <pre> tags work as the combination of <nowiki> and the standard HTML <pre>
" tag: the content will preformatted, and it will not be parsed, but shown as
" in the wikitext source.
" With wikiPre, indented lines would be rendered differently from unindented
" lines.
syn match htmlPreTag /<pre>/ contains=htmlTag
syn match wikiNowikiTag /<nowiki>/ contains=htmlTag
syn match wikiNowikiEndTag /<\/nowiki>/ contains=htmlEndTag
" Note: Cannot use 'start="<pre>"rs=e', so still have the <pre> tag highlighted
" correctly via separate syn-match. Unfortunately, this will also highlight
" <pre> tags inside the preformatted region.
syn region htmlPre start="<pre>" end="</pre>"me=e-6 contains=htmlPreTag
syn region wikiNowiki start="<nowiki>" end="</nowiki>"me=e-9 contains=wikiNowikiTag
" wiki formatting
syn region wikiItalic start=+'\@<!'''\@!+ end=+''+ skip="<nowiki>.*</nowiki>" contains=@Spell,wikiLink,wikiItalicBold,wikiNowiki,wikiNowikiEndTag
syn region wikiBold start=+'''+ end=+'''+ skip="<nowiki>.*</nowiki>" contains=@Spell,wikiLink,wikiBoldItalic,wikiNowiki,wikiNowikiEndTag
syn region wikiBoldAndItalic start=+'''''+ end=+'''''+ skip="<nowiki>.*</nowiki>" contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiBoldItalic contained start=+'\@<!'''\@!+ end=+''+ skip="<nowiki>.*</nowiki>" contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiItalicBold contained start=+'''+ end=+'''+ skip="<nowiki>.*</nowiki>" contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiH1 start="^=" end="=" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiH2 start="^==" end="==" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiH3 start="^===" end="===" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiH4 start="^====" end="====" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiH5 start="^=====" end="=====" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiH6 start="^======" end="======" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiLink start="\[\[" end="\]\]\(s\|'s\|es\|ing\|\)" skip="<nowiki>.*</nowiki>" oneline contains=wikiLink,wikiNowiki,wikiNowikiEndTag
syn region wikiLink start="\[http:" end="\]" skip="<nowiki>.*</nowiki>" oneline contains=wikiNowiki,wikiNowikiEndTag
syn region wikiLink start="\[https:" end="\]" skip="<nowiki>.*</nowiki>" oneline contains=wikiNowiki,wikiNowikiEndTag
syn region wikiLink start="\[ftp:" end="\]" skip="<nowiki>.*</nowiki>" oneline contains=wikiNowiki,wikiNowikiEndTag
syn region wikiLink start="\[gopher:" end="\]" skip="<nowiki>.*</nowiki>" oneline contains=wikiNowiki,wikiNowikiEndTag
syn region wikiLink start="\[news:" end="\]" skip="<nowiki>.*</nowiki>" oneline contains=wikiNowiki,wikiNowikiEndTag
syn region wikiLink start="\[mailto:" end="\]" skip="<nowiki>.*</nowiki>" oneline contains=wikiNowiki,wikiNowikiEndTag
syn region wikiTemplate start="{{" end="}}" skip="<nowiki>.*</nowiki>" contains=wikiNowiki,wikiNowikiEndTag
syn match wikiParaFormatChar /^[\:|\*|;|#]\+/
syn match wikiParaFormatChar /^-----*/
syn match wikiPre /^\ .*$/ contains=wikiNowiki,wikiNowikiEndTag
syn include @TeX syntax/tex.vim
syntax region wikiTeX matchgroup=htmlTag start="<math>" end="</math>" skip="<nowiki>.*</nowiki>" contains=@TeX,wikiNowiki,wikiNowikiEndTag
syntax region wikiRef matchgroup=htmlTag start="<ref>" end="</ref>" skip="<nowiki>.*</nowiki>" contains=wikiNowiki,wikiNowikiEndTag
" HTML highlighting
HtmlHiLink htmlTag Function
HtmlHiLink htmlEndTag Identifier
HtmlHiLink htmlArg Type
HtmlHiLink htmlTagName htmlStatement
HtmlHiLink htmlSpecialTagName Exception
HtmlHiLink htmlValue String
HtmlHiLink htmlSpecialChar Special
HtmlHiLink htmlH1 Title
HtmlHiLink htmlH2 htmlH1
HtmlHiLink htmlH3 htmlH2
HtmlHiLink htmlH4 htmlH3
HtmlHiLink htmlH5 htmlH4
HtmlHiLink htmlH6 htmlH5
HtmlHiLink htmlHead PreProc
HtmlHiLink htmlTitle Title
HtmlHiLink htmlBoldItalicUnderline htmlBoldUnderlineItalic
HtmlHiLink htmlUnderlineBold htmlBoldUnderline
HtmlHiLink htmlUnderlineItalicBold htmlBoldUnderlineItalic
HtmlHiLink htmlUnderlineBoldItalic htmlBoldUnderlineItalic
HtmlHiLink htmlItalicUnderline htmlUnderlineItalic
HtmlHiLink htmlItalicBold htmlBoldItalic
HtmlHiLink htmlItalicBoldUnderline htmlBoldUnderlineItalic
HtmlHiLink htmlItalicUnderlineBold htmlBoldUnderlineItalic
HtmlHiLink htmlSpecial Special
HtmlHiLink htmlSpecialChar Special
HtmlHiLink htmlString String
HtmlHiLink htmlStatement Statement
HtmlHiLink htmlComment Comment
HtmlHiLink htmlCommentPart Comment
HtmlHiLink htmlValue String
HtmlHiLink htmlCommentError htmlError
HtmlHiLink htmlTagError htmlError
HtmlHiLink htmlBadTag htmlError
HtmlHiLink htmlBadArg htmlError
HtmlHiLink htmlEvent javaScript
HtmlHiLink htmlError Error
HtmlHiLink htmlCssStyleComment Comment
HtmlHiLink htmlCssDefinition Special
" The default highlighting.
if version >= 508 || !exists("did_html_syn_inits")
if version < 508
let did_html_syn_inits = 1
endif
HtmlHiLink htmlTag Function
HtmlHiLink htmlEndTag Identifier
HtmlHiLink htmlArg Type
HtmlHiLink htmlTagName htmlStatement
HtmlHiLink htmlSpecialTagName Exception
HtmlHiLink htmlValue String
HtmlHiLink htmlSpecialChar Special
if !exists("html_no_rendering")
HtmlHiLink htmlH1 Title
HtmlHiLink htmlH2 htmlH1
HtmlHiLink htmlH3 htmlH2
HtmlHiLink htmlH4 htmlH3
HtmlHiLink htmlH5 htmlH4
HtmlHiLink htmlH6 htmlH5
HtmlHiLink htmlHead PreProc
HtmlHiLink htmlTitle Title
HtmlHiLink htmlBoldItalicUnderline htmlBoldUnderlineItalic
HtmlHiLink htmlUnderlineBold htmlBoldUnderline
HtmlHiLink htmlUnderlineItalicBold htmlBoldUnderlineItalic
HtmlHiLink htmlUnderlineBoldItalic htmlBoldUnderlineItalic
HtmlHiLink htmlItalicUnderline htmlUnderlineItalic
HtmlHiLink htmlItalicBold htmlBoldItalic
HtmlHiLink htmlItalicBoldUnderline htmlBoldUnderlineItalic
HtmlHiLink htmlItalicUnderlineBold htmlBoldUnderlineItalic
HtmlHiLink htmlLink Underlined
if !exists("html_my_rendering")
hi def htmlBold term=bold cterm=bold gui=bold
hi def htmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline
hi def htmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
hi def htmlUnderline term=underline cterm=underline gui=underline
hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline
hi def htmlItalic term=italic cterm=italic gui=italic
endif
endif
HtmlHiLink htmlPreStmt PreProc
HtmlHiLink htmlPreError Error
HtmlHiLink htmlPreProc PreProc
HtmlHiLink htmlPreAttr String
HtmlHiLink htmlPreProcAttrName PreProc
HtmlHiLink htmlPreProcAttrError Error
HtmlHiLink htmlSpecial Special
HtmlHiLink htmlSpecialChar Special
HtmlHiLink htmlString String
HtmlHiLink htmlStatement Statement
HtmlHiLink htmlComment Comment
HtmlHiLink htmlCommentPart Comment
HtmlHiLink htmlValue String
HtmlHiLink htmlCommentError htmlError
HtmlHiLink htmlTagError htmlError
HtmlHiLink htmlBadTag htmlError
HtmlHiLink htmlBadArg htmlError
HtmlHiLink htmlEvent javaScript
HtmlHiLink htmlError Error
HtmlHiLink javaScript Special
HtmlHiLink javaScriptExpression javaScript
HtmlHiLink htmlCssStyleComment Comment
HtmlHiLink htmlCssDefinition Special
endif
" wiki highlighting
HtmlHiLink wikiItalic htmlItalic
HtmlHiLink wikiBold htmlBold
HtmlHiLink wikiBoldItalic htmlBoldItalic
HtmlHiLink wikiItalicBold htmlBoldItalic
HtmlHiLink wikiBoldAndItalic htmlBoldItalic
HtmlHiLink wikiH1 htmlH1
HtmlHiLink wikiH2 htmlH2
HtmlHiLink wikiH3 htmlH3
HtmlHiLink wikiH4 htmlH4
HtmlHiLink wikiH5 htmlH5
HtmlHiLink wikiH6 htmlH6
HtmlHiLink wikiLink Underlined
HtmlHiLink wikiTemplate Special
HtmlHiLink wikiParaFormatChar Special
HtmlHiLink wikiPre Constant
HtmlHiLink wikiRef Comment
let b:current_syntax = "html"
delcommand HtmlHiLink
if main_syntax == 'html'
unlet main_syntax
endif

104
dot_vim/syntax/mkd.vim Normal file
View file

@ -0,0 +1,104 @@
" Vim syntax file
" Language: Markdown
" Maintainer: Ben Williams <benw@plasticboy.com>
" URL: http://plasticboy.com/markdown-vim-mode/
" Version: 9
" Last Change: 2009 May 18
" Remark: Uses HTML syntax file
" Remark: I don't do anything with angle brackets (<>) because that would too easily
" easily conflict with HTML syntax
" TODO: Handle stuff contained within stuff (e.g. headings within blockquotes)
" Read the HTML syntax to start with
if version < 600
so <sfile>:p:h/html.vim
else
runtime! syntax/html.vim
unlet b:current_syntax
endif
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" don't use standard HiLink, it will not work with included syntax files
if version < 508
command! -nargs=+ HtmlHiLink hi link <args>
else
command! -nargs=+ HtmlHiLink hi def link <args>
endif
syn spell toplevel
syn case ignore
syn sync linebreaks=1
"additions to HTML groups
syn region htmlBold start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\*\@!/ end=/\\\@<!\*\@<!\*\*\*\@!\($\|\A\)\@=/ contains=@Spell,htmlItalic
syn region htmlItalic start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\@!/ end=/\\\@<!\*\@<!\*\*\@!\($\|\A\)\@=/ contains=htmlBold,@Spell
syn region htmlBold start=/\\\@<!\(^\|\A\)\@=_\@<!___\@!/ end=/\\\@<!_\@<!___\@!\($\|\A\)\@=/ contains=htmlItalic,@Spell
syn region htmlItalic start=/\\\@<!\(^\|\A\)\@=_\@<!__\@!/ end=/\\\@<!_\@<!__\@!\($\|\A\)\@=/ contains=htmlBold,@Spell
" [link](URL) | [link][id] | [link][]
syn region mkdLink matchgroup=mkdDelimiter start="\!\?\[" end="\]\ze\s*[[(]" contains=@Spell nextgroup=mkdURL,mkdID skipwhite oneline
syn region mkdID matchgroup=mkdDelimiter start="\[" end="\]" contained
syn region mkdURL matchgroup=mkdDelimiter start="(" end=")" contained
" Link definitions: [id]: URL (Optional Title)
" TODO handle automatic links without colliding with htmlTag (<URL>)
syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite
syn region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]" contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained
"define Markdown groups
syn match mkdLineContinue ".$" contained
syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/
syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/
syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/
syn match mkdRule /^\s*-\{3,}$/
syn match mkdRule /^\s*\*\{3,5}$/
syn match mkdListItem "^\s*[-*+]\s\+"
syn match mkdListItem "^\s*\d\+\.\s\+"
syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
syn match mkdLineBreak / \+$/
syn region mkdCode start=/\\\@<!`/ end=/\\\@<!`/
syn region mkdCode start=/\s*``[^`]*/ end=/[^`]*``\s*/
syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell
syn region mkdCode start="<pre[^>]*>" end="</pre>"
syn region mkdCode start="<code[^>]*>" end="</code>"
"HTML headings
syn region htmlH1 start="^\s*#" end="\($\|#\+\)" contains=@Spell
syn region htmlH2 start="^\s*##" end="\($\|#\+\)" contains=@Spell
syn region htmlH3 start="^\s*###" end="\($\|#\+\)" contains=@Spell
syn region htmlH4 start="^\s*####" end="\($\|#\+\)" contains=@Spell
syn region htmlH5 start="^\s*#####" end="\($\|#\+\)" contains=@Spell
syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contains=@Spell
syn match htmlH1 /^.\+\n=\+$/ contains=@Spell
syn match htmlH2 /^.\+\n-\+$/ contains=@Spell
"highlighting for Markdown groups
HtmlHiLink mkdString String
HtmlHiLink mkdCode String
HtmlHiLink mkdBlockquote Comment
HtmlHiLink mkdLineContinue Comment
HtmlHiLink mkdListItem Identifier
HtmlHiLink mkdRule Identifier
HtmlHiLink mkdLineBreak Todo
HtmlHiLink mkdLink htmlLink
HtmlHiLink mkdURL htmlString
HtmlHiLink mkdID Identifier
HtmlHiLink mkdLinkDef mkdID
HtmlHiLink mkdLinkDefTarget mkdURL
HtmlHiLink mkdLinkTitle htmlString
HtmlHiLink mkdDelimiter Delimiter
let b:current_syntax = "mkd"
delcommand HtmlHiLink
" vim: ts=8

23
dot_vim/syntax/motd.vim Normal file
View file

@ -0,0 +1,23 @@
" Vim syntax file
" Language: MotD Public
" Maintainer: David Bushong <david@bushong.net>
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn match motdSig "\(\s\s\+\|\t\)--\?.\+$\|\s--\?\w\+\s*$"
syn match motdThread "^\s\+\\[_-]"
syn match motdDate "^\d\+/\d\+\s"
syn match motdLink "https\?://\S\+"
hi link motdSig String
hi link motdThread Type
hi link motdDate Number
hi link motdLink Underlined
let b:current_syntax = "motd"

View file

@ -0,0 +1,72 @@
" Vim syn file
" Language: NVISION Script
" Maintainer: Barak Michener
" Last Change: 2006 Jun 29
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
"this language is oblivious to case.
syn case ignore
" The only keywords
syn keyword nvpKeyword elseif else defsub endif msgbox for if
syn keyword nvpKeyword gosub endsub next print printn sleep
syn keyword nvpKeyword to wend while yesnobox
syn keyword nvpFunction #flush #sendbreak #halt
" String contstants
syn region nvpString start=+"+ skip=+\\"+ end=+"+
"integer number, or floating point number without a dot.
syn match nvpNumber "\<\d\+\>"
"floating point number, with dot
syn match nvpNumber "\<\d\+\.\d*\>"
"floating point number, starting with a dot
syn match nvpNumber "\.\d\+\>"
"hex number
syn match nvpNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
syn match nvpNumber "\<[0-9ABCDEF]{2}\>"
syn region nvpComment start="!" end="$"
syn match nvpOperator "[+\-*/()%<>=\^]"
syn match nvpVarPlain "$^[ADEFHILMOPSTWX]\="
syn match nvpVarPlain "$[\\\"\[\]'&`+*.,;=%~?@$<>(-]"
syn match nvpVarPlain "$\(0\|[1-9]\d*\)"
syn region nvpSend start="<<" end="$"
syn region nvpRecv start="\d*: " end="$"
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_basic_syntax_inits")
if version < 508
let did_basic_syntax_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
"My Highlighting
HiLink nvpFunction PreProc
HiLink nvpKeyword Statement
HiLink nvpString String
HiLink nvpNumber Number
HiLink nvpComment Comment
HiLink nvpOperator Operator
HiLink nvpVarPlain Identifier
HiLink nvpSend Include
HiLink nvpRecv SpecialChar
delcommand HiLink
endif
let b:current_syntax = "nvpscript"
"vim: ts=4

105
dot_vim/syntax/proto.vim Normal file
View file

@ -0,0 +1,105 @@
" Protocol Buffers - Google's data interchange format
" Copyright 2008 Google Inc. All rights reserved.
" https://developers.google.com/protocol-buffers/
"
" Redistribution and use in source and binary forms, with or without
" modification, are permitted provided that the following conditions are
" met:
"
" * Redistributions of source code must retain the above copyright
" notice, this list of conditions and the following disclaimer.
" * Redistributions in binary form must reproduce the above
" copyright notice, this list of conditions and the following disclaimer
" in the documentation and/or other materials provided with the
" distribution.
" * Neither the name of Google Inc. nor the names of its
" contributors may be used to endorse or promote products derived from
" this software without specific prior written permission.
"
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
" This is the Vim syntax file for Google Protocol Buffers.
"
" Usage:
"
" 1. cp proto.vim ~/.vim/syntax/
" 2. Add the following to ~/.vimrc:
"
" augroup filetype
" au! BufRead,BufNewFile *.proto setfiletype proto
" augroup end
"
" Or just create a new file called ~/.vim/ftdetect/proto.vim with the
" previous lines on it.
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case match
syn keyword pbTodo contained TODO FIXME XXX
syn cluster pbCommentGrp contains=pbTodo
syn keyword pbSyntax syntax import option
syn keyword pbStructure package message group oneof
syn keyword pbRepeat optional required repeated
syn keyword pbDefault default
syn keyword pbExtend extend extensions to max
syn keyword pbRPC service rpc returns
syn keyword pbType int32 int64 uint32 uint64 sint32 sint64
syn keyword pbType fixed32 fixed64 sfixed32 sfixed64
syn keyword pbType float double bool string bytes
syn keyword pbTypedef enum
syn keyword pbBool true false
syn match pbInt /-\?\<\d\+\>/
syn match pbInt /\<0[xX]\x+\>/
syn match pbFloat /\<-\?\d*\(\.\d*\)\?/
syn region pbComment start="\/\*" end="\*\/" contains=@pbCommentGrp
syn region pbComment start="//" skip="\\$" end="$" keepend contains=@pbCommentGrp
syn region pbString start=/"/ skip=/\\./ end=/"/
syn region pbString start=/'/ skip=/\\./ end=/'/
if version >= 508 || !exists("did_proto_syn_inits")
if version < 508
let did_proto_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink pbTodo Todo
HiLink pbSyntax Include
HiLink pbStructure Structure
HiLink pbRepeat Repeat
HiLink pbDefault Keyword
HiLink pbExtend Keyword
HiLink pbRPC Keyword
HiLink pbType Type
HiLink pbTypedef Typedef
HiLink pbBool Boolean
HiLink pbInt Number
HiLink pbFloat Float
HiLink pbComment Comment
HiLink pbString String
delcommand HiLink
endif
let b:current_syntax = "proto"

153
dot_vim/syntax/scala.vim Normal file
View file

@ -0,0 +1,153 @@
" Vim syntax file
" Language : Scala (http://scala-lang.org/)
" Maintainers: Stefan Matthias Aust, Julien Wetterwald
" Last Change: 2007 June 13
" Revision : $Id$
" $URL$
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case match
syn sync minlines=50
" most Scala keywords
syn keyword scalaKeyword abstract case catch do else extends final finally for forSome if implicit lazy match new null override private protected requires return sealed super this throw try type while with yield
syn match scalaKeyword "=>"
syn match scalaKeyword "<-"
syn match scalaKeyword "\<_\>"
syn match scalaOperator ":\{2,\}" "this is not a type
" package and import statements
syn keyword scalaPackage package nextgroup=scalaFqn skipwhite
syn keyword scalaImport import nextgroup=scalaFqn skipwhite
syn match scalaFqn "\<[._$a-zA-Z0-9,]*" contained nextgroup=scalaFqnSet
syn region scalaFqnSet start="{" end="}" contained
" boolean literals
syn keyword scalaBoolean true false
" definitions
syn keyword scalaDef def nextgroup=scalaDefName skipwhite
syn keyword scalaVal val nextgroup=scalaValName skipwhite
syn keyword scalaVar var nextgroup=scalaVarName skipwhite
syn keyword scalaClass class nextgroup=scalaClassName skipwhite
syn keyword scalaObject object nextgroup=scalaClassName skipwhite
syn keyword scalaTrait trait nextgroup=scalaClassName skipwhite
syn match scalaDefName "[^ =:;([]\+" contained nextgroup=scalaDefSpecializer skipwhite
syn match scalaValName "[^ =:;([]\+" contained
syn match scalaVarName "[^ =:;([]\+" contained
syn match scalaClassName "[^ =:;(\[]\+" contained nextgroup=scalaClassSpecializer skipwhite
syn region scalaDefSpecializer start="\[" end="\]" contained contains=scalaDefSpecializer
syn region scalaClassSpecializer start="\[" end="\]" contained contains=scalaClassSpecializer
" type constructor (actually anything with an uppercase letter)
syn match scalaConstructor "\<[A-Z][_$a-zA-Z0-9]*\>" nextgroup=scalaConstructorSpecializer
syn region scalaConstructorSpecializer start="\[" end="\]" contained contains=scalaConstructorSpecializer
" method call
syn match scalaRoot "\<[a-zA-Z][_$a-zA-Z0-9]*\."me=e-1
syn match scalaMethodCall "\.[a-z][_$a-zA-Z0-9]*"ms=s+1
" type declarations in val/var/def
syn match scalaType ":\s*\(=>\s*\)\?[._$a-zA-Z0-9]\+\(\[[^]]*\]\+\)\?\(\s*\(<:\|>:\|#\|=>\)\s*[._$a-zA-Z0-9]\+\(\[[^]]*\]\+\)*\)*"ms=s+1
" comments
syn match scalaTodo "[tT][oO][dD][oO]" contained
syn match scalaLineComment "//.*" contains=scalaTodo
syn region scalaComment start="/\*" end="\*/" contains=scalaTodo
syn case ignore
syn include @scalaHtml syntax/html.vim
unlet b:current_syntax
syn case match
syn region scalaDocComment start="/\*\*" end="\*/" contains=scalaDocTags,scalaTodo,@scalaHtml keepend
syn region scalaDocTags start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" contained
syn match scalaDocTags "@[a-z]\+" contained
syn match scalaEmptyString "\"\""
" multi-line string literals
syn region scalaMultiLineString start="\"\"\"" end="\"\"\"" contains=scalaUnicode
syn match scalaUnicode "\\u[0-9a-fA-F]\{4}" contained
" string literals with escapes
syn region scalaString start="\"[^"]" skip="\\\"" end="\"" contains=scalaStringEscape " TODO end \n or not?
syn match scalaStringEscape "\\u[0-9a-fA-F]\{4}" contained
syn match scalaStringEscape "\\[nrfvb\\\"]" contained
" symbol and character literals
syn match scalaSymbol "'[_a-zA-Z0-9][_a-zA-Z0-9]*\>"
syn match scalaChar "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'"
" number literals
syn match scalaNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
syn match scalaNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
syn match scalaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
syn match scalaNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
" xml literals
syn match scalaXmlTag "<[a-zA-Z]\_[^>]*/>" contains=scalaXmlQuote,scalaXmlEscape,scalaXmlString
syn region scalaXmlString start="\"" end="\"" contained
syn match scalaXmlStart "<[a-zA-Z]\_[^>]*>" contained contains=scalaXmlQuote,scalaXmlEscape,scalaXmlString
syn region scalaXml start="<\([a-zA-Z]\_[^>]*\_[^/]\|[a-zA-Z]\)>" matchgroup=scalaXmlStart end="</\_[^>]\+>" contains=scalaXmlEscape,scalaXmlQuote,scalaXml,scalaXmlStart,scalaXmlComment
syn region scalaXmlEscape matchgroup=scalaXmlEscapeSpecial start="{" matchgroup=scalaXmlEscapeSpecial end="}" contained contains=TOP
syn match scalaXmlQuote "&[^;]\+;" contained
syn match scalaXmlComment "<!--\_[^>]*-->" contained
syn sync fromstart
" map Scala groups to standard groups
hi link scalaKeyword Keyword
hi link scalaPackage Include
hi link scalaImport Include
hi link scalaBoolean Boolean
hi link scalaOperator Normal
hi link scalaNumber Number
hi link scalaEmptyString String
hi link scalaString String
hi link scalaChar String
hi link scalaMultiLineString String
hi link scalaStringEscape Special
hi link scalaSymbol Special
hi link scalaUnicode Special
hi link scalaComment Comment
hi link scalaLineComment Comment
hi link scalaDocComment Comment
hi link scalaDocTags Special
hi link scalaTodo Todo
hi link scalaType Type
hi link scalaTypeSpecializer scalaType
hi link scalaXml String
hi link scalaXmlTag Include
hi link scalaXmlString String
hi link scalaXmlStart Include
hi link scalaXmlEscape Normal
hi link scalaXmlEscapeSpecial Special
hi link scalaXmlQuote Special
hi link scalaXmlComment Comment
hi link scalaDef Keyword
hi link scalaVar Keyword
hi link scalaVal Keyword
hi link scalaClass Keyword
hi link scalaObject Keyword
hi link scalaTrait Keyword
hi link scalaDefName Function
hi link scalaDefSpecializer Function
hi link scalaClassName Special
hi link scalaClassSpecializer Special
hi link scalaConstructor Special
hi link scalaConstructorSpecializer scalaConstructor
let b:current_syntax = "scala"
" you might like to put these lines in your .vimrc
"
" customize colors a little bit (should be a different file)
" hi scalaNew gui=underline
" hi scalaMethodCall gui=italic
" hi scalaValName gui=underline
" hi scalaVarName gui=underline

View file

@ -0,0 +1,19 @@
" Syntax highlighting for snippet files (used for snipMate.vim)
" Hopefully this should make snippets a bit nicer to write!
syn match snipComment '^#.*'
syn match placeHolder '\${\d\+\(:.\{-}\)\=}' contains=snipCommand
syn match tabStop '\$\d\+'
syn match snipCommand '`.\{-}`'
syn match snippet '^snippet.*' transparent contains=multiSnipText,snipKeyword
syn match multiSnipText '\S\+ \zs.*' contained
syn match snipKeyword '^snippet'me=s+8 contained
syn match snipError "^[^#s\t].*$"
hi link snipComment Comment
hi link multiSnipText String
hi link snipKeyword Keyword
hi link snipComment Comment
hi link placeHolder Special
hi link tabStop Special
hi link snipCommand String
hi link snipError Error

View file

@ -0,0 +1,42 @@
" Vim syntax file
" Language: SVK annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the vcscommand plugin.
" License:
" Copyright (c) 2007 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
if exists("b:current_syntax")
finish
endif
syn match svkDate /\d\{4}-\d\{1,2}-\d\{1,2}/ skipwhite contained
syn match svkName /(\s*\zs\S\+/ contained nextgroup=svkDate skipwhite
syn match svkVer /^\s*\d\+/ contained nextgroup=svkName skipwhite
syn region svkHead start=/^/ end="):" contains=svkVer,svkName,svkDate oneline
if !exists("did_svkannotate_syntax_inits")
let did_svkannotate_syntax_inits = 1
hi link svkName Type
hi link svkDate Comment
hi link svkVer Statement
endif
let b:current_syntax="svkAnnotate"

View file

@ -0,0 +1,40 @@
" Vim syntax file
" Language: SVN annotate output
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
" Remark: Used by the vcscommand plugin.
" License:
" Copyright (c) 2007 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
if exists("b:current_syntax")
finish
endif
syn match svnName /\S\+/ contained
syn match svnVer /^\s\+\zs\d\+/ contained nextgroup=svnName skipwhite
syn match svnHead /^\s\+\d\+\s\+\S\+/ contains=svnVer,svnName
if !exists("did_svnannotate_syntax_inits")
let did_svnannotate_syntax_inits = 1
hi link svnName Type
hi link svnVer Statement
endif
let b:current_syntax="svnAnnotate"

View file

@ -0,0 +1,31 @@
" Vim syntax file
" Language: VCS commit file
" Maintainer: Bob Hiestand (bob.hiestand@gmail.com)
" License:
" Copyright (c) 2007 Bob Hiestand
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to
" deal in the Software without restriction, including without limitation the
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
" sell copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
" IN THE SOFTWARE.
if exists("b:current_syntax")
finish
endif
syntax region vcsComment start="^VCS: " end="$"
highlight link vcsComment Comment
let b:current_syntax = "vcscommit"

View file

@ -0,0 +1,42 @@
"============================================================================
"File: golintc.vim
"Description: Check go syntax using 'golintc'
"Maintainer: Hiroshi Ioka <hirochachacha@gmail.com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists("g:loaded_syntastic_go_golintc_checker")
finish
endif
let g:loaded_syntastic_go_golintc_checker = 1
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_go_golintc_GetLocList() dict
let makeprg = self.makeprgBuild({})
let errorformat =
\ '%f:%l:%c: %m,' .
\ '%-G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'defaults': {'type': 'w'},
\ 'subtype': 'Style' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'go',
\ 'name': 'golintc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set sw=4 sts=4 et fdm=marker:

Some files were not shown because too many files have changed in this diff Show more