Mercurial > dotfiles
changeset 284:8d04d41d4903
Don't change the cwd when no project root markers have been found.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 02 Feb 2015 11:01:13 -0800 |
parents | 897a6823d603 |
children | 175fbfef4267 |
files | vim/vimrc |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/vim/vimrc Wed Jan 28 21:28:27 2015 -0800 +++ b/vim/vimrc Mon Feb 02 11:01:13 2015 -0800 @@ -581,9 +581,11 @@ function! s:SetProjectRootCwd() abort let l:cur_file_dir = expand('%:p:h', 1) - if l:cur_file_dir =~ '\v^.+:(//|\\\\)' + if l:cur_file_dir =~ '\v^(\w+:)?(//|\\\\)' + " Don't do shit on filenames coming from the network or something. return endif + let l:found_root = 0 let l:root = l:cur_file_dir let l:markers = [] if exists('g:ctrlp_root_markers') @@ -594,10 +596,13 @@ let l:proj_root = s:FindProjectRoot(l:cur_file_dir, marker) if l:proj_root != '' let l:root = l:proj_root + let l:found_root = 1 break endif endfor - execute 'lcd!' fnameescape(l:root) + if l:found_root + execute 'lcd!' fnameescape(l:root) + endif endfunction function! s:ToggleNERDTree() abort