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

Re: percentage of vim users running python

Expand Messages
  • Marc Weber
    Hi Ted: You re writing code for a system you ve been using. You say its not ready for release. Still you care much about portability and other users (?). One
    Message 1 of 15 , Jul 1, 2010
      Hi Ted:

      You're writing code for a system you've been using. You say its not
      ready for release. Still you care much about portability and other users
      (?). One design goal should be : Never over engineer. Do what you have
      to do because things are going to change anyway.

      Such a change could be a team mate popping up who loves Emacs.
      If you have a Python module he can hack the module and Emacs and reuse
      your code. If you use VimL ..

      Same applies if you want to offer the functionality in web application
      or whatsoever.

      About plugin / addon / extension? I didn't care much. I just tried to
      get the job done.

      Have a look from a historical point of view: VimL was great when it was
      invented. That time it was ahead of the time by years. There was no
      Python or X which could be used instead. However today those languages
      exist. VimL can get jobs done. However its only used within Vim.
      You can use Python. However the language bindings are rather limited. Eg
      Vim module doesn't provide a call function which allows you to call vim
      function without caring about quoting.. Nevertheless you can hack this
      up fast.

      When should you use VimL?
      - you're going to use many Vim commands (regex, cursor movements etc)

      When should you be using Python or something else?
      - you're going to implement heavy stuff such as language parsers.
      You want to operate on syntax trees etc.

      Sometimes a solution which only gets done 90% can be implemented *much*
      faster in Vim using commands you already know. So if you task is about
      finding paragraphs and adding characters or joining those paragraphs
      probably I'd try to get up a quick and dirty Vim script

      Do whatever you feel most comfortable with.

      Python:

      --
      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
    • AK
      ... It would be really great if Python became widely included with Vim, there s a very large number of Python developers who use Vim but don t know VimL or
      Message 2 of 15 , Jul 1, 2010
        On 06/30/2010 07:01 PM, Ted wrote:
        > Thanks to all for providing input on my question.  I realized that the
        > demographic is a bit more restricted than the general population of
        > vim users; it is that portion thereof who actually install vim modules
        > at all.  It's informative to learn that there are some in that group
        > who would not be willing to install python as a module dependency.


        It would be really great if Python became widely included with Vim,
        there's a very large number of Python developers who use Vim but don't
        know VimL or only know a little bit of it. On top of that, Python is a
        very clean, powerful language with extensive libraries.

        I think it's a chicken and an egg problem, once there's a large number
        of good plugins, more people will choose to install python with Vim and
        this will lead to more good plugins. -ak

        --
        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
      • Tony Mechelynck
        ... Myself, I have Python installed just in case , and even compiled into Vim, but in practice I don t use it, in part because I don t know Python, in part
        Message 3 of 15 , Jul 7, 2010
          On 30/06/10 03:20, Ted wrote:
          > Hello folks,
          >
          > I'm wondering if there are some figures somewhere that would provide
          > some sort of estimate of the percentage of vim users who have python
          > installed, or would be free of objections to installing it if a module
          > required it. I'm working on some vim modules, to be released for
          > general use, that are threatening to become pretty complicated, and
          > would prefer to write them in python. Is it likely that this would
          > lock out a significant portion of the vim user population? Is it
          > frowned upon to use external languages in cases where it's not
          > entirely necessary? Python is more or less ubiquitous on linux
          > installs, but I don't feel like I could guess at how many vim users on
          > other platforms would be unable or unwilling to install it.
          >
          > The modules themselves are relatively general purpose; my motivation
          > to code them in Python stems partly from this very generality: it's
          > advantageous to have that code available outside of the context of
          > vim. I also find that I tend more and more toward a functional
          > programming style that doesn't work particularly well in vimscript.
          >
          > Cheers
          > -Ted
          >

          Myself, I have Python installed "just in case", and even compiled into
          Vim, but in practice I don't use it, in part because I don't know
          Python, in part because, to extend or customize Vim, vimscript is good
          enough for me. If I found a good useful script written in Vim + Python I
          would not necessarily shun it as others have said they would; but so far
          all my third- (and second- ;-) ) -party scripts are in "plain" vimscript.

          About terminology: I think it isn't cast in bronze, but personally I use
          "a Vim script" in two words to mean "a file to be sourced by Vim", or
          "vimscript" in one word to mean "the programming language used to write
          Vim scripts".

          My main use (AFAIK) for the Python interpreter is to run Mercurial ;-)


          Best regards,
          Tony.
          --
          The fact that it works is immaterial.
          -- L. Ogborn

          --
          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
        • Ted
          Regarding the terminology: My point of confusion with the term a vim script is that, in addition to bearing a similarity to the vimscript or VimL
          Message 4 of 15 , Jul 7, 2010
            Regarding the terminology:
            My point of confusion with the term "a vim script" is that, in
            addition to bearing a similarity to the "vimscript" or "VimL"
            programming language, this can imply either of two other things:
            - a package, downloadable from "http://vim.org/scripts/script.php?
            script_id=$some_number", which provides new functionality for or
            ameliorates existing functionality of the `vim` editor
            - an individual file to be installed, as part of such a package, to,
            for example, 'plugin/vigour.vim'.

            My question was just if there is a preference or consensus on what
            instances of the second of those two types of things should be called.

            The term "plugin" is particularly confusing in this sense, as it is
            the name of one of the directories into which *.vim files are
            installed, and thereby indicates a subclass of *.vim file, as
            differentiated from an autoload or filetype-plugin file.

            It seems like Python is mostly used for more complex modules that, as
            Marc mentions, do "heavy lifting", such as the conque module linked to
            in Marko's list, or the very useful DBGp debugger module (http://
            www.vim.org/scripts/script.php?script_id=1152). As well, there are
            numerous modules that are to be used for python development (again see
            Marko's list), where it's pretty safe to assume that the Python
            dependency is met.

            VimL/vimscript as a language is, I've found, not entirely terrible,
            and is fairly well suited to scripting vim. The worst of the fallout
            from its storied history would seem to be an inconsistency to nearly
            rival that of PHP. But it does lack portability, a large, organized,
            and growing library, module dependency management, and a lot of the
            convenience factors that are readily available in Python. For
            example, being able to use Python's shlex module, or even argparse, to
            parse user-defined command invocations can be very useful.

            So I'd really like to be able to just use Python as a general rule
            when writing vim modules, even simple ones, and eventually find a way
            to streamline this sort of thing. But since about half of the people
            who responded to my question indicated some objection to running a
            python-enabled vim, this seems like an inconsiderate policy. This
            assumes that the sampling of people who did raise objections to the
            use of Python have a tendency to use third-party vim modules under the
            same set of circumstances in which `has('python') == 0`. Presumably
            they wouldn't have responded if that weren't the case.

            Cheers
            -Ted

            On Jul 7, 7:33 pm, Tony Mechelynck <antoine.mechely...@...>
            wrote:
            > On 30/06/10 03:20, Ted wrote:
            >
            >
            >
            >
            >
            > > Hello folks,
            >
            > > I'm wondering if there are some figures somewhere that would provide
            > > some sort of estimate of the percentage of vim users who have python
            > > installed, or would be free of objections to installing it if a module
            > > required it.  I'm working on some vim modules, to be released for
            > > general use, that are threatening to become pretty complicated, and
            > > would prefer to write them in python.  Is it likely that this would
            > > lock out a significant portion of the vim user population?  Is it
            > > frowned upon to use external languages in cases where it's not
            > > entirely necessary?  Python is more or less ubiquitous on linux
            > > installs, but I don't feel like I could guess at how many vim users on
            > > other platforms would be unable or unwilling to install it.
            >
            > > The modules themselves are relatively general purpose; my motivation
            > > to code them in Python stems partly from this very generality: it's
            > > advantageous to have that code available outside of the context of
            > > vim.  I also find that I tend more and more toward a functional
            > > programming style that doesn't work particularly well in vimscript.
            >
            > > Cheers
            > > -Ted
            >
            > Myself, I have Python installed "just in case", and even compiled into
            > Vim, but in practice I don't use it, in part because I don't know
            > Python, in part because, to extend or customize Vim, vimscript is good
            > enough for me. If I found a good useful script written in Vim + Python I
            > would not necessarily shun it as others have said they would; but so far
            > all my third- (and second- ;-) ) -party scripts are in "plain" vimscript.
            >
            > About terminology: I think it isn't cast in bronze, but personally I use
            > "a Vim script" in two words to mean "a file to be sourced by Vim", or
            > "vimscript" in one word to mean "the programming language used to write
            > Vim scripts".
            >
            > My main use (AFAIK) for the Python interpreter is to run Mercurial ;-)
            >
            > Best regards,
            > Tony.
            > --
            > The fact that it works is immaterial.
            >                 -- L. Ogborn

            --
            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
          • Nico
            ... If I had to make a completely wild guess on python support, I d say maybe 50% of Vim script users have python-enabled Vim, and another 25% could very
            Message 5 of 15 , Jul 13, 2010
              On Jun 29, 6:20 pm, Ted <cecinemapasdera...@...> wrote:
              > I'm wondering if there are some figures somewhere that would provide
              > some sort of estimate of the percentage of vim users who have python
              > installed, or would be free of objections to installing it if a module
              > required it. .....

              If I had to make a completely wild guess on python support, I'd say
              maybe 50% of Vim script users have python-enabled Vim, and another 25%
              could very easily install it. If your plugin is significantly better
              using python I'd say go ahead and use it. However VimL isn't half bad,
              and will probably have everything you need. So in that case it may be
              silly to endanger 50% of your audience due to your personal language
              preference.

              Python has a few strong advantages, beyond the great standard
              libraries. One of the reasons I moved Conque from VimL to python was
              the very poor performance of VimL when writing to a buffer. This seems
              counter intuitive, but for some reason the python buffer variable is
              almost 10 times faster at updating a buffer than the builtin VimL
              functions getline()/setline(). So if your plugin has to write large
              amounts of content to a buffer, this would be something to take into
              consideration.

              A sample script to show what I mean:

              "
              ---------------------------------------------------------------------------
              " profile results
              -------------------------------------------------------

              FUNCTION ScreenWriteBenchPy()
              Called 1 time
              Total time: 2.697767
              Self time: 2.697767

              count total (s) self (s)
              1 2.697753 python SWB()

              FUNCTION ScreenWriteBench()
              Called 1 time
              Total time: 20.614985
              Self time: 20.614985

              count total (s) self (s)
              501 0.003105 for k in range(1, 500)
              500 0.054599 normal ggdG
              50500 0.301234 for j in range(1, 100)
              550000 3.337009 for i in range(1,10)
              500000 7.288676 call setline(i,
              getline(i) . i . j)
              500000 2.684931 endfor
              50000 0.228279 endfor
              500 0.002241 endfor


              "
              ---------------------------------------------------------------------------
              " test.vim
              ---------------------------------------------------------------

              function! ScreenWriteBench()
              for k in range(1, 500)
              normal ggdG
              for j in range(1, 100)
              for i in range(1,10)
              call setline(i, getline(i) . i . j)
              endfor
              endfor
              endfor
              endfunction

              function! ScreenWriteBenchPy()
              python SWB()
              endfunction

              python << EOF

              import vim

              def SWB():
              for k in range(1, 501):
              del vim.current.buffer[0:10]
              for j in range(1, 101):
              for i in range(1,11):
              if len(vim.current.buffer) < i:
              vim.current.buffer.append('')
              vim.current.buffer[i-1] += str(i) + str(j)

              EOF




              --
              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
            Your message has been successfully submitted and would be delivered to recipients shortly.