This commit is contained in:
Adam Stankiewicz 2014-03-11 00:36:09 +01:00
parent 9b3b092d15
commit 94f72a68c3
8 changed files with 122 additions and 45 deletions

View File

@ -20,10 +20,7 @@ autocmd BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules set ft=gitconfig
autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
autocmd BufNewFile,BufRead .msg.[0-9]*
\ if getline(1) =~ '^From.*# This line is ignored.$' |
\ set ft=gitsendemail |
\ endif
autocmd BufNewFile,BufRead .gitsendemail.* set ft=gitsendemail
autocmd BufNewFile,BufRead *.git/**
\ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
\ set ft=git |

View File

@ -2381,11 +2381,12 @@ fu! <sid>SubstituteInColumn(command, line1, line2) range "{{{3
endfu
fu! <sid>ColumnMode() "{{{3
if mode() =~# 'R'
let mode = mode()
if mode =~# 'R'
" (virtual) Replace mode
let new_line = (line('.') == line('$') ||
\ (synIDattr(synIDtrans(synID(line("."), col("."), 1)), "name") !~# "comment"))
return "\<ESC>". (new_line ? "o" : "JE".mode())
\ (synIDattr(synIDtrans(synID(line("."), col("."), 1)), "name") =~? "comment"))
return "\<ESC>g`[". (new_line ? "o" : "J".mode)
else
return "\<CR>"
endif

View File

@ -31,6 +31,9 @@ endif
if !exists('g:LatexBox_fold_envs')
let g:LatexBox_fold_envs=1
endif
if !exists('g:LatexBox_fold_envs_force')
let g:LatexBox_fold_envs_force = []
endif
if !exists('g:LatexBox_fold_parts')
let g:LatexBox_fold_parts=[
\ "appendix",
@ -159,11 +162,27 @@ function! LatexBox_FoldLevel(lnum)
endif
" Fold environments
if g:LatexBox_fold_envs == 1
if line =~# s:envbeginpattern
if line =~# s:envbeginpattern
if g:LatexBox_fold_envs == 1
return "a1"
elseif line =~# s:envendpattern
else
let env = matchstr(line,'\\begin\*\?{\zs\w*\*\?\ze}')
if index(g:LatexBox_fold_envs_force, env) >= 0
return "a1"
else
return "="
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
return "s1"
else
return "="
endif
endif
endif

View File

@ -1,7 +1,7 @@
" Vim syntax file
" Language: Rust
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Last Change: 2013 Jul 10
" Last Change: 2014 Feb 27
if exists("b:did_ftplugin")
finish
@ -42,4 +42,55 @@ if exists("g:loaded_delimitMate")
let b:delimitMate_excluded_regions = delimitMate#Get("excluded_regions") . ',rustLifetimeCandidate,rustGenericLifetimeCandidate'
endif
let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< | if exists('b:rust_original_delimitMate_excluded_regions') | let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions | unlet b:rust_original_delimitMate_excluded_regions | elseif exists('b:delimitMate_excluded_regions') | unlet b:delimitMate_excluded_regions | endif"
" Bind motion commands to support hanging indents
nnoremap <silent> <buffer> [[ :call <SID>Rust_Jump('n', 'Back')<CR>
nnoremap <silent> <buffer> ]] :call <SID>Rust_Jump('n', 'Forward')<CR>
xnoremap <silent> <buffer> [[ :call <SID>Rust_Jump('v', 'Back')<CR>
xnoremap <silent> <buffer> ]] :call <SID>Rust_Jump('v', 'Forward')<CR>
onoremap <silent> <buffer> [[ :call <SID>Rust_Jump('o', 'Back')<CR>
onoremap <silent> <buffer> ]] :call <SID>Rust_Jump('o', 'Forward')<CR>
let b:undo_ftplugin = "
\setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd<
\|if exists('b:rust_original_delimitMate_excluded_regions')
\|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions
\|unlet b:rust_original_delimitMate_excluded_regions
\|elseif exists('b:delimitMate_excluded_regions')
\|unlet b:delimitMate_excluded_regions
\|endif
\|nunmap <buffer> [[
\|nunmap <buffer> ]]
\|xunmap <buffer> [[
\|xunmap <buffer> ]]
\|ounmap <buffer> [[
\|ounmap <buffer> ]]
\"
if exists('*<SID>Rust_Jump') | finish | endif
function! <SID>Rust_Jump(mode, function) range
let cnt = v:count1
normal! m'
if a:mode ==# 'v'
norm! gv
endif
let foldenable = &foldenable
set nofoldenable
while cnt > 0
execute "call <SID>Rust_Jump_" . a:function . "()"
let cnt = cnt - 1
endwhile
let &foldenable = foldenable
endfunction
function! <SID>Rust_Jump_Back()
call search('{', 'b')
keepjumps normal! w99[{
endfunction
function! <SID>Rust_Jump_Forward()
normal! j0
call search('{', 'b')
keepjumps normal! w99[{%
call search('{')
endfunction

15
indent/arduino.vim Normal file
View File

@ -0,0 +1,15 @@
" Vim indent file
" Language: Arduino
" Maintainer: Kevin Sjöberg <kev.sjoberg@gmail.com>
" Last Change: 2014 Feb 28
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" C++ indenting is built-in, thus this is very simple
setlocal cindent
let b:undo_indent = "setl cin<"

View File

@ -16,8 +16,8 @@ syn match elixirComment '#.*' contains=elixirTodo
syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained
syn keyword elixirKeyword is_atom is_binary is_bitstring is_boolean is_float is_function is_integer is_list is_number is_pid is_port is_record is_reference is_tuple is_exception
syn keyword elixirKeyword case cond bc lc inlist inbits if unless try receive function
syn keyword elixirKeyword exit raise throw after rescue catch else
syn keyword elixirKeyword case cond bc lc inlist inbits if unless try receive
syn keyword elixirKeyword exit raise throw after rescue catch else do end
syn keyword elixirKeyword quote unquote super
syn match elixirKeyword '\<\%(->\)\>\s*'

View File

@ -95,7 +95,7 @@ syn match perlStatementVector "\<vec\>"
syn match perlStatementFiles "\<\%(ch\%(dir\|mod\|own\|root\)\|glob\|link\|mkdir\|readlink\|rename\|rmdir\|symlink\|umask\|unlink\|utime\)\>"
syn match perlStatementFiles "-[rwxoRWXOezsfdlpSbctugkTBMAC]\>"
syn match perlStatementFlow "\<\%(caller\|die\|dump\|eval\|exit\|wantarray\|evalbytes\)\>"
syn match perlStatementInclude "\<\%(require\|import\)\>"
syn match perlStatementInclude "\<\%(require\|import\|unimport\)\>"
syn match perlStatementInclude "\<\%(use\|no\)\s\+\%(\%(attributes\|attrs\|autouse\|parent\|base\|big\%(int\|num\|rat\)\|blib\|bytes\|charnames\|constant\|diagnostics\|encoding\%(::warnings\)\=\|feature\|fields\|filetest\|if\|integer\|less\|lib\|locale\|mro\|open\|ops\|overload\|re\|sigtrap\|sort\|strict\|subs\|threads\%(::shared\)\=\|utf8\|vars\|version\|vmsish\|warnings\%(::register\)\=\)\>\)\="
syn match perlStatementProc "\<\%(alarm\|exec\|fork\|get\%(pgrp\|ppid\|priority\)\|kill\|pipe\|set\%(pgrp\|priority\)\|sleep\|system\|times\|wait\%(pid\)\=\)\>"
syn match perlStatementSocket "\<\%(accept\|bind\|connect\|get\%(peername\|sock\%(name\|opt\)\)\|listen\|recv\|send\|setsockopt\|shutdown\|socket\%(pair\)\=\)\>"
@ -513,7 +513,9 @@ HiLink perlStatementIndirObj perlStatement
HiLink perlFunctionName perlIdentifier
HiLink perlMethod perlIdentifier
HiLink perlFunctionPRef perlType
HiLink perlPOD perlComment
if !get(g:, 'perl_include_pod', 1)
HiLink perlPOD perlComment
endif
HiLink perlShellCommand perlString
HiLink perlSpecialAscii perlSpecial
HiLink perlSpecialDollar perlSpecial

View File

@ -3,7 +3,7 @@
" Maintainer: Patrick Walton <pcwalton@mozilla.com>
" Maintainer: Ben Blum <bblum@cs.cmu.edu>
" Maintainer: Chris Morgan <me@chrismorgan.info>
" Last Change: 2014 Feb 14
" Last Change: 2014 Feb 27
if version < 600
syntax clear
@ -18,8 +18,8 @@ syn keyword rustOperator as
syn match rustAssert "\<assert\(\w\)*!" contained
syn match rustFail "\<fail\(\w\)*!" contained
syn keyword rustKeyword break continue do
syn keyword rustKeyword extern nextgroup=rustExternCrate skipwhite
syn keyword rustKeyword break continue
syn keyword rustKeyword extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite
syn keyword rustKeyword for in if impl let
syn keyword rustKeyword loop once priv pub
syn keyword rustKeyword return
@ -35,12 +35,13 @@ syn keyword rustObsoleteStorage const
syn keyword rustInvalidBareKeyword crate
syn keyword rustExternCrate crate contained nextgroup=rustIdentifier skipwhite
syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipwhite
syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
" Reserved (but not yet used) keywords {{{2
syn keyword rustReservedKeyword alignof be offsetof pure sizeof typeof yield
syn keyword rustReservedKeyword alignof be do offsetof pure sizeof typeof yield
" Built-in types {{{2
syn keyword rustType int uint float char bool u8 u16 u32 u64 f32
@ -51,8 +52,7 @@ syn keyword rustType f64 i8 i16 i32 i64 str Self
" to make it easy to update.
" Core operators {{{3
syn keyword rustTrait Sized
syn keyword rustTrait Freeze Send
syn keyword rustTrait Freeze Pod Send Sized
syn keyword rustTrait Add Sub Mul Div Rem Neg Not
syn keyword rustTrait BitAnd BitOr BitXor
syn keyword rustTrait Drop
@ -63,32 +63,25 @@ syn keyword rustEnum Result
syn keyword rustEnumVariant Ok Err
" Functions {{{3
"syn keyword rustFunction print println
"syn keyword rustFunction range
"syn keyword rustFunction from_str
"syn keyword rustFunction range
"syn keyword rustFunction drop
" Types and traits {{{3
syn keyword rustTrait Any AnyOwnExt AnyRefExt AnyMutRefExt
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr IntoBytes
syn keyword rustTrait Bool
syn keyword rustTrait ToCStr
syn keyword rustTrait Char
syn keyword rustTrait Clone DeepClone
syn keyword rustTrait Eq Ord TotalEq TotalOrd Ordering Equiv
syn keyword rustEnumVariant Less Equal Greater
syn keyword rustTrait Container Mutable Map MutableMap Set MutableSet
syn keyword rustTrait Default
syn keyword rustTrait Hash
syn keyword rustTrait FromStr
syn keyword rustTrait FromIterator Extendable
syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator CloneableIterator
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize
syn keyword rustTrait Algebraic Trigonometric Exponential Hyperbolic
syn keyword rustTrait Bitwise Bounded Fractional
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul CheckedDiv
syn keyword rustTrait Orderable Signed Unsigned Round
syn keyword rustTrait Primitive Int Float ToStrRadix ToPrimitive FromPrimitive
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul
syn keyword rustTrait Signed Unsigned Round
syn keyword rustTrait Primitive Int Float ToPrimitive FromPrimitive
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
syn keyword rustTrait RawPtr
syn keyword rustTrait Buffer Writer Reader Seek
@ -98,20 +91,17 @@ syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8
syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCloneableVector
syn keyword rustTrait OwnedVector OwnedCloneableVector OwnedEqVector MutableVector
syn keyword rustTrait OwnedVector OwnedCloneableVector OwnedEqVector
syn keyword rustTrait MutableVector MutableTotalOrdVector
syn keyword rustTrait Vector VectorVector CloneableVector ImmutableVector
"syn keyword rustFunction stream
syn keyword rustTrait Port Chan GenericChan GenericSmartChan GenericPort Peekable
syn keyword rustTrait Port Chan
"syn keyword rustFunction spawn
syn keyword rustSelf self
syn keyword rustBoolean true false
syn keyword rustConstant Some None " option
syn keyword rustConstant Ok Err " result
syn keyword rustConstant Less Equal Greater " Ordering
" Other syntax {{{2
" If foo::bar changes to foo.bar, change this ("::" to "\.").
@ -173,11 +163,12 @@ syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
syn match rustCharacter /'\([^'\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial,rustSpecialError
syn cluster rustComment contains=rustCommentLine,rustCommentLineDoc,rustCommentBlock,rustCommentBlockDoc
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell
syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent
syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent
" FIXME: this is a really ugly and not fully correct implementation. Most
" importantly, a case like ``/* */*`` should have the final ``*`` not being in
" a comment, but in practice at present it leaves comments open two levels
@ -247,6 +238,7 @@ hi def link rustObsoleteStorage Error
hi def link rustLifetime Special
hi def link rustInvalidBareKeyword Error
hi def link rustExternCrate rustKeyword
hi def link rustObsoleteExternMod Error
" Other Suggestions:
" hi rustAttribute ctermfg=cyan