From b5ccce5c38c4d932a7ca910149e3cfe1e1f869d8 Mon Sep 17 00:00:00 2001 From: Ferry Boender Date: Sun, 23 Apr 2017 22:09:45 +0200 Subject: [PATCH] Support stopping of live updating by calling :BexecLive again. --- README.md | 10 ++++++++++ autoload/bexec.vim | 13 ++++++++++--- doc/bexec.txt | 12 +++++++++--- plugin/bexec.vim | 8 +++++--- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8205531..ccc5b68 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,16 @@ You can map execution of Bexec to a key for convenient execution. In your .vimrc Now you can simply press `` to execute the current buffer. +To start live updating: + + \bc + +or + + :BexecLive + +To stop live updating, call `BexecLive` again. + For configuration options, please read the documentation (`:help bexec`) or see the [documentation](doc/bexec.txt). diff --git a/autoload/bexec.vim b/autoload/bexec.vim index 285b4b7..c2221d9 100644 --- a/autoload/bexec.vim +++ b/autoload/bexec.vim @@ -349,9 +349,16 @@ endfunction " Realtime updates to the bexec buffer. " function! bexec#Live(...) - let g:bexec_auto_save = 1 - call BexecDo([]) - au CursorHold,CursorHoldI,InsertLeave * call bexec#AutoSave() + if g:bexec_auto_save == 1 + " Stop auto update + let g:bexec_auto_save = 0 + au! CursorHold,CursorHoldI,InsertLeave * call bexec#AutoSave() + else + " Start auto update + let g:bexec_auto_save = 1 + call BexecDo([]) + au CursorHold,CursorHoldI,InsertLeave * call bexec#AutoSave() + endif endfunction function! bexec#AutoSave() diff --git a/doc/bexec.txt b/doc/bexec.txt index 2a66be7..9792ca6 100644 --- a/doc/bexec.txt +++ b/doc/bexec.txt @@ -1,6 +1,6 @@ -*bexec.txt* Buffer execute and grab output Last Change: 08 Jan 2017 +*bexec.txt* Buffer execute and grab output Last Change: 23 Apr 2017 -Buffer Execute (v0.10) *buffer-execute* *bexec* +Buffer Execute (v0.11) *buffer-execute* *bexec* The Bexec plugin allows the user to execute the current buffer if it contains a script with a shebang (#!/path/to/interpreter) on the first line. @@ -264,9 +264,15 @@ MISC *bexec-misc* Changelog + v0.11 + - Support stopping of live updating. + + v0.10 + - Add bexec_splitsize setting. + v0.9 - Move a lot of code to the autoload directory for faster startup (by - Lucas Hoffmann). + Lucas Hoffmann). v0.8 - Honor splitbelow vim setting (by Christopher Pease). diff --git a/plugin/bexec.vim b/plugin/bexec.vim index bae5fbc..fb853b1 100644 --- a/plugin/bexec.vim +++ b/plugin/bexec.vim @@ -3,8 +3,8 @@ " Use the shebang (#!) or filetype to execute a script in the current buffer, " capture its output and put it in a seperate buffer. " -" Last Change: 2017 Jan 8 -" Version: v0.10 +" Last Change: 2017 Apr 23 +" Version: v0.11 " Maintainer: Ferry Boender " License: This file is placed in the public domain. " Usage: To use this plugin: @@ -45,7 +45,9 @@ " * Horizontal column pos gets lost when running in visual " select mode. " * Fix FIXME's. -" Changelog: v0.10 (Jan 08, 2017) +" Changelog: v0.11 (Apr 23, 2017) +" * Support stopping of live updating. +" v0.10 (Jan 08, 2017) " * Add bexec_splitsize setting. " v0.9 (Dec 03, 2015) " * Move a lot of code to the autoload directory for faster