vim config ctags cscope
vim插件配置,包含插件:delimitMate、indentLine、taglist、The-NERD-tree、vim-airline、YouCompleteMe和Vundle config目录:存放配置文件 scripts目录:存放脚本
1.安装vim sudo apt install vim
2.安装ctags和cscope sudo apt install universal-ctags cscope
3.在用户目录下创建~/.vim/bundle目录,在目录中执行以下命令 git clone https://github.com/vim-scripts/delimitMate.vim.git git clone https://github.com/vim-scripts/indentLine.vim.git git clone https://github.com/vim-scripts/taglist.vim.git git clone https://github.com/vim-scripts/The-NERD-tree.git git clone https://github.com/vim-airline/vim-airline.git git clone https://github.com/VundleVim/Vundle.vim.git git clone https://github.com/ycm-core/YouCompleteMe.git git clone https://github.com/vim-scripts/cscope.vim.git
4.将config/.vimrc拷贝到用户目录下~/.vimrc
5.安装插件 进入vim,执行PluginInstall
6.插件YouCompleteMe需要编译安装 a. 安装必要的编译环境 sudo apt install build-essential python3-dev cmake b. 安装其他编程语言环境,也可以等编译报错了再安装 sudo apt install golang-go npm c. 编译所有的语言支持 cd YouCompleteMe git submodule update --init --recursive python3 install.py --all d.编译部分语言支持,比如c++ python3 install.py --clangd-completer
1.ctags使用 将scripts/taglist拷贝到可执行目录,在源码根目录执行taglist生成tags,使用vim打开源码中的文件,可自动加载tags文件 在vim界面按F4显示taglist界面 Ctrl + o 后退 Ctrl + ] 跳转 Ctrl + ww 光标窗口跳转
2.The NerdTree使用 在vim界面按F2
3.生成ctags和cscope索引 在vim界面按F10生成tags索引 在vim界面按F12生成cscope.out索引
4.cscope使用 add : Add a new database (Usage: add file|dir [pre-path] [flags]) find : Query for a pattern (Usage: find a|c|d|e|f|g|i|s|t name) a: Find assignments to this symbol c: Find functions calling this function d: Find functions called by this function e: Find this egrep pattern f: Find this file g: Find this definition i: Find files #including this file s: Find this C symbol t: Find this text string help : Show this message (Usage: help) kill : Kill a connection (Usage: kill #) reset: Reinit all connections (Usage: reset) show : Show connections (Usage: show)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。