summaryrefslogtreecommitdiff
path: root/.config/nvim/plugin/scratch.vim
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-08-19 23:32:02 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-08-19 23:32:02 +0200
commit4ceb9b896760e900caf12237a94b6c837746edeb (patch)
tree31577455552eb47c09001ff0e6aff4dc11bd88e0 /.config/nvim/plugin/scratch.vim
parentf3abc6e3247dee49fdb03dd371f2c5c4361a6f3d (diff)
Make scratch.vim a plugin
Diffstat (limited to '.config/nvim/plugin/scratch.vim')
-rw-r--r--.config/nvim/plugin/scratch.vim18
1 files changed, 18 insertions, 0 deletions
diff --git a/.config/nvim/plugin/scratch.vim b/.config/nvim/plugin/scratch.vim
new file mode 100644
index 0000000..a6a7a07
--- /dev/null
+++ b/.config/nvim/plugin/scratch.vim
@@ -0,0 +1,18 @@
+if &cp || exists('g:loaded_scratch')
+ finish
+endif
+let g:loaded_scratch = v:true
+
+function! scratch#New(cmd)
+ execute a:cmd
+ if bufexists('scratch')
+ buffer scratch
+ else
+ noswapfile hide enew
+ setlocal buftype=nofile bufhidden=hide
+ file scratch
+ endif
+endfunction
+
+command! -nargs=0 Scratch call scratch#New('split')
+command! -nargs=0 VScratch call scratch#New('vsplit')