1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2016-02-20 13:13:10 +00:00
parent 795a8fb80d
commit e81e42ec4d
214 changed files with 5916 additions and 1107 deletions

View File

@ -0,0 +1,19 @@
# vim-pug #
Vim syntax highlighting for Pug (formerly Jade) templates.
Installation
------------
I prefer to install plugins using Tim Pope's
[pathogen.vim](https://github.com/tpope/vim-pathogen). Installation using
pathogen is quite simple.
cd ~/.vim/bundle
git clone git://github.com/digitaltoad/vim-pug.git
If you do not want to use pathogen. You can always install vim-pug in the
normal manner by copying each directory to your ~/.vim directory. Make sure
not to overwrite any existing directory of the same name and instead copy only
the contents of the source directory to the directory of the same name in your
~/.vim directory.

View File

@ -0,0 +1,5 @@
" Pug
autocmd BufNewFile,BufReadPost *.pug set filetype=pug
" Jade
autocmd BufNewFile,BufReadPost *.jade set filetype=pug

View File

@ -0,0 +1,57 @@
" Vim filetype plugin
" Language: Pug
" Maintainer: Joshua Borton
" Credits: Tim Pope
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
finish
endif
let s:save_cpo = &cpo
set cpo-=C
setlocal iskeyword+=-
" Define some defaults in case the included ftplugins don't set them.
let s:undo_ftplugin = ""
let s:browsefilter = "All Files (*.*)\t*.*\n"
let s:match_words = ""
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
unlet! b:did_ftplugin
" Override our defaults if these were set by an included ftplugin.
if exists("b:undo_ftplugin")
let s:undo_ftplugin = b:undo_ftplugin
unlet b:undo_ftplugin
endif
if exists("b:browsefilter")
let s:browsefilter = b:browsefilter
unlet b:browsefilter
endif
if exists("b:match_words")
let s:match_words = b:match_words
unlet b:match_words
endif
" Change the browse dialog on Win32 to show mainly Haml-related files
if has("gui_win32")
let b:browsefilter="Pug Files (*.pug)\t*.pug\n" . s:browsefilter
endif
" Load the combined list of match_words for matchit.vim
if exists("loaded_matchit")
let b:match_words = s:match_words
endif
setlocal comments=://-,:// commentstring=//\ %s
setlocal suffixesadd+=.pug
let b:undo_ftplugin = "setl cms< com< "
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
let &cpo = s:save_cpo
" vim:set sw=2:

View File

@ -0,0 +1,70 @@
" Vim indent file
" Language: Pug
" Maintainer: Joshua Borton
" Credits: Tim Pope (vim-pug)
" Last Change: 2010 Sep 22
if exists("b:did_indent")
finish
endif
unlet! b:did_indent
let b:did_indent = 1
setlocal autoindent
setlocal indentexpr=GetPugIndent()
setlocal indentkeys=o,O,*<Return>,},],0),!^F
" Only define the function once.
if exists("*GetPugIndent")
finish
endif
let s:attributes = '\%((.\{-\})\)'
let s:tag = '\([%.#][[:alnum:]_-]\+\|'.s:attributes.'\)*[<>]*'
if !exists('g:pug_self_closing_tags')
let g:pug_self_closing_tags = 'meta|link|img|hr|br|input'
endif
setlocal formatoptions+=r
setlocal comments+=n:\|
function! GetPugIndent()
let lnum = prevnonblank(v:lnum-1)
if lnum == 0
return 0
endif
let line = substitute(getline(lnum),'\s\+$','','')
let cline = substitute(substitute(getline(v:lnum),'\s\+$','',''),'^\s\+','','')
let lastcol = strlen(line)
let line = substitute(line,'^\s\+','','')
let indent = indent(lnum)
let cindent = indent(v:lnum)
let increase = indent + &sw
if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif
let group = synIDattr(synID(lnum,lastcol,1),'name')
if line =~ '^!!!'
return indent
elseif line =~ '^/\%(\[[^]]*\]\)\=$'
return increase
elseif line =~ '^\%(if\|else\|unless\|for\|each\|block\|mixin\|append\|case\|when\)'
return increase
elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$'
return increase
elseif line == '-#'
return increase
elseif line =~? '^\v%('.g:pug_self_closing_tags.')>'
return indent
elseif group =~? '\v^%(pugAttributesDelimiter|pugClass|pugId|htmlTagName|htmlSpecialTagName|pugFilter|pugTagBlockChar)$'
return increase
else
return indent
endif
endfunction
" vim:set sw=2:

View File

