~gpanders/dotfiles

ref: 8bbb6b42ada8c7e573ffba9c35b376dd6bec1d15 dotfiles/vim/.vim/autoload/scratch.vim -rw-r--r-- 433 bytes
8bbb6b42Greg Anders Move weechat config directory to .config/weechat 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function! scratch#open(command, ...)
  let lines = substitute(execute(a:command), '\n\zs\s*\d\+:\s*', '', 'g')
  new
  put =lines
  let b:lines = lines
  nnoremap <silent> <buffer> q <C-W>q
  if a:0
    execute 'vglobal/' . a:1 . '/delete'
  endif
  silent %substitute/\%^\_s*\n\|\_s*\%$
  let height = min([line('$'), 20])
  execute height . 'wincmd_'
  setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
  0
endfunction