Group:  English: General ยป microsoft.public.windows.powershell
Thread: Vim and PowerShell paths

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Vim and PowerShell paths
"David Trimboli" <trimboli[ at ]cshl.edu> 13.07.2007 14:31:40
No doubt the PowerShell folks will think this is a Vim question, and the
Vim folks will think this is a PowerShell question.

When I try to edit a file with Vim 7.1 from Windows PowerShell, Vim
seems to require a full path to the file. For instance, if I'm in "H:\My
Documents\WindowsPowerShell" and I type "vim profile.ps1" or even "vim
..\profile.ps1" I find myself editing "H:\profile.ps1".

This behavior is apparently unique to PowerShell; in CMD and CSH Vim
lets me use relative paths the way one would expect. Is there a way to
adjust Vim (or PowerShell!) to let me use relative paths when calling
Vim from PowerShell?

--
David
Stardate 7530.7


Re: Vim and PowerShell paths
"Jason" <nospam[ at ]nospam.com> 13.07.2007 17:11:19
Hi David:

Here's a function you can put into your $profile so that you can pipe into
vim (e.g., "dir c:\ | vim") and which may also help get around the relative
path issue:

function vim ( $path = $null )
{
$vimpath = 'C:\Progra~1\Vim\vim71\vim.exe'
if ($path -ne $null) {invoke-expression "$vimpath $path"}
elseif ( $input.movenext() )
{
$input.reset()
$input | out-string | out-file "$env:TEMP\vimtempfile.txt"
invoke-expression "$vimpath $env:TEMP\vimtempfile.txt"
remove-item "$env:TEMP\vimtempfile.txt"
}
else { invoke-expression "$vimpath" }
}


Cheers,
Jason


------------------------------------------------------
PowerShell Training at SANS Conferences
http://www.WindowsPowerShellTraining.com
------------------------------------------------------

Re: Vim and PowerShell paths
Martin Krischik <krischik[ at ]users.sourceforge.net> 13.07.2007 17:20:16
David Trimboli wrote:

[Quoted Text]
> No doubt the PowerShell folks will think this is a Vim question, and the
> Vim folks will think this is a PowerShell question.
>
> When I try to edit a file with Vim 7.1 from Windows PowerShell, Vim
> seems to require a full path to the file. For instance, if I'm in "H:\My
> Documents\WindowsPowerShell" and I type "vim profile.ps1" or even "vim
> .\profile.ps1" I find myself editing "H:\profile.ps1".
>
> This behavior is apparently unique to PowerShell; in CMD and CSH Vim
> lets me use relative paths the way one would expect. Is there a way to
> adjust Vim (or PowerShell!) to let me use relative paths when calling
> Vim from PowerShell?

Well repeat your example above - but now once vim has started call
Vims ":pwd" command. The output should be "H:\My
Documents\WindowsPowerShell" ! If not them powershell just might be
powerfull but it certainly is not propper shell.

Martin
--
mailto://krischik[ at ]users.sourceforge.net
Ada programming at: http://ada.krischik.com
Re: Vim and PowerShell paths
"David Trimboli" <trimboli[ at ]cshl.edu> 13.07.2007 17:50:17
Jason <nospam[ at ]nospam.com> wrote:
[Quoted Text]
> Here's a function you can put into your $profile so that you can pipe
> into vim (e.g., "dir c:\ | vim") and which may also help get around
> the relative path issue:

Thanks, Jason. That works!

--
David
Stardate 7531.1


Re: Vim and PowerShell paths
"David Trimboli" <trimboli[ at ]cshl.edu> 13.07.2007 17:59:12
David Trimboli <trimboli[ at ]cshl.edu> wrote:
[Quoted Text]
> Jason <nospam[ at ]nospam.com> wrote:
>> Here's a function you can put into your $profile so that you can pipe
>> into vim (e.g., "dir c:\ | vim") and which may also help get around
>> the relative path issue:
>
> Thanks, Jason. That works!

Er, well, mostly. I'll have to tweak it to allow Vim's command-line
parameters.

--
David
Stardate 7531.1


Re: Vim and PowerShell paths
"David Trimboli" <trimboli[ at ]cshl.edu> 13.07.2007 17:59:53
David Trimboli <trimboli[ at ]cshl.edu> wrote:
[Quoted Text]
> Jason <nospam[ at ]nospam.com> wrote:
>> Here's a function you can put into your $profile so that you can pipe
>> into vim (e.g., "dir c:\ | vim") and which may also help get around
>> the relative path issue:
>
> Thanks, Jason. That works!

Er, well, mostly. I'll have to tweak it to allow Vim's command-line
parameters.

--
David
Stardate 7531.1



Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net