ad458d7e3e8d

Add syntax support for the ls command (from Ümit Kablan).
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 08 Sep 2012 14:01:49 -0400
parents ed67c4908fa0
children 34dccad2239d
branches/tags (none)
files clamsyntax/pacman.vim plugin/clam.vim

Changes

--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/clamsyntax/pacman.vim	Sat Sep 08 14:01:49 2012 -0400
@@ -0,0 +1,17 @@
+" pacman program output syntax rules for Clam.vim
+
+" syn match outputItemLineFirst "\^\S\+/\.\+\>"
+syn match packageName "/\S\+\>"
+
+syn keyword packageGroupExtra extra
+syn keyword packageGroupCommunity community
+syn keyword packageGroupMultilib multilib
+syn keyword packageInstalledMark installed
+
+
+hi def link packageGroupCommunity Type
+hi def link packageGroupExtra     Type
+hi def link packageGroupMultilib  Type
+hi def link packageInstalledMark  Error
+hi def link packageName           String
+" hi def link outputItemLineFirst Comment
--- a/plugin/clam.vim	Fri May 04 00:09:55 2012 -0700
+++ b/plugin/clam.vim	Sat Sep 08 14:01:49 2012 -0400
@@ -38,6 +38,18 @@
         silent! execute winnr . 'wincmd w'
     endif
 endfunction " }}}
+function! s:ExtractBareCommanName(fullCommand)
+    let j = stridx(a:fullCommand, " ")
+    if j > -1
+        return a:fullCommand[0:j-1]
+    endif
+    return a:fullCommand
+endfunction
+function! s:ApplySyntaxFileForCommand(command)
+    let barecommand = s:ExtractBareCommanName(a:command)
+    let syntaxfile = "clamsyntax/" . barecommand . ".vim"
+    exe "runtime! " . syntaxfile
+endfunction
 function! s:ConfigureCurrentClamBuffer(command) " {{{
     " Set some basic options for the output window.
     setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap nonumber
@@ -104,6 +116,8 @@
 
     silent! redraw
 
+    call s:ApplySyntaxFileForCommand(command)
+
     echo 'Shell command executed: ' . command
 endfunction " }}}