Hello.
I wonder if there are any Eclim users that can help me.
I have a function which I called from a BufRead autocommand to set the local working directory
of the current window to the path of the buffer's file, I change it to set it to the file's project
path whne using eclim:
function! SetLocalPath ()
if exists ('g:tdvim_eclim_running') && g:tdvim_eclim_running == 1
" Use Eclim project local cd if it is running
let projPath = tdvimEclim#GetCurrentProjectInfo('path')
"echomsg "Path for Eclim project: " . projPath
if projPath == '0'
echomsg "no project path"
return
elseif projPath == ''
" Current basename for the buffer
let baseName = expand("%:p:h")
if isdirectory(baseName)
exe 'lcd ' . fnameescape(baseName)
endif
else
"echomsg 'Setting local project path'
"exe 'lcd ' . tdvimEclim#GetCurrentProjectInfo('path')
exe 'ProjectLCD'
endif
else
" Current basename for the buffer
let baseName = expand("%:p:h")
if isdirectory(baseName)
exe 'lcd ' . fnameescape(baseName)
endif
endif
" Debug current path:
"redir => res
"pwd
"redir END
"echomsg "Current path after SetLocal execution: " . res
endfunction
The global variable g:tdvim_eclim_running is set by another function which basically enables the
eclim bundle (I am using vim-addons to load plugins, but applies to pathogen also).
So this works fine if I use Eclim and then open a file directly using the :e command.
But if I open the ProjectTree window and then press return on the file I want to open, it opens it in a new buffer
as expected but rather than setting the local working path to the project path it sets it to my home folder.
Summarizing, the above function is called by a BufEnter event, it works and set the local path for the buffer to the project path,
executing ProjectLCD command, but it doesnt work when I open the file form the ProjectTree, in this case the local path is set to my home
folder.
Any ideas?
Thanks
--
Un saludo
Best Regards
Pablo Giménez
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Sunday, August 12, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment