On 2013-08-14, tjg wrote:
> I have a file where all the lines have the same structure : ID (integer),
> Type (text), Description (text). These "fields" are separated by tabs (ts=7)
> 
> To add new items I have created (well, not yet, as you will see) an
> interactive function which goes :
> 
> function NewData ()
>     let ts=7
>     let ID = input("ID ? : ")
>     let Type = input("Type ? : ")
>     let Description = input("Description ? : ")
>     execute "normal! i".ID
>     execute "normal! a".Type
>     execute "normal! a".Description
> endfunction
> 
> which, for data such as [5237, Stock, something] gives me
> 5237Stocksomething...
> 
> How must I proceed to have the function insert a tab between execute #1 and
> execute #2, and another one between execute #2 and execute #3 ?

Just append "\<tab>" to your execute #1 and execute #2 lines:

    execute "normal! i".ID."\<tab>"
    execute "normal! a".Type."\<tab>"

See the :normal example under

    :help :execute

and

    :help expr-quote

Regards,
Gary

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to