rhysd / NyaoVim

Web-enhanced Extensible Neovim Frontend
Other
2.22k stars 57 forks source link

I cannot open a file directly from command line using NyaoVim #142

Open chaitunya opened 6 years ago

chaitunya commented 6 years ago

When I type nyaovim file.txt into PowerShell, NyaoVim starts in AppData/Roaming/npm/node_modules/nyaovim instead of editing file.txt.

Your Environment

ndaman commented 5 years ago

I am having the same issue. This causes problems with Startify as well, as instead of loading Startify (like I had set up in my init.vim), it loads the netrw directory.

ndaman commented 5 years ago

I've done a little digging and comparing nvim to nyaovim, it appears that nyaovim is adding its base directory to argv, you can get around this by editing your init.vim (or vimrc) to drop that file.

Currently, the file you wanted to open IS open, just in a hidden buffer behind the directory that nyaovim has added. I made a little hack that does the trick for me (opens Startify when no options are passed, opens files passed otherwise), this is in near the end of my init.vim

" workaround for nyaovim's weird argv issue
if exists('g:nyaovim_version')
" delete first arg
    execute '1argd'
" close current buffer
    execute 'bd'
endif