summaryrefslogtreecommitdiffstats
path: root/runtime/doc/tagsrch.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-10 22:10:56 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-10 22:10:56 +0200
commitd1caa941d876181aae0ebebc6ea954045bf0da24 (patch)
treed1bf3cfdafc0c363b970f95aaa55a3a9c81f12fb /runtime/doc/tagsrch.txt
parent7b293c730b07d1586688e622b8d9cbbb4a52379b (diff)
Update runtime files
Diffstat (limited to 'runtime/doc/tagsrch.txt')
-rw-r--r--runtime/doc/tagsrch.txt25
1 files changed, 24 insertions, 1 deletions
diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt
index ed406e8dc3..0b22deba13 100644
--- a/runtime/doc/tagsrch.txt
+++ b/runtime/doc/tagsrch.txt
@@ -1,4 +1,4 @@
-*tagsrch.txt* For Vim version 8.2. Last change: 2020 Jan 30
+*tagsrch.txt* For Vim version 8.2. Last change: 2020 Apr 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -185,6 +185,29 @@ commands explained above the tag stack will look like this:
The |gettagstack()| function returns the tag stack of a specified window. The
|settagstack()| function modifies the tag stack of a window.
+ *tagstack-examples*
+Write to the tag stack just like `:tag` but with a user-defined
+jumper#jump_to_tag function: >
+ " Store where we're jumping from before we jump.
+ let tag = expand('<cword>')
+ let pos = [bufnr()] + getcurpos()[1:]
+ let item = {'bufnr': pos[0], 'from': pos, 'tagname': tag}
+ if jumper#jump_to_tag(tag)
+ " Jump was successful, write previous location to tag stack.
+ let winid = win_getid()
+ let stack = gettagstack(winid)
+ let stack['items'] = [item]
+ call settagstack(winid, stack, 't')
+ endif
+<
+Set current index of the tag stack to 4: >
+ call settagstack(1005, {'curidx' : 4})
+<
+Push a new item onto the tag stack: >
+ let pos = [bufnr('myfile.txt'), 10, 1, 0]
+ let newtag = [{'tagname' : 'mytag', 'from' : pos}]
+ call settagstack(2, {'items' : newtag}, 'a')
+<
*E73*
When you try to use the tag stack while it doesn't contain anything you will
get an error message.