Wednesday, July 15, 2015

Re: Preventing Vim from loading files from arglist

On 07/07/2015 03:22 PM, Ben Fritz wrote:
> On Tuesday, July 7, 2015 at 12:35:32 PM UTC-5, David Fishburn wrote:
>> An autocmd I can create and therefore provide some command line argument to tell it not to load the files from the command line
> Maybe the BufReadCmd autocmd event would work? I'm not sure how it interacts with swap files.
>

I typically live on Powershell at work these days, to my chagrin being
stuck on a Windows platform. The easiest solution in my mind is just to
write a Powershell wrapper script which runs Vim with the first file if
it's not already running. Toss this into Start-Vim.ps1:

$ProcessActive = Get-Process "vim.exe" -ErrorAction SilentlyContinue
If ($ProcessActive) {
& "C:\Program Files (x86)\Vim\Vim74\vim.exe" --remote @args
} else {
& "C:\Program Files (x86)\Vim\Vim74\vim.exe" @args
}

Put that somewhere convenient. Assuming you've got anything after XP,
Powershell's already onboard. XP you'll need to install it. Then in your
SendTo folder, put a .bat file containing:

powershell -noprofile -executionpolicy bypass -command "&
c:\path\to\Start-Vim.ps1 %*"

That should be all you need (although I haven't tested it yet, and files
with spaces in the path might give it a headache.); the Powershell part
is functional (I use it daily), it's the batch file that runs it from
the cmd shell that may cause issues.

Hope it helps!
-- Jack




--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: