using vim as a python class/module/function etc.. browser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Jones

    using vim as a python class/module/function etc.. browser

    I'm trying to make sense of a python program and was wondering if vim
    has any python-oriented functionalities (apart from syntax highlighting)
    that would make it somewhat easier to browse the source code.

    What I had in mind is something that would let me use CTRL+] to
    automatically display whatever object is under the cursor (a bit like
    ctags for code written in C..)

    I have read somewhere about something called 'ptags' but could not find
    it in debian - and I'm not 100% sure it's really a python equivalent of
    ctags.

    I'm not too keen on using a gui IDE and would much prefer to stick with
    vim if at all possible.

    Any pointers or tips from python/vim folks welcome.

    CJ
  • Robert Kern

    #2
    Re: using vim as a python class/module/function etc.. browser

    Chris Jones wrote:[color=blue]
    > I'm trying to make sense of a python program and was wondering if vim
    > has any python-oriented functionalities (apart from syntax highlighting)
    > that would make it somewhat easier to browse the source code.
    >
    > What I had in mind is something that would let me use CTRL+] to
    > automatically display whatever object is under the cursor (a bit like
    > ctags for code written in C..)
    >
    > I have read somewhere about something called 'ptags' but could not find
    > it in debian - and I'm not 100% sure it's really a python equivalent of
    > ctags.[/color]

    On ptags:


    Of course, modern versions of Exuberant Ctags also support Python, too.

    --
    Robert Kern
    robert.kern@gma il.com

    "I have come to believe that the whole world is an enigma, a harmless enigma
    that is made terrible by our own mad attempt to interpret it as though it had
    an underlying truth."
    -- Umberto Eco

    Comment

    • Chris Jones

      #3
      Re: using vim as a python class/module/function etc.. browser

      Robert Kern wrote:[color=blue]
      > Chris Jones wrote:
      >[color=green]
      >>I'm trying to make sense of a python program and was wondering if vim
      >>has any python-oriented functionalities (apart from syntax highlighting)
      >>that would make it somewhat easier to browse the source code.
      >>
      >>What I had in mind is something that would let me use CTRL+] to
      >>automatical ly display whatever object is under the cursor (a bit like
      >>ctags for code written in C..)
      >>
      >>I have read somewhere about something called 'ptags' but could not find
      >>it in debian - and I'm not 100% sure it's really a python equivalent of
      >>ctags.[/color]
      >
      >
      > On ptags:
      > http://www.vim.org/tips/tip.php?tip_id=1188
      >
      > Of course, modern versions of Exuberant Ctags also support Python, too.
      >[/color]

      I apt-installed this package but the man page is rather intimidating so
      I thought I might as well make sure I was going in the right direction.

      Just need to verify that the stable version (sarge) is modern enough..

      Thanks..!

      Comment

      • Chris Jones

        #4
        Re: using vim as a python class/module/function etc.. browser

        Robert Kern wrote:[color=blue]
        > Chris Jones wrote:
        >[color=green]
        >>I'm trying to make sense of a python program and was wondering if vim
        >>has any python-oriented functionalities (apart from syntax highlighting)
        >>that would make it somewhat easier to browse the source code.
        >>
        >>What I had in mind is something that would let me use CTRL+] to
        >>automatical ly display whatever object is under the cursor (a bit like
        >>ctags for code written in C..)
        >>
        >>I have read somewhere about something called 'ptags' but could not find
        >>it in debian - and I'm not 100% sure it's really a python equivalent of
        >>ctags.[/color]
        >
        >
        > On ptags:
        > http://www.vim.org/tips/tip.php?tip_id=1188
        >
        > Of course, modern versions of Exuberant Ctags also support Python, too.
        >[/color]

        I apt-installed this package but the man page is rather intimidating so
        I thought I might as well make sure I was going in the right direction.

        Just need to verify that the stable version (sarge) is modern enough..

        Thanks..!

        Comment

        • Robert Kern

          #5
          Re: using vim as a python class/module/function etc.. browser

          Chris Jones wrote:[color=blue]
          > Robert Kern wrote:[/color]
          [color=blue][color=green]
          >>Of course, modern versions of Exuberant Ctags also support Python, too.[/color]
          >
          > I apt-installed this package but the man page is rather intimidating so
          > I thought I might as well make sure I was going in the right direction.[/color]

          You will probably want to read the vim documentation on how to use ctags from
          vim. That will tell you all you need to know without extraneous cruft.
          [color=blue]
          > Just need to verify that the stable version (sarge) is modern enough..[/color]

          It ought to be. It has supported Python for years and years.

          --
          Robert Kern
          robert.kern@gma il.com

          "I have come to believe that the whole world is an enigma, a harmless enigma
          that is made terrible by our own mad attempt to interpret it as though it had
          an underlying truth."
          -- Umberto Eco

          Comment

          • Daniel Nogradi

            #6
            Re: using vim as a python class/module/function etc.. browser

            > >>Of course, modern versions of Exuberant Ctags also support Python, too.[color=blue][color=green]
            > >
            > > I apt-installed this package but the man page is rather intimidating so
            > > I thought I might as well make sure I was going in the right direction.[/color]
            >
            > You will probably want to read the vim documentation on how to use ctags
            > from
            > vim. That will tell you all you need to know without extraneous cruft.
            >[color=green]
            > > Just need to verify that the stable version (sarge) is modern enough..[/color]
            >
            > It ought to be. It has supported Python for years and years.[/color]

            For browsing source code I found the folding feature of vim very
            useful. It collapses the body of function and class definitions into
            one line so you can have a general overview of definitions in the
            code. It is available from version 6 up and I recently wrote a vim
            plugin specifically for folding python source code. You can find it
            here: http://www.vim.org/scripts/script.php?script_id=1494

            There is also an excellent vim plugin by Yegappan Lakshmanan for
            working with 'tags' files using ctags. It displays all your function
            and class definitions (from multiple files if you wish) in a narrow
            vertical window where you can easily jump to the file containing a
            chosen definition. This script is here:


            HTH,
            Daniel

            Comment

            • Chris Jones

              #7
              Re: using vim as a python class/module/function etc.. browser

              Daniel Nogradi wrote:[color=blue][color=green][color=darkred]
              >>>>Of course, modern versions of Exuberant Ctags also support Python, too.
              >>>
              >>>I apt-installed this package but the man page is rather intimidating so
              >>>I thought I might as well make sure I was going in the right direction.[/color]
              >>
              >>You will probably want to read the vim documentation on how to use ctags
              >>from
              >>vim. That will tell you all you need to know without extraneous cruft.
              >>
              >>[color=darkred]
              >>>Just need to verify that the stable version (sarge) is modern enough..[/color]
              >>
              >>It ought to be. It has supported Python for years and years.[/color]
              >
              >
              > For browsing source code I found the folding feature of vim very
              > useful. It collapses the body of function and class definitions into
              > one line so you can have a general overview of definitions in the
              > code. It is available from version 6 up and I recently wrote a vim
              > plugin specifically for folding python source code. You can find it
              > here: http://www.vim.org/scripts/script.php?script_id=1494[/color]

              I'm currently re-evaluating my vim habits .. see what new stuff I can
              integrate so as to be more productive.. so it's probably a good time to
              look into the folding feature...
              [color=blue]
              >
              > There is also an excellent vim plugin by Yegappan Lakshmanan for
              > working with 'tags' files using ctags. It displays all your function
              > and class definitions (from multiple files if you wish) in a narrow
              > vertical window where you can easily jump to the file containing a
              > chosen definition. This script is here:
              > http://www.vim.org/scripts/script.php?script_id=273[/color]

              this sounds very useful. Thanks very much for pointing me in the right
              direction.
              [color=blue]
              >
              > HTH,
              > Daniel[/color]

              Comment

              • Chris Jones

                #8
                Re: using vim as a python class/module/function etc.. browser

                Daniel Nogradi wrote:[color=blue][color=green][color=darkred]
                >>>>Of course, modern versions of Exuberant Ctags also support Python, too.
                >>>
                >>>I apt-installed this package but the man page is rather intimidating so
                >>>I thought I might as well make sure I was going in the right direction.[/color]
                >>
                >>You will probably want to read the vim documentation on how to use ctags
                >>from
                >>vim. That will tell you all you need to know without extraneous cruft.
                >>
                >>[color=darkred]
                >>>Just need to verify that the stable version (sarge) is modern enough..[/color]
                >>
                >>It ought to be. It has supported Python for years and years.[/color]
                >
                >
                > For browsing source code I found the folding feature of vim very
                > useful. It collapses the body of function and class definitions into
                > one line so you can have a general overview of definitions in the
                > code. It is available from version 6 up and I recently wrote a vim
                > plugin specifically for folding python source code. You can find it
                > here: http://www.vim.org/scripts/script.php?script_id=1494[/color]

                I'm currently re-evaluating my vim habits .. see what new stuff I can
                integrate so as to be more productive.. so it's probably a good time to
                look into the folding feature...
                [color=blue]
                >
                > There is also an excellent vim plugin by Yegappan Lakshmanan for
                > working with 'tags' files using ctags. It displays all your function
                > and class definitions (from multiple files if you wish) in a narrow
                > vertical window where you can easily jump to the file containing a
                > chosen definition. This script is here:
                > http://www.vim.org/scripts/script.php?script_id=273[/color]

                this sounds very useful. Thanks very much for pointing me in the right
                direction.
                [color=blue]
                >
                > HTH,
                > Daniel[/color]

                Comment

                Working...