Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server does not run due to empty g:nvim_ghost_binary_path #68

Open
mostafatouny opened this issue Nov 10, 2024 · 9 comments
Open

Server does not run due to empty g:nvim_ghost_binary_path #68

mostafatouny opened this issue Nov 10, 2024 · 9 comments

Comments

@mostafatouny
Copy link

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.

@mostafatouny mostafatouny changed the title Server does not run due to setting let g:nvim_ghost_binary_path Server does not run due to empty g:nvim_ghost_binary_path Nov 10, 2024
@subnut
Copy link
Owner

subnut commented Nov 10, 2024

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?

@mostafatouny
Copy link
Author

mostafatouny commented Nov 10, 2024

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

@mostafatouny
Copy link
Author

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

@subnut
Copy link
Owner

subnut commented Nov 10, 2024

.... 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"

@mostafatouny
Copy link
Author

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

@mostafatouny
Copy link
Author

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

@mostafatouny
Copy link
Author

Also note :GhostTextStart returns E492: Not an editor command: GhostTextStart.

@mostafatouny
Copy link
Author

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.

@mostafatouny
Copy link
Author

I think you should modify nvim_ghost.vim file, augroup nvim_ghost, and add autocmd ExitPre * call nvim_ghost#helper#kill_server() also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants