とっしぃのTech Memo

PHPとかサーバとか他色々言語のメモ的な。あとはたまにガジェットとか。

vimのtags設定(セミコロンの意味的な)

vimrcでtaglistの設定をごちゃごちゃといじくってる時に、下記サイト


Re: vimの勉強〜タグジャンプの勘どころ〜 - daffy log - 永遠に未完成

2009-07-22 - daffy log

を見つけて、

最後のセミコロン重要。

'tags'オプションに指定するセミコロンは便利なのに割と知られていないので紹介してみた。詳細は :help file-searching

って書いてあったので実際に調べてみた。

:help file-searching

をとりあえず叩いてみる。

1637 2) Upward search:
1638 Here you can give a directory and then search the directory tree upward for
1639 a file. You could give stop-directories to limit the upward search. The
1640 stop-directories are appended to the path (for the 'path' option) or to
1641 the filename (for the 'tags' option) with a ';'. If you want several
1642 stop-directories separate them with ';'. If you want no stop-directory
1643 ("search upward till the root directory) just use ';'.
1644 /usr/include/sys;/usr
1645 will search in:
1646 /usr/include/sys
1647 /usr/include
1648 /usr
1649
1650 If you use a relative path the upward search is started in Vim's current
1651 directory or in the directory of the current file (if the relative path
1652 starts with './' and 'd' is not included in 'cpoptions').
1653
1654 If Vim's current path is /u/user_x/work/release and you do
1655 :set path=include;/u/user_x
1656 and then search for a file with gf the file is searched in:
1657 /u/user_x/work/release/include
1658 /u/user_x/work/include
1659 /u/user_x/include

あ、ちなみにVimCentOSに7.4入れたやつです。
neocomplete使いたかったので(*´艸`*)


んで多分L1639の最後のThe辺りからがそれっぽいこと書いてそう。

まずはGoogle翻訳にぶち込んでみましょう。

';'ストップディレクトリはと( 'path'オプションのために)パスに、または( 'タグ'オプション用)のファイル名に付加されます。必要に応じていくつかのストップディレクトリがで区切り';'。

日本語でおk(´・ω・`)


拙い英語力(しかも読むのonly)で超意訳してみると、

「上方向に検索するならセミコロンで区切って、そのストップディレクトリ指定するといいよ。
ストップディレクトリ指定しない(Rootディレクトリまで遡る)ならセミコロンだけつけてね」

ということだろうか。


と思ってもうちょい検索したらこんなん出てきてしまった。

2) 上向き検索:
この方法ではディレクトリを指定すると、そのディレクトリから上に遡ってファイ
ルを探す。上向き探索の上限となるディレクトリが指定できる。それはパス (オプ
ション 'path') かファイル名 (オプション 'tags') の末尾に ';' で区切って指定
する。複数のディレクトリを指定したいときはそれらを ';' で区切る。上限ディレ
クトリを指定したくないときは (ルートディレクトリまで上向き検索したいとき)
';' だけを付ける。

Vim documentation: editing


めっちゃわかりやすい!!!


でもまぁさっきの超意訳とそんなに違うことは言ってない気がする。

よかったよかった。