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

Go to Definition?

Expand Messages
  • James Morrin
    I switched to vim a couple of months ago for some of my development work and Its been great but there is one feature I am still missing that would come in very
    Message 1 of 5 , Mar 6, 2011
    • 0 Attachment
      I switched to vim a couple of months ago for some of my development work and Its been great but there is one feature I am still missing that would come in very handy. 

      Most IDEs I have worked with in the past have some form of "Go to definition" when you are on a class name or a function. In static typed languages its very accurate and in dynamically typed languages it'll give you a list to choose from. Is there a plugin for vim that does the same thing? I need something that will work across python, ruby, javascript, and java. That would complete my vim setup and I would be very grateful! :) 

      BTW I am constantly hitting :w in other text editors / IDEs now. 

      --
      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
    • Ben Fritz
      ... I think you want Vim s ctags interface. See :help tags-and-searches Exuberant ctags is an external application which is used to generate tags of your
      Message 2 of 5 , Mar 6, 2011
      • 0 Attachment
        On Mar 6, 5:40 am, James Morrin <treas...@...> wrote:
        > I switched to vim a couple of months ago for some of my development work and
        > Its been great but there is one feature I am still missing that would come
        > in very handy.
        >
        > Most IDEs I have worked with in the past have some form of "Go to
        > definition" when you are on a class name or a function. In static typed
        > languages its very accurate and in dynamically typed languages it'll give
        > you a list to choose from. Is there a plugin for vim that does the same
        > thing? I need something that will work across python, ruby, javascript, and
        > java. That would complete my vim setup and I would be very grateful! :)
        >
        > BTW I am constantly hitting :w in other text editors / IDEs now.

        I think you want Vim's 'ctags' interface.

        See :help tags-and-searches

        Exuberant ctags is an external application which is used to generate
        tags of your entire code base, and works with many common languages.
        I'm not sure if it works for all of the languages you request, out of
        the box, but it supports a great many common ones.

        --
        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
      • Michael(Xi Zhang)
        ... If you have less than 100 files, another way is to use vimgrep command: nmap :vimgrep /^ s* S + s* / .. include *.h This command will
        Message 3 of 5 , Mar 6, 2011
        • 0 Attachment
          On Sun, Mar 6, 2011 at 11:03 AM, Ben Fritz <fritzophrenic@...> wrote:


          On Mar 6, 5:40 am, James Morrin <treas...@...> wrote:
          > I switched to vim a couple of months ago for some of my development work and
          > Its been great but there is one feature I am still missing that would come
          > in very handy.
          >
          > Most IDEs I have worked with in the past have some form of "Go to
          > definition" when you are on a class name or a function. In static typed
          > languages its very accurate and in dynamically typed languages it'll give
          > you a list to choose from. Is there a plugin for vim that does the same
          > thing? I need something that will work across python, ruby, javascript, and
          > java. That would complete my vim setup and I would be very grateful! :)
          >
          > BTW I am constantly hitting :w in other text editors / IDEs now.

          I think you want Vim's 'ctags' interface.

          See :help tags-and-searches

          Exuberant ctags is an external application which is used to generate
          tags of your entire code base, and works with many common languages.
          I'm not sure if it works for all of the languages you request, out of
          the box, but it supports a great many common ones.

          If you have hundreds/thousands of files to search, you can use Ctags.
          If you have less than 100 files, another way is to use vimgrep command:

          nmap <F5>  :vimgrep /^\s*\S\+\s*<C-R><C-W>/ ..\include\*.h <cr>

          This command will search the type declaration of the word under current cursor in ..\include\*.h files, you can add your own folder here.

          I used Ctags before, it is good, but you have to update tags file ofter.

          For more info, check out 
          :help vimgrep

          Michael

          --
          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
        • Ben Schmidt
          ... I know you probably want something better than this, and others have mentioned alternatives, but a response wouldn t be complete without ... Also, note
          Message 4 of 5 , Mar 6, 2011
          • 0 Attachment
            >> Most IDEs I have worked with in the past have some form of "Go to
            >> definition" when you are on a class name or a function. In static typed
            >> languages its very accurate and in dynamically typed languages it'll give
            >> you a list to choose from. Is there a plugin for vim that does the same
            >> thing? I need something that will work across python, ruby, javascript, and
            >> java. That would complete my vim setup and I would be very grateful! :)

            I know you probably want something better than this, and others have
            mentioned alternatives, but a response wouldn't be complete without
            mentioning these built-in Vim commands:

            :help gd
            :help gD
            :help definition-search

            Also, note that a bunch of people have written plugins to make using the
            ctags and cscope features easier to use. A little googling, perhaps
            restricted to site:vim.org might help you find something useful.

            Ben.



            --
            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
          • lzap
            There are some scripts or plugins but I found all too complicated. My (dumb & working) solution follows. In the project dir I do: # ctags -R . In my
            Message 5 of 5 , Mar 7, 2011
            • 0 Attachment
              There are some scripts or plugins but I found all too complicated. My (dumb & working) solution follows. In the project dir I do:

              # ctags -R .

              In my configuration I mapped <leader>g to script that a) search for tags file in the current dir (and all parents until it gets one), b) regeneratees all tags.

              Here is all you need:

              https://github.com/lzap/vim-lzap/commit/ca63e9924d2eb48420fa36d37ae30128894c17df

              ps - works only on UNIXes 

              --
              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.