mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2025-12-06 06:36:11 +00:00
style: add and apply stylua config
Made it compatible with the .editorconfig already present and didn't introduce any bells and whistles beyond that. Fixed the typo in .editorconfig indent_style while I was at it.
This commit is contained in:
@@ -10,7 +10,7 @@ end_of_line = lf
|
|||||||
charset = utf-8
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
indent_style = tabs
|
indent_style = tab
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
[*.txt]
|
[*.txt]
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ Config = {
|
|||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
local utils = require("auto-save.utils.data")
|
local utils = require("auto-save.utils.data")
|
||||||
|
|
||||||
if fn.getbufvar(buf, "&modifiable") == 1 and
|
if fn.getbufvar(buf, "&modifiable") == 1 and utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
|
||||||
utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
|
|
||||||
return true -- met condition(s), can save
|
return true -- met condition(s), can save
|
||||||
end
|
end
|
||||||
return false -- can't save
|
return false -- can't save
|
||||||
|
|||||||
@@ -82,20 +82,15 @@ function M.save(buf)
|
|||||||
|
|
||||||
callback("after_saving")
|
callback("after_saving")
|
||||||
|
|
||||||
api.nvim_echo(
|
api.nvim_echo({
|
||||||
{
|
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
type(cnf.opts.execution_message.message) == "function"
|
type(cnf.opts.execution_message.message) == "function" and cnf.opts.execution_message.message()
|
||||||
and cnf.opts.execution_message.message()
|
|
||||||
or cnf.opts.execution_message.message
|
or cnf.opts.execution_message.message
|
||||||
),
|
),
|
||||||
AUTO_SAVE_COLOR,
|
AUTO_SAVE_COLOR,
|
||||||
},
|
},
|
||||||
},
|
}, true, {})
|
||||||
true,
|
|
||||||
{}
|
|
||||||
)
|
|
||||||
if cnf.opts.execution_message.cleaning_interval > 0 then
|
if cnf.opts.execution_message.cleaning_interval > 0 then
|
||||||
fn.timer_start(cnf.opts.execution_message.cleaning_interval, function()
|
fn.timer_start(cnf.opts.execution_message.cleaning_interval, function()
|
||||||
cmd([[echon '']])
|
cmd([[echon '']])
|
||||||
@@ -104,8 +99,7 @@ function M.save(buf)
|
|||||||
api.nvim_echo({
|
api.nvim_echo({
|
||||||
{
|
{
|
||||||
(
|
(
|
||||||
type(cnf.opts.execution_message.message) == "function"
|
type(cnf.opts.execution_message.message) == "function" and cnf.opts.execution_message.message()
|
||||||
and cnf.opts.execution_message.message()
|
|
||||||
or cnf.opts.execution_message.message
|
or cnf.opts.execution_message.message
|
||||||
),
|
),
|
||||||
AUTO_SAVE_COLOR,
|
AUTO_SAVE_COLOR,
|
||||||
@@ -118,9 +112,7 @@ function M.save(buf)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local save_func = (
|
local save_func = (cnf.opts.debounce_delay > 0 and debounce(M.save, cnf.opts.debounce_delay) or M.save)
|
||||||
cnf.opts.debounce_delay > 0 and debounce(M.save, cnf.opts.debounce_delay) or M.save
|
|
||||||
)
|
|
||||||
|
|
||||||
local function perform_save()
|
local function perform_save()
|
||||||
g.auto_save_abort = false
|
g.auto_save_abort = false
|
||||||
@@ -142,9 +134,7 @@ function M.on()
|
|||||||
if cnf.opts.execution_message.dim > 0 then
|
if cnf.opts.execution_message.dim > 0 then
|
||||||
MSG_AREA = colors.get_hl("MsgArea")
|
MSG_AREA = colors.get_hl("MsgArea")
|
||||||
if MSG_AREA.foreground ~= nil then
|
if MSG_AREA.foreground ~= nil then
|
||||||
MSG_AREA.background = (
|
MSG_AREA.background = (MSG_AREA.background or colors.get_hl("Normal")["background"])
|
||||||
MSG_AREA.background or colors.get_hl("Normal")["background"]
|
|
||||||
)
|
|
||||||
local foreground = (
|
local foreground = (
|
||||||
o.background == "dark"
|
o.background == "dark"
|
||||||
and colors.darken(
|
and colors.darken(
|
||||||
|
|||||||
5
stylua.toml
Normal file
5
stylua.toml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Tabs"
|
||||||
|
indent_width = 4
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
call_parentheses = "Always"
|
||||||
Reference in New Issue
Block a user