diff options
| author | nsfisis <nsfisis@gmail.com> | 2022-05-09 23:08:37 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2022-05-09 23:08:37 +0900 |
| commit | 213651779344f25a8fcce21784e4fbde24117d22 (patch) | |
| tree | 72c7870da2237d1e44a906b766d89d4108e5eaae /.config/nvim/plugin/autosave.lua | |
| parent | d7f54d84afae5347f4cf1cffa63122ffad1dc1c0 (diff) | |
| download | dotfiles-213651779344f25a8fcce21784e4fbde24117d22.tar.gz dotfiles-213651779344f25a8fcce21784e4fbde24117d22.tar.zst dotfiles-213651779344f25a8fcce21784e4fbde24117d22.zip | |
neovim: replace :command with Lua API
Diffstat (limited to '.config/nvim/plugin/autosave.lua')
| -rw-r--r-- | .config/nvim/plugin/autosave.lua | 30 |
1 files changed, 30 insertions, 0 deletions
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 |
