Skip to content

Commit db49cea

Browse files
committed
SPC br?
1 parent 9e17c69 commit db49cea

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

init.lua

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--[[
2-
2+
fff
33
What is Kickstart?
44
55
Kickstart.nvim is *not* a distribution.
@@ -551,6 +551,23 @@ require('lazy').setup({
551551
vim.keymap.set('n', '<leader>bb', builtin.buffers, { desc = '[B]earch [B]uffers' })
552552
vim.keymap.set('n', '<leader>*', builtin.live_grep, { desc = '[S]earch by [G]rep' })
553553

554+
-- TODO: This is scuffed really, I'm not sure if it works well.
555+
vim.keymap.set('n', '<leader>br', function()
556+
if vim.bo.modified then
557+
vim.cmd 'echohl WarningMsg'
558+
vim.cmd 'echo "Discard changes and reload buffer? (y/n)"'
559+
vim.cmd 'echohl None'
560+
local choice = vim.fn.nr2char(vim.fn.getchar())
561+
if choice:lower() == 'y' then
562+
vim.cmd 'e!'
563+
else
564+
print 'Cancelled.'
565+
end
566+
else
567+
print 'Buffer is already up to date.'
568+
end
569+
end)
570+
554571
-- Slightly advanced example of overriding default behavior and theme
555572
vim.keymap.set('n', '<leader>/', function()
556573
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
@@ -752,8 +769,7 @@ require('lazy').setup({
752769
rust_analyzer = {},
753770
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
754771
lua_ls = {},
755-
},
756-
772+
}
757773

758774
-- Ensure the servers and tools above are installed
759775
--

0 commit comments

Comments
 (0)