Skip to main content
Incorporate comment about suffix
Source Link
Ingo Karkat
  • 12.2k
  • 2
  • 36
  • 48

vipe uses temporary files (for me in /tmp) to pass and receive the pipe contents to / from Vim. Because of the pipeline, previous vipe invocations cannot be re-edited anymore; they've already been re-read by vipe and sent along the pipeline. So, it should be sufficient to save the previous vipe temp file (as the original one is removed by vipe), and re-open that one in the next Vim invocation from vipe.

The following autocmds do that for a single previous pipeline step. As I couldn't recognize any pattern in the vipe temp files, this broadly handles all files opened in /tmp; it would be better if vipe is reconfigured to use a separate directory or unique naming scheme (newer vipe versions support --suffix SUFFIX, so you can turn * into *.SUFFIX):

Sketch

autocmd BufWritePost /tmp/* silent! bdelete ~/.previous-vipe | keepalt write! ~/.previous-vipe
autocmd BufRead /tmp/* pedit ~/.previous-vipe

vipe uses temporary files (for me in /tmp) to pass and receive the pipe contents to / from Vim. Because of the pipeline, previous vipe invocations cannot be re-edited anymore; they've already been re-read by vipe and sent along the pipeline. So, it should be sufficient to save the previous vipe temp file (as the original one is removed by vipe), and re-open that one in the next Vim invocation from vipe.

The following autocmds do that for a single previous pipeline step. As I couldn't recognize any pattern in the vipe temp files, this broadly handles all files opened in /tmp; it would be better if vipe is reconfigured to use a separate directory or unique naming scheme:

Sketch

autocmd BufWritePost /tmp/* silent! bdelete ~/.previous-vipe | keepalt write! ~/.previous-vipe
autocmd BufRead /tmp/* pedit ~/.previous-vipe

vipe uses temporary files (for me in /tmp) to pass and receive the pipe contents to / from Vim. Because of the pipeline, previous vipe invocations cannot be re-edited anymore; they've already been re-read by vipe and sent along the pipeline. So, it should be sufficient to save the previous vipe temp file (as the original one is removed by vipe), and re-open that one in the next Vim invocation from vipe.

The following autocmds do that for a single previous pipeline step. As I couldn't recognize any pattern in the vipe temp files, this broadly handles all files opened in /tmp; it would be better if vipe is reconfigured to use a separate directory or unique naming scheme (newer vipe versions support --suffix SUFFIX, so you can turn * into *.SUFFIX):

Sketch

autocmd BufWritePost /tmp/* silent! bdelete ~/.previous-vipe | keepalt write! ~/.previous-vipe
autocmd BufRead /tmp/* pedit ~/.previous-vipe
Source Link
Ingo Karkat
  • 12.2k
  • 2
  • 36
  • 48

vipe uses temporary files (for me in /tmp) to pass and receive the pipe contents to / from Vim. Because of the pipeline, previous vipe invocations cannot be re-edited anymore; they've already been re-read by vipe and sent along the pipeline. So, it should be sufficient to save the previous vipe temp file (as the original one is removed by vipe), and re-open that one in the next Vim invocation from vipe.

The following autocmds do that for a single previous pipeline step. As I couldn't recognize any pattern in the vipe temp files, this broadly handles all files opened in /tmp; it would be better if vipe is reconfigured to use a separate directory or unique naming scheme:

Sketch

autocmd BufWritePost /tmp/* silent! bdelete ~/.previous-vipe | keepalt write! ~/.previous-vipe
autocmd BufRead /tmp/* pedit ~/.previous-vipe