This commit is contained in:
Kiyan 2021-06-29 23:13:28 +02:00 committed by GitHub
parent 62cfaaef4f
commit a80ea23b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 32 deletions

View File

@ -1,6 +1,6 @@
name: Linting and style checking name: Linting and style checking
on: [push, pull_request] on: [push]
jobs: jobs:
luacheck: luacheck:

View File

@ -69,8 +69,8 @@ end
function M.use_git() function M.use_git()
return M.get_icon_state().show_git_icon return M.get_icon_state().show_git_icon
or vim.g.nvim_tree_git_hl == 1 or vim.g.nvim_tree_git_hl == 1
or vim.g.nvim_tree_gitignore == 1 or vim.g.nvim_tree_gitignore == 1
end end
function M.nvim_tree_callback(callback_name) function M.nvim_tree_callback(callback_name)

View File

@ -369,37 +369,37 @@ end
local M = {} local M = {}
function M.draw_help() function M.draw_help()
local help_lines = {'HELP'} local help_lines = {'HELP'}
local help_hl = {{'NvimTreeRootFolder', 0, 0, string.len('HELP')}} local help_hl = {{'NvimTreeRootFolder', 0, 0, string.len('HELP')}}
local bindings = view.View.bindings local bindings = view.View.bindings
local processed = {} local processed = {}
for i, v in pairs(bindings) do for i, v in pairs(bindings) do
if v:sub(1,35) == view.nvim_tree_callback('test'):sub(1,35) then if v:sub(1,35) == view.nvim_tree_callback('test'):sub(1,35) then
v = v:match("'[^']+'[^']*$") v = v:match("'[^']+'[^']*$")
v = v:match("'[^']+'") v = v:match("'[^']+'")
table.insert(processed,{i,v,true}) table.insert(processed,{i,v,true})
else else
v = '"' .. v .. '"' v = '"' .. v .. '"'
table.insert(processed,{i,v,false}) table.insert(processed,{i,v,false})
end
end end
table.sort(processed,function(a,b) end
return (a[3]==b[3] and (a[2]<b[2] or (a[2]==b[2] and #a[1]<#b[1]))) or (a[3] and not b[3]) table.sort(processed,function(a,b)
end) return (a[3]==b[3] and (a[2]<b[2] or (a[2]==b[2] and #a[1]<#b[1]))) or (a[3] and not b[3])
local i, v, builtin end)
for num, val in pairs(processed) do local i, v, builtin
i = val[1] for num, val in pairs(processed) do
v = val[2] i = val[1]
builtin = val[3] v = val[2]
local bind_string = string.format("%6s : %s",i,v) builtin = val[3]
table.insert(help_lines,bind_string) local bind_string = string.format("%6s : %s",i,v)
local hl_len = math.max(6,#i)+2 table.insert(help_lines,bind_string)
table.insert(help_hl,{'NvimTreeFolderName', num, 0, hl_len}) local hl_len = math.max(6,#i)+2
if not builtin then table.insert(help_hl,{'NvimTreeFolderName', num, 0, hl_len})
table.insert(help_hl,{'NvimTreeFileRenamed', num, hl_len, -1}) if not builtin then
end table.insert(help_hl,{'NvimTreeFileRenamed', num, hl_len, -1})
end end
return help_lines, help_hl end
return help_lines, help_hl
end end
function M.draw(tree, reload) function M.draw(tree, reload)