ci: format
This commit is contained in:
parent
58703c4bf8
commit
1e2eaec728
2 changed files with 28 additions and 8 deletions
|
|
@ -154,7 +154,10 @@ return {
|
||||||
before = function()
|
before = function()
|
||||||
vim.g.pending = {
|
vim.g.pending = {
|
||||||
debug = false,
|
debug = false,
|
||||||
data_path = (os.getenv('XDG_STATE_HOME') or (os.getenv('HOME') .. '/.local/state')) .. '/nvim/pending/tasks.json',
|
data_path = (
|
||||||
|
os.getenv('XDG_STATE_HOME')
|
||||||
|
or (os.getenv('HOME') .. '/.local/state')
|
||||||
|
) .. '/nvim/pending/tasks.json',
|
||||||
date_format = '%d/%m/%y',
|
date_format = '%d/%m/%y',
|
||||||
date_syntax = 'd',
|
date_syntax = 'd',
|
||||||
recur_syntax = 'r',
|
recur_syntax = 'r',
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,13 @@ local function bufremove(wipeout)
|
||||||
if vim.bo[buf].modified then
|
if vim.bo[buf].modified then
|
||||||
local ok = vim.fn.confirm(
|
local ok = vim.fn.confirm(
|
||||||
('Buffer %d has unsaved changes. Force %s?'):format(buf, cmd),
|
('Buffer %d has unsaved changes. Force %s?'):format(buf, cmd),
|
||||||
'&No\n&Yes', 1, 'Question'
|
'&No\n&Yes',
|
||||||
|
1,
|
||||||
|
'Question'
|
||||||
) == 2
|
) == 2
|
||||||
if not ok then return end
|
if not ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, win in ipairs(vim.fn.win_findbuf(buf)) do
|
for _, win in ipairs(vim.fn.win_findbuf(buf)) do
|
||||||
|
|
@ -22,19 +26,32 @@ local function bufremove(wipeout)
|
||||||
local alt = vim.fn.bufnr('#')
|
local alt = vim.fn.bufnr('#')
|
||||||
if alt ~= buf and vim.fn.buflisted(alt) == 1 then
|
if alt ~= buf and vim.fn.buflisted(alt) == 1 then
|
||||||
vim.api.nvim_win_set_buf(win, alt)
|
vim.api.nvim_win_set_buf(win, alt)
|
||||||
elseif pcall(vim.cmd, 'bprevious') and buf ~= vim.api.nvim_win_get_buf(win) then
|
elseif
|
||||||
|
pcall(vim.cmd, 'bprevious')
|
||||||
|
and buf ~= vim.api.nvim_win_get_buf(win)
|
||||||
|
then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
vim.api.nvim_win_set_buf(win, vim.api.nvim_create_buf(true, false))
|
vim.api.nvim_win_set_buf(
|
||||||
|
win,
|
||||||
|
vim.api.nvim_create_buf(true, false)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
local ok, err = pcall(vim.cmd, ('%s! %d'):format(cmd, buf))
|
local ok, err = pcall(vim.cmd, ('%s! %d'):format(cmd, buf))
|
||||||
if not ok and not (err:find('E516%D') or err:find('E517%D') or err:find('E11%D')) then
|
if
|
||||||
|
not ok
|
||||||
|
and not (err:find('E516%D') or err:find('E517%D') or err:find('E11%D'))
|
||||||
|
then
|
||||||
vim.notify(err, vim.log.levels.ERROR)
|
vim.notify(err, vim.log.levels.ERROR)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>bd', function() bufremove() end)
|
vim.keymap.set('n', '<leader>bd', function()
|
||||||
vim.keymap.set('n', '<leader>bw', function() bufremove(true) end)
|
bufremove()
|
||||||
|
end)
|
||||||
|
vim.keymap.set('n', '<leader>bw', function()
|
||||||
|
bufremove(true)
|
||||||
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue