diff options
author | Gregor Uhlenheuer <kongo2002@googlemail.com> | 2010-04-04 22:13:18 +0800 |
---|---|---|
committer | Mason Larobina <mason.larobina@gmail.com> | 2010-04-04 22:16:49 +0800 |
commit | 774e48054149fe1f9512104a2f821e0055168d8a (patch) | |
tree | 9bd855395099e5b57c1e4ec40c422b68535a14b5 /extras/vim | |
parent | ae15d257a858fe27090f3e5798357aea2f5a76da (diff) |
vim ftplugin for uzbl, config section folding & improved vim syntax file
Diffstat (limited to 'extras/vim')
-rw-r--r-- | extras/vim/ftplugin/uzbl.vim | 29 | ||||
-rw-r--r-- | extras/vim/syntax/uzbl.vim | 14 |
2 files changed, 36 insertions, 7 deletions
diff --git a/extras/vim/ftplugin/uzbl.vim b/extras/vim/ftplugin/uzbl.vim new file mode 100644 index 0000000..513eaa4 --- /dev/null +++ b/extras/vim/ftplugin/uzbl.vim @@ -0,0 +1,29 @@ +" Vim filetype file +" Filename: uzbl.vim +" Maintainer: Gregor Uhlenheuer +" Last Change: Sun 04 Apr 2010 01:37:49 PM CEST + +if exists('b:did_ftplugin') + finish +endif + +let b:did_ftplugin = 1 + +" enable syntax based folding +setlocal foldmethod=syntax + +" correctly format comments +setlocal formatoptions=croql +setlocal comments=:# +setlocal commentstring=#%s + +" define config testing commands and mappings +if executable('uzbl-core') + com! -buffer UzblCoreTest !uzbl-core -c % + nmap <buffer> <Leader>uc :UzblCoreTest<CR> +endif + +if executable('uzbl-browser') + com! -buffer UzblBrowserTest !uzbl-browser -c % + nmap <buffer> <Leader>ub :UzblBrowserTest<CR> +endif diff --git a/extras/vim/syntax/uzbl.vim b/extras/vim/syntax/uzbl.vim index 39f2495..ab78a4b 100644 --- a/extras/vim/syntax/uzbl.vim +++ b/extras/vim/syntax/uzbl.vim @@ -26,7 +26,7 @@ elseif exists("b:current_syntax") endif " Don't match keywords inside strings -set iskeyword=!-~,192-255 +setl iskeyword=!-~,192-255 syn keyword uzblKeyword back forward scroll reload reload_ign_cache stop syn keyword uzblKeyword zoom_in zoom_out toggle_zoom_type uri script @@ -44,13 +44,13 @@ syn match uzblTodo /TODO:/ contained syn region uzblComment display start=/^#/ end=/$/ contains=uzblTodo " Comment headings -syn region uzblSection display start=/^# ===/ end=/$/ -syn region uzblSubSection display start=/^# ---/ end=/$/ +syn region uzblSec matchgroup=uzblSection start=/^# ===.*$/ end=/^# ===/me=e-5 contains=ALL fold +syn region uzblSSec matchgroup=uzblSubSection start=/^# ---.*$/ end=/^# [=-]\{3}/me=e-5 contains=ALLBUT,uzblSec,uzblSSec fold " Integer and float matching -syn match uzblPercent display /\s\(+\|-\|\)\(\d\+.\d\+\|\d\+\)%\(\s\|\n\)/ -syn match uzblInt display /\s\(+\|-\|\)\d\+\(\s\|\n\)/ -syn match uzblFloat display /\s\(+\|-\|\)\d\+.\d\+\(\s\|\n\)/ +syn match uzblPercent display /\s[+-]\=\%(\d\+\.\)\=\d\+%\_s/ +syn match uzblInt display /\s[+-]\=\d\+\_s/ +syn match uzblFloat display /\s[+-]\=\d\+\.\d\+\_s/ " Handler arguments syn match uzblArgs display /$\d\+/ @@ -63,7 +63,7 @@ syn match uzblInternalExpand display /@[A-Z_]\+/ syn match uzblInternalExpand display /@{[A-Z_]\+}/ " Matches $ENVIRON_VAR -syn match uzblEnvironVariable display /$[A-Za-z0-9_]\+/ +syn match uzblEnvironVariable display /$\a\+\w*/ " Matches @some_var and @{some_var} syn match uzblExpand display /@[A-Za-z0-9_\.]\+/ |