nvim plugins

This commit is contained in:
TheK4n 2022-11-07 18:14:21 +03:00
parent cdbe7f6b73
commit 59c5e8796d
2 changed files with 36 additions and 28 deletions

View File

@ -1,22 +1,41 @@
local autosave = require("autosave")
local autosave = require("auto-save")
autosave.setup(
{
enabled = true,
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
events = {"TextChanged", "InsertLeave"},
conditions = {
exists = true,
filename_is_not = {},
filetype_is_not = {},
modifiable = true
{
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
execution_message = {
message = function() -- message to print on save
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
end,
dim = 0.18, -- dim the color of `message`
cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea
},
write_all_buffers = false,
on_off_commands = true,
clean_command_line_interval = 0,
debounce_delay = 0
trigger_events = {"InsertLeave", "TextChanged"}, -- vim events that trigger auto-save. See :h events
-- function that determines whether to save the current buffer or not
-- return true: if buffer is ok to be saved
-- return false: if it's not ok to be saved
condition = function(buf)
local fn = vim.fn
local utils = require("auto-save.utils.data")
if
fn.getbufvar(buf, "&modifiable") == 1 and
utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
return true -- met condition(s), can save
end
return false -- can't save
end,
write_all_buffers = false, -- write all buffers when the current one meets `condition`
debounce_delay = 135, -- saves the file at most every `debounce_delay` milliseconds
callbacks = { -- functions to be executed at different intervals
enabling = nil, -- ran when enabling auto-save
disabling = nil, -- ran when disabling auto-save
before_asserting_save = nil, -- ran before checking `condition`
before_saving = nil, -- ran before doing the actual save
after_saving = nil -- ran after doing the actual save
}
}
)
@ -132,12 +151,3 @@ require("nvim-autopairs").setup {}
require('gitsigns').setup()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua,
null_ls.builtins.diagnostics.eslint,
null_ls.builtins.completion.spell,
},
})

View File

@ -181,7 +181,7 @@ call vundle#begin()
Plugin 'preservim/vimux'
Plugin 'rbgrouleff/bclose.vim'
Plugin 'frazrepo/vim-rainbow'
Plugin 'Pocco81/AutoSave.nvim'
Plugin 'Pocco81/auto-save.nvim'
" requiered patch your font
Plugin 'ryanoasis/vim-devicons'
Plugin 'windwp/nvim-autopairs'
@ -205,7 +205,6 @@ call vundle#begin()
Plugin 'preservim/nerdtree'
Plugin 'lewis6991/gitsigns.nvim'
Plugin 'jose-elias-alvarez/null-ls.nvim'
call vundle#end()
@ -310,4 +309,3 @@ nnoremap <silent> <Leader>l :call TabDo('call ToggleRelativeAbsoluteNumber()') <
" Quick exiting without save
nnoremap <silent> <Leader>qq :qa!<CR>