I've had a bit of frustration opening file paths when running VIM
through Cygwin because of the forward vs. backslash issue. Finally I
decided to add a mapping to my vimrc. It's rather clunky, but allows
me to copy a path that I have, say in a windows folder, and open it
easily in vim:
"Map the insert key to paste what's on the clipboard
nmap <Insert> iz<Esc>mz:execute "normal a".system("cat /dev/clipboard")<CR>`zx
"Map Control-n to paste what's on the clipboard, then change the
slashes, add cygdrive to it, and open the path in a new tab
map <C-n>
A<CR><Esc><Insert>A<CR><Esc>k:s#\\\\#/#g<CR>I/cygdrive/<Esc>llx^v$h"yy:new
<C-r>y<CR>
It's not the prettiest Vim macro in the world, but I can finally just
copy a path that's in the Windows format and not pull my hair out
trying to figure out how to open it in vim.
I tried just doing :new followed by the path to the file in quotes,
but I think the problem is that the slashes are interpreted as escape
characters. Why did Microsoft have to be different? Why couldn't they
just use slashes the same way as Unix systems did? It would have saved
countless hours of programming and development over the years.
Thanks,
Ven
--
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