reference jump to word

pull/4/head
ray-x 3 years ago
parent b23c31735c
commit 8c31546892

@ -64,8 +64,10 @@ function M._preview_location(opts) --location, width, pos_x, pos_y
local win_opts = {syntax = syntax, width = opts.width, pos_x = opts.offset_x or 0, pos_y = opts.offset_y or 10}
win_opts.items = contents
win_opts.hl_line = opts.lnum - range.start.line
if win_opts.hl_line < 0 then win_opts.hl_line = 1 end
log(opts.lnum, range.start.line, win_opts.hl_line)
if win_opts.hl_line < 0 then
win_opts.hl_line = 1
end
verbose(opts.lnum, range.start.line, win_opts.hl_line)
local w = M.new_preview(win_opts)
return w
@ -96,7 +98,7 @@ function M.new_list_view(opts)
data = require "guihua.util".aggregate_filename(items, opts)
end
local wwidth = api.nvim_get_option("columns")
local width = math.min( opts.width or config.width or 120, math.floor(wwidth * 0.8))
local width = math.min(opts.width or config.width or 120, math.floor(wwidth * 0.8))
local wheight = config.height or math.floor(api.nvim_get_option("lines") * 0.8)
local prompt = opts.prompt or false
if data and not vim.tbl_isempty(data) then
@ -132,8 +134,8 @@ function M.new_list_view(opts)
end
local l = data[pos]
if l.filename ~= nil then
-- log ('openfile ', l.filename, l.lnum)
util.open_file_at(l.filename, l.lnum)
verbose("openfile ", l.filename, l.lnum, l.col)
util.open_file_at(l.filename, l.lnum, l.col)
end
end,
on_move = opts.on_move or function(pos)

@ -322,7 +322,7 @@ local function setup(user_opts)
}
for i = 1, #disable_ft do
if ft == disable_ft[i] then
retry = false
return
end
end
if lspconfig == nil then

@ -212,8 +212,10 @@ M.open_file = function(filename)
vim.api.nvim_command(string.format("e! %s", filename))
end
M.open_file_at = function(filename, line)
M.open_file_at = function(filename, line, col)
vim.api.nvim_command(string.format("e! +%s %s", line, filename))
col = col or 1
vim.api.nvim_command(string.format("normal! %dl", col-1))
end
function M.exists(var)

Loading…
Cancel
Save