blob: 6e4e1f179986d8917c3ef412adc8f1b4ff9cf3a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
" capture (dump) the (somewhat long) ouput of the commands like `:digraph`, `:map', `:highlight`, `:scripnames` etc.
function! s:dump(cmd) abort
" Start a new split or maybe a buffer or a tab
" enew | " open a new buffer
10split | enew | " open a new split (with 10% height (?))
" tabnew | " open a new tab
" Make it a scratch buffer ( `:help special-buffers`)
setlocal
\ bufhidden=wipe
\ buftype=nofile
\ nobuflisted
\ nolist
\ noswapfile
\ norelativenumber
\ nonumber
" Write the cmd output to the buffer
put =execute(a:cmd)
" There are 2 empty line at the beginning of the buffer before the ouput of
" the cmd. Not sure from where they are comning from. Anyhow I will delete
" them.
norm gg2dd
" No modifications to this buffer
setlocal readonly nomodifiable nomodified
" Press escape to close when you're done
nnoremap <buffer><silent> <Esc> :bd<CR>
endfunction
" Define a command to use the function easier
command! -nargs=1 Dump execute "call s:dump(" string(<q-args>) ")"
|