I'm sorry, the script which I call basically just makes a system call: function! SDCheckout() let file = expand("%") if (confirm("Checkout from Source Depot?\n\n" . file, "&Yes\n&No", 1) == 1) call system("sd edit " . file . " > /dev/null") if v:shell_error == 0 set noreadonly edit! else if (confirm("An error occured!", "Oh no!", 1) == 1) endif endif endif endfunction
Sorry for the wrapping problems. I'm not entirely sure what you are suggesting doing with :h and :s??, but would I not suffer the problem of not knowing which subdirectory the file was in? Surely this isn't something that should need to be fixed, rather it should Just Work? Thanks! Max -----Original Message----- From: Eric Arnold [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 24, 2006 8:10 PM To: Max Dyckhoff Cc: vim@vim.org Subject: Re: Working directory problems I'm not sure how your bound function works. Have you tried using fnamemodify() to manipulate the filename? You can use the :h option to strip the path, and :s?? to substitute the relative path. On 5/24/06, Max Dyckhoff <[EMAIL PROTECTED]> wrote: > Hi, > > I have some issues with the working directory in vim that I really > cannot get to the bottom of. I have tried looking through the help, and > I've searched the Interweb too, to no avail, so I thought I would turn > to this trusty mailing list! > > I operate a single vim instance with multiple files open in multiple > splits. The common working directory for my code files is > c:\<project>\main\source\, and the majority of the files therein lie in > ai\<filename>. Normally the vim split status line shows the file as > being ai\<filename>, namely the relative path from the working directory > of c:\<project>\main\source\. > > When I open a new file - which I invariably do using "sf <filename>", as > I have all the appropriate directories in my path - occasionally the > statusline shows as the absolute path, namely > c:\<project>\main\source\ai\<filename>. If I perform the command "cd > c:\<project>\main\source", then the status line fixes itself. It should > be noted that the status line is only incorrect for the new file; > existing files are still fine. > > Now I wouldn't normally be bothered by this, but I have a function in > vim which I have bound to F6 that will check the current source file out > of our source depot, and if the status line is showing the absolute path > then it will fail, because the information about the source depot lies > only within the c:\<project>\main directories. > > God, I hope that makes sense. It seems like such a trivial problem, but > it really irks me, and I wonder if anyone could give me a hand! > > Cheers, > > Max > > -- > Max Dyckhoff > AI Engineer > Bungie Studios >