mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2026-06-06 20:02:15 +00:00
BREAKING CHANGES: plugin rewrite
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
" GPL-3.0 License
|
||||
|
||||
" prevent the plugin from loading twice
|
||||
if exists('g:loaded_autosave') | finish | endif
|
||||
|
||||
let s:save_cpo = &cpo " save user coptions
|
||||
set cpo&vim " reset them to defaults
|
||||
|
||||
|
||||
" Interface {{{
|
||||
command! ASToggle lua require'autosave.main'.main('toggle')
|
||||
" }}}
|
||||
|
||||
|
||||
let &cpo = s:save_cpo " restore after
|
||||
unlet s:save_cpo
|
||||
|
||||
" set to true the var that controls the plugin's loading
|
||||
let g:loaded_autosave = 1
|
||||
@@ -0,0 +1,15 @@
|
||||
if vim.g.loaded_auto_save then
|
||||
return
|
||||
end
|
||||
vim.g.loaded_auto_save = true
|
||||
|
||||
local command = vim.api.nvim_create_user_command
|
||||
local cnf = require("auto-save.config").options
|
||||
|
||||
command("AToggle", function()
|
||||
require("auto-save").toggle()
|
||||
end, {})
|
||||
|
||||
if cnf.enabled then
|
||||
require("auto-save").on()
|
||||
end
|
||||
Reference in New Issue
Block a user