tagbar for ctags
ctagsというプログラムのインストールが必要です。- LSP を使って更に精度のいいオーバービューを生成する
lspsaga.nvimというプラグイン(セットアップ)があるので、最近は使ってないです。- LSP が対応してないファイルタイプでも動作するという強みがあります。
Markdown,Latex...
- LSP が対応してないファイルタイプでも動作するという強みがあります。
What Tagbar is
Tagbar is a Vim plugin that provides an easy way to browse the tags of the current file and get an overview of its structure.
ctags というプログラミングコード解析ツールを使ってコード内のオブジェクトを列挙して、簡単に飛べるようにしたものです。
(画像内右側のウィンドウ)
なお、このプラグインが動くためには ctags というプログラムのインストールが必要です。(See: ## How to Setup ctags)
Setup
Normal Mode で<F8> (Function Key) で右側の画面をトグルできます。
20-utility-config/tagbar.lua
vim.cmd([[
nmap <F8> :TagbarToggle<CR>
]])How to Setup ctags
- OSX (homebrew)
$ brew tap universal-ctags/universal-ctags
$ brew install --HEAD universal-ctags- Ubuntu
$ sudo apt-get remove exuberant-ctags
$ sudo snap install universal-ctags- ArchLinux
$ pacman -S ctags- Build from source (recommended)
# XDG Base Directory specification
# For more info, see https://wiki.archlinux.org/title/XDG_Base_Directory
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_PREFIX_HOME="$HOME/.local"
export XDG_DATA_HOME="$XDG_PREFIX_HOME/share"
export XDG_STATE_HOME="$XDG_PREFIX_HOME/state"
export XDG_BIN_HOME="$XDG_PREFIX_HOME/bin"
export PATH="$XDG_BIN_HOME:$PATH"
# install ctags
git clone --depth 1 https://github.com/universal-ctags/ctags.git "$XDG_DATA_HOME/ctags"
cd "$XDG_DATA_HOME/ctags"
git submodule update --init --recursive
./autogen.sh && ./configure --prefix="$XDG_PREFIX_HOME" \
&& make -j$(nproc) && make install
cd "$current_dir"Last updated on September 25, 2022