From 213651779344f25a8fcce21784e4fbde24117d22 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 9 May 2022 23:08:37 +0900 Subject: neovim: replace :command with Lua API --- .config/nvim/plugin/autosave.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .config/nvim/plugin/autosave.lua (limited to '.config/nvim/plugin/autosave.lua') diff --git a/.config/nvim/plugin/autosave.lua b/.config/nvim/plugin/autosave.lua new file mode 100644 index 0000000..6725195 --- /dev/null +++ b/.config/nvim/plugin/autosave.lua @@ -0,0 +1,30 @@ +if vim.g.loaded_autosave then + return +end + +vim.api.nvim_create_user_command( + 'AutosaveEnable', + function() require('autosave').enable() end, + { + desc = '[Autosave] enable autosaving', + bar = true, + } +) +vim.api.nvim_create_user_command( + 'AutosaveDisable', + function() require('autosave').disable() end, + { + desc = '[Autosave] disable autosaving', + bar = true, + } +) +vim.api.nvim_create_user_command( + 'AutosaveToggle', + function() require('autosave').toggle() end, + { + desc = '[Autosave] toggle autosaving', + bar = true, + } +) + +vim.g.loaded_autosave = true -- cgit v1.3.1-4-g156e