Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
VimL
tag: 0.03

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
autoload
doc
ftplugin
indent
plugin
syntax
test
README
TODO_vimform.txt

README

*vimform.txt*       Simple text-based forms for vim

Example: >

    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.name
        for [field, value] in items(self.values)
            echom "Field" field value
        endfor
    endf

    call form.Split()

This will create a form, which looks like this: >

    <<&Submit>> <<&Cancel>>
         Name: 
      Address: 
       Planet: Earth
        Phone: 
       E-Mail: 
      Private: [ ]
     Business: [X]

Check out further examples on:
http://github.com/tomtom/vimform_vim/tree/master/test/

The following field types are currently supported:

    - text fields
    - check boxes
    - single choice/drop-down lists

                                                    *vimform-keys*
The following key maps can be used to navigate through forms:

<c-cr>          "Press" a button. If the cursor, is not over a button, 
                the form will be submitted, i.e. the Do_Submit() method 
                is called.

<c-w>c          Abandon/close/cancel the form.

<f5>            Redraw the form.

<tab>           Jump to the next field (this will also save the current 
                field's value so that it doesn't get lost when redrawing 
                a form)

<s-tab>         Jump to the previous field

<c-x><c-o>
<c-space>       Invoke the completion menu if a completion function is 
                defined for the current field.

`[LETTER]       Accelerator keys are prefixed with an ampersand (&). 
                Those letters are defined as |mark|s. Jump to a button 
                with |`|.

<LeftMouse>
<space>
<cr>            If the cursor is located over a checkbox, toggle that 
                check box. If the cursor is over a drop-down list, open the 
                list.

a
i               Switch to insert mode.

<c-n> <c-p> <c-y> <c-e>
                Navigate drop-down lists. See also |ins-completion|.


-----------------------------------------------------------------------

Extracted from http://github.com/tomtom/vimtlib
Status:  Experimental
Install: See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT

Something went wrong with that request. Please try again.