Skip to content

Commit

Permalink
feat(lsp): add nvim-lsp-file-operations plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Dec 21, 2023
1 parent 5812210 commit dc452c4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/astrocommunity/lsp/nvim-lsp-file-operations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# nvim-lsp-file-operations

**Repository:** <https://github.com/antosha417/nvim-lsp-file-operations>

Neovim plugin that adds support for file operations using built-in LSP by integrating with `nvim-tree` and `neo-tree`.
35 changes: 35 additions & 0 deletions lua/astrocommunity/lsp/nvim-lsp-file-operations/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
return {
"antosha417/nvim-lsp-file-operations",
-- lazy will handle loading nvim-tree and neo-tree appropriately based on the module load and our `init` function
lazy = true,
init = function() -- lazily load plugin after a tree plugin is loaded
-- the plugins that should trigger this one to load when they have loaded
local plugins = { "nvim-tree.lua", "neo-tree.nvim" }

local load_plugin = function() require("lazy").load { plugins = { "nvim-lsp-file-operations" } } end
local lazy_plugins = require("lazy.core.config").plugins

-- check if any of the plugins are already loaded, in which case load
for _, plugin in ipairs(plugins) do
if vim.tbl_get(lazy_plugins, plugin, "_", "loaded") then
vim.schedule(load_plugin)
return
end
end

-- if none, then set up autocommand to load the plugin
local autocmd
autocmd = vim.api.nvim_create_autocmd("User", {
pattern = "LazyLoad",
desc = "lazily load nvim-lsp-file-operations",
callback = function(args)
if vim.tbl_contains(plugins, args.data) then
load_plugin()
if autocmd then vim.api.nvim_del_autocmd(autocmd) end
end
end,
})
end,
main = "lsp-file-operations", -- set the main module name where the `setup` function is
opts = {},
}

0 comments on commit dc452c4

Please sign in to comment.