4b44be488644

Add g:clam_autorun.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 03 Apr 2012 18:45:30 -0400
parents fa37ec671fb5
children 509be39ca8b7
branches/tags (none)
files doc/clam.txt plugin/clam.vim

Changes

--- a/doc/clam.txt	Tue Apr 03 14:47:11 2012 -0400
+++ b/doc/clam.txt	Tue Apr 03 18:45:30 2012 -0400
@@ -14,10 +14,12 @@
     2. Mappings ........................ |ClamMappings|
         2.1 Refresh .................... |ClamRefresh|
         2.2 Pipe ....................... |ClamPipe|
-    3. License ......................... |ClamLicense|
-    4. Bugs ............................ |ClamBugs|
-    5. Contributing .................... |ClamContributing|
-    6. Changelog ....................... |ClamChangelog|
+    3. Configuration ................... |ClamConfiguration|
+        3.1 g:clam_autoreturn .......... |ClamConfiguration_autoreturn|
+    4. License ......................... |ClamLicense|
+    5. Bugs ............................ |ClamBugs|
+    6. Contributing .................... |ClamContributing|
+    7. Changelog ....................... |ClamChangelog|
 
 ==============================================================================
 1. Usage                                                           *ClamUsage*
@@ -68,18 +70,36 @@
 massage the intermediate results.
 
 ==============================================================================
-3. License                                                       *ClamLicense*
+3. Configuration                                           *ClamConfiguration*
+
+You can configure the following settings to change how Clam works.
+
+------------------------------------------------------------------------------
+3.1 g:clam_autoreturn                           *ClamConfiguration_autoreturn*
+
+Set this to 0 to disable the "return to the last buffer you were in on closing
+the output window" behavior: >
+
+    let g:clam_autoreturn = 0
+
+This can be useful if you use :bprevious (which can cause Vim to crash when
+autoreturning).
+
+Default: 1 (autoreturn is on)
+
+==============================================================================
+4. License                                                       *ClamLicense*
 
 Clam is MIT/X11 licensed.
 
 ==============================================================================
-4. Bugs                                                             *ClamBugs*
+5. Bugs                                                             *ClamBugs*
 
 If you find a bug please post it on the issue tracker:
 http://github.com/sjl/clam.vim/issues/
 
 ==============================================================================
-5. Contributing                                             *ClamContributing*
+6. Contributing                                             *ClamContributing*
 
 Think you can make this plugin better?  Awesome!  Fork it on BitBucket or
 GitHub and send a pull request.
@@ -88,7 +108,7 @@
 GitHub: http://github.com/sjl/clam.vim/
 
 ==============================================================================
-6. Changelog                                                   *ClamChangelog*
+7. Changelog                                                   *ClamChangelog*
 
 v1.0.0
     * Initial stable release.
--- a/plugin/clam.vim	Tue Apr 03 14:47:11 2012 -0400
+++ b/plugin/clam.vim	Tue Apr 03 18:45:30 2012 -0400
@@ -14,6 +14,10 @@
 
 let loaded_clam = 1
 
+if !exists('g:clam_autoreturn') "{{{
+    let g:clam_autoreturn = 1
+endif " }}}
+
 "}}}
 " Function {{{
 
@@ -38,8 +42,10 @@
     echo 'Executing: ' . command
     silent! execute 'silent %!'. command
 
-    " When closing this buffer in any way (like :quit), jump back to the original window.
-    silent! execute 'au BufUnload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w'''
+    if g:clam_autoreturn
+        " When closing this buffer in any way (like :quit), jump back to the original window.
+        silent! execute 'au BufUnload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w'''
+    endif
 
     " Map <localleader>r to "refresh" the command (call it again).
     silent! execute 'nnoremap <silent> <buffer> <localleader>r :call <SID>Execlam(''' . command . ''')<cr>'