On 2020-04-17 07:47, DwigtArmyOfChampions wrote:
> I am using gVim on Windows. I open a file in C:\tmp called
> file1.cpp. After looking around in file1.cpp I now want to open
> file2.cpp which is also in C:\tmp. So I run the command
>
> :e .\file2.cpp
>
> But this doesn't work because the "." is C:\Windows\system32. Is
> there a different character or function or variable I can use in
> command mode to designate "the directory that the current file is
> in"?
There are two main ways to do this
1) set 'autochdir'. This will automatically change directory to the
directory of the containing file so that "./" will always refer to
the directory of the current file.
2) use expand() or fnamemodify() with the various available modifiers
(":help filename-modifiers"). In this case you want either :p for the
absolute path or :~ for the path relative to your home directory.
-tim
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200417104100.55816e0d%40bigbox.attlocal.net.
Friday, April 17, 2020
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment