-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStart-Vim.ps1
More file actions
36 lines (28 loc) · 767 Bytes
/
Start-Vim.ps1
File metadata and controls
36 lines (28 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function Start-Vim {
$paths = & {
$env:Path.Split(';');
Join-Path $PSScriptRoot '..\vim'
} | ? {
$_
} | % {
Join-Path $_ vim.exe
} | ? {
Test-Path $_
}
if(-not($paths)) {
Write-Warning "Could not find Vim in $(Join-Path $PSScriptRoot ..\vim)"
return;
}
Write-Verbose "Start Vim from '$(@($paths)[0])'"
$newArgs = & {
$vimrc = (Join-Path $PSScriptRoot vim\vimrc);
if(Test-Path $vimrc) {
'-u';
$vimrc;
}
Expand-Arguments $args | Resolve-PSDrive;
} $args;
$currentPos = [Console]::CursorTop
& @($paths)[0] $newArgs
[Console]::SetCursorPosition(0, $currentPos)
}