summaryrefslogtreecommitdiff
path: root/.config/nvim/plugin/scratch.vim
blob: a6a7a078ffd0711bd3ec3e3e76010d7c9d2e1807 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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')