Update kemap document

pull/15/head
ray-x 3 years ago
parent f813aa97db
commit 6c9ce98d03

@ -259,7 +259,14 @@ require.'navigator'.setup({
| n | ]r | next treesitter reference/usage|
| n | [r | previous treesitter reference/usage|
| n | \<Leader\>k | toggle reference highlight |
| i/n | \<C-p\> | previous item in list|
| i/n | \<C-n\> | next item in list|
| i/n | \<Up\> | previous item in list|
| i/n | \<Down\> | next item in list|
| i/n | \<C-o\> | Open preview/Apply action|
| n | \<Enter\> | Open preview/Apply action|
| i/n | \<C-b\> | Previous in list|
| i/n | \<C-f\> | next page in list|
### Colors:

@ -173,7 +173,7 @@ local function ts_functions(uri)
end
local unload = false
if not api.nvim_buf_is_loaded(bufnr) then
log("! load buf !", uri, bufnr)
trace("! load buf !", uri, bufnr)
vim.fn.bufload(bufnr)
unload = true
end
@ -181,13 +181,13 @@ local function ts_functions(uri)
local funcs = ts_func(bufnr)
if unload then
local cmd = string.format("bd %d", bufnr)
log(cmd)
trace(cmd)
-- vim.cmd(cmd) -- todo: not sure if it is needed
end
ts_nodes[uri] = funcs
ts_nodes_time[uri] = os.time()
trace(funcs, ts_nodes)
log(string.format("elapsed time: %.4f\n", os.clock() - x))
trace(string.format("elapsed time: %.4f\n", os.clock() - x)) -- how long it tooks
return funcs
end
@ -213,7 +213,7 @@ local function ts_defination(uri, range)
log(cmd)
-- vim.cmd(cmd) -- todo: not sure if it is needed
end
log(string.format(" ts def elapsed time: %.4f\n", os.clock() - x), def_range)
trace(string.format(" ts def elapsed time: %.4f\n", os.clock() - x), def_range) -- how long it takes
return def_range
end
@ -276,7 +276,7 @@ function M.locations_to_items(locations)
end
end
end
log(uri_def[item.uri], item.range)
trace(uri_def[item.uri], item.range) -- set to log if need to get all in rnge
local def = uri_def[item.uri]
if def and def.start and item.range then
if def.start.line == item.range.start.line then

@ -15,7 +15,7 @@ local function get_pads(win_width, text, postfix)
local trim = false
local margin = win_width - #text - #postfix
if margin < 0 then
log('line too long', win_width, #text, #postfix)
trace('line too long', win_width, #text, #postfix)
if #postfix > 1 then
trim = true
end
@ -27,15 +27,13 @@ local function get_pads(win_width, text, postfix)
local space
local i = math.floor((sz + 10) / 10)
i = i * 10 - #text
log(i, #text, #postfix, postfix, text, win_width)
trace(i, #text, #postfix, postfix, text, win_width)
if i + #text + #postfix < win_width then
local rem = win_width - i - #text - #postfix
rem = math.floor(rem / 10)
if rem > 0 then
i = i + rem * 10
-- rem = (i + #text) % 10
-- i = i - rem
log(i)
-- log(i)
end
end
@ -138,7 +136,7 @@ function M.prepare_for_render(items, opts)
ts_report = ts_report .. '🦕 '
end
local header_len = #ts_report + 4 -- magic number 2
log(ts_report, header_len)
trace(ts_report, header_len)
item.text = item.text:gsub('%s*[%[%(%{]*%s*$', '')
if item.call_by ~= nil and #item.call_by > 0 then
@ -174,11 +172,11 @@ function M.prepare_for_render(items, opts)
end
if #space + #item.text + #ts_report >= win_width then
if #item.text + #ts_report > win_width then
log("exceeding", #item.text, #ts_report, win_width)
trace("exceeding", #item.text, #ts_report, win_width)
space = ' '
else
local remain = win_width - #item.text - #ts_report
log("remain", remain)
trace("remain", remain)
space = string.rep(' ', remain)
end
end

@ -79,11 +79,11 @@ function M.find_definition(range, bufnr)
local definition = locals.find_definition(node_at_point, bufnr)
if definition ~= node_at_point then
log("def found:", definition:range(), definition:type())
trace("err: def found:", definition:range(), definition:type())
local r, c = definition:range()
return {start = {line = r, character = c}}
else
log("def not found in ", bufnr)
trace("err: def not found in ", bufnr)
end
end
@ -337,8 +337,8 @@ local function get_all_nodes(bufnr, filter, summary)
end
if item.node_scope then
log(item.type, tsdata:type(), item.node_text, item.kind, item.node_text, "range",
item.node_scope.start.line, item.node_scope['end'].line)
trace(item.type, tsdata:type(), item.node_text, item.kind, item.node_text, "range",
item.node_scope.start.line, item.node_scope['end'].line) -- set to log if need to trace result
end
goto continue
end
@ -392,7 +392,7 @@ function M.buf_func(bufnr)
["type"] = true
}, true)
if #all_nodes < 1 then
log("no node found for ", bufnr)
trace("no node found for ", bufnr) -- set to log
return
end

Loading…
Cancel
Save