Permalink
Browse files

rewrite: new format; checkboxes; omni-completion

  • Loading branch information...
1 parent 04c9940 commit 5626b61343917902f90ab6018f3465638b701e8b Tom Link committed Apr 10, 2010
Showing with 658 additions and 241 deletions.
  1. +43 −11 README
  2. +420 −151 autoload/vimform.vim
  3. +61 −74 doc/vimform.txt
  4. +39 −0 ftplugin/vimform.vim
  5. +16 −0 indent/vimform.vim
  6. +3 −3 plugin/vimform.vim
  7. +4 −2 syntax/vimform.vim
  8. +39 −0 test/address.vim
  9. +33 −0 test/replace_gui.vim
View
54 README
@@ -1,22 +1,54 @@
*vimform.txt* Simple text-based forms for vim
-This experimental plugin provides simple text-based forms for vim.
-
Example: >
- let form_s = "Form Test~\n".
- \"Field1.1:� � Field1.2:� �\n".
- \"Field2.1:� � Field2.2:� �\n"
-
- let form = vimform#SimpleForm()
- let form.fields = {'Field2.1': 'foo', 'Field2.2': 'bar'}
+ let form = vimform#New()
+ let form.name = "Test Form"
+ let form.fields = [
+ \ ['Name'],
+ \ ['Address', {'join': "\n"}],
+ \ ['Planet', {'value': 'Earth'}],
+ \ ['Phone', {'validate': '%%s =~ ''^[0-9()+-]*$''',
+ \ 'message': 'Must be a phone number'}],
+ \ ['E-Mail', {'validate': '%%s =~ ''^\([a-zA-Z.]\+@[a-zA-Z]\+\.[a-zA-Z.]\+\)\?$''',
+ \ 'message': 'Must be an e-mail'}],
+ \ ['Private', {'value': 0, 'type': 'checkbox'}],
+ \ ['Business', {'value': 1, 'type': 'checkbox'}],
+ \ ]
function! form.Do_Submit() dict "{{{3
- echom "Test: ". self.fields['Field1.1'] ." ". self.fields['Field2.2']
+ echom "Test: ". self.name
+ for [field, value] in items(self.values)
+ echom "Field" field value
+ endfor
endf
- call vimform#WithString(form_s, form)
+ call form.Split()
+
+This will create a form, which looks like this: >
+
+ <<&Submit>> <<&Cancel>>
+ Name:
+ Address:
+ Planet: Earth
+ Phone:
+ E-Mail:
+ Private: [ ]
+ Business: [X]
+
+The following field types are currently supported:
+
+ - text fields
+ - check boxes
+
+Check boxes can be toggled by pressing: <cr>, <space>, of <LeftMouse>.
+
+Use <tab> to change fields.
+
+Press <c-cr> to submit the form. If the cursor, is not over a button,
+the Do_Submit() method will be called.
-Currently only single line text fields are supported.
+Buttons are marked with |mark|s. So you can jump to a button with |`|X,
+where X is the "accelerator" key marked with "&".
-----------------------------------------------------------------------
Oops, something went wrong.

0 comments on commit 5626b61

Please sign in to comment.