如何在Vim中查找所有出现的变量?

前端之家收集整理的这篇文章主要介绍了如何在Vim中查找所有出现的变量?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
vim中,如何在某个目录下的文件中查找所有出现的变量?

我知道vimgrep有时可以工作,但是它只查找文本,如果其他类具有相同名称的变量并且我只想要特定类下的变量,则它不起作用.

我该怎么办?或者我应该改为使用IDE?

为什么要在已有的IDE中使用另一个IDE? Vim是一个可配置的IDE,可用于不同的语言.

您可以使用代码cscopebuild a database.这个数据库

  • Allows searching code for:
    • all references to a symbol
    • global definitions
    • functions called by a function
    • functions calling a function
    • text string
    • regular expression pattern
    • a file
    • files including a file

Cscope的更多功能

  • Curses based (text screen)
  • An information database is generated for faster searches and later reference
  • The fuzzy parser supports C,but is flexible enough to be useful for C++ and Java,and for use as a generalized ‘grep database’ (use it to browse large text documents!)
  • Has a command line mode for inclusion in scripts or as a backend to a GUI/frontend
  • Runs on all flavors of Unix,plus most monopoly-controlled operating systems.

创建数据库后,您可以使用变量,函数等的用法.

编辑(略加OT):
代码上使用Vim时非常方便的另一个很酷的东西是使用Ctagstaglist插件

The “Tag List” plugin is a source code browser plugin for Vim and provides an overview of the structure of source code files and allows you to efficiently browse through source code files for different programming languages.

原文链接:https://www.f2er.com/bash/384403.html

猜你在找的Bash相关文章