summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/mango
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/mango')
-rw-r--r--.config/nvim/lua/mango/lib.lua12
-rw-r--r--.config/nvim/lua/mango/remap.lua9
2 files changed, 21 insertions, 0 deletions
diff --git a/.config/nvim/lua/mango/lib.lua b/.config/nvim/lua/mango/lib.lua
index 5b46012..e062352 100644
--- a/.config/nvim/lua/mango/lib.lua
+++ b/.config/nvim/lua/mango/lib.lua
@@ -21,4 +21,16 @@ function M.remap(modes, from, to, opts)
})
end
+function M.scratch_buffer()
+ vim.cmd [[
+ if bufexists('scratch')
+ buffer scratch
+ else
+ noswapfile hide enew
+ setlocal buftype=nofile bufhidden=hide
+ file scratch
+ endif
+ ]]
+end
+
return M
diff --git a/.config/nvim/lua/mango/remap.lua b/.config/nvim/lua/mango/remap.lua
index dadb5c0..6de5149 100644
--- a/.config/nvim/lua/mango/remap.lua
+++ b/.config/nvim/lua/mango/remap.lua
@@ -44,3 +44,12 @@ remap('n', '-', ':Ex<CR>')
-- bottom instead of the left or top
remap('n', '–', ':vsplit | Ex<CR>')
remap('n', 'g–', ':split | Ex<CR>')
+
+remap('n', '<leader>s', function()
+ vim.cmd('vsplit')
+ lib.scratch_buffer()
+end)
+remap('n', '<leader>S', function()
+ vim.cmd('split')
+ lib.scratch_buffer()
+end)