From 352b7839192c70ddeb8d6b4e647634d8bcc9c908 Mon Sep 17 00:00:00 2001 From: Andrew Radev Date: Fri, 5 Jun 2020 22:14:28 +0300 Subject: [PATCH] Use `systemlist` instead of `r!` Doesn't use a temporary file, which avoids a potential issue with the `egrep` backend. Also doesn't show stderr to the console. --- autoload/writable_search.vim | 2 -- autoload/writable_search/command.vim | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/autoload/writable_search.vim b/autoload/writable_search.vim index d2aca6c..76332f7 100644 --- a/autoload/writable_search.vim +++ b/autoload/writable_search.vim @@ -45,7 +45,6 @@ function! writable_search#Rerun(...) %delete _ call b:command.Read() - 0delete _ call writable_search#Parse() endfunction @@ -221,7 +220,6 @@ function! s:Grep(query) %delete _ call b:command.Read() - 0delete _ endfunction function! s:LastSelectedText() diff --git a/autoload/writable_search/command.vim b/autoload/writable_search/command.vim index 339c079..1440586 100644 --- a/autoload/writable_search/command.vim +++ b/autoload/writable_search/command.vim @@ -20,7 +20,8 @@ function! writable_search#command#Read() dict let saved_shellredir = &shellredir let &shellredir = substitute(&shellredir, '\V2>&1', '', 'g') - exe 'r!'.full_command + let output = systemlist(full_command) + call append(0, output) let &shellredir = saved_shellredir endfunction