diff options
-rw-r--r-- | vim/autoload/scratch.vim | 11 | ||||
-rw-r--r-- | vim/plugin/scratch.vim | 2 | ||||
-rw-r--r-- | vim/vimrc | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/vim/autoload/scratch.vim b/vim/autoload/scratch.vim new file mode 100644 index 00000000..bf6566dc --- /dev/null +++ b/vim/autoload/scratch.vim @@ -0,0 +1,11 @@ +function! scratch#(mods, count, ...) abort + let command = [] + call add(command, a:mods) + if a:count + call add(command, a:count) + endif + call add(command, 'new') + call extend(command, a:000) + execute join(command) + set buftype=nofile +endfunction diff --git a/vim/plugin/scratch.vim b/vim/plugin/scratch.vim new file mode 100644 index 00000000..399f5a31 --- /dev/null +++ b/vim/plugin/scratch.vim @@ -0,0 +1,2 @@ +command! -bar -count=0 -nargs=* Scratch + \ call scratch#(<q-mods>, <q-count>, <f-args>) @@ -1625,6 +1625,12 @@ xmap <Leader>7 <Leader>& "" Leader,*/8 is sticky-star: search, highlight, but don't move nnoremap <silent> <Leader>* *N nmap <Leader>8 <Leader>* +"" Leader,` opens a scratch buffer, horizontally split +nnoremap <silent> <Leader>` + \ :<C-U>Scratch<CR> +"" Leader,~ opens a scratch buffer, vertically split +nnoremap <silent> <Leader>~ + \ :<C-U>vertical Scratch<CR> " And last, but definitely not least, I'm required by Vim fanatic law to " include a mapping that reloads my whole configuration. This uses the |