Closed SamShowalter closed 1 year ago
Thank you for providing all this information. Could you edit your ~/.local/share/firenvim/firenvim script as suggested in https://github.com/glacambre/firenvim/blob/master/TROUBLESHOOTING.md#print-debugging-your-initvim , attempt to use Firenvim multiple times on a simple website like http://txti.es and then upload the content of /tmp/stdout and /tmp/stderr here?
Sure, and this is going to sound strange, so in hoping that I did not make a stupid error I am going to outline the exact steps I took.
~/.local/share/firenvim/firenvim
and replaced the final line with what was included in the troubleshooting doc
-exec '/usr/bin/nvim' --headless --cmd "let g:firenvim_i=[]|let g:firenvim_o=[]|let g:Firenvim_oi={i,d,e >add(g:firenvim_i,d)}|let g:Firenvim_oo={t->add(g:firenvim_o,t)}|let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})" --cmd 'let g:started_by_firenvim = v:true' -c 'call firenvim#run()'
+exec '/usr/bin/nvim' --headless --cmd "let g:firenvim_i=[]|let g:firenvim_o=[]|let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}|let g:Firenvim_oo={t->add(g:firenvim_o,t)}|let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})" --cmd 'let g:started_by_firenvim = v:true' -c 'call firenvim#run()' 2>>/tmp/stderr | tee -a /tmp/stdout
What is really strange is that the stderr and stdout files in the /tmp dir are completely empty. The Chrome errors remain the same though. I have other Chrome plugins working such as Grammarly, but I disabled those and tried this process again without any change.
Okay, so the files are created but they're empty? This must mean that the script is correctly invoked, but that somehow it breaks before being able to invoke neovim.
Could you append something like "echo 'Step 1' >> /tmp/steps", "echo 'Step 2' >> /tmp/steps" and so on after each line of /.local/share/firenvim/firenvim? This will help us identify where exactly things go wrong. Then, upload the edited script and /tmp/steps
here :)
Edit: this is absurd, if /tmp/std{out,err} are created, we know the exec
line is reached. It's nvim specifically that can't run. Let me think about an alternative... :thinking:
Good idea, here is a link to the script and the output of /tmp/steps/
#!/bin/sh
echo 'Step 1' >> /tmp/steps
mkdir -p /var/folders/xc/2w84ttvd2kxchz7t1_f_rxl40000gn/T//firenvim
echo 'Step 2' >> /tmp/steps
chmod 700 /var/folders/xc/2w84ttvd2kxchz7t1_f_rxl40000gn/T//firenvim
echo 'Step 3' >> /tmp/steps
cd /var/folders/xc/2w84ttvd2kxchz7t1_f_rxl40000gn/T//firenvim
echo 'Step 4' >> /tmp/steps
export PATH=...
echo 'Step 5' >> /tmp/steps
unset NVIM_LISTEN_ADDRESS
if [ -n "$VIM" ] && [ ! -d "$VIM" ]; then
unset VIM
fi
if [ -n "$VIMRUNTIME" ] && [ ! -d "$VIMRUNTIME" ]; then
unset VIMRUNTIME
fi
echo 'Step 6' >> /tmp/steps
# exec '/opt/homebrew/Cellar/neovim/0.8.0/bin/nvim' --headless --cmd "let g:firenvim_i=[]|let g:firenvim_o=[]|let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}|let g:Firenvim_oo={t->add(g:firenvim_o,t)}|let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})" --cmd 'let g:started_by_firenvim = v:true' -c 'call firenvim#run()'
exec '/opt/homebrew/Cellar/neovim/0.8.0/bin/nvim' --headless --cmd "let g:firenvim_i=[]|let g:firenvim_o=[]|let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}|let g:Firenvim_oo={t->add(g:firenvim_o,t)}|let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})" --cmd 'let g:started_by_firenvim = v:true' -c 'call firenvim#run()' 2>>/tmp/stderr | tee -a /tmp/stdout
echo 'Step 7' >> /tmp/steps
echo 'DONE' >> /tmp/steps
Output:
Step 1
Step 2
Step 3
Step 4
Step 5
Step 6
Maybe not that bad of an idea after all. It looks like something gets hung maybe. I tried the website multiple times and there were never repeat runs of the script.
Edit: I now see that this basically proves your point. I should also add as a comment that when I originally installed this package with Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
I got an error that said Unknown function: firenvim#install
but when I ran the command manually after the install everything worked fine. I just figured something was not getting restarted to acknowledge the new functions.
Mh, so maybe firenvim somehow is not available while being ran from chrome? Could you remove --cmd "let g:firenvim_i=[]|let g:firenvim_o=[]|let g:Firenvim_oi={i,d,e->add(g:firenvim_i,d)}|let g:Firenvim_oo={t->add(g:firenvim_o,t)}|let g:firenvim_c=stdioopen({'on_stdin':{i,d,e->g:Firenvim_oi(i,d,e)},'on_print':{t->g:Firenvim_oo(t)}})"
from the script, while keeping the 2>>/tmp/stderr | tee -a /tmp/stdout
and then attempt to run firenvim at least twice? This might yield some messages about firenvim#run
not existing :thinking:
No changes. The command is now
exec nvim --headless 2>>/tmp/stderr | tee -a /tmp/stdout
but the script still hangs and never completes the printing of step 7
Could you re-add --cmd 'let g:started_by_firenvim = v:true' -c 'call firenvim#run()'
and upload /tmp/stdout and /tmp/stderr here?
Not reaching step 7 is actually normal and expected - the exec
command means "overwrite the rest of the script with this command". If we saw a step 7, this would mean that something went wrong with exec
itself :)
Ah, interesting, I learned something today. Also, finally we got something.
stderr
Error detected while processing command line:
E117: Unknown function: firenvim#run
How could this be if the other steps are working?
My guess would be that your init.vim depends on something (a switch, an environment variable, the current working directory...) being (or not being) set in order to decide whether Firenvim should be loaded. Could you upload your init.vim here?
My init.vim is fairly complicated and references several additional files (I really should convert to lua). Here is is:
"Plugins
let $DOT_ROOT='my_root'
" ===========================================================
" SET, LET, MAP, and COMPILE for GENERAL settings
" ===========================================================
source $DOT_ROOT/set.vim
source $DOT_ROOT/let.vim
source $DOT_ROOT/map.vim
source $DOT_ROOT/compile.vim
" source $DOT_ROOT/graveyard.vim
" ===========================================================
" Mappings to different CONFIGURATIONS
" ===========================================================
" Edit specific configuration files - have to pop up a directory
nmap <leader>vi :e $DOT_ROOT/../.vimrc<CR>
nmap <leader>zi :e $DOT_ROOT/../.zshrc<CR>
nmap <Leader>lp :e $DOT_ROOT/../.pylintrc<CR>:145 <CR>
" Reload vimrc and zshrc, maybe also install plugins
nmap <Leader>cv :source ~/.config/nvim/init.vim<CR>
nmap <Leader>civ :source ~/.config/nvim/init.vim<CR>:PlugInstall<CR>
nmap <Leader>cz :source ~/.zshrc<CR>
" ===========================================================
" Plugin Package settings
" ===========================================================
" Automatically install vim plug if not there
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin(data_dir . '/plugins')
source $DOT_ROOT/vim-plugins/ale.vim
source $DOT_ROOT/vim-plugins/bracey.vim
source $DOT_ROOT/vim-plugins/clever-f.vim
source $DOT_ROOT/vim-plugins/coc.vim
source $DOT_ROOT/vim-plugins/colorschemes.vim "Has plugloaded
source $DOT_ROOT/vim-plugins/comfortable-motion.vim
source $DOT_ROOT/vim-plugins/commentary.vim
source $DOT_ROOT/vim-plugins/fzf.vim
source $DOT_ROOT/vim-plugins/gutentags.vim
source $DOT_ROOT/vim-plugins/markdown-preview.vim
source $DOT_ROOT/vim-plugins/nerdtree.vim
source $DOT_ROOT/vim-plugins/python-mode.vim
" source $DOT_ROOT/vim-plugins/simply-fold.vim
source $DOT_ROOT/vim-plugins/tagbar.vim
source $DOT_ROOT/vim-plugins/targets.vim
source $DOT_ROOT/vim-plugins/vimtex.vim
source $DOT_ROOT/vim-plugins/vim-airline.vim
source $DOT_ROOT/vim-plugins/vim-auto-save.vim
source $DOT_ROOT/vim-plugins/vim-easy-align.vim
source $DOT_ROOT/vim-plugins/vim-easymotion.vim
source $DOT_ROOT/vim-plugins/vim-eunuch.vim
source $DOT_ROOT/vim-plugins/vim-firenvim.vim
source $DOT_ROOT/vim-plugins/vim-floaterm.vim
source $DOT_ROOT/vim-plugins/vim-fugitive.vim
source $DOT_ROOT/vim-plugins/vim-gitgutter.vim
source $DOT_ROOT/vim-plugins/vim-markdown.vim
source $DOT_ROOT/vim-plugins/vim-polyglot.vim
source $DOT_ROOT/vim-plugins/vim-startify.vim
source $DOT_ROOT/vim-plugins/vim-surround.vim
source $DOT_ROOT/vim-plugins/vim-ultisnips.vim
source $DOT_ROOT/vim-plugins/vim-visual-multi.vim
source $DOT_ROOT/vim-plugins/vim-which-key.vim
source $DOT_ROOT/vim-plugins/vim-wiki.vim
source $DOT_ROOT/vim-plugins/winresizer.vim
source $DOT_ROOT/vim-plugins/vim-highlightedyank.vim
call plug#end()
doautocmd User PlugLoaded
The vim-firenvim.vim file is fairly simple:
Plug 'glacambre/firenvim'
I use $DOT_ROOT
because I keep all my dotfiles in a repo and then just symlink everything to the correct spots for a given device (for internships and new lab equipment I have to set this up fairly often).
Could you add call writefile([$HOME, $DOT_ROOT, stdpath("data"), $VIM, $VIMRUNTIME, &runtimepath], "/tmp/data", "a")
on line 3 and at the very end of your init.vim, and attempt to use firenvim multiple times? Afterwards, save /tmp/data
somewhere, and run neovim in the terminal. If you compare the saved /tmp/data
with the new one, do you see any differences?
Of course, and thanks for the timely replies. There were no differences from the run, except that when I ran firenvim multiple times I had the output print twice (which is expected). Here is the output (just pasted it once, and replaced my username with "me")
/Users/me
/Users/me/Documents/Repos/Dotfiles/nvim
/Users/me/.local/share/nvim
/opt/homebrew/Cellar/neovim/0.8.0/share/nvim
/opt/homebrew/Cellar/neovim/0.8.0/share/nvim/runtime
/Users/me/.config/nvim,/opt/homebrew/etc/xdg/nvim,/etc/xdg/nvim,/Users/me/.local/share/nvim/site,/opt/homebrew/share/nvim/site,/usr/local/share/nvim/site,/usr/share/nvim/site,/opt/homebrew/Cellar/neovim/0.8.0/share/nvim/runtime,/opt/homebrew/Cellar/neovim/0.8.0/lib/nvim,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,/opt/homebrew/share/nvim/site/after,/Users/me/.local/share/nvim/site/after,/etc/xdg/nvim/after,/opt/homebrew/etc/xdg/nvim/after,/Users/me/.config/nvim/after
/Users/me
/Users/me/Documents/Repos/Dotfiles/nvim
/Users/me/.local/share/nvim
/opt/homebrew/Cellar/neovim/0.8.0/share/nvim
/opt/homebrew/Cellar/neovim/0.8.0/share/nvim/runtime
/Users/me/.config/nvim,/Users/me/.local/share/nvim/site/plugins/ale,/Users/me/.local/share/nvim/site/plugins/bracey.vim,/Users/me/.local/share/nvim/site/plugins/clever-f.vim,/Users/me/.local/share/nvim/site/plugins/coc.nvim,/Users/me/.local/share/nvim/site/plugins/onedark.vim,/Users/me/.local/share/nvim/site/plugins/vim-one,/Users/me/.local/share/nvim/site/plugins/vim-solarized8,/Users/me/.local/share/nvim/site/plugins/gruvbox,/Users/me/.local/share/nvim/site/plugins/ayu-vim,/Users/me/.local/share/nvim/site/plugins/comfortable-motion.vim,/Users/me/.local/share/nvim/site/plugins/vim-commentary,/Users/me/.local/share/nvim/site/plugins/fzf,/Users/me/.local/share/nvim/site/plugins/fzf.vim,/Users/me/.local/share/nvim/site/plugins/fzf-preview.vim,/Users/me/.local/share/nvim/site/plugins/vim-gutentags,/Users/me/.local/share/nvim/site/plugins/markdown-preview.nvim,/Users/me/.local/share/nvim/site/plugins/nerdtree,/Users/me/.local/share/nvim/site/plugins/vim-devicons,/Users/me/.local/share/nvim/site/plugins/vim-nerdtree-syntax-highlight,/Users/me/.local/share/nvim/site/plugins/tagbar,/Users/me/.local/share/nvim/site/plugins/targets.vim,/Users/me/.local/share/nvim/site/plugins/vimtex,/Users/me/.local/share/nvim/site/plugins/vim-airline,/Users/me/.local/share/nvim/site/plugins/vim-airline-themes,/Users/me/.local/share/nvim/site/plugins/vim-auto-save,/Users/me/.local/share/nvim/site/plugins/vim-easy-align,/Users/me/.local/share/nvim/site/plugins/vim-easymotion,/Users/me/.local/share/nvim/site/plugins/vim-eunuch,/Users/me/.local/share/nvim/site/plugins/firenvim,/Users/me/.local/share/nvim/site/plugins/vim-floaterm,/Users/me/.local/share/nvim/site/plugins/vim-fugitive,/Users/me/.local/share/nvim/site/plugins/vim-gitgutter,/Users/me/.local/share/nvim/site/plugins/tabular,/Users/me/.local/share/nvim/site/plugins/vim-markdown,/Users/me/.local/share/nvim/site/plugins/vim-startify,/Users/me/.local/share/nvim/site/plugins/vim-surround,/Users/me/.local/share/nvim/site/plugins/ultisnips,/Users/me/.local/share/nvim/site/plugins/vim-snippets,/Users/me/.local/share/nvim/site/plugins/vim-visual-multi,/Users/me/.local/share/nvim/site/plugins/vim-which-key,/Users/me/.local/share/nvim/site/plugins/vimwiki,/Users/me/.local/share/nvim/site/plugins/winresizer,/Users/me/.local/share/nvim/site/plugins/vim-highlightedyank,/opt/homebrew/etc/xdg/nvim,/private/etc/xdg/nvim,/Users/me/.local/share/nvim/site,/opt/homebrew/Cellar/neovim/0.8.0/share/nvim/site,/usr/local/share/nvim/site,/usr/share/nvim/site,/Users/me/.local/share/nvim/site/plugins/vim-polyglot,/opt/homebrew/Cellar/neovim/0.8.0/share/nvim/runtime,/opt/homebrew/Cellar/neovim/0.8.0/lib/nvim,/Users/me/.local/share/nvim/site/plugins/vim-polyglot/after,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,/opt/homebrew/Cellar/neovim/0.8.0/share/nvim/site/after,/Users/me/.local/share/nvim/site/after,/private/etc/xdg/nvim/after,/opt/homebrew/etc/xdg/nvim/after,/Users/me/.local/share/nvim/site/plugins/vim-nerdtree-syntax-highlight/after,/Users/me/.local/share/nvim/site/plugins/vimtex/after,/Users/me/.local/share/nvim/site/plugins/tabular/after,/Users/me/.local/share/nvim/site/plugins/vim-markdown/after,/Users/me/.local/share/nvim/site/plugins/ultisnips/after,/Users/me/.config/nvim/after
Mh, perhaps neovim is not allowed to traverse symlinks when ran from Chrome? What happens if you replace the content of your init.vim with just set rtp+=/Users/me/.local/share/nvim/site/plugins/firenvim
and try to use Firenvim multiple times? Do you get anything interesting in /tmp/stdout
or /tmp/stderr
?
Closing this issue because it has been awaiting a response from its author for more than a month. Please provide the requested information and this issue will be re-opened.
What I tried to do
Plug 'glacambre/firenvim'
(no errors)call firenvim#install(0)
(adds correct configs to chrome and firefox, my browsers)echo "abcde{}" | $HOME/.local/share/firenvim/firenvim
$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts/firenvim.json
was present in Chrome (it is)What happened
In Chrome inspector console:
Followed by:
I also enabled error logging for the Chrome extension and got this from the background page (included as a snapshot)
Thanks, and let me know if I can provide any additional information.