Skip to content

Commit e5fdb89

Browse files
committed
* Implemented include Vim Script syntax.
1 parent 5e0deeb commit e5fdb89

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

doc/vimshell.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,16 @@ BUGS *vimshell-bugs*
153153
==============================================================================
154154
CHANGELOG *vimshell-changelog*
155155

156+
2010-04-18
157+
* Implemented include Vim Script syntax.
158+
156159
2010-04-17
157160
* Improved update behaivior on insert mode.
158161
* Fixed g:VimShell_IgnoreCase default value.
159162
* Improved g:VimShell_IgnoreCase behaivior.
160163
* Detect head matches each prompt pattern.
161164
* Fixed searchpos() bug.
162165
* Improved prompt syntax highlight.
163-
* Implemented include Vim Script syntax(incomplete).
164166

165167
2010-04-16
166168
* Improved iexe update.

syntax/vimshell.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"=============================================================================
22
" FILE: syntax/vimshell.vim
33
" AUTHOR: Shougo Matsushita <[email protected]>(Modified)
4-
" Last Modified: 17 Apr 2010
4+
" Last Modified: 18 Apr 2010
55
" License: MIT license {{{
66
" Permission is hereby granted, free of charge, to any person obtaining
77
" a copy of this software and associated documentation files (the

syntax/vimshrc.vim

+25-23
Original file line numberDiff line numberDiff line change
@@ -31,37 +31,38 @@ elseif exists('b:current_syntax')
3131
finish
3232
endif
3333

34-
syn region VimShellRcString start=+'+ end=+'+ oneline
35-
syn region VimShellRcString start=+"+ end=+"+ contains=VimShellQuoted oneline
36-
syn region VimShellRcString start=+`+ end=+`+ oneline
34+
syn match VimShellRcCommand '\%(^\|\s\)[[:alnum:]_.][[:alnum:]_.-]\+[[:blank:]\n]' contained
35+
syn match VimShellRcVariable '$\h\w*' contained
36+
syn match VimShellRcVariable '$$\h\w*' contained
37+
syn region VimShellRcVariable start=+${+ end=+}+ contained
38+
syn region VimShellRcString start=+'+ end=+'+ oneline contained
39+
syn region VimShellRcString start=+"+ end=+"+ contains=VimShellQuoted oneline contained
40+
syn region VimShellRcString start=+`+ end=+`+ oneline contained
3741
syn match VimShellRcString '[''"`]$' contained
38-
syn match VimShellRcComment '#.*$'
39-
syn match VimShellRcConstants '[+-]\=\<\d\+\>'
40-
syn match VimShellRcConstants '[+-]\=\<0x\x\+\>'
41-
syn match VimShellRcConstants '[+-]\=\<0\o\+\>'
42-
syn match VimShellRcConstants '[+-]\=\d\+#[-+]\=\w\+\>'
43-
syn match VimShellRcConstants '[+-]\=\d\+\.\d\+\([eE][+-]\?\d\+\)\?\>'
44-
syn match VimShellRcArguments '\s-\=-[[:alnum:]-]\+=\='
42+
syn match VimShellRcComment '#.*$' contained
43+
syn match VimShellRcConstants '[+-]\=\<\d\+\>' contained
44+
syn match VimShellRcConstants '[+-]\=\<0x\x\+\>' contained
45+
syn match VimShellRcConstants '[+-]\=\<0\o\+\>' contained
46+
syn match VimShellRcConstants '[+-]\=\d\+#[-+]\=\w\+\>' contained
47+
syn match VimShellRcConstants '[+-]\=\d\+\.\d\+\([eE][+-]\?\d\+\)\?\>' contained
48+
syn match VimShellRcArguments '\s-\=-[[:alnum:]-]\+=\=' contained
4549
syn match VimShellRcQuoted '\\.' contained
46-
syn match VimShellRcSpecial '[|<>;&;]'
47-
syn match VimShellRcVariable '$\h\w*'
48-
syn match VimShellRcVariable '$$\h\w*'
49-
syn region VimShellRcVariable start=+${+ end=+}+
50-
syn match VimShellRcCommand '\%(^\|\s\)[[:alnum:]_.][[:alnum:]_.-]\+[[:blank:]\n]'
50+
syn match VimShellRcSpecial '[|<>;&;]' contained
5151
if vimshell#iswin()
5252
syn match VimShellRcArguments '\s/[?:,_[:alnum:]]\+\ze\%(\s\|$\)' contained
5353
syn match VimShellRcDirectory '\%(\f\s\?\)\+[/\\]\ze\%(\s\|$\)'
5454
else
5555
syn match VimShellRcDirectory '\%(\f\s\?\)\+/\ze\%(\s\|$\)'
5656
endif
57-
let s:vim_syntax_path = split(globpath(&rtp, 'syntax/vim.vim'), '\n')
58-
if !empty(s:vim_syntax_path) && filereadable(s:vim_syntax_path[0])
59-
unlet! b:current_syntax
60-
execute 'syn include @VimShellRcVimScript' s:vim_syntax_path[0]
61-
syn region VimShellRcVimScriptRegion start=+^\s*vexe\s\+"\zs$+ end=+"\zs$+ contains=@VimShellRcVimScript
62-
syn region VimShellRcVimScriptRegion start=+^\s*vexe\s\+'\zs$+ end=+'\zs$+ contains=@VimShellRcVimScript
63-
endif
64-
unlet s:vim_syntax_path
57+
58+
syn region VimShellRcVimShellScriptRegion start='\zs\<\f\+' end='\zs$' contains=VimShellRcCommand,VimShellRcVariable,VimShellRcString,VimShellRcComment,VimShellRcConstants,VimShellRcArguments,VimShellRcQuoted,VimShellRcSpecial,VimShellRcDirectory
59+
syn region VimShellRcCommentRegion start='#' end='\zs$'
60+
syn cluster VimShellRcBodyList contains=VimShellRcVimShellScriptRegion,VimShellRcComment
61+
62+
unlet! b:current_syntax
63+
syn include @VimShellRcVimScript syntax/vim.vim
64+
syn region VimShellRcVimScriptRegion start=-\<vexe\s\+\z(["']\)\zs$- end=+\z1\zs$+ contains=@VimShellRcVimScript
65+
syn cluster VimShellRcBodyList add=VimShellRcVimScriptRegion
6566

6667
hi def link VimShellRcQuoted Special
6768
hi def link VimShellRcString Constant
@@ -70,6 +71,7 @@ hi def link VimShellRcConstants Constant
7071
hi def link VimShellRcSpecial PreProc
7172
hi def link VimShellRcVariable Comment
7273
hi def link VimShellRcComment Identifier
74+
hi def link VimShellRcCommentRegion Identifier
7375
hi def link VimShellRcNormal Normal
7476

7577
hi def link VimShellRcCommand Statement

0 commit comments

Comments
 (0)