chore: add stylua to format the codebase, and run on CI (#1055)
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
local utils = require'nvim-tree.utils'
|
||||
local utils = require "nvim-tree.utils"
|
||||
local a = vim.api
|
||||
|
||||
local M = {}
|
||||
|
||||
local function get_formatted_lines(node)
|
||||
local stats = node.fs_stat
|
||||
local fpath = ' fullpath: ' .. node.absolute_path
|
||||
local created_at = ' created: ' .. os.date("%x %X", stats.birthtime.sec)
|
||||
local modified_at = ' modified: ' .. os.date("%x %X", stats.mtime.sec)
|
||||
local accessed_at = ' accessed: ' .. os.date("%x %X", stats.atime.sec)
|
||||
local size = ' size: ' .. utils.format_bytes(stats.size)
|
||||
local fpath = " fullpath: " .. node.absolute_path
|
||||
local created_at = " created: " .. os.date("%x %X", stats.birthtime.sec)
|
||||
local modified_at = " modified: " .. os.date("%x %X", stats.mtime.sec)
|
||||
local accessed_at = " accessed: " .. os.date("%x %X", stats.atime.sec)
|
||||
local size = " size: " .. utils.format_bytes(stats.size)
|
||||
|
||||
return {
|
||||
fpath,
|
||||
@@ -25,20 +25,22 @@ local current_popup = nil
|
||||
local function setup_window(node)
|
||||
local lines = get_formatted_lines(node)
|
||||
|
||||
local max_width = vim.fn.max(vim.tbl_map(function(n) return #n end, lines))
|
||||
local max_width = vim.fn.max(vim.tbl_map(function(n)
|
||||
return #n
|
||||
end, lines))
|
||||
local winnr = a.nvim_open_win(0, false, {
|
||||
col = 1,
|
||||
row = 1,
|
||||
relative = "cursor",
|
||||
width = max_width + 1,
|
||||
height = #lines,
|
||||
border = 'shadow',
|
||||
border = "shadow",
|
||||
noautocmd = true,
|
||||
style = 'minimal'
|
||||
style = "minimal",
|
||||
})
|
||||
current_popup = {
|
||||
winnr = winnr,
|
||||
file_path = node.absolute_path
|
||||
file_path = node.absolute_path,
|
||||
}
|
||||
local bufnr = a.nvim_create_buf(false, true)
|
||||
a.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
|
||||
|
||||
Reference in New Issue
Block a user