diff --git a/after/indent/html.vim b/after/indent/html.vim index e637708..2fa8637 100644 --- a/after/indent/html.vim +++ b/after/indent/html.vim @@ -1,5 +1,5 @@ " Language: CoffeeScript -" Maintainer: Mick Koch +" Maintainer: Mick Koch " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL diff --git a/after/syntax/c.vim b/after/syntax/c.vim index be34d25..5255ca7 100644 --- a/after/syntax/c.vim +++ b/after/syntax/c.vim @@ -1,10 +1,13 @@ " Vim syntax file " Language: C Additions " Maintainer: Jon Haggblad +" Contributor: Mikhail Wolfson " URL: http://www.haeggblad.com -" Last Change: 9 Aug 2014 -" Version: 0.1 +" Last Change: 6 Sep 2014 +" Version: 0.3 " Changelog: +" 0.3 - integration of aftersyntaxc.vim +" 0.2 - Cleanup " 0.1 - initial version. " " Syntax highlighting for functions in C. @@ -13,15 +16,279 @@ " http://stackoverflow.com/questions/736701/class-function-names-highlighting-in-vim " ----------------------------------------------------------------------------- -" Highlight Class and Function names. +" Highlight 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 +" ----------------------------------------------------------------------------- +" Source: aftersyntaxc.vim +" ----------------------------------------------------------------------------- + +" Common ANSI-standard functions +syn keyword cAnsiFunction MULU_ DIVU_ MODU_ MUL_ DIV_ MOD_ +syn keyword cAnsiFunction main typeof +syn keyword cAnsiFunction open close read write lseek dup dup2 +syn keyword cAnsiFunction fcntl ioctl +syn keyword cAnsiFunction wctrans towctrans towupper +syn keyword cAnsiFunction towlower wctype iswctype +syn keyword cAnsiFunction iswxdigit iswupper iswspace +syn keyword cAnsiFunction iswpunct iswprint iswlower +syn keyword cAnsiFunction iswgraph iswdigit iswcntrl +syn keyword cAnsiFunction iswalpha iswalnum wcsrtombs +syn keyword cAnsiFunction mbsrtowcs wcrtomb mbrtowc +syn keyword cAnsiFunction mbrlen mbsinit wctob +syn keyword cAnsiFunction btowc wcsfxtime wcsftime +syn keyword cAnsiFunction wmemset wmemmove wmemcpy +syn keyword cAnsiFunction wmemcmp wmemchr wcstok +syn keyword cAnsiFunction wcsstr wcsspn wcsrchr +syn keyword cAnsiFunction wcspbrk wcslen wcscspn +syn keyword cAnsiFunction wcschr wcsxfrm wcsncmp +syn keyword cAnsiFunction wcscoll wcscmp wcsncat +syn keyword cAnsiFunction wcscat wcsncpy wcscpy +syn keyword cAnsiFunction wcstoull wcstoul wcstoll +syn keyword cAnsiFunction wcstol wcstold wcstof +syn keyword cAnsiFunction wcstod ungetwc putwchar +syn keyword cAnsiFunction putwc getwchar getwc +syn keyword cAnsiFunction fwide fputws fputwc +syn keyword cAnsiFunction fgetws fgetwc wscanf +syn keyword cAnsiFunction wprintf vwscanf vwprintf +syn keyword cAnsiFunction vswscanf vswprintf vfwscanf +syn keyword cAnsiFunction vfwprintf swscanf swprintf +syn keyword cAnsiFunction fwscanf fwprintf zonetime +syn keyword cAnsiFunction strfxtime strftime localtime +syn keyword cAnsiFunction gmtime ctime asctime +syn keyword cAnsiFunction time mkxtime mktime +syn keyword cAnsiFunction difftime clock strlen +syn keyword cAnsiFunction strerror memset strtok +syn keyword cAnsiFunction strstr strspn strrchr +syn keyword cAnsiFunction strpbrk strcspn strchr +syn keyword cAnsiFunction memchr strxfrm strncmp +syn keyword cAnsiFunction strcoll strcmp memcmp +syn keyword cAnsiFunction strncat strcat strncpy +syn keyword cAnsiFunction strcpy memmove memcpy +syn keyword cAnsiFunction wcstombs mbstowcs wctomb +syn keyword cAnsiFunction mbtowc mblen lldiv +syn keyword cAnsiFunction ldiv div llabs +syn keyword cAnsiFunction labs abs qsort +syn keyword cAnsiFunction bsearch system getenv +syn keyword cAnsiFunction exit atexit abort +syn keyword cAnsiFunction realloc malloc free +syn keyword cAnsiFunction calloc srand rand +syn keyword cAnsiFunction strtoull strtoul strtoll +syn keyword cAnsiFunction strtol strtold strtof +syn keyword cAnsiFunction strtod atoll atol +syn keyword cAnsiFunction atoi atof perror +syn keyword cAnsiFunction ferror feof clearerr +syn keyword cAnsiFunction rewind ftell fsetpos +syn keyword cAnsiFunction fseek fgetpos fwrite +syn keyword cAnsiFunction fread ungetc puts +syn keyword cAnsiFunction putchar putc gets +syn keyword cAnsiFunction getchar getc fputs +syn keyword cAnsiFunction fputc fgets fgetc +syn keyword cAnsiFunction vsscanf vsprintf vsnprintf +syn keyword cAnsiFunction vscanf vprintf vfscanf +syn keyword cAnsiFunction vfprintf sscanf sprintf +syn keyword cAnsiFunction snprintf scanf printf +syn keyword cAnsiFunction fscanf fprintf setvbuf +syn keyword cAnsiFunction setbuf freopen fopen +syn keyword cAnsiFunction fflush fclose tmpnam +syn keyword cAnsiFunction tmpfile rename remove +syn keyword cAnsiFunction offsetof va_start va_end +syn keyword cAnsiFunction va_copy va_arg raise signal +syn keyword cAnsiFunction longjmp setjmp isunordered +syn keyword cAnsiFunction islessgreater islessequal isless +syn keyword cAnsiFunction isgreaterequal isgreater fmal +syn keyword cAnsiFunction fmaf fma fminl +syn keyword cAnsiFunction fminf fmin fmaxl +syn keyword cAnsiFunction fmaxf fmax fdiml +syn keyword cAnsiFunction fdimf fdim nextafterxl +syn keyword cAnsiFunction nextafterxf nextafterx nextafterl +syn keyword cAnsiFunction nextafterf nextafter nanl +syn keyword cAnsiFunction nanf nan copysignl +syn keyword cAnsiFunction copysignf copysign remquol +syn keyword cAnsiFunction remquof remquo remainderl +syn keyword cAnsiFunction remainderf remainder fmodl +syn keyword cAnsiFunction fmodf fmod truncl +syn keyword cAnsiFunction truncf trunc llroundl +syn keyword cAnsiFunction llroundf llround lroundl +syn keyword cAnsiFunction lroundf lround roundl +syn keyword cAnsiFunction roundf round llrintl +syn keyword cAnsiFunction llrintf llrint lrintl +syn keyword cAnsiFunction lrintf lrint rintl +syn keyword cAnsiFunction rintf rint nearbyintl +syn keyword cAnsiFunction nearbyintf nearbyint floorl +syn keyword cAnsiFunction floorf floor ceill +syn keyword cAnsiFunction ceilf ceil tgammal +syn keyword cAnsiFunction tgammaf tgamma lgammal +syn keyword cAnsiFunction lgammaf lgamma erfcl +syn keyword cAnsiFunction erfcf erfc erfl +syn keyword cAnsiFunction erff erf sqrtl +syn keyword cAnsiFunction sqrtf sqrt powl +syn keyword cAnsiFunction powf pow hypotl +syn keyword cAnsiFunction hypotf hypot fabsl +syn keyword cAnsiFunction fabsf fabs cbrtl +syn keyword cAnsiFunction cbrtf cbrt scalblnl +syn keyword cAnsiFunction scalblnf scalbln scalbnl +syn keyword cAnsiFunction scalbnf scalbn modfl +syn keyword cAnsiFunction modff modf logbl +syn keyword cAnsiFunction logbf logb log2l +syn keyword cAnsiFunction log2f log2 log1pl +syn keyword cAnsiFunction log1pf log1p log10l +syn keyword cAnsiFunction log10f log10 logl +syn keyword cAnsiFunction logf log ldexpl +syn keyword cAnsiFunction ldexpf ldexp ilogbl +syn keyword cAnsiFunction ilogbf ilogb frexpl +syn keyword cAnsiFunction frexpf frexp expm1l +syn keyword cAnsiFunction expm1f expm1 exp2l +syn keyword cAnsiFunction exp2f exp2 expl +syn keyword cAnsiFunction expf exp tanhl +syn keyword cAnsiFunction tanhf tanh sinhl +syn keyword cAnsiFunction sinhf sinh coshl +syn keyword cAnsiFunction coshf cosh atanhl +syn keyword cAnsiFunction atanhf atanh asinhl +syn keyword cAnsiFunction asinhf asinh acoshl +syn keyword cAnsiFunction acoshf acosh tanl +syn keyword cAnsiFunction tanf tan sinl +syn keyword cAnsiFunction sinf sin cosl +syn keyword cAnsiFunction cosf cos atan2l +syn keyword cAnsiFunction atan2f atan2 atanl +syn keyword cAnsiFunction atanf atan asinl +syn keyword cAnsiFunction asinf asin acosl +syn keyword cAnsiFunction acosf acos signbit +syn keyword cAnsiFunction isnormal isnan isinf +syn keyword cAnsiFunction isfinite fpclassify localeconv +syn keyword cAnsiFunction setlocale wcstoumax wcstoimax +syn keyword cAnsiFunction strtoumax strtoimax feupdateenv +syn keyword cAnsiFunction fesetenv feholdexcept fegetenv +syn keyword cAnsiFunction fesetround fegetround fetestexcept +syn keyword cAnsiFunction fesetexceptflag feraiseexcept fegetexceptflag +syn keyword cAnsiFunction feclearexcept toupper tolower +syn keyword cAnsiFunction isxdigit isupper isspace +syn keyword cAnsiFunction ispunct isprint islower +syn keyword cAnsiFunction isgraph isdigit iscntrl +syn keyword cAnsiFunction isalpha isalnum creall +syn keyword cAnsiFunction crealf creal cprojl +syn keyword cAnsiFunction cprojf cproj conjl +syn keyword cAnsiFunction conjf conj cimagl +syn keyword cAnsiFunction cimagf cimag cargl +syn keyword cAnsiFunction cargf carg csqrtl +syn keyword cAnsiFunction csqrtf csqrt cpowl +syn keyword cAnsiFunction cpowf cpow cabsl +syn keyword cAnsiFunction cabsf cabs clogl +syn keyword cAnsiFunction clogf clog cexpl +syn keyword cAnsiFunction cexpf cexp ctanhl +syn keyword cAnsiFunction ctanhf ctanh csinhl +syn keyword cAnsiFunction csinhf csinh ccoshl +syn keyword cAnsiFunction ccoshf ccosh catanhl +syn keyword cAnsiFunction catanhf catanh casinhl +syn keyword cAnsiFunction casinhf casinh cacoshl +syn keyword cAnsiFunction cacoshf cacosh ctanl +syn keyword cAnsiFunction ctanf ctan csinl +syn keyword cAnsiFunction csinf csin ccosl +syn keyword cAnsiFunction ccosf ccos catanl +syn keyword cAnsiFunction catanf catan casinl +syn keyword cAnsiFunction casinf casin cacosl +syn keyword cAnsiFunction cacosf cacos assert +syn keyword cAnsiFunction UINTMAX_C INTMAX_C UINT64_C +syn keyword cAnsiFunction UINT32_C UINT16_C UINT8_C +syn keyword cAnsiFunction INT64_C INT32_C INT16_C INT8_C + +" Common ANSI-standard Names +syn keyword cAnsiName PRId8 PRIi16 PRIo32 PRIu64 +syn keyword cAnsiName PRId16 PRIi32 PRIo64 PRIuLEAST8 +syn keyword cAnsiName PRId32 PRIi64 PRIoLEAST8 PRIuLEAST16 +syn keyword cAnsiName PRId64 PRIiLEAST8 PRIoLEAST16 PRIuLEAST32 +syn keyword cAnsiName PRIdLEAST8 PRIiLEAST16 PRIoLEAST32 PRIuLEAST64 +syn keyword cAnsiName PRIdLEAST16 PRIiLEAST32 PRIoLEAST64 PRIuFAST8 +syn keyword cAnsiName PRIdLEAST32 PRIiLEAST64 PRIoFAST8 PRIuFAST16 +syn keyword cAnsiName PRIdLEAST64 PRIiFAST8 PRIoFAST16 PRIuFAST32 +syn keyword cAnsiName PRIdFAST8 PRIiFAST16 PRIoFAST32 PRIuFAST64 +syn keyword cAnsiName PRIdFAST16 PRIiFAST32 PRIoFAST64 PRIuMAX +syn keyword cAnsiName PRIdFAST32 PRIiFAST64 PRIoMAX PRIuPTR +syn keyword cAnsiName PRIdFAST64 PRIiMAX PRIoPTR PRIx8 +syn keyword cAnsiName PRIdMAX PRIiPTR PRIu8 PRIx16 +syn keyword cAnsiName PRIdPTR PRIo8 PRIu16 PRIx32 +syn keyword cAnsiName PRIi8 PRIo16 PRIu32 PRIx64 + +syn keyword cAnsiName PRIxLEAST8 SCNd8 SCNiFAST32 SCNuLEAST32 +syn keyword cAnsiName PRIxLEAST16 SCNd16 SCNiFAST64 SCNuLEAST64 +syn keyword cAnsiName PRIxLEAST32 SCNd32 SCNiMAX SCNuFAST8 +syn keyword cAnsiName PRIxLEAST64 SCNd64 SCNiPTR SCNuFAST16 +syn keyword cAnsiName PRIxFAST8 SCNdLEAST8 SCNo8 SCNuFAST32 +syn keyword cAnsiName PRIxFAST16 SCNdLEAST16 SCNo16 SCNuFAST64 +syn keyword cAnsiName PRIxFAST32 SCNdLEAST32 SCNo32 SCNuMAX +syn keyword cAnsiName PRIxFAST64 SCNdLEAST64 SCNo64 SCNuPTR +syn keyword cAnsiName PRIxMAX SCNdFAST8 SCNoLEAST8 SCNx8 +syn keyword cAnsiName PRIxPTR SCNdFAST16 SCNoLEAST16 SCNx16 +syn keyword cAnsiName PRIX8 SCNdFAST32 SCNoLEAST32 SCNx32 +syn keyword cAnsiName PRIX16 SCNdFAST64 SCNoLEAST64 SCNx64 +syn keyword cAnsiName PRIX32 SCNdMAX SCNoFAST8 SCNxLEAST8 +syn keyword cAnsiName PRIX64 SCNdPTR SCNoFAST16 SCNxLEAST16 +syn keyword cAnsiName PRIXLEAST8 SCNi8 SCNoFAST32 SCNxLEAST32 +syn keyword cAnsiName PRIXLEAST16 SCNi16 SCNoFAST64 SCNxLEAST64 +syn keyword cAnsiName PRIXLEAST32 SCNi32 SCNoMAX SCNxFAST8 +syn keyword cAnsiName PRIXLEAST64 SCNi64 SCNoPTR SCNxFAST16 +syn keyword cAnsiName PRIXFAST8 SCNiLEAST8 SCNu8 SCNxFAST32 +syn keyword cAnsiName PRIXFAST16 SCNiLEAST16 SCNu16 SCNxFAST64 +syn keyword cAnsiName PRIXFAST32 SCNiLEAST32 SCNu32 SCNxMAX +syn keyword cAnsiName PRIXFAST64 SCNiLEAST64 SCNu64 SCNxPTR +syn keyword cAnsiName PRIXMAX SCNiFAST8 SCNuLEAST8 +syn keyword cAnsiName PRIXPTR SCNiFAST16 SCNuLEAST16 + +syn keyword cAnsiName errno environ + +syn keyword cAnsiName STDC CX_LIMITED_RANGE +syn keyword cAnsiName STDC FENV_ACCESS +syn keyword cAnsiName STDC FP_CONTRACT + +syn keyword cAnsiName and bitor not_eq xor +syn keyword cAnsiName and_eq compl or xor_eq +syn keyword cAnsiName bitand not or_eq + +hi def link cAnsiFunction cFunction +hi def link cAnsiName cIdentifier +hi def link cFunction Function +hi def link cIdentifier Identifier + +" Booleans +syn keyword cBoolean true false TRUE FALSE +hi def link cBoolean Boolean + +" ----------------------------------------------------------------------------- +" Additional optional highlighting +" ----------------------------------------------------------------------------- + +" Operators +"syn match cOperator "\(<<\|>>\|[-+*/%&^|<>!=]\)=" +"syn match cOperator "<<\|>>\|&&\|||\|++\|--\|->" +"syn match cOperator "[.!~*&%<>^|=,+-]" +"syn match cOperator "/[^/*=]"me=e-1 +"syn match cOperator "/$" +"syn match cOperator "&&\|||" +"syn match cOperator "[][]" +" +"" Preprocs +"syn keyword cDefined defined contained containedin=cDefine +"hi def link cDefined cDefine + +"" Functions +"syn match cUserFunction "\<\h\w*\>\(\s\|\n\)*("me=e-1 contains=cType,cDelimiter,cDefine +"syn match cUserFunctionPointer "(\s*\*\s*\h\w*\s*)\(\s\|\n\)*(" contains=cDelimiter,cOperator +" +"hi def link cUserFunction cFunction +"hi def link cUserFunctionPointer cFunction +" +"" Delimiters +"syn match cDelimiter "[();\\]" +"" foldmethod=syntax fix, courtesy of Ivan Freitas +"syn match cBraces display "[{}]" + +" Links +"hi def link cDelimiter Delimiter +" foldmethod=syntax fix, courtesy of Ivan Freitas +"hi def link cBraces Delimiter " Vim syntax file " Language: C Additions " Maintainer: Mikhail Wolfson diff --git a/after/syntax/cpp.vim b/after/syntax/cpp.vim index 1f91714..f286af0 100644 --- a/after/syntax/cpp.vim +++ b/after/syntax/cpp.vim @@ -2,16 +2,18 @@ " Language: C++ Additions " Maintainer: Jon Haggblad " URL: http://www.haeggblad.com -" Last Change: 21 Apr 2014 -" Version: 0.3 +" Last Change: 21 Sep 2014 +" Version: 0.5 " Changelog: " 0.1 - initial version. " 0.2 - C++14 " 0.3 - Incorporate lastest changes from Mizuchi/STL-Syntax +" 0.4 - Add template function highlight +" 0.5 - Redo template function highlight to be more robust. Add options. " -" Additional Vim syntax highlighting for C++ (including C++11) +" Additional Vim syntax highlighting for C++ (including C++11/14) " -" This file contains additional syntax highlighting that I use for my C++11/14 +" This file contains additional syntax highlighting that I use for C++11/14 " development in Vim. Compared to the standard syntax highlighting for C++ it " adds highlighting of (user defined) functions and the containers and types " in the standard library / boost. @@ -29,21 +31,35 @@ " Based on the discussion in: " http://stackoverflow.com/questions/736701/class-function-names-highlighting-in-vim " ----------------------------------------------------------------------------- -syn match cCustomParen "(" contains=cParen contains=cCppParen -syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen -syn match cCustomScope "::" -syn match cCustomClass "\w\+\s*::" contains=cCustomScope +" Functions +syn match cCustomParen "(" contains=cParen contains=cCppParen +syn match cCustomFunc "\w\+\s*(\@=" contains=cCustomParen hi def link cCustomFunc Function -" Uncomment this to also highlight 'class::' and 'namespace::' -"hi def link cCustomClass Function +" Template functions +if exists('g:cpp_experimental_template_highlight') && g:cpp_experimental_template_highlight + syn region cCustomAngleBrackets matchgroup=AngleBracketContents start="\v%(" contains=cCustomAngleBrackets + syn match cCustomTemplateFunc "\w\+\s*<.*>(\@=" contains=cCustomBrack,cCustomAngleBrackets + hi def link cCustomTemplateFunc Function +endif + +" Class and namespace scope +if exists('g:cpp_class_scope_highlight') && g:cpp_class_scope_highlight + syn match cCustomScope "::" + syn match cCustomClass "\w\+\s*::" contains=cCustomScope + hi def link cCustomClass Function " disabled for now +endif " Alternative syntax that is used in: " http://www.vim.org/scripts/script.php?script_id=3064 "syn match cUserFunction "\<\h\w*\>\(\s\|\n\)*("me=e-1 contains=cType,cDelimiter,cDefine "hi def link cCustomFunc Function +" Cluster for all the stdlib functions defined below +syn cluster cppSTLgroup contains=cppSTLfunction,cppSTLfunctional,cppSTLconstant,cppSTLnamespace,cppSTLtype,cppSTLexception,cppSTLiterator,cppSTLiterator_tagcppSTLenumcppSTLioscppSTLcast + " ----------------------------------------------------------------------------- " Standard library types and functions. " @@ -1294,6 +1310,8 @@ if !exists("cpp_no_cpp11") syntax keyword cppSTLtype minutes syntax keyword cppSTLtype hours + "raw string literals + syntax region cppRawString matchgroup=cppRawDelimiter start=@\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(@ end=/)\z1"/ contains=@Spell endif " C++11 if !exists("cpp_no_cpp14") @@ -1338,5 +1356,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits") HiLink cppSTLenum Typedef HiLink cppSTLios Function HiLink cppSTLcast Statement " be consistent with official syntax + HiLink cppRawString String + HiLink cppRawDelimiter Delimiter delcommand HiLink endif diff --git a/after/syntax/html.vim b/after/syntax/html.vim index 8c8e738..b9dc9f9 100644 --- a/after/syntax/html.vim +++ b/after/syntax/html.vim @@ -1,5 +1,5 @@ " Language: CoffeeScript -" Maintainer: Mick Koch +" Maintainer: Mick Koch " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL @@ -18,8 +18,10 @@ if !g:less_html_style_tags endif " Unset (but preserve) so that less will run. -let s:pre_less_cur_syn = b:current_syntax -unlet b:current_syntax +if exists("b:current_syntax") + let s:pre_less_cur_syn = b:current_syntax + unlet b:current_syntax +endif " Inspired by code from github.com/kchmck/vim-coffee-script " and the html syntax file included with vim 7.4. @@ -30,7 +32,9 @@ syn include @htmlLess syntax/less.vim syn region lessStyle start=++ contains=@htmlLess,htmlTag,htmlEndTag,htmlCssStyleComment,@htmlPreproc containedin=htmlHead " Reset since 'less' isn't really the current_syntax. -let b:current_syntax = s:pre_less_cur_syn +if exists("s:pre_less_cur_syn") + let b:current_syntax = s:pre_less_cur_syn +endif " Language: Colorful CSS Color Preview " Author: Aristotle Pagaltzis diff --git a/autoload/coffee.vim b/autoload/coffee.vim index 04d5efb..8d72795 100644 --- a/autoload/coffee.vim +++ b/autoload/coffee.vim @@ -1,5 +1,5 @@ " Language: CoffeeScript -" Maintainer: Mick Koch +" Maintainer: Mick Koch " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL diff --git a/autoload/rust.vim b/autoload/rust.vim index c6b9b31..fe8e743 100644 --- a/autoload/rust.vim +++ b/autoload/rust.vim @@ -178,14 +178,14 @@ function! s:WithPath(func, ...) call mkdir(tmpdir) let save_cwd = getcwd() - silent exe 'lcd' tmpdir + silent exe 'lcd' fnameescape(tmpdir) let path = 'unnamed.rs' let save_mod = &mod set nomod - silent exe 'keepalt write! ' . path + silent exe 'keepalt write! ' . fnameescape(path) if pathisempty silent keepalt 0file endif @@ -195,10 +195,10 @@ function! s:WithPath(func, ...) call call(a:func, [path] + a:000) finally - if exists("save_mod") | let &mod = save_mod | endif - if exists("save_write") | let &write = save_write | endif - if exists("save_cwd") | silent exe 'lcd' save_cwd | endif - if exists("tmpdir") | silent call s:RmDir(tmpdir) | endif + if exists("save_mod") | let &mod = save_mod | endif + if exists("save_write") | let &write = save_write | endif + if exists("save_cwd") | silent exe 'lcd' fnameescape(save_cwd) | endif + if exists("tmpdir") | silent call s:RmDir(tmpdir) | endif endtry endfunction diff --git a/compiler/cake.vim b/compiler/cake.vim index 0a3c703..b49638e 100644 --- a/compiler/cake.vim +++ b/compiler/cake.vim @@ -1,5 +1,5 @@ " Language: CoffeeScript -" Maintainer: Mick Koch +" Maintainer: Mick Koch " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL diff --git a/compiler/cargo.vim b/compiler/cargo.vim new file mode 100644 index 0000000..89c1cff --- /dev/null +++ b/compiler/cargo.vim @@ -0,0 +1,49 @@ +" Vim compiler file +" Compiler: Cargo Compiler +" Maintainer: Damien Radtke +" Latest Revision: 2014 Sep 18 + +if exists("current_compiler") + finish +endif +let current_compiler = "cargo" + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal +endif + +CompilerSet errorformat& +CompilerSet makeprg=cargo\ $* + +" Allow a configurable global Cargo.toml name. This makes it easy to +" support variations like 'cargo.toml'. +if !exists('g:cargo_toml_name') + let g:cargo_toml_name = 'Cargo.toml' +endif + +let s:toml_dir = fnamemodify(findfile(g:cargo_toml_name, '.;'), ':p:h').'/' + +if s:toml_dir != '' + augroup cargo + au! + au QuickfixCmdPost make call s:FixPaths() + augroup END + + " FixPaths() is run after Cargo, and is used to change the file paths + " to be relative to the current directory instead of Cargo.toml. + function! s:FixPaths() + let qflist = getqflist() + for qf in qflist + if !qf['valid'] + continue + endif + let filename = bufname(qf['bufnr']) + if stridx(filename, s:toml_dir) == -1 + let filename = s:toml_dir.filename + endif + let qf['filename'] = simplify(s:toml_dir.bufname(qf['bufnr'])) + call remove(qf, 'bufnr') + endfor + call setqflist(qflist, 'r') + endfunction +endif diff --git a/compiler/coffee.vim b/compiler/coffee.vim index 9a91d35..5a91457 100644 --- a/compiler/coffee.vim +++ b/compiler/coffee.vim @@ -1,5 +1,5 @@ " Language: CoffeeScript -" Maintainer: Mick Koch +" Maintainer: Mick Koch " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL diff --git a/compiler/cucumber.vim b/compiler/cucumber.vim index c020be6..e30a089 100644 --- a/compiler/cucumber.vim +++ b/compiler/cucumber.vim @@ -19,7 +19,7 @@ CompilerSet makeprg=cucumber CompilerSet errorformat= \%W%m\ (Cucumber::Undefined), - \%E%m\ (%.%#), + \%E%m\ (%\\S%#), \%Z%f:%l, \%Z%f:%l:%.%# diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 402804b..0e60f3a 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -1,5 +1,5 @@ au BufRead,BufNewFile *.ino,*.pde set filetype=arduino -autocmd BufRead,BufNewFile *.blade.php set filetype=blade +au BufNewFile,BufRead *.blade.php set filetype=blade autocmd BufNewFile,BufRead *.clj,*.cljs,*.edn setlocal filetype=clojure autocmd BufNewFile,BufRead *.coffee set filetype=coffee autocmd BufNewFile,BufRead *Cakefile set filetype=coffee @@ -18,6 +18,12 @@ au BufRead,BufNewFile *.eex set filetype=eelixir au FileType eelixir setl sw=2 sts=2 et iskeyword+=!,? au BufRead,BufNewFile *.ex,*.exs set filetype=elixir au FileType elixir setl sw=2 sts=2 et iskeyword+=!,? +function! s:DetectElixir() + if getline(1) =~ '^#!.*\' + set filetype=elixir + endif +endfunction +autocmd BufNewFile,BufRead * call s:DetectElixir() autocmd BufNewFile,BufRead *.em set filetype=ember-script autocmd FileType ember-script set tabstop=2|set shiftwidth=2|set expandtab autocmd BufNewFile,BufRead *.emblem set filetype=emblem @@ -104,7 +110,8 @@ autocmd BufRead *.html \ set filetype=mason | \ endif if has("autocmd") - au BufNewFile,BufRead *.mustache,*.handlebars,*.hbs,*.hogan,*.hulk,*.hjs set filetype=html syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim + au BufNewFile,BufRead *.mustache,*.hogan,*.hulk,*.hjs set filetype=html.mustache syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim + au BufNewFile,BufRead *.handlebars,*.hbs set filetype=html.handlebars syntax=mustache | runtime! ftplugin/mustache.vim ftplugin/mustache*.vim ftplugin/mustache/*.vim endif au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/*,*/nginx/vhosts.d/*,nginx.conf if &ft == '' | setfiletype nginx | endif au BufRead,BufNewFile *.cl set filetype=opencl diff --git a/ftplugin/coffee.vim b/ftplugin/coffee.vim index c44fe97..347155a 100644 --- a/ftplugin/coffee.vim +++ b/ftplugin/coffee.vim @@ -1,5 +1,5 @@ " Language: CoffeeScript -" Maintainer: Mick Koch +" Maintainer: Mick Koch " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL @@ -13,6 +13,7 @@ call coffee#CoffeeSetUpVariables() setlocal formatoptions-=t formatoptions+=croql setlocal comments=:# commentstring=#\ %s setlocal omnifunc=javascriptcomplete#CompleteJS +setlocal suffixesadd+=coffee " Create custom augroups. augroup CoffeeBufUpdate | augroup END @@ -330,7 +331,7 @@ function! s:CoffeeLint(startline, endline, bang, args) endif let output = system(g:coffee_linter . - \ ' -s --csv' . + \ ' -s --reporter csv' . \ ' ' . b:coffee_litcoffee . \ ' ' . g:coffee_lint_options . \ ' ' . a:args . @@ -394,11 +395,11 @@ if !exists('b:coffee_run_buf') call s:CoffeeRunResetVars() endif -command! -range=% -bar -nargs=* -complete=customlist,s:CoffeeComplete +command! -buffer -range=% -bar -nargs=* -complete=customlist,s:CoffeeComplete \ CoffeeCompile call s:CoffeeCompile(, , ) -command! -bar -nargs=* -complete=customlist,s:CoffeeComplete +command! -buffer -bar -nargs=* -complete=customlist,s:CoffeeComplete \ CoffeeWatch call s:CoffeeWatch() -command! -range=% -bar -nargs=* CoffeeRun +command! -buffer -range=% -bar -nargs=* CoffeeRun \ call s:CoffeeRun(, , ) -command! -range=% -bang -bar -nargs=* CoffeeLint +command! -buffer -range=% -bang -bar -nargs=* CoffeeLint \ call s:CoffeeLint(, , , ) diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim index 9d8df12..19f649c 100644 --- a/ftplugin/csv.vim +++ b/ftplugin/csv.vim @@ -517,7 +517,13 @@ fu! WColumn(...) "{{{3 " Return on which column the cursor is let _cur = getpos('.') if !exists("b:csv_fixed_width_cols") - let line=getline('.') + if line('.') > 1 && mode('') != 'n' + " in insert mode, get line from above, just in case the current + " line is empty + let line = getline(line('.')-1) + else + let line=getline('.') + endif " move cursor to end of field "call search(b:col, 'ec', line('.')) call search(b:col, 'ec') @@ -2398,6 +2404,9 @@ fu! csv#EvalColumn(nr, func, first, last) range "{{{3 call CheckHeaderLine() let nr = matchstr(a:nr, '^\-\?\d\+') let col = (empty(nr) ? WColumn() : nr) + if col == 0 + let col = 1 + endif " don't take the header line into consideration let start = a:first - 1 + s:csv_fold_headerline let stop = a:last - 1 + s:csv_fold_headerline @@ -2516,8 +2525,18 @@ fu! CSV_CloseBuffer(buffer) "{{{3 augroup! CSV_QuitPre endtry endfu - +fu! CSVSum(col, fmt, first, last) "{{{3 + let first = a:first + let last = a:last + if empty(first) + let first = 1 + endif + if empty(last) + let last = line('$') + endif + return csv#EvalColumn(a:col, 'SumColumn', first, last) +endfu " Initialize Plugin "{{{2 let b:csv_start = exists("b:csv_start") ? b:csv_start : 1 let b:csv_end = exists("b:csv_end") ? b:csv_end : line('$') diff --git a/ftplugin/erlang.vim b/ftplugin/erlang.vim index f75f47a..4f1acfe 100644 --- a/ftplugin/erlang.vim +++ b/ftplugin/erlang.vim @@ -39,6 +39,9 @@ function s:SetErlangOptions() setlocal omnifunc=erlangcomplete#Complete endif + setlocal comments=:%%%,:%%,:% + setlocal commentstring=%%s + setlocal foldmethod=expr setlocal foldexpr=GetErlangFold(v:lnum) setlocal foldtext=ErlangFoldText() diff --git a/ftplugin/html.vim b/ftplugin/html.vim index 4c0d9d0..a2af59c 100644 --- a/ftplugin/html.vim +++ b/ftplugin/html.vim @@ -4,4 +4,4 @@ " License: MIT " Changes: Add - to keyword -setlocal iskeyword+=- +" setlocal iskeyword+=- diff --git a/ftplugin/latex-box/complete.vim b/ftplugin/latex-box/complete.vim index 458e8d8..150b00e 100644 --- a/ftplugin/latex-box/complete.vim +++ b/ftplugin/latex-box/complete.vim @@ -367,6 +367,7 @@ function! s:ExtractLabels() " Ignore cref entries (because they are duplicates) if curname =~# "@cref$" + let [lblline, lblbegin] = searchpos( '\\newlabel{', 'ecW' ) continue endif diff --git a/ftplugin/latex-box/folding.vim b/ftplugin/latex-box/folding.vim index 4fe13bc..5d733c2 100644 --- a/ftplugin/latex-box/folding.vim +++ b/ftplugin/latex-box/folding.vim @@ -156,7 +156,7 @@ let s:notcomment = '\%(\%(\\\@= 0 + if line =~# s:envbeginpattern && line =~# s:envendpattern + " If the begin and end pattern are on the same line , do not fold + return "=" + else + if line =~# s:envbeginpattern + if g:LatexBox_fold_envs == 1 return "a1" else - return "=" + let env = matchstr(line,'\\begin\*\?{\zs\w*\*\?\ze}') + if index(g:LatexBox_fold_envs_force, env) >= 0 + return "a1" + else + return "=" + endif endif - endif - elseif line =~# s:envendpattern - if g:LatexBox_fold_envs == 1 - return "s1" - else - let env = matchstr(line,'\\end\*\?{\zs\w*\*\?\ze}') - if index(g:LatexBox_fold_envs_force, env) >= 0 + elseif line =~# s:envendpattern + if g:LatexBox_fold_envs == 1 return "s1" else - return "=" + let env = matchstr(line,'\\end\*\?{\zs\w*\*\?\ze}') + if index(g:LatexBox_fold_envs_force, env) >= 0 + return "s1" + else + return "=" + endif endif endif endif @@ -288,7 +293,7 @@ function! LatexBox_FoldText_title() endif " Parts, sections and fakesections - let sections = '\(\(sub\)*section\|part\|chapter\)' + let sections = '\(\(sub\)*\(section\|paragraph\)\|part\|chapter\)' let secpat1 = '^\s*\\' . sections . '\*\?\s*{' let secpat2 = '^\s*\\' . sections . '\*\?\s*\[' if line =~ '\\frontmatter' diff --git a/ftplugin/latex-box/latexmk.vim b/ftplugin/latex-box/latexmk.vim index bb70f83..6c5d3eb 100644 --- a/ftplugin/latex-box/latexmk.vim +++ b/ftplugin/latex-box/latexmk.vim @@ -23,6 +23,9 @@ endif if ! exists('g:LatexBox_quickfix') let g:LatexBox_quickfix = 1 endif +if ! exists('g:LatexBox_personal_latexmkrc') + let g:LatexBox_personal_latexmkrc = 0 +endif " }}} @@ -177,7 +180,9 @@ function! LatexBox_Latexmk(force) let cmd = 'cd ' . texroot . ' && ' endif let cmd .= env . ' latexmk' - let cmd .= ' -' . g:LatexBox_output_type + if ! g:LatexBox_personal_latexmkrc + let cmd .= ' -' . g:LatexBox_output_type + endif let cmd .= ' -quiet ' let cmd .= g:LatexBox_latexmk_options if a:force diff --git a/ftplugin/latextoc.vim b/ftplugin/latextoc.vim index 8edf23d..65315de 100644 --- a/ftplugin/latextoc.vim +++ b/ftplugin/latextoc.vim @@ -87,8 +87,12 @@ function! s:TOCActivate(close) endfor " Find section in buffer (or inputted files) - call s:TOCFindMatch('\\' . entry['level'] . '\_\s*{' . titlestr . '}', - \ duplicates, files) + if entry['level'] == 'label' + let re = '\(\\label\_\s*{\|label\s*=\s*\)' . titlestr . '\>' + else + let re = '\\' . entry['level'] . '\_\s*{' . titlestr . '}' + endif + call s:TOCFindMatch(re, duplicates, files) if a:close if g:LatexBox_split_resize diff --git a/ftplugin/mustache.vim b/ftplugin/mustache.vim index 592ed09..61b5896 100644 --- a/ftplugin/mustache.vim +++ b/ftplugin/mustache.vim @@ -1,3 +1,8 @@ +if exists('g:loaded_mustache_handlebars') && g:loaded_mustache_handlebars + finish +endif +let g:loaded_mustache_handlebars = 1 + let s:cpo_save = &cpo set cpo&vim diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index f406cc8..a032928 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -277,12 +277,12 @@ function! RubyBalloonexpr() endfunction function! s:searchsyn(pattern,syn,flags,mode) + let cnt = v:count1 norm! m' if a:mode ==# 'v' norm! gv endif let i = 0 - let cnt = v:count ? v:count : 1 while i < cnt let i = i + 1 let line = line('.') diff --git a/indent/blade.vim b/indent/blade.vim deleted file mode 100644 index 73550fb..0000000 --- a/indent/blade.vim +++ /dev/null @@ -1,12 +0,0 @@ -" Language: Blade (Laravel) -" Maintainer: xsbeats -" URL: http://github.com/xsbeats/vim-blade -" License: WTFPL - -if exists("b:did_indent") - finish -endif - -runtime! indent/html.vim - -let b:did_indent = 1 diff --git a/indent/coffee.vim b/indent/coffee.vim index 7bd82e3..4f4570a 100644 --- a/indent/coffee.vim +++ b/indent/coffee.vim @@ -1,5 +1,5 @@ " Language: CoffeeScript -" Maintainer: Mick Koch +" Maintainer: Mick Koch " URL: http://github.com/kchmck/vim-coffee-script " License: WTFPL diff --git a/indent/elixir.vim b/indent/elixir.vim index fababe4..3563f44 100644 --- a/indent/elixir.vim +++ b/indent/elixir.vim @@ -11,7 +11,8 @@ let b:did_indent = 1 setlocal nosmartindent setlocal indentexpr=GetElixirIndent() -setlocal indentkeys+==end,=else:,=match:,=elsif:,=catch:,=after:,=rescue: +setlocal indentkeys+=0=end,0=else,0=match,0=elsif,0=catch,0=after,0=rescue +setlocal indentkeys+==-> if exists("*GetElixirIndent") finish diff --git a/indent/haskell.vim b/indent/haskell.vim index 1d74103..1d50025 100644 --- a/indent/haskell.vim +++ b/indent/haskell.vim @@ -55,7 +55,7 @@ function! HIndent(lnum) " This is the wrong thing if you are deeply indented already and want to put " a where clause on the top-level construct, but there isn't much that can " be done about that case... - if thisl =~ '^\s*where\s*$' + if thisl =~ '^\s*where\s*' return previ + &sw endif @@ -175,11 +175,11 @@ function! HIndent(lnum) return previ - &sw endif - " On the other hand, if the previous line is a where with some bindings + " On the other hand, if the previous line is a do or where with some bindings " following it on the same line, accommodate and align with the first non-ws " char after the where - if prevl =~ '\Wwhere\s\+\w' - let bindStart = match(prevl, '\(\Wwhere\s\+\)\@<=\w') + if prevl =~ '\W\(do\|where\)\s\+\w' + let bindStart = match(prevl, '\(\W\(do\|where\)\s\+\)\@<=\w') if bindStart != -1 return bindStart endif @@ -248,7 +248,7 @@ function! s:GetAndStripTrailingComments(lnum) let aline = getline(a:lnum) " We can't just remove the string literal since that leaves us with a " trailing operator (=), so replace it with a fake identifier - let noStrings = substitute(aline, '"\([^"]\|\\"\)*"', 's', '') + let noStrings = substitute(aline, '"\([^"]\|\\"\)*"', '\=repeat("s", len(submatch(0)))', '') let noLineCom = substitute(noStrings, '--.*$', '', '') " If there are no fancy block comments involved, skip some of this extra diff --git a/indent/html.vim b/indent/html.vim index cbd324b..769f631 100644 --- a/indent/html.vim +++ b/indent/html.vim @@ -187,6 +187,7 @@ if exists('g:html_exclude_tags') endfor endif let s:html_indent_tags = join(s:tags, '\|') +let s:html_indent_tags = s:html_indent_tags.'\|\w\+\(-\w\+\)\+' if exists('g:html_indent_tags') let s:html_indent_tags = s:html_indent_tags.'\|'.g:html_indent_tags endif @@ -281,7 +282,7 @@ fun! HtmlIndentGet(lnum) if 0 < searchpair(js, '', jse, 'nWb') \ && 0 < searchpair(js, '', jse, 'nW') " we're inside javascript - if getline(searchpair(js, '', '', 'nWb')) !~ '', 'nWb')) !~ '