On 16/09/12 22:46, shawn wilson wrote:
On Sun, Sep 16, 2012 at 6:38 PM, Tony Mechelynck
<[email protected]> wrote:
On 16/09/12 20:08, shawn wilson wrote:
i like autochdir so that i can easily rename files and :E stuff where
i am. but, then if i use command-t again, it is limited to the current
directory. how do i make the pwd of certain commands the path vim was
opened in and the pwd of another set of commands the pwd of the file
of the current buffer?
What about not using 'autochdir' but
:lcd %:h
that's not a bad solution. is there a way of getting the directory
where i opened vim back? so, basically some way of toggling between
the path of the file and the path i opened vim in? i could map it to
an f-key and be fine with that...
Hm... I thought there was a way to unset the lcd (like there are ways to
set a local option back to the global setting, or any option to the Vi
or Vim default), but I can't find it in the help. So here's a
workaround, to be added to your vimrc
either (F5 to toggle)
let <SID>curdir = getcwd()
map <F5> :if getcwd() == <SID>curdir <Bar> lcd %:h <Bar> else <Bar> exe
'lcd' <SID>curdir <Bar> endif<CR>
or (F5 to set, Shift-F5 to clear)
let <SID>curdir = getcwd()
map <F5> :lcd %:h<CR>
map <S-F5> :exe 'lcd' <SID>curdir<CR>
Note that :lcd %:h while "editing a directory" with netrw will set the
current directory to the _parent_ of the directory being displayed. Use
:lcd % (which doesn't work when editing a file) to set it to that
directory itself.
Best regards,
Tony.
--
Organic chemistry is the chemistry of carbon compounds. Biochemistry
is the study of carbon compounds that crawl.
-- Mike Adams
--
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