Skip to content

Commit

Permalink
Improve edit
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Aug 12, 2010
1 parent 1a844c8 commit 2293d91
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion vimrc
Expand Up @@ -146,7 +146,16 @@ function Edit(file)
endif

execute "e " . a:file
call ChangeDirectory(system("dirname " . a:file), 0)

ruby << RUBY
destination = File.expand_path(VIM.evaluate(%{system("dirname " . a:file)}))
pwd = File.expand_path(Dir.pwd)
home = pwd == File.expand_path("~")

if home || Regexp.new("^" + Regexp.escape(pwd)) !~ destination
VIM.command(%{call ChangeDirectory(system("dirname " . a:file), 0)})
end
RUBY
endfunction

" Define the NERDTree-aware aliases
Expand Down

0 comments on commit 2293d91

Please sign in to comment.