mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[nvim] redirect PutOutput into a preview window
This commit is contained in:
parent
4c3f20a0ce
commit
20c3f3b524
1 changed files with 7 additions and 1 deletions
|
@ -78,7 +78,13 @@ set commentstring=//%s
|
|||
nmap <silent> <leader>] m'yygccp`'j
|
||||
nmap <silent> <leader>[ m'yygccP`'k
|
||||
|
||||
command! -nargs=+ -complete=command PutOutput execute 'put =execute(' . escape(string(<q-args>), '|"') . ')'
|
||||
function! PutOutput(cmd)
|
||||
let output = execute(a:cmd)
|
||||
execute "noswapfile pedit" "+" . fnameescape("setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile") fnameescape("preview://" . a:cmd)
|
||||
wincmd P
|
||||
call setline(1, split(output, "\n"))
|
||||
endfunction
|
||||
command! -nargs=+ -complete=command PutOutput silent call PutOutput(<q-args>)
|
||||
|
||||
" ,c is easier to type than "+ because it doesn't require pressing Shift
|
||||
noremap <leader>c "+
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue