Loading ...
Sorry, an error occurred while loading the content.

Re: [RFC] Some more python and VimL interfaces

Expand Messages
  • Bram Moolenaar
    ZyX wrote: [...] ... Calling functions would be a very common thing. Thus I would keep the name as short as possible: vim.f.bufnr( % ) ... No, just the
    Message 1 of 42 , May 15, 2013
    • 0 Attachment
      ZyX wrote:

      [...]

      > >Would it be possible to have most Vim functions made callable from
      > >Python this way? Obviously it's much better than using vim.eval().
      >
      > I assumed it be a convenience wrapper replacing
      >
      > vim.bindeval('function("bufnr")')('%')
      >
      > (obviously, you can save `vim.bindeval('function("bufnr")')` result in
      > a variable) with a nicer syntax. I believe author of proposal assumed
      > the same.

      Calling functions would be a very common thing. Thus I would keep the
      name as short as possible: vim.f.bufnr('%')

      > >An example from the help:
      > >
      > > :py tagList = vim.eval('taglist("eval_expr")')
      > >
      > >Would then be something like:
      > >
      > > :py tagList = vim.functions.taglist(eval_expr)
      > >
      > >With the difference that eval_expr would be a Python expression.
      >
      > You mean, python regex?

      No, just the difference of passing the whole string to vim.eval vs.
      processing the arguments in Python and passing the result of that to
      Vim.

      --
      Mental Floss prevents moral decay!

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      --
      You received this message from the "vim_dev" 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_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bram Moolenaar
      ... Yes, this also came up as a side effect of the os.chdir() solution. It s especially useful if a plugin can be distributed as a Python module plus some
      Message 42 of 42 , May 21, 2013
      • 0 Attachment
        Marc Weber wrote:

        > Yet another suggestion - what about adding &rtp to sys.path somehow ?
        > (with or without python version site-packages or the like)
        >
        > Then you could
        > - write .py files
        > - use them from python by
        >
        > import module
        > do_stuff()
        >
        > Yes - it can be trivially implemented in tools like vim-addon-manager,
        > but I'd prefer a global solution usable by everyone.

        Yes, this also came up as a side effect of the os.chdir() solution.

        It's especially useful if a plugin can be distributed as a Python module
        plus some lines in the Vim plugin. It would have a similar effect as
        using a Vim script under autoload.

        --
        A M00se once bit my sister ...
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        --
        You received this message from the "vim_dev" 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_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.