How to navigate in large project in VIM

后端 未结 12 2460
温柔的废话
温柔的废话 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:35

    Although I'm kinda hoping someone will point out a better solution so I can learn something, NERDTree has been good to me for getting to specific files with name completion as long as I have the tree expanded. The command when I need to get to a file is something like:

    ,d/foo.pyo (where foo.py is a file name)

    ,d to open the tree, / to enter search mode, the name (or partial name, or regex, or whatever) of the file, and then o to open.

    Of course you may have to hit 'n' a few times if you didn't type enough of the filename or there are duplicates.

    I admit it feels like a bit of a hack using NERDTree like this although it has gotten so far into my muscle memory by now that I don't even think about it.

    Of course I use ctags too but those are only useful when you have a function near the cursor and need to get to its definition in another file or something. A lot of times I say "OK, I need to work on feature x now" and need to navigate to another file without any references nearby that ctags would really help with.

提交回复
热议问题