diff --git a/config/nvim/lua/plugins/dev.lua b/config/nvim/lua/plugins/dev.lua index 1ac62a3..4ac5a36 100644 --- a/config/nvim/lua/plugins/dev.lua +++ b/config/nvim/lua/plugins/dev.lua @@ -154,7 +154,10 @@ return { before = function() vim.g.pending = { 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_syntax = 'd', recur_syntax = 'r', diff --git a/config/nvim/plugin/bufremove.lua b/config/nvim/plugin/bufremove.lua index 7770ae1..a2f1287 100644 --- a/config/nvim/plugin/bufremove.lua +++ b/config/nvim/plugin/bufremove.lua @@ -8,9 +8,13 @@ local function bufremove(wipeout) if vim.bo[buf].modified then local ok = vim.fn.confirm( ('Buffer %d has unsaved changes. Force %s?'):format(buf, cmd), - '&No\n&Yes', 1, 'Question' + '&No\n&Yes', + 1, + 'Question' ) == 2 - if not ok then return end + if not ok then + return + end end for _, win in ipairs(vim.fn.win_findbuf(buf)) do @@ -22,19 +26,32 @@ local function bufremove(wipeout) local alt = vim.fn.bufnr('#') if alt ~= buf and vim.fn.buflisted(alt) == 1 then 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 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 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) end end -vim.keymap.set('n', 'bd', function() bufremove() end) -vim.keymap.set('n', 'bw', function() bufremove(true) end) +vim.keymap.set('n', 'bd', function() + bufremove() +end) +vim.keymap.set('n', 'bw', function() + bufremove(true) +end)