Commits

kien committed db34f38

Disable autocmds when opening/closing

Comments (0)

Files changed (2)

autoload/ctrlp.vim

 	cal s:log(1)
 	cal s:getenv()
 	cal s:execextvar('enter')
-	sil! exe 'noa keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new +setl\ nobl ControlP'
+	sil! exe 'keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP'
 	cal s:buffunc(1)
 	let [s:bufnr, s:prompt, s:winw] = [bufnr('%'), ['', '', ''], winwidth(0)]
 	abc <buffer>
 
 fu! s:Close()
 	cal s:buffunc(0)
-	try | noa bun!
-	cat | noa clo! | endt
+	try | bun!
+	cat | clo! | endt
 	cal s:unmarksigns()
 	for key in keys(s:glbs) | if exists('+'.key)
 		sil! exe 'let &'.key.' = s:glb_'.key
 
 fu! s:PrtExit()
 	if !has('autocmd') | cal s:Close() | en
-	winc p
+	exe ( winnr('$') == 1 ? 'bw!' : 'winc p' )
 endf
 
 fu! s:PrtHistory(...)
 endf
 
 fu! s:setupblank()
-	setl noswf nonu nowrap nolist nospell nocuc wfh
+	setl noswf nonu nobl nowrap nolist nospell nocuc wfh
 	setl fdc=0 fdl=99 tw=0 bt=nofile bh=unload
 	if v:version > 702
 		setl nornu noudf cc=0
 	if exists('s:init') || s:iscmdwin() | retu | en
 	let [s:matches, s:init] = [1, 1]
 	cal ctrlp#reset()
-	cal s:Open()
+	noa cal s:Open()
 	cal s:SetWD(a:0 ? a:1 : '')
 	cal s:MapKeys()
 	cal ctrlp#syntax()
 	aug CtrlPAug
 		au!
 		au BufEnter ControlP cal s:checkbuf()
-		au BufLeave ControlP cal s:Close()
+		au BufLeave ControlP noa cal s:Close()
 		au VimLeavePre * cal s:leavepre()
 	aug END
 en
     " +- a:next    : The next search mode.
     " |
     " +- a:marked  : The number of marked files, or a comma separated list of
-    "                the filenames.
+    "                the marked filenames.
 
     return full_statusline
   endfunction
     " |             + "first-non-tab": match until the first tab char.
     " |             + "until-last-tab": match until the last tab char.
     " |
-    " +- a:ispath : Is 1 when searching in file, buffer, mru, dir, and rtscript
-    " |             modes. Is 0 otherwise.
+    " +- a:ispath : Is 1 when searching in file, buffer, mru, mixed, dir, and
+    " |             rtscript modes. Is 0 otherwise.
     " |
     " +- a:crfile : The file in the current window. Should be excluded from the
     " |             results when a:ispath == 1.
 
    If no argument is given, the value of |g:ctrlp_working_path_mode| will be
    used to determine the starting directory.
+
    You can use <tab> to auto-complete the [starting-directory] when typing it.
 
                                                                  *:CtrlPBuffer*
 
                                                                    *:CtrlPRoot*
 :CtrlPRoot
-    This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 2 (ignores its
-    current value).
+    This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 2 (ignores the
+    variable's current value).
 
                                                              *:CtrlPClearCache*
 :CtrlPClearCache
 
                                                          *:CtrlPClearAllCaches*
 :CtrlPClearAllCaches
-   Delete all the cache files saved in |g:ctrlp_cache_dir|.
+   Delete all the cache files saved in |g:ctrlp_cache_dir| location.
 
 -------------------------------------------------------------------------------
 For commands provided by bundled extensions, see |ctrlp-extensions|.
   <c-c>
     Exit CtrlP.
 
-Movement:~
+Moving:~
 
   <c-j>,
   <down>
   <c-u>
     Clear the input field.
 
-Input history:~
+Browsing input history:~
 
   <c-n>
     Next string in the prompt's history.
   <c-p>
     Previous string in the prompt's history.
 
-Open a file:~
+Opening/Creating a file:~
 
   <cr>
-    Open selected file in the active window if possible.
+    Open the selected file in the 'current' window if possible.
 
   <c-t>
-    Open selected file in a new 'tab' after the last tabpage.
+    Open the selected file in a new 'tab' after the last tabpage.
 
   <c-v>
-    Open selected file in a 'vertical' split.
+    Open the selected file in a 'vertical' split.
 
   <c-x>,
   <c-cr>,
   <c-s>
-    Open selected file in a 'horizontal' split.
+    Open the selected file in a 'horizontal' split.
 
   <c-y>
     Create a new file and its parent directories.
 
-Open multiple files:~
+Opening multiple files:~
 
   <c-z>
     - Mark/unmark a file to be opened with <c-o>.
     might help speeding up the intial scan (see |g:ctrlp_user_command| for more
     details).
 
-    Note: e) and d) only work in file, directory and mixed modes.
+    Note: d) and e) only work in file, directory and mixed modes.
 
 f)  Type the name of a non-existent file and press <c-y> to create it. Mark a
     file with <c-z> to create the new file in the same directory as the marked
 
 * Using a |count| to invoke different commands using the same mapping:
 >
-  let g:ctrlp_map = '<leader>f'
   let g:ctrlp_cmd = 'exe "CtrlP".get(["", "Buffer", "MRU"], v:count)'
 <