How to navigate in large project in VIM

后端 未结 12 2477
温柔的废话
温柔的废话 2020-12-12 10:19

How do you manage big projects (hundreds of files) using only VIM?

I personally start having problems in any larger than small project.

  • is there any wa
12条回答
  •  臣服心动
    2020-12-12 10:39

    As well as the invaluable ctags and the various associated commands. I also couldn't live without the project plugin, which allows you to have the files of interest associated with a project in a separate pane. I can't remember how much of my setup is customised, but if I want to open a source file called Debug.c, I hit:

         " Opens the project pane
    /De       " Searches for "De", which is likely to be enough to find Debug.c or possibly Debug.h
       " Opens the selected file and closes the project pane
    

    I often then do:

    :vsp      " Vertically split the window
         " Reopen project pane
    #         " Search back to find previous entry with the same name (to find
                Debug.h if I was on Debug.c: my headers are in Headers/ and
                my source is in Source/, so the headers come earlier in the list
                than the source).  I use * to go the other way, obviously.
       " Open the header file in the other window and close the project window.
    

    With this relatively short sequence, I can open any file and it's header in a vertical split. Since the project plugin window is just a text file, completion is achieved by using Vim's searching capability.

提交回复
热议问题