uivonim icon indicating copy to clipboard operation
uivonim copied to clipboard

Cannot open uivonim from the command-line with parameters

Open halostatue opened this issue 3 years ago • 6 comments

I’m using the arm64 build I made as discussed in #411; I can’t seem to open it from the command-line with parameters.

Neither of these works:

> open -a uivonim chat.md
> /Applications/uivonim.app/Contents/MacOS/uivonim chat.md

I would expect the file chat.md to be opened; it is not. As I have startify in my configuration, I see that (which should not be the case).

Eventually, it would be useful for there to be a command (:Uivonim install-helper) that installs a helper script (similar to code for VScode).

The script for code is this:

#!/usr/bin/env bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.

function realpath() { python -c "import os,sys; print(os.path.realpath(sys.argv[1]))" "$0"; }
CONTENTS="$(dirname "$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")")"
ELECTRON="$CONTENTS/MacOS/Electron"
CLI="$CONTENTS/Resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?

The rough equivalent of that script would result in this: /Applications/uivonim.app/Contents/MacOS/uivonim /Applications/uivonim.app/Contents/Resources/app/build/main/main.js chat.md, which also doesn’t work. Changing the command to include ELECTRON_RUN_AS_NODE=1 fails:

> ELECTRON_RUN_AS_NODE=1 /Applications/uivonim.app/Contents/MacOS/uivonim /Applications/uivonim.app/Contents/Resources/app/build/main/main.js chat.md
node:internal/modules/cjs/loader:937
  throw err;
  ^

Error: Cannot find module 'electron'
Require stack:
- /Applications/uivonim.app/Contents/Resources/app/build/main/main.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:934:15)
    at Module._load (node:internal/modules/cjs/loader:779:27)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Module.require (node:internal/modules/cjs/loader:1006:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/Applications/uivonim.app/Contents/Resources/app/build/main/main.js:3:17)
    at Module._compile (node:internal/modules/cjs/loader:1110:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1140:10)
    at Module.load (node:internal/modules/cjs/loader:982:32)
    at Module._load (node:internal/modules/cjs/loader:823:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Applications/uivonim.app/Contents/Resources/app/build/main/main.js'
  ]
}

halostatue avatar Oct 11 '21 01:10 halostatue

This is going to be fairly important for me, because I frequently use gvim chat.md (or whatever) or occasionally gvim -d (diff mode). I really want to use a real neovim GUI on macOS and so far UIvonim is the best I’ve seen so far, but it’s still not quite usable as a replacement for MacVim.app / gvim.

halostatue avatar Oct 11 '21 01:10 halostatue

Hmm so not totally sure how to go about fixing this, but threw together something real quick, mind giving it a test? https://github.com/smolck/uivonim/tree/fix-421

With that branch this works: ./dist/mac-arm64/uivonim.app/Contents/MacOS/uivonim path/to/whatever/file. Is that the sort of thing you're looking for? Not quite a self-installing script, but it does seem to do what you want?

smolck avatar Oct 11 '21 02:10 smolck

It works reasonably well. It still outputs a lot of logs when run that way. Ideally things can work with open -a uivonim as well; I know that there’s ways to do this, but I’m not sure what would be.

halostatue avatar Oct 11 '21 02:10 halostatue

Maybe could try adapting this cli wrapper from MacVim: https://github.com/macvim-dev/macvim/blob/0b2587e10c63404503c43f9e47bfc574bc3a7a87/src/MacVim/mvim

timoxley avatar Jan 09 '22 18:01 timoxley

I really want to use a real neovim GUI on macOS and so far UIvonim is the best I’ve seen so far, but it’s still not quite usable as a replacement for MacVim.app / gvim.

+100 this. I've been using macvim for as long as I can remember, maybe 10+ years and this is the first alternative that makes me consider dropping macvim (and I've tried most/all of them). This is great.

timoxley avatar Jan 09 '22 18:01 timoxley

Just for the sake of completeness -- if all you're looking for is "Macvim-but-with-Neovim", that is https://github.com/qvacua/vimr.

(Which is not as shiny as Uivonim, of course!)

clason avatar Jan 09 '22 21:01 clason