replace vim-auto-save with AutoSave.nvim

This commit is contained in:
siduck76 2021-07-02 15:17:36 +05:30
parent 76cdd5a29b
commit 50b00f4737
4 changed files with 31 additions and 4 deletions

View File

@ -6,7 +6,7 @@ require "top-bufferline"
local g = vim.g
g.mapleader = " "
g.auto_save = 0
g.auto_save = false
-- colorscheme related stuff

View File

@ -32,6 +32,7 @@ map("n", "<leader>n", [[ <Cmd> set nu!<CR>]], opt)
-- Truezen.nvim
map("n", "<leader>z", ":TZAtaraxis<CR>", opt)
map("n", "<leader>m", ":TZMinimalist<CR>", opt)
map("n", "<leader>f", ":TZFocus<CR>", opt)
map("n", "<C-s>", ":w <CR>", opt)
-- vim.cmd("inoremap jh <Esc>")

View File

@ -140,9 +140,12 @@ return packer.startup(
-- load autosave only if its globally enabled
use {
"907th/vim-auto-save",
"Pocco81/AutoSave.nvim",
config = function()
require("zenmode").autoSave()
end,
cond = function()
return vim.g.auto_save == 1
return vim.g.auto_save == true
end
}
@ -157,7 +160,7 @@ return packer.startup(
use {
"Pocco81/TrueZen.nvim",
cmd = {"TZAtaraxis", "TZMinimalist"},
cmd = {"TZAtaraxis", "TZMinimalist", "TZFocus"},
config = function()
require("zenmode").config()
end

View File

@ -1,3 +1,5 @@
-- plugins made by @Pocco81 =)
local M = {}
M.config = function()
@ -50,4 +52,25 @@ M.config = function()
)
end
-- autosave.nvim plugin disabled by default
M.autoSave = function()
local autosave = require("autosave")
autosave.setup(
{
enabled = vim.g.auto_save, -- takes boolean value from init.lua
execution_message = "autosaved at : " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
modifiable = true
},
write_all_buffers = true,
on_off_commands = true,
clean_command_line_interval = 2500
}
)
end
return M