Can I increase the tagstack size and prevent duplicates?

34 views Asked by At

While in thought, after some fidgeting with ctrl+], my tagstack looked like this.

:tags
  # TO tag         FROM line  in file/text
> 1  1 useParams         193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
  2  1 useParams         193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
  3  1 useParams         193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
  4  1 useParams         193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
  5  1 useParams         193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
  6  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
  7  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
  8  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
  9  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 10  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 11  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 12  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 13  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 14  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 15  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 16  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 17  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 18  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 19  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;
 20  1 Params            193  export function useParams<Params extends { [K in keyof Params]?: string } = {}>(): Params;

The start fell off.

  • Can I increase the size of the tag stack?
  • Can I prevent adding an entry to the stack when it is identical with what's already on top of the stack?
1

There are 1 answers

1
romainl On

Can I increase the size of the tag stack?

:help :tags says:

If the stack was full (it can hold up to 20
entries), the oldest entry is deleted and the older entries shift one
position up (their index number is decremented by one).

so the answer is no.

Can I prevent adding an entry to the stack when it is identical with what's already on top of the stack?

:help tagstack-examples, just a few screens below :help tagstack, has a couple of examples that should get you started. In your case, you would check if a similar entry already exists with :help gettagstack() before adding it with :help settagstack().

Note that the tag stack can be used in two ways. Picking from the list, as you seem to do, would probably benefit from deduplication, but the other use, as history, would be broken because of the missing jumps.