onivim / oni2

Native, lightweight modal code editor
https://v2.onivim.io
MIT License
7.76k stars 274 forks source link

open onivim2 from the terminal #3856

Closed ghost closed 2 years ago

ghost commented 2 years ago

when i want to edit a file from the terminal i wish if i can use onivim (the path to the file) and onivim2 will open with the file to edit just like vscode with the code command

veryspry commented 2 years ago

You can actually do this pretty easily by directly running the program executable on disk when you install OniVim!

As an example, I installed as an AppImage, so I've got a AppRun file that serves as the executable to run OniVim2. For me, that file is:

$HOME/AppImageKit/Onivim2.AppDir/AppRun

I can open a directory or file like so:

$HOME/AppImageKit/Onivim2.AppDir/AppRun ./some-directory

I also aliased this in my shell config file for easier use:

alias oni="$HOME/AppImageKit/Onivim2.AppDir/AppRun"

Which means I can do this to open a file / directory with Oni:

oni ./some-directory

You can probably do something similar to get your desired behavior. The caveat is to make sure you find the exact path to the program executable as installed on your machine and substitute that for the example here.

Hope this helps!

ghost commented 2 years ago

Thank you