From faff324fb709bbe5eb1e713399455e51256ae111 Mon Sep 17 00:00:00 2001 From: Kien N Date: Wed, 9 Nov 2011 19:29:08 +0700 Subject: [PATCH] Extend the nosplit option * Accept filetypes in addition to bufnames. --- autoload/ctrlp.vim | 12 +++++------- doc/ctrlp.txt | 11 ++++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index d025d8b..fa8783a 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -10,7 +10,7 @@ fu! s:opts() let opts = { \ 'g:ctrlp_by_filename': ['s:byfname', 0], \ 'g:ctrlp_clear_cache_on_exit': ['s:cconex', 1], - \ 'g:ctrlp_dont_split': ['s:nosplit', []], + \ 'g:ctrlp_dont_split': ['s:nosplit', ''], \ 'g:ctrlp_dotfiles': ['s:dotfiles', 1], \ 'g:ctrlp_extensions': ['s:extensions', []], \ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'Identifier']], @@ -1031,15 +1031,13 @@ fu! s:normbuf() endf fu! s:normcmd(cmd) + if match([bufname('%'), &l:ft], s:nosplit) >=0 | retu a:cmd | en + " Find a regular buffer let norwins = s:normbuf() let norwin = empty(norwins) ? 0 : norwins[0] - " Don't split these - for each in s:nosplit | if match(bufname('%'), each) >= 0 - retu a:cmd - en | endfo - " If there's at least 1 normal buffer + " If there's at least 1 if norwin - " But not the current one + " But not the current if index(norwins, winnr()) < 0 exe norwin.'winc w' en diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index d5eb831..ff87744 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -266,12 +266,13 @@ all files, each in a vertical split. *'g:ctrlp_dont_split'* When opening a file with , |CtrlP| avoids opening it in windows created by -plugins, help or quickfix. Use this to setup some exceptions: > - let g:ctrlp_dont_split = [] +plugins. Use this to setup some exceptions: > + let g:ctrlp_dont_split = '' < -Accepted values are partial names of the special buffers. -Examples: > - let g:ctrlp_dont_split = ['Netrw'] +Acceptable values are partial names or filetypes of the special buffers. +Use |regexp| to specify the pattern. +Example: > + let g:ctrlp_dont_split = 'netrw\|myplugin' <