Skip to main content
Module

x/ddc_vim/deps.ts>op.tagbsearch

Dark deno-powered completion framework for neovim/Vim
Latest
variable op.tagbsearch
import { op } from "https://deno.land/x/ddc_vim@v4.3.1/deps.ts";
const { tagbsearch } = op;

When searching for a tag (e.g., for the :ta command), Vim can either use a binary search or a linear search in a tags file. Binary searching makes searching for a tag a LOT faster, but a linear search will find more tags if the tags file wasn't properly sorted. Vim normally assumes that your tags files are sorted, or indicate that they are not sorted. Only when this is not the case does the 'tagbsearch' option need to be switched off.

When 'tagbsearch' is on, binary searching is first used in the tags files. In certain situations, Vim will do a linear search instead for certain files, or retry all files with a linear search. When 'tagbsearch' is off, only a linear search is done.

Linear searching is done anyway, for one file, when Vim finds a line at the start of the file indicating that it's not sorted:

!_TAG_FILE_SORTED    0       /some comment/

[The whitespace before and after the '0' must be a single ]

When a binary search was done and no match was found in any of the files listed in 'tags', and case is ignored or a pattern is used instead of a normal tag name, a retry is done with a linear search. Tags in unsorted tags files, and matches with different case will only be found in the retry.

If a tag file indicates that it is case-fold sorted, the second, linear search can be avoided when case is ignored. Use a value of '2' in the "!_TAG_FILE_SORTED" line for this. A tag file can be case-fold sorted with the -f switch to "sort" in most unices, as in the command: "sort -f -o tags tags". For Universal ctags and Exuberant ctags version 5.x or higher (at least 5.5) the --sort=foldcase switch can be used for this as well. Note that case must be folded to uppercase for this to work.

By default, tag searches are case-sensitive. Case is ignored when 'ignorecase' is set and 'tagcase' is "followic", or when 'tagcase' is "ignore". Also when 'tagcase' is "followscs" and 'smartcase' is set, or 'tagcase' is "smart", and the pattern contains only lowercase characters.

When 'tagbsearch' is off, tags searching is slower when a full match exists, but faster when no full match exists. Tags in unsorted tags files may only be found with 'tagbsearch' off. When the tags file is not sorted, or sorted in a wrong way (not on ASCII byte value), 'tagbsearch' should be off, or the line given above must be included in the tags file. This option doesn't affect commands that find all matching tags (e.g., command-line completion and ":help").

(default on)

type

GlobalOption<boolean>