diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index ccfd823..ea6add0 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -78,6 +78,7 @@ let [s:pref, s:opts, s:new_opts] = ['g:ctrlp_', { \ 'root_markers': ['s:rmarkers', []], \ 'split_window': ['s:splitwin', 0], \ 'status_func': ['s:status', {}], + \ 'tabpage_position': ['s:tabpage', 'ac'], \ 'use_caching': ['s:caching', 1], \ 'use_migemo': ['s:migemo', 0], \ 'user_command': ['s:usrcmd', ''], @@ -1017,7 +1018,7 @@ fu! s:OpenMulti(...) \ + ( ur ? [] : ['ignruw'] ) let fst = call('ctrlp#normcmd', ncmd) " Check if the current window has a replaceable buffer - let repabl = empty(bufname('%')) && empty(&l:ft) + let repabl = !( md == 't' && !ur ) && empty(bufname('%')) && empty(&l:ft) " Commands for the rest of the files let [ic, cmds] = [1, { 'v': ['vert sb', 'vne'], 'h': ['sb', 'new'], \ 't': ['tab sb', 'tabe'] }] @@ -1712,7 +1713,7 @@ endf fu! s:openfile(cmd, fid, tail, ...) let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd - let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd + let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd let j2l = a:0 && a:1 ? a:2 : 0 exe cmd.( a:0 && a:1 ? '' : a:tail ) ctrlp#fnesc(a:fid) if j2l @@ -1726,6 +1727,12 @@ fu! s:openfile(cmd, fid, tail, ...) en endf +fu! ctrlp#tabcount() + retu + \ s:tabpage == 'al' ? tabpagenr('$') : + \ s:tabpage == 'ac' ? '' : '' +endf + fu! s:settype(type) retu a:type < 0 ? exists('s:itemtype') ? s:itemtype : 0 : a:type endf diff --git a/autoload/ctrlp/tag.vim b/autoload/ctrlp/tag.vim index 26af1a0..c54d5ad 100644 --- a/autoload/ctrlp/tag.vim +++ b/autoload/ctrlp/tag.vim @@ -87,7 +87,7 @@ fu! ctrlp#tag#accept(mode, str) \ } let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1] let cmd = cmd == 'tj' && &modified ? 'hid '.cmd : cmd - let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd + let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd if fnd[0] == 1 if cmd != '' exe cmd diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index 9ee5be9..2e26ac5 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -45,6 +45,7 @@ Overview:~ |ctrlp_max_height| Max height of the match window. |ctrlp_switch_buffer| Jump to an open buffer if already opened. |ctrlp_reuse_window| Reuse special windows (help, quickfix, etc). + |ctrlp_tabpage_position| Where to put the new tab page. |ctrlp_working_path_mode| How to set CtrlP's local working directory. |ctrlp_root_markers| Additional, high priority root markers. |ctrlp_use_caching| Use per-session caching or not. @@ -145,6 +146,13 @@ Example: > let g:ctrlp_reuse_window = 'netrw\|help\|quickfix' < + *'g:ctrlp_tabpage_position'* +Where to put the new tab page when opening one: > + let g:ctrlp_tabpage_position = 'ac' +< + al - after the last tab page. + ac - after the current tab page. + *'g:ctrlp_working_path_mode'* When starting up, CtrlP sets its local working directory according to this variable: > @@ -669,7 +677,7 @@ Opening/Creating a file:~ Open the selected file in the 'current' window if possible. - Open the selected file in a new 'tab' after the last tabpage. + Open the selected file in a new 'tab'. Open the selected file in a 'vertical' split. @@ -1035,6 +1043,8 @@ Special thanks:~ =============================================================================== CHANGELOG *ctrlp-changelog* + + New option: |g:ctrlp_tabpage_position|. + Before 2012/06/15~ + New value for |g:ctrlp_follow_symlinks|: 2.