Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Also split if the buffer isn't writable

  • Loading branch information...
commit 767368d5e7965fb0a53df4845e16246d8eff73d9 1 parent 1fd3760
@kien authored
View
12 autoload/ctrlp.vim
@@ -1529,9 +1529,9 @@ fu! ctrlp#normcmd(cmd, ...)
retu a:0 ? a:1 : 'bo vne'
endf
-fu! ctrlp#modfilecond()
- retu &mod && !&hid && &bh != 'hide' && !&cf && !&awa
- \ && s:bufwins(bufnr('%')) == 1
+fu! ctrlp#modfilecond(w)
+ retu &mod && !&hid && &bh != 'hide' && s:bufwins(bufnr('%')) == 1 && !&cf &&
+ \ ( ( !&awa && a:w ) || filewritable(fnamemodify(bufname('%'), ':p')) != 1 )
endf
fu! s:nosplit()
@@ -1787,8 +1787,10 @@ fu! s:buffunc(e)
endf
fu! s:openfile(cmd, fid, tail, chkmod, ...)
- let cmd = a:chkmod && a:cmd =~ '^[eb]$' && ctrlp#modfilecond()
- \ && !( a:cmd == 'b' && &aw ) ? ( a:cmd == 'b' ? 'sb' : 'sp' ) : a:cmd
+ let cmd = a:cmd
+ if a:chkmod && cmd =~ '^[eb]$' && ctrlp#modfilecond(!( cmd == 'b' && &aw ))
+ let cmd = cmd == 'b' ? 'sb' : 'sp'
+ en
let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd
let j2l = a:0 && a:1[0] ? a:1[1] : 0
exe cmd.( a:0 && a:1[0] ? '' : a:tail ) ctrlp#fnesc(a:fid)
View
2  autoload/ctrlp/quickfix.vim
@@ -47,7 +47,7 @@ fu! ctrlp#quickfix#accept(mode, str)
cal ctrlp#exit()
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
\ : ctrlp#normcmd('e')
- let cmd = cmd == 'e' && ctrlp#modfilecond() ? 'new' : cmd
+ let cmd = cmd == 'e' && ctrlp#modfilecond(1) ? 'new' : cmd
exe cmd ctrlp#fnesc(filpath)
cal cursor(items[2], items[3])
sil! norm! zvzz
View
2  autoload/ctrlp/tag.vim
@@ -97,7 +97,7 @@ fu! ctrlp#tag#accept(mode, str)
\ 'e': ['', 'tj'],
\ }
let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1]
- let cmd = a:mode == 'e' && ctrlp#modfilecond() && !&aw
+ let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw)
\ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd
let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd
if fnd[0] == 1
Please sign in to comment.
Something went wrong with that request. Please try again.