Hello,

Below patch to yesterday version of forms.vim .

Rather proof of concept than full solution but looks much nicer:

Features:

- highlight header of form in Comment
- highlight labels of fields as Questions
- hightlight hotkeys as Statements

Limitations:

- Buttons are not supported

Problems with current version of forms:

- arrows doesn't work in terminal. They are completely messing things
  eg. destroy knowledge about default value.
- when there is more than one the same character as hotkey repeating
  hotkey doesn't cycle between them. It stucks with last entry with that
  hotkey


--- /home/mikolaj/kget/forms.vim        2006-10-02 10:31:54.000000000 +0200
+++ forms.vim   2006-10-03 01:26:04.000000000 +0200
@@ -182,13 +182,20 @@
   let a:form.stLine = line('$') + 1
   " Center it.
   silent! put =a:form.title
+  exe 'syn match formHeader /\%'.line('.').'l.*/'
   silent! put =substitute(a:form.title, '.', '-', 'g')
+  exe 'syn match formHeader /\%'.line('.').'l.*/'
   for field in a:form.fields
     let field.stLine = line('$')+1
     call s:SetCurFieldValue(field, field.value)
     let a:form.fieldMap[field.name] = field
     let a:form.hotkeyMap[field.hotkey] = field
+    exe 'syn match formLabel /\%'.field.stLine.'l.*\%<'.(maxLblSize+2).'c/ 
contains=formHotkey'
+    exe 'syn match formHotkey /\c\%'.field.stLine.'l'.field.hotkey.'\%<'.
(maxLblSize+2).'c/'
   endfor
+  hi def link formHeader Comment
+  hi def link formLabel Question
+  hi def link formHotkey Statement
   setl nomodifiable
 
   call s:SetupBuf()

Reply via email to