Server does not run due to empty g:nvim_ghost_binary_path
Hello,
If I manually run nvim-ghost-binary the server runs and everything works as expected. However, whenever I launch neovim and load nvim-ghost I get error message "could not connect to localhost:4001". When I debugged I figured out:
echo g:nvim_ghost_installation_dir returns the correct installation path but nvim_ghost_binary_path returns the empty string. When I attempted to manually set nvim_ghost_binary_path to the path of binary file, I would still get an empty string. Any other string can be set to nvim_ghost_binary_path.
In my init.lua I have
vim.g.nvim_ghost_binary_path = "/home/touny/.local/share/nvim/lazy/nvim-ghost.nvim/nvim-ghost-binary"
and echo g:nvim_ghost_binary_path returns the empty string.
What do these return?
-
echo g:nvim_ghost_installation_dir -
echo g:nvim_ghost_scripts_dir -
echo g:nvim_ghost_script_path -
echo g:nvim_ghost_binary_path
Also, what's the output of :version?
echo g:nvim_ghost_installation_dir
/home/touny/.local/share/nvim/lazy/nvim-ghost.nvim
echo g:nvim_ghost_scripts_dir
/home/touny/.local/share/nvim/lazy/nvim-ghost.nvim/scripts/
echo g:nvim_ghost_script_path
/home/touny/.local/share/nvim/lazy/nvim-ghost.nvim/binary.py
echo g:nvim_ghost_binary_path
empty string
:version
NVIM v0.10.2 LuaJIT 2.1.1727870382
Moreover doing let tem = g:nvim_ghost_binary_path = g:nvim_ghost_installation_dir .. "nvim-ghost-binary" then echo tem returns the empty string also
.... this is perplexing.
what's the output of
echo "a/b/c/" .. "a-b-c"
echo g:nvim_ghost_installation_dir
echo g:nvim_ghost_installation_dir .. "HI"
echo g:nvim_ghost_installation_dir .. "nvim-ghost-binary"
I cloned nvim-ghost-binary to nvim-ghost and cloned nvim-ghost-binary.version to nvim-ghost.version, and modified nvim_ghost with let g:nvim_ghost_binary_path = g:nvim_ghost_installation_dir .. 'nvim-ghost' in place of " let g:nvim_ghost_binary_path = g:nvim_ghost_installation_dir .. 'nvim-ghost-binary' .. (has('win32') ? '.exe' : '')
The server does run at expected. When I manually run call nvim_ghost#helper#start_server() it works
echo "a/b/c/" .. "a-b-c"
a/b/c/a-b-c
echo g:nvim_ghost_installation_dir
/home/touny/.local/share/nvim/lazy/nvim-ghost.nvim/
echo g:nvim_ghost_installation_dir .. "HI"
/home/touny/.local/share/nvim/lazy/nvim-ghost.nvim/HI
echo g:nvim_ghost_installation_dir .. "nvim-ghost-binary"
empty string
Also note :GhostTextStart returns E492: Not an editor command: GhostTextStart.
To fix the server startup, I modified file nvim_ghost.vim, function nvim_ghost#enable, changing
function! nvim_ghost#init(defer = 1) to function! nvim_ghost#init(defer = 0) so that line call s:start_server_or_request_focus() inside function nvim_ghost#enable runs on startup.
I think you should modify nvim_ghost.vim file, augroup nvim_ghost, and add autocmd ExitPre * call nvim_ghost#helper#kill_server() also.