通过vim-plug安装tarbar
安装好vim-plug后,在.vimrc中添加
call plug#begin('~/.vim/plugged')
Plug 'majutsushi/tagbar'
call plug#end()
然后执行
source ~/.vimrc
:PlugInstall
然后去cpp文件使用tagba,执行
:TagbarToggle
出现错误
Please download Exuberant Ctags from ctags.sourceforge.net and install it in a directory in your $PATH or set g:tagbar_ctags_bin.
原理安装tagbar需要依赖
- Vim >= 7.3.1058 or any version of NeoVim.
- Exuberant Ctags >= 5.5, or (highly recommended) any version of Universal Ctags which is a currently maintained fork of Exuberant Ctags with many bugfixes, support for many more formats, and proper Unicode support. Some additional formats can also be handled by other providers such as jsctags, phpctags, or others.
我的vim是vim8.所以,我还需要去安装Ctgas。
首先git Ctgas
git clone https://github.com/universal-ctags/ctags.git
下载好后进入文件夹中
cd ctags
然后执行以下命令
$ ./autogen.sh
$ ./configure --prefix=/where/you/want # defaults to /usr/local
$ make
$ make install # may require extra privileges depending on where to install
又出现错误
执行./autogen.sh时
- type autoreconf ./autogen.sh: 第 5 行:type: autoreconf: 未找到 + exit 1
解决办法
yum -y install install autoconf automake libtool
执行make install # may require extra privileges depending on where to install时
/usr/bin/install: 无法删除"/usr/local/bin/ctags": 权限不够
/usr/bin/install: 无法删除"/usr/local/bin/readtags": 权限不够
解决办法,进入root用户,执行
chmod -R 777 /usr/local/bin
给其权限。
最后可以使用tagbar了。
本文详细介绍如何在Vim环境中配置Tagbar插件,并解决在安装过程中遇到的依赖问题,包括Ctags的安装与配置,确保代码导航功能正常运行。
753

被折叠的 条评论
为什么被折叠?



