From 1373c418b9a2b68aff774ea28c2e4450bda630d5 Mon Sep 17 00:00:00 2001 From: jdhao Date: Thu, 30 Dec 2021 23:39:42 +0800 Subject: [PATCH] restore reg content after using it --- autoload/utils.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoload/utils.vim b/autoload/utils.vim index c029cd3..580c1cd 100644 --- a/autoload/utils.vim +++ b/autoload/utils.vim @@ -174,6 +174,7 @@ endfunction " Redirect command output to a register for later processing. " Ref: https://stackoverflow.com/q/2573021/6064933 and https://unix.stackexchange.com/q/8101/221410 . function! utils#CaptureCommandOutput(command) abort + let l:tmp = @m redir @m silent! execute a:command redir END @@ -183,6 +184,8 @@ function! utils#CaptureCommandOutput(command) abort let l:lines = split(@m, '\n') call nvim_buf_set_lines(0, 0, 0, 0, l:lines) + + let @m = l:tmp endfunction " Edit all files matching the given patterns.