commit 53b0f014fcf995d8562e80f1d0f0680e2726a9d3
parent d7cb25307de65f8d41de0355af4c2d885626566f
Author: Daniel Moch <daniel@danielmoch.com>
Date: Tue, 17 Dec 2019 06:06:58 -0500
Vis: Add tags option
Diffstat:
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/.config/vis/ctags.lua b/.config/vis/ctags.lua
@@ -3,6 +3,7 @@
require('vis')
local positions = {}
+local tags = {'tags'}
local function get_path(prefix, path)
if string.find(path, '^./') ~= nil then
@@ -16,11 +17,19 @@ local function find_tags(path)
for i = #path, 1, -1 do
if path:sub(i, i) == '/' then
local prefix = path:sub(1, i)
- local filename = prefix .. 'tags'
- local file = io.open(filename, 'r')
+ for j = 1, #tags do
+ local tagfile = tags[j]
+ local filename
+ if tagfile:sub(1,1) == '/' then
+ filename = tagfile
+ else
+ filename = prefix .. tagfile
+ end
+ local file = io.open(filename, 'r')
- if file ~= nil then
- return file, prefix
+ if file ~= nil then
+ return file, prefix
+ end
end
end
end
@@ -251,6 +260,13 @@ vis:command_register("pop", function(argv, force, win, selection, range)
pop_pos()
end)
+vis:option_register("tags", "string", function(value)
+ tags = {}
+ for str in value:gmatch('([^%s]+)') do
+ table.insert(tags, str)
+ end
+end, 'paths to search for tags')
+
vis:map(vis.modes.NORMAL, '<C-]>', function(keys)
local query = get_query()
if query ~= nil then
diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua
@@ -6,6 +6,7 @@ vis.events.subscribe(vis.events.INIT, function()
-- Your global configuration options
vis:command('set theme djmoch')
vis:command('set autoindent')
+ vis:command('set tags "tags .git/tags"')
end)
vis.events.subscribe(vis.events.WIN_OPEN, function(win)