chore: add stylua to format the codebase, and run on CI (#1055)
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
local a = vim.api
|
||||
local utils = require'nvim-tree.utils'
|
||||
local utils = require "nvim-tree.utils"
|
||||
|
||||
local M = {
|
||||
current_tab = a.nvim_get_current_tabpage(),
|
||||
options = {
|
||||
global = false,
|
||||
change_cwd = true,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function M.fn(name, with_open)
|
||||
if not TreeExplorer then return end
|
||||
if not TreeExplorer then
|
||||
return
|
||||
end
|
||||
|
||||
local foldername = name == '..' and vim.fn.fnamemodify(utils.path_remove_trailing(TreeExplorer.cwd), ':h') or name
|
||||
local foldername = name == ".." and vim.fn.fnamemodify(utils.path_remove_trailing(TreeExplorer.cwd), ":h") or name
|
||||
local no_cwd_change = vim.fn.expand(foldername) == TreeExplorer.cwd
|
||||
local new_tab = a.nvim_get_current_tabpage()
|
||||
local is_window = (vim.v.event.scope == "window" or vim.v.event.changed_window) and new_tab == M.current_tab
|
||||
@@ -26,16 +28,16 @@ end
|
||||
function M.force_dirchange(foldername, with_open)
|
||||
if M.options.change_cwd and vim.tbl_isempty(vim.v.event) then
|
||||
if M.options.global then
|
||||
vim.cmd('cd '..vim.fn.fnameescape(foldername))
|
||||
vim.cmd("cd " .. vim.fn.fnameescape(foldername))
|
||||
else
|
||||
vim.cmd('lcd '..vim.fn.fnameescape(foldername))
|
||||
vim.cmd("lcd " .. vim.fn.fnameescape(foldername))
|
||||
end
|
||||
end
|
||||
require'nvim-tree.lib'.init(foldername)
|
||||
require("nvim-tree.lib").init(foldername)
|
||||
if with_open then
|
||||
require"nvim-tree.lib".open()
|
||||
require("nvim-tree.lib").open()
|
||||
else
|
||||
require"nvim-tree.renderer".draw()
|
||||
require("nvim-tree.renderer").draw()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user