mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
restore reg content after using it
This commit is contained in:
parent
e82b450464
commit
1373c418b9
@ -174,6 +174,7 @@ endfunction
|
|||||||
" Redirect command output to a register for later processing.
|
" Redirect command output to a register for later processing.
|
||||||
" Ref: https://stackoverflow.com/q/2573021/6064933 and https://unix.stackexchange.com/q/8101/221410 .
|
" Ref: https://stackoverflow.com/q/2573021/6064933 and https://unix.stackexchange.com/q/8101/221410 .
|
||||||
function! utils#CaptureCommandOutput(command) abort
|
function! utils#CaptureCommandOutput(command) abort
|
||||||
|
let l:tmp = @m
|
||||||
redir @m
|
redir @m
|
||||||
silent! execute a:command
|
silent! execute a:command
|
||||||
redir END
|
redir END
|
||||||
@ -183,6 +184,8 @@ function! utils#CaptureCommandOutput(command) abort
|
|||||||
|
|
||||||
let l:lines = split(@m, '\n')
|
let l:lines = split(@m, '\n')
|
||||||
call nvim_buf_set_lines(0, 0, 0, 0, l:lines)
|
call nvim_buf_set_lines(0, 0, 0, 0, l:lines)
|
||||||
|
|
||||||
|
let @m = l:tmp
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Edit all files matching the given patterns.
|
" Edit all files matching the given patterns.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user