upload dir

This commit is contained in:
cdricms
2025-03-12 23:57:33 +01:00
parent 9bc332b833
commit 9ec1860ca7
3 changed files with 199 additions and 116 deletions

View File

@@ -3,42 +3,46 @@ local cli = require("nvim-sync-ftp.cli")
local M = {}
function M.setup(opts)
local config = cli.getConfig()
local config = cli.getConfig()
vim.api.nvim_create_user_command("SyncFtpMapToRemote", function(params)
cli.MapToRemote(params)
end, {
force = true,
nargs = '*',
range = true,
})
vim.api.nvim_create_user_command("SyncFtpMapToRemote", function (params)
cli.MapToRemote(params)
end,{
force = true,
nargs = '*',
range = true,
})
vim.api.nvim_create_user_command("SyncFtpUpload", function(params)
cli.UploadFile()
end, {
force = true,
nargs = '*',
range = true,
})
vim.api.nvim_create_user_command("SyncFtpUpload", function(params)
cli.Upload()
end,{
force = true,
nargs = '*',
range = true,
})
vim.api.nvim_create_user_command("SyncFtpUploadDir", function(params)
cli.UploadDir()
end, {
force = true,
nargs = '*',
range = true,
})
if next(config) ~= nil then
-- Config for on save
if config.upload_to_save == 'true' then
vim.api.nvim_create_augroup("SyncFtpUploadGroup", { clear = true })
vim.api.nvim_create_autocmd("BufWritePost", {
group = "SyncFtpUploadGroup",
pattern = "*.*",
callback = function(args)
cli.Upload()
end
})
end
end
if next(config) ~= nil then
-- Config for on save
if config.upload_to_save == 'true' then
vim.api.nvim_create_augroup("SyncFtpUploadGroup", { clear = true })
vim.api.nvim_create_autocmd("BufWritePost", {
group = "SyncFtpUploadGroup",
pattern = "*.*",
callback = function(args)
cli.Upload()
end
})
end
end
end
return M