Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@ __Linux:__
- Gnome (or a derivative)
- gVim

__Windows:__

- AutoHotKey
- gVim

#### Install

```bash
curl -fsSL https://raw.github.com/cknadler/vim-anywhere/master/install | bash
```

```powershell
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/cknadler/vim-anywhere/master/install.ps1'))
```

__OSX caveat:__ key binding is unbound by default. See [keybinding](#keybinding)
for details.

Expand Down Expand Up @@ -67,6 +76,10 @@ $ echo "bindsym $mod+Alt+v exec ~/.vim-anywhere/bin/run" >> ~/.i3/config # remem
```
Adjust in case `$mod` is not set to ctrl.

__Windows:__

Check the `AutoHotkey` example file from `script/hotkey.example.ahk`

## History

vim-anywhere creates a temporary file in `/tmp/vim-anywhere` when
Expand Down
19 changes: 19 additions & 0 deletions bin/run.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function Find-BinaryPath() {
$VimBinaries = @(
"${env:ProgramFiles(x86)}\vim\vim80\gvim.exe",
"$env:ProgramFiles\vim\vim80\gvim.exe"
)
foreach($Path in $VimBinaries) {
if (Test-Path -Path "$Path") {
return "$Path"
}
}
}

$VimPath = Find-BinaryPath
$TempFile = "$env:LOCALAPPDATA\.vim-anywhere"

Start-Process "$VimPath" -Args "$TempFile", "--nofork" -Wait
Get-Content "$TempFile" | Set-Clipboard
Remove-Item -Force -Path "$TempFile"

13 changes: 13 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Add zip assembly
Add-Type -AssemblyName System.IO.Compression.FileSystem

# Download from Github
Invoke-WebRequest -Uri "https://github.com/cknadler/vim-anywhere/archive/master.zip" -OutFile "$env:LOCALAPPDATA\vim-anywhere.zip"

# Extract
[System.IO.Compression.ZipFile]::ExtractToDirectory("$env:LOCALAPPDATA\vim-anywhere.zip", "$HOME")

# Setup
Move-Item "$HOME\vim-anywhere-master" "$HOME\.vim-anywhere"
Remove-Item -Force "$env:LOCALAPPDATA\vim-anywhere.zip"

3 changes: 3 additions & 0 deletions script/hotkey.example.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^!V:: ; vim-anywhere
Run C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden %HOMEDRIVE%\%HOMEPATH%\.vim-anywhere\bin\run.ps1
Return