Compare commits

..

No commits in common. "6317d0214817a8b5f56696b7e51735723372b79e" and "be5e7007c97b3e34fb57bbf7f71f01ce0480cfd1" have entirely different histories.

2 changed files with 11 additions and 28 deletions

View File

@ -1,4 +1,3 @@
vim.opt.commentstring = '//%s' vim.bo.commentstring = '//%s'
vim.opt.matchpairs:append('<:>')
require('build').create_commands() require('build').create_commands()

View File

@ -15,33 +15,17 @@ end, { nargs = 1 })
-- vim.loop.fs_rename -- vim.loop.fs_rename
-- :Remove the file associated with the current buffer, then delete the buffer -- :Remove the file associated with the current buffer, then delete the buffer
vim.api.nvim_create_user_command('Remove', function(opts) vim.api.nvim_create_user_command('Remove', function()
local path = vim.fn.expand('%:p') local path = vim.fn.expand('%:p')
-- Using opts.bang in the callback can cause a SEGFAULT, instead use it vim.loop.fs_unlink(path, function(err, success)
-- before invoking the async unlink to select which callback should be called if success then
-- on completion. vim.schedule(function()
local callback = nil vim.api.nvim_buf_delete(vim.api.nvim_get_current_buf(), {})
if opts.bang then end)
-- Invoked as :Remove! so also delete the buffer. else
callback = function(err, success) error(err)
if success then
vim.schedule(function()
vim.api.nvim_buf_delete(vim.api.nvim_get_current_buf(), {})
end)
else
error(err)
end
end end
else end)
-- Invoked as :Remove so don't delete the buffer. end, {})
callback = function(err, success)
if not success then
error(err)
end
end
end
-- Actually remove the file using the selecte callback.
vim.loop.fs_unlink(path, callback)
end, { bang = true })
-- TODO: :Move -- TODO: :Move