* stylua -> EmmyLuaCodeStyle: config and doc * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle: CI * stylua -> EmmyLuaCodeStyle * stylua -> EmmyLuaCodeStyle: call_arg_parentheses = always * stylua -> EmmyLuaCodeStyle * stylua -> EmmyLuaCodeStyle
This commit is contained in:
committed by
GitHub
parent
9650e735ba
commit
1ae1c33ce1
@@ -1,8 +1,8 @@
|
||||
local log = require "nvim-tree.log"
|
||||
local view = require "nvim-tree.view"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local Iterator = require "nvim-tree.iterators.node-iterator"
|
||||
local log = require("nvim-tree.log")
|
||||
local view = require("nvim-tree.view")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local core = require("nvim-tree.core")
|
||||
local Iterator = require("nvim-tree.iterators.node-iterator")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -76,7 +76,7 @@ function M.fn(path)
|
||||
|
||||
if found and view.is_visible() then
|
||||
explorer.renderer:draw()
|
||||
view.set_cursor { line, 0 }
|
||||
view.set_cursor({ line, 0 })
|
||||
end
|
||||
|
||||
running[path_real] = false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local M = {}
|
||||
|
||||
M.find_file = require "nvim-tree.actions.finders.find-file"
|
||||
M.search_node = require "nvim-tree.actions.finders.search-node"
|
||||
M.find_file = require("nvim-tree.actions.finders.find-file")
|
||||
M.search_node = require("nvim-tree.actions.finders.search-node")
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local core = require "nvim-tree.core"
|
||||
local core = require("nvim-tree.core")
|
||||
local find_file = require("nvim-tree.actions.finders.find-file").fn
|
||||
|
||||
local M = {}
|
||||
@@ -75,7 +75,7 @@ function M.fn()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
local path_existed, path_opt
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
path_existed, path_opt = pcall(vim.api.nvim_get_option_value, "path", { buf = bufnr })
|
||||
vim.api.nvim_set_option_value("path", core.get_cwd() .. "/**", { buf = bufnr })
|
||||
else
|
||||
@@ -89,13 +89,13 @@ function M.fn()
|
||||
end
|
||||
-- reset &path
|
||||
if path_existed then
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
vim.api.nvim_set_option_value("path", path_opt, { buf = bufnr })
|
||||
else
|
||||
vim.api.nvim_buf_set_option(bufnr, "path", path_opt) ---@diagnostic disable-line: deprecated
|
||||
end
|
||||
else
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
vim.api.nvim_set_option_value("path", nil, { buf = bufnr })
|
||||
else
|
||||
vim.api.nvim_buf_set_option(bufnr, "path", nil) ---@diagnostic disable-line: deprecated
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
local lib = require "nvim-tree.lib"
|
||||
local log = require "nvim-tree.log"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local events = require "nvim-tree.events"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local lib = require("nvim-tree.lib")
|
||||
local log = require("nvim-tree.log")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local core = require("nvim-tree.core")
|
||||
local events = require("nvim-tree.events")
|
||||
local notify = require("nvim-tree.notify")
|
||||
|
||||
local find_file = require("nvim-tree.actions.finders.find-file").fn
|
||||
|
||||
@@ -89,8 +89,8 @@ local function do_copy(source, destination)
|
||||
break
|
||||
end
|
||||
|
||||
local new_name = utils.path_join { source, name }
|
||||
local new_destination = utils.path_join { destination, name }
|
||||
local new_name = utils.path_join({ source, name })
|
||||
local new_destination = utils.path_join({ destination, name })
|
||||
success, errmsg = do_copy(new_name, new_destination)
|
||||
if not success then
|
||||
return false, errmsg
|
||||
@@ -191,7 +191,7 @@ end
|
||||
function Clipboard:clear_clipboard()
|
||||
self.data[ACTION.copy] = {}
|
||||
self.data[ACTION.cut] = {}
|
||||
notify.info "Clipboard has been emptied."
|
||||
notify.info("Clipboard has been emptied.")
|
||||
self.explorer.renderer:draw()
|
||||
end
|
||||
|
||||
@@ -240,7 +240,7 @@ function Clipboard:do_paste(node, action, action_fn)
|
||||
end
|
||||
|
||||
for _, _node in ipairs(clip) do
|
||||
local dest = utils.path_join { destination, _node.name }
|
||||
local dest = utils.path_join({ destination, _node.name })
|
||||
do_single_paste(_node.absolute_path, dest, action, action_fn)
|
||||
end
|
||||
|
||||
@@ -361,7 +361,7 @@ function Clipboard:copy_path(node)
|
||||
|
||||
if node.name == ".." then
|
||||
-- root
|
||||
content = utils.path_add_trailing ""
|
||||
content = utils.path_add_trailing("")
|
||||
else
|
||||
-- node
|
||||
local absolute_path = node.absolute_path
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
local utils = require "nvim-tree.utils"
|
||||
local events = require "nvim-tree.events"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local core = require "nvim-tree.core"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local utils = require("nvim-tree.utils")
|
||||
local events = require("nvim-tree.events")
|
||||
local lib = require("nvim-tree.lib")
|
||||
local core = require("nvim-tree.core")
|
||||
local notify = require("nvim-tree.notify")
|
||||
|
||||
local find_file = require("nvim-tree.actions.finders.find-file").fn
|
||||
|
||||
@@ -72,7 +72,7 @@ function M.fn(node)
|
||||
end
|
||||
|
||||
if utils.file_exists(new_file_path) then
|
||||
notify.warn "Cannot create: file already exists"
|
||||
notify.warn("Cannot create: file already exists")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -87,10 +87,10 @@ function M.fn(node)
|
||||
for path in utils.path_split(new_file_path) do
|
||||
idx = idx + 1
|
||||
local p = utils.path_remove_trailing(path)
|
||||
if #path_to_create == 0 and vim.fn.has "win32" == 1 then
|
||||
path_to_create = utils.path_join { p, path_to_create }
|
||||
if #path_to_create == 0 and vim.fn.has("win32") == 1 then
|
||||
path_to_create = utils.path_join({ p, path_to_create })
|
||||
else
|
||||
path_to_create = utils.path_join { path_to_create, p }
|
||||
path_to_create = utils.path_join({ path_to_create, p })
|
||||
end
|
||||
if is_last_path_file and idx == num_nodes then
|
||||
create_and_notify(path_to_create)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
local M = {}
|
||||
|
||||
M.create_file = require "nvim-tree.actions.fs.create-file"
|
||||
M.remove_file = require "nvim-tree.actions.fs.remove-file"
|
||||
M.rename_file = require "nvim-tree.actions.fs.rename-file"
|
||||
M.trash = require "nvim-tree.actions.fs.trash"
|
||||
M.create_file = require("nvim-tree.actions.fs.create-file")
|
||||
M.remove_file = require("nvim-tree.actions.fs.remove-file")
|
||||
M.rename_file = require("nvim-tree.actions.fs.rename-file")
|
||||
M.trash = require("nvim-tree.actions.fs.trash")
|
||||
|
||||
function M.setup(opts)
|
||||
M.remove_file.setup(opts)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
local core = require "nvim-tree.core"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local events = require "nvim-tree.events"
|
||||
local view = require "nvim-tree.view"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local core = require("nvim-tree.core")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local events = require("nvim-tree.events")
|
||||
local view = require("nvim-tree.view")
|
||||
local lib = require("nvim-tree.lib")
|
||||
local notify = require("nvim-tree.notify")
|
||||
|
||||
local M = {
|
||||
config = {},
|
||||
@@ -27,13 +27,13 @@ end
|
||||
|
||||
---@param absolute_path string
|
||||
local function clear_buffer(absolute_path)
|
||||
local bufs = vim.fn.getbufinfo { bufloaded = 1, buflisted = 1 }
|
||||
local bufs = vim.fn.getbufinfo({ bufloaded = 1, buflisted = 1 })
|
||||
for _, buf in pairs(bufs) do
|
||||
if buf.name == absolute_path then
|
||||
local tree_winnr = vim.api.nvim_get_current_win()
|
||||
if buf.hidden == 0 and (#bufs > 1 or view.View.float.enable) then
|
||||
vim.api.nvim_set_current_win(buf.windows[1])
|
||||
vim.cmd ":bn"
|
||||
vim.cmd(":bn")
|
||||
end
|
||||
vim.api.nvim_buf_delete(buf.bufnr, { force = true })
|
||||
if not view.View.float.quit_on_focus_loss then
|
||||
@@ -62,7 +62,7 @@ local function remove_dir(cwd)
|
||||
break
|
||||
end
|
||||
|
||||
local new_cwd = utils.path_join { cwd, name }
|
||||
local new_cwd = utils.path_join({ cwd, name })
|
||||
|
||||
-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
|
||||
local stat = vim.loop.fs_stat(new_cwd)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local events = require "nvim-tree.events"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local core = require("nvim-tree.core")
|
||||
local lib = require("nvim-tree.lib")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local events = require("nvim-tree.events")
|
||||
local notify = require("nvim-tree.notify")
|
||||
|
||||
local find_file = require("nvim-tree.actions.finders.find-file").fn
|
||||
|
||||
@@ -64,10 +64,10 @@ function M.rename(node, to)
|
||||
idx = idx + 1
|
||||
|
||||
local p = utils.path_remove_trailing(path)
|
||||
if #path_to_create == 0 and vim.fn.has "win32" == 1 then
|
||||
path_to_create = utils.path_join { p, path_to_create }
|
||||
if #path_to_create == 0 and vim.fn.has("win32") == 1 then
|
||||
path_to_create = utils.path_join({ p, path_to_create })
|
||||
else
|
||||
path_to_create = utils.path_join { path_to_create, p }
|
||||
path_to_create = utils.path_join({ path_to_create, p })
|
||||
end
|
||||
|
||||
if idx == num_nodes then
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local core = require("nvim-tree.core")
|
||||
local lib = require("nvim-tree.lib")
|
||||
local notify = require("nvim-tree.notify")
|
||||
|
||||
local M = {
|
||||
config = {},
|
||||
}
|
||||
|
||||
local utils = require "nvim-tree.utils"
|
||||
local events = require "nvim-tree.events"
|
||||
local utils = require("nvim-tree.utils")
|
||||
local events = require("nvim-tree.events")
|
||||
|
||||
---@param absolute_path string
|
||||
local function clear_buffer(absolute_path)
|
||||
local bufs = vim.fn.getbufinfo { bufloaded = 1, buflisted = 1 }
|
||||
local bufs = vim.fn.getbufinfo({ bufloaded = 1, buflisted = 1 })
|
||||
for _, buf in pairs(bufs) do
|
||||
if buf.name == absolute_path then
|
||||
if buf.hidden == 0 and #bufs > 1 then
|
||||
local winnr = vim.api.nvim_get_current_win()
|
||||
vim.api.nvim_set_current_win(buf.windows[1])
|
||||
vim.cmd ":bn"
|
||||
vim.cmd(":bn")
|
||||
vim.api.nvim_set_current_win(winnr)
|
||||
end
|
||||
vim.api.nvim_buf_delete(buf.bufnr, {})
|
||||
@@ -48,7 +48,7 @@ function M.remove(node)
|
||||
on_stderr = on_stderr,
|
||||
})
|
||||
if need_sync_wait then
|
||||
vim.fn.jobwait { job }
|
||||
vim.fn.jobwait({ job })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
local M = {}
|
||||
|
||||
M.finders = require "nvim-tree.actions.finders"
|
||||
M.fs = require "nvim-tree.actions.fs"
|
||||
M.moves = require "nvim-tree.actions.moves"
|
||||
M.node = require "nvim-tree.actions.node"
|
||||
M.root = require "nvim-tree.actions.root"
|
||||
M.tree = require "nvim-tree.actions.tree"
|
||||
M.finders = require("nvim-tree.actions.finders")
|
||||
M.fs = require("nvim-tree.actions.fs")
|
||||
M.moves = require("nvim-tree.actions.moves")
|
||||
M.node = require("nvim-tree.actions.node")
|
||||
M.root = require("nvim-tree.actions.root")
|
||||
M.tree = require("nvim-tree.actions.tree")
|
||||
|
||||
function M.setup(opts)
|
||||
M.fs.setup(opts)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local M = {}
|
||||
|
||||
M.item = require "nvim-tree.actions.moves.item"
|
||||
M.parent = require "nvim-tree.actions.moves.parent"
|
||||
M.sibling = require "nvim-tree.actions.moves.sibling"
|
||||
M.item = require("nvim-tree.actions.moves.item")
|
||||
M.parent = require("nvim-tree.actions.moves.parent")
|
||||
M.sibling = require("nvim-tree.actions.moves.sibling")
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
local utils = require "nvim-tree.utils"
|
||||
local view = require "nvim-tree.view"
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local explorer_node = require "nvim-tree.explorer.node"
|
||||
local diagnostics = require "nvim-tree.diagnostics"
|
||||
local utils = require("nvim-tree.utils")
|
||||
local view = require("nvim-tree.view")
|
||||
local core = require("nvim-tree.core")
|
||||
local lib = require("nvim-tree.lib")
|
||||
local explorer_node = require("nvim-tree.explorer.node")
|
||||
local diagnostics = require("nvim-tree.diagnostics")
|
||||
|
||||
local M = {}
|
||||
local MAX_DEPTH = 100
|
||||
@@ -65,9 +65,9 @@ local function move(where, what, skip_gitignored)
|
||||
end
|
||||
|
||||
if nex then
|
||||
view.set_cursor { nex, 0 }
|
||||
view.set_cursor({ nex, 0 })
|
||||
elseif vim.o.wrapscan and first then
|
||||
view.set_cursor { first, 0 }
|
||||
view.set_cursor({ first, 0 })
|
||||
end
|
||||
end
|
||||
|
||||
@@ -175,7 +175,7 @@ local function move_prev_recursive(what, skip_gitignored)
|
||||
if
|
||||
node_cur == nil
|
||||
or node_cur == node_init -- we didn't move
|
||||
or not node_cur.nodes -- node is a file
|
||||
or not node_cur.nodes -- node is a file
|
||||
then
|
||||
return
|
||||
end
|
||||
@@ -186,13 +186,13 @@ local function move_prev_recursive(what, skip_gitignored)
|
||||
|
||||
-- 4.3)
|
||||
if node_init.name == ".." then -- root node
|
||||
view.set_cursor { 1, 0 } -- move to root node (position 1)
|
||||
view.set_cursor({ 1, 0 }) -- move to root node (position 1)
|
||||
else
|
||||
local node_init_line = utils.find_node_line(node_init)
|
||||
if node_init_line < 0 then
|
||||
return
|
||||
end
|
||||
view.set_cursor { node_init_line, 0 }
|
||||
view.set_cursor({ node_init_line, 0 })
|
||||
end
|
||||
|
||||
-- 4.4)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local view = require "nvim-tree.view"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local view = require("nvim-tree.view")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local core = require("nvim-tree.core")
|
||||
local lib = require("nvim-tree.lib")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -24,14 +24,14 @@ function M.fn(should_close)
|
||||
local parent = utils.get_parent_of_group(node).parent
|
||||
|
||||
if not parent or not parent.parent then
|
||||
return view.set_cursor { 1, 0 }
|
||||
return view.set_cursor({ 1, 0 })
|
||||
end
|
||||
|
||||
local _, line = utils.find_node(core.get_explorer().nodes, function(n)
|
||||
return n.absolute_path == parent.absolute_path
|
||||
end)
|
||||
|
||||
view.set_cursor { line + 1, 0 }
|
||||
view.set_cursor({ line + 1, 0 })
|
||||
if should_close then
|
||||
parent.open = false
|
||||
if explorer then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local Iterator = require "nvim-tree.iterators.node-iterator"
|
||||
local utils = require("nvim-tree.utils")
|
||||
local core = require("nvim-tree.core")
|
||||
local Iterator = require("nvim-tree.iterators.node-iterator")
|
||||
|
||||
local M = {}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local utils = require "nvim-tree.utils"
|
||||
local utils = require("nvim-tree.utils")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -57,7 +57,7 @@ end
|
||||
function M.close_popup()
|
||||
if current_popup ~= nil then
|
||||
vim.api.nvim_win_close(current_popup.winnr, true)
|
||||
vim.cmd "augroup NvimTreeRemoveFilePopup | au! CursorMoved | augroup END"
|
||||
vim.cmd("augroup NvimTreeRemoveFilePopup | au! CursorMoved | augroup END")
|
||||
|
||||
current_popup = nil
|
||||
end
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
local M = {}
|
||||
|
||||
M.file_popup = require "nvim-tree.actions.node.file-popup"
|
||||
M.open_file = require "nvim-tree.actions.node.open-file"
|
||||
M.run_command = require "nvim-tree.actions.node.run-command"
|
||||
M.system_open = require "nvim-tree.actions.node.system-open"
|
||||
M.file_popup = require("nvim-tree.actions.node.file-popup")
|
||||
M.open_file = require("nvim-tree.actions.node.open-file")
|
||||
M.run_command = require("nvim-tree.actions.node.run-command")
|
||||
M.system_open = require("nvim-tree.actions.node.system-open")
|
||||
|
||||
function M.setup(opts)
|
||||
require("nvim-tree.actions.node.system-open").setup(opts)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
-- Copyright 2019 Yazdani Kiyan under MIT License
|
||||
local lib = require "nvim-tree.lib"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local view = require "nvim-tree.view"
|
||||
local lib = require("nvim-tree.lib")
|
||||
local notify = require("nvim-tree.notify")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local view = require("nvim-tree.view")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -27,7 +27,7 @@ local function usable_win_ids()
|
||||
local bufid = vim.api.nvim_win_get_buf(id)
|
||||
for option, v in pairs(M.window_picker.exclude) do
|
||||
local ok, option_value
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
ok, option_value = pcall(vim.api.nvim_get_option_value, option, { buf = bufid })
|
||||
else
|
||||
ok, option_value = pcall(vim.api.nvim_buf_get_option, bufid, option) ---@diagnostic disable-line: deprecated
|
||||
@@ -91,7 +91,7 @@ local function pick_win_id()
|
||||
for _, win_id in ipairs(not_selectable) do
|
||||
local ok_status, statusline, ok_hl, winhl
|
||||
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
ok_status, statusline = pcall(vim.api.nvim_get_option_value, "statusline", { win = win_id })
|
||||
ok_hl, winhl = pcall(vim.api.nvim_get_option_value, "winhl", { win = win_id })
|
||||
else
|
||||
@@ -105,7 +105,7 @@ local function pick_win_id()
|
||||
}
|
||||
|
||||
-- Clear statusline for windows not selectable
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
vim.api.nvim_set_option_value("statusline", " ", { win = win_id })
|
||||
else
|
||||
vim.api.nvim_win_set_option(win_id, "statusline", " ") ---@diagnostic disable-line: deprecated
|
||||
@@ -118,7 +118,7 @@ local function pick_win_id()
|
||||
local char = M.window_picker.chars:sub(i, i)
|
||||
|
||||
local ok_status, statusline, ok_hl, winhl
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
ok_status, statusline = pcall(vim.api.nvim_get_option_value, "statusline", { win = id })
|
||||
ok_hl, winhl = pcall(vim.api.nvim_get_option_value, "winhl", { win = id })
|
||||
else
|
||||
@@ -132,7 +132,7 @@ local function pick_win_id()
|
||||
}
|
||||
win_map[char] = id
|
||||
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
vim.api.nvim_set_option_value("statusline", "%=" .. char .. "%=", { win = id })
|
||||
vim.api.nvim_set_option_value("winhl", "StatusLine:NvimTreeWindowPicker,StatusLineNC:NvimTreeWindowPicker", { win = id })
|
||||
else
|
||||
@@ -146,9 +146,9 @@ local function pick_win_id()
|
||||
end
|
||||
end
|
||||
|
||||
vim.cmd "redraw"
|
||||
vim.cmd("redraw")
|
||||
if vim.opt.cmdheight._value ~= 0 then
|
||||
print "Pick window: "
|
||||
print("Pick window: ")
|
||||
end
|
||||
local _, resp = pcall(get_user_input_char)
|
||||
resp = (resp or ""):upper()
|
||||
@@ -157,7 +157,7 @@ local function pick_win_id()
|
||||
-- Restore window options
|
||||
for _, id in ipairs(selectable) do
|
||||
for opt, value in pairs(win_opts[id]) do
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
vim.api.nvim_set_option_value(opt, value, { win = id })
|
||||
else
|
||||
vim.api.nvim_win_set_option(id, opt, value) ---@diagnostic disable-line: deprecated
|
||||
@@ -170,7 +170,7 @@ local function pick_win_id()
|
||||
-- Ensure window still exists at this point
|
||||
if vim.api.nvim_win_is_valid(id) then
|
||||
for opt, value in pairs(win_opts[id]) do
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
vim.api.nvim_set_option_value(opt, value, { win = id })
|
||||
else
|
||||
vim.api.nvim_win_set_option(id, opt, value) ---@diagnostic disable-line: deprecated
|
||||
@@ -300,7 +300,7 @@ local function open_in_new_window(filename, mode)
|
||||
|
||||
-- No need to split, as we created a new window.
|
||||
create_new_window = false
|
||||
if mode:match "split$" then
|
||||
if mode:match("split$") then
|
||||
mode = "edit"
|
||||
end
|
||||
elseif not vim.o.hidden then
|
||||
@@ -309,14 +309,14 @@ local function open_in_new_window(filename, mode)
|
||||
local target_bufid = vim.api.nvim_win_get_buf(target_winid)
|
||||
|
||||
local modified
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
modified = vim.api.nvim_get_option_value("modified", { buf = target_bufid })
|
||||
else
|
||||
modified = vim.api.nvim_buf_get_option(target_bufid, "modified") ---@diagnostic disable-line: deprecated
|
||||
end
|
||||
|
||||
if modified then
|
||||
if not mode:match "split$" then
|
||||
if not mode:match("split$") then
|
||||
mode = "vsplit"
|
||||
end
|
||||
end
|
||||
@@ -342,7 +342,7 @@ local function open_in_new_window(filename, mode)
|
||||
if create_new_window then
|
||||
-- generated from vim.api.nvim_parse_cmd("belowright vsplit foo", {})
|
||||
command = { cmd = "vsplit", mods = { split = new_window_side }, args = { fname } }
|
||||
elseif mode:match "split$" then
|
||||
elseif mode:match("split$") then
|
||||
command = { cmd = mode, args = { fname } }
|
||||
else
|
||||
command = { cmd = "edit", args = { fname } }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local utils = require("nvim-tree.utils")
|
||||
local core = require("nvim-tree.core")
|
||||
|
||||
local M = {}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
local notify = require "nvim-tree.notify"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local notify = require("nvim-tree.notify")
|
||||
local utils = require("nvim-tree.utils")
|
||||
|
||||
local M = {}
|
||||
|
||||
---@param node Node
|
||||
local function user(node)
|
||||
if #M.config.system_open.cmd == 0 then
|
||||
require("nvim-tree.utils").notify.warn "Cannot open file with system application. Unrecognized platform."
|
||||
require("nvim-tree.utils").notify.warn("Cannot open file with system application. Unrecognized platform.")
|
||||
return
|
||||
end
|
||||
|
||||
@@ -69,7 +69,7 @@ function M.setup(opts)
|
||||
M.config = {}
|
||||
M.config.system_open = opts.system_open or {}
|
||||
|
||||
if vim.fn.has "nvim-0.10" == 1 and #M.config.system_open.cmd == 0 then
|
||||
if vim.fn.has("nvim-0.10") == 1 and #M.config.system_open.cmd == 0 then
|
||||
M.open = native
|
||||
else
|
||||
M.open = user
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local log = require "nvim-tree.log"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local log = require("nvim-tree.log")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local core = require("nvim-tree.core")
|
||||
|
||||
local M = {
|
||||
current_tab = vim.api.nvim_get_current_tabpage(),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local utils = require("nvim-tree.utils")
|
||||
local core = require("nvim-tree.core")
|
||||
|
||||
local M = {}
|
||||
|
||||
---@param node Node
|
||||
function M.fn(node)
|
||||
if not node or node.name == ".." then
|
||||
require("nvim-tree.actions.root.change-dir").fn ".."
|
||||
require("nvim-tree.actions.root.change-dir").fn("..")
|
||||
else
|
||||
local cwd = core.get_cwd()
|
||||
if cwd == nil then
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local M = {}
|
||||
|
||||
M.change_dir = require "nvim-tree.actions.root.change-dir"
|
||||
M.dir_up = require "nvim-tree.actions.root.dir-up"
|
||||
M.change_dir = require("nvim-tree.actions.root.change-dir")
|
||||
M.dir_up = require("nvim-tree.actions.root.dir-up")
|
||||
|
||||
function M.setup(opts)
|
||||
M.change_dir.setup(opts)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local view = require "nvim-tree.view"
|
||||
local finders_find_file = require "nvim-tree.actions.finders.find-file"
|
||||
local core = require("nvim-tree.core")
|
||||
local lib = require("nvim-tree.lib")
|
||||
local view = require("nvim-tree.view")
|
||||
local finders_find_file = require("nvim-tree.actions.finders.find-file")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -49,9 +49,9 @@ function M.fn(opts)
|
||||
end
|
||||
elseif opts.open then
|
||||
-- open
|
||||
lib.open { current_window = opts.current_window, winid = opts.winid }
|
||||
lib.open({ current_window = opts.current_window, winid = opts.winid })
|
||||
if not opts.focus then
|
||||
vim.cmd "noautocmd wincmd p"
|
||||
vim.cmd("noautocmd wincmd p")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
local M = {}
|
||||
|
||||
M.find_file = require "nvim-tree.actions.tree.find-file"
|
||||
M.modifiers = require "nvim-tree.actions.tree.modifiers"
|
||||
M.open = require "nvim-tree.actions.tree.open"
|
||||
M.toggle = require "nvim-tree.actions.tree.toggle"
|
||||
M.resize = require "nvim-tree.actions.tree.resize"
|
||||
M.find_file = require("nvim-tree.actions.tree.find-file")
|
||||
M.modifiers = require("nvim-tree.actions.tree.modifiers")
|
||||
M.open = require("nvim-tree.actions.tree.open")
|
||||
M.toggle = require("nvim-tree.actions.tree.toggle")
|
||||
M.resize = require("nvim-tree.actions.tree.resize")
|
||||
|
||||
function M.setup(opts)
|
||||
M.find_file.setup(opts)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local Iterator = require "nvim-tree.iterators.node-iterator"
|
||||
local utils = require("nvim-tree.utils")
|
||||
local core = require("nvim-tree.core")
|
||||
local lib = require("nvim-tree.lib")
|
||||
local Iterator = require("nvim-tree.iterators.node-iterator")
|
||||
|
||||
local M = {}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local core = require "nvim-tree.core"
|
||||
local Iterator = require "nvim-tree.iterators.node-iterator"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local core = require("nvim-tree.core")
|
||||
local Iterator = require("nvim-tree.iterators.node-iterator")
|
||||
local notify = require("nvim-tree.notify")
|
||||
local lib = require("nvim-tree.lib")
|
||||
|
||||
local M = {}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
local M = {}
|
||||
|
||||
M.collapse_all = require "nvim-tree.actions.tree.modifiers.collapse-all"
|
||||
M.expand_all = require "nvim-tree.actions.tree.modifiers.expand-all"
|
||||
M.toggles = require "nvim-tree.actions.tree.modifiers.toggles"
|
||||
M.collapse_all = require("nvim-tree.actions.tree.modifiers.collapse-all")
|
||||
M.expand_all = require("nvim-tree.actions.tree.modifiers.expand-all")
|
||||
M.toggles = require("nvim-tree.actions.tree.modifiers.toggles")
|
||||
|
||||
function M.setup(opts)
|
||||
M.expand_all.setup(opts)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local lib = require "nvim-tree.lib"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local core = require "nvim-tree.core"
|
||||
local lib = require("nvim-tree.lib")
|
||||
local utils = require("nvim-tree.utils")
|
||||
local core = require("nvim-tree.core")
|
||||
local M = {}
|
||||
|
||||
---@param explorer Explorer
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local lib = require "nvim-tree.lib"
|
||||
local view = require "nvim-tree.view"
|
||||
local finders_find_file = require "nvim-tree.actions.finders.find-file"
|
||||
local lib = require("nvim-tree.lib")
|
||||
local view = require("nvim-tree.view")
|
||||
local finders_find_file = require("nvim-tree.actions.finders.find-file")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -29,11 +29,11 @@ function M.fn(opts)
|
||||
view.focus()
|
||||
else
|
||||
-- open
|
||||
lib.open {
|
||||
lib.open({
|
||||
path = opts.path,
|
||||
current_window = opts.current_window,
|
||||
winid = opts.winid,
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- find file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local view = require "nvim-tree.view"
|
||||
local view = require("nvim-tree.view")
|
||||
|
||||
local M = {}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local lib = require "nvim-tree.lib"
|
||||
local view = require "nvim-tree.view"
|
||||
local finders_find_file = require "nvim-tree.actions.finders.find-file"
|
||||
local lib = require("nvim-tree.lib")
|
||||
local view = require("nvim-tree.view")
|
||||
local finders_find_file = require("nvim-tree.actions.finders.find-file")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -45,11 +45,11 @@ function M.fn(opts, no_focus, cwd, bang)
|
||||
view.close()
|
||||
else
|
||||
-- open
|
||||
lib.open {
|
||||
lib.open({
|
||||
path = opts.path,
|
||||
current_window = opts.current_window,
|
||||
winid = opts.winid,
|
||||
}
|
||||
})
|
||||
|
||||
-- find file
|
||||
if M.config.update_focused_file.enable or opts.find_file then
|
||||
@@ -64,7 +64,7 @@ function M.fn(opts, no_focus, cwd, bang)
|
||||
|
||||
-- restore focus
|
||||
if not opts.focus then
|
||||
vim.cmd "noautocmd wincmd p"
|
||||
vim.cmd("noautocmd wincmd p")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user