@ -0,0 +1,104 @@
" Vim syntax file
" Language: Pug
" Maintainer: Joshua Borton
" Credits: Tim Pope
" Filenames: *.pug
if exists("b:current_syntax")
finish
endif
if !exists("main_syntax")
let main_syntax = 'pug'
endif
silent! syntax include @htmlCoffeescript syntax/coffee.vim
unlet! b:current_syntax
silent! syntax include @htmlStylus syntax/stylus.vim
unlet! b:current_syntax
silent! syntax include @htmlCss syntax/css.vim
unlet! b:current_syntax
silent! syntax include @htmlMarkdown syntax/markdown.vim
unlet! b:current_syntax
syn case match
syn region javascriptParenthesisBlock start="(" end=")" contains=@htmlJavascript contained keepend
syn cluster htmlJavascript add=javascriptParenthesisBlock
syn region pugJavascript matchgroup=pugJavascriptOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
syn region pugJavascript matchgroup=pugJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend
syn cluster pugTop contains=pugBegin,pugComment,pugHtmlComment,pugJavascript
syn match pugBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=pugTag,pugClassChar,pugIdChar,pugPlainChar,pugJavascript,pugScriptConditional,pugScriptStatement,pugPipedText
syn match pugTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@pugComponent
syn cluster pugComponent contains=pugAttributes,pugIdChar,pugBlockExpansionChar,pugClassChar,pugPlainChar,pugJavascript,pugTagBlockChar,pugTagInlineText
syn match pugComment '\s*\/\/.*$'
syn region pugCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!" keepend
syn region pugHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->"
syn region pugAttributes matchgroup=pugAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,pugHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@pugComponent
syn match pugClassChar "\." contained nextgroup=pugClass
syn match pugBlockExpansionChar ":\s\+" contained nextgroup=pugTag,pugClassChar,pugIdChar
syn match pugIdChar "#[[{]\@!" contained nextgroup=pugId
syn match pugClass "\%(\w\|-\)\+" contained nextgroup=@pugComponent
syn match pugId "\%(\w\|-\)\+" contained nextgroup=@pugComponent
syn region pugDocType start="^\s*\(!!!\|doctype\)" end="$"
" Unless I'm mistaken, syntax/html.vim requires
" that the = sign be present for these matches.
" This adds the matches back for pug.
syn keyword pugHtmlArg contained href title
syn match pugPlainChar "\\" contained
syn region pugInterpolation matchgroup=pugInterpolationDelimiter start="[#!]{" end="}" contains=@htmlJavascript
syn match pugInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)"
syn match pugTagInlineText "\s.*$" contained contains=pugInterpolation,pugTextInlinePug
syn region pugPipedText matchgroup=pugPipeChar start="|" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugPipedText skipnl
syn match pugTagBlockChar "\.$" contained nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
syn region pugTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugTagBlockText,pugTagBlockEnd skipnl
syn region pugTagBlockEnd start="\s*\S" end="$" contained contains=pugInterpolation,pugTextInlinePug nextgroup=pugBegin skipnl
syn region pugTextInlinePug matchgroup=pugInlineDelimiter start="#\[" end="]" contains=pugTag keepend
syn region pugJavascriptFilter matchgroup=pugFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript
syn region pugMarkdownFilter matchgroup=pugFilter start=/^\z(\s*\):\%(markdown\|marked\)\s*$/ end=/^\%(\z1\s\|\s*$\)\@!/ contains=@htmlMarkdown
syn region pugStylusFilter matchgroup=pugFilter start="^\z(\s*\):stylus\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlStylus
syn region pugPlainFilter matchgroup=pugFilter start="^\z(\s*\):\%(sass\|less\|cdata\)\s*$" end="^\%(\z1\s\|\s*$\)\@!"
syn match pugScriptConditional "^\s*\<\%(if\|else\|else if\|elif\|unless\|while\|until\|case\|when\|default\)\>[?!]\@!"
syn match pugScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!"
syn region pugScriptLoopRegion start="^\s*\(for \)" end="$" contains=pugScriptLoopKeywords
syn keyword pugScriptLoopKeywords for in contained
syn region pugJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,pugJavascriptTag,pugCoffeescriptFilter keepend
syn region pugCoffeescriptFilter matchgroup=pugFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained
syn region pugJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=pugBegin,pugTag
syn region pugCssBlock start="^\z(\s*\)style" nextgroup=@pugComponent,pugError end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend
syn match pugError "\$" contained
hi def link pugPlainChar Special
hi def link pugScriptConditional PreProc
hi def link pugScriptLoopKeywords PreProc
hi def link pugScriptStatement PreProc
hi def link pugHtmlArg htmlArg
hi def link pugAttributeString String
hi def link pugAttributesDelimiter Identifier
hi def link pugIdChar Special
hi def link pugClassChar Special
hi def link pugBlockExpansionChar Special
hi def link pugPipeChar Special
hi def link pugTagBlockChar Special
hi def link pugId Identifier
hi def link pugClass Type
hi def link pugInterpolationDelimiter Delimiter
hi def link pugInlineDelimiter Delimiter
hi def link pugFilter PreProc
hi def link pugDocType PreProc
hi def link pugComment Comment
hi def link pugCommentBlock Comment
hi def link pugHtmlConditionalComment pugComment
let b:current_syntax = "pug"
if main_syntax == "pug"
unlet main_syntax
endif