terror / chatgpt.nvim

Query ChatGPT in Neovim
Creative Commons Zero v1.0 Universal
277 stars 15 forks source link

E492: Not an editor command: ChatGPT #8

Open vprokopev opened 1 year ago

vprokopev commented 1 year ago

I installed it with packer, same is in README file here. Got a prompt that it is installed successfully. But when I try to use it I get 'E492: Not an editor command: ChatGPT'.

terror commented 1 year ago

You may have to run :UpdateRemotePlugins, let me know if that works, I'll add it to the readme

yingzhu146 commented 1 year ago

Thanks a lot for the amazing plugins @terror!

I have the same issue

I did :UpdateRemotePlugins, it created the rplugin file correctly

.local/share/nvim/rplugin.vim

containing

call remote#host#RegisterPlugin('python3', '/Users/yingzhu/.local/share/nvim/site/pack/packer/opt/chatgpt.nvim/rplugin/python3/chatgpt_nvim.py', [
      \ {'sync': v:false, 'name': 'ChatGPT', 'type': 'command', 'opts': {'nargs': '1'}},
     \ ])

I tried to manually source this file too, but get hit with a

E605: Exception not caught: Plugin "/Users/yingzhu/.local/share/nvim/site/pack/packer/opt/chatgpt.nvim/rplugin/python3/chatgpt_nvim.py" is already registered

So clearly it's loaded.

Nonetheless, get the 492.

maybe Important to note: I'm lazy loading on ChatGPT command via packer, but even if I manually force load it and do the above dance it doesn't work.

Thanks a lot for the help!

kiil commented 1 year ago

I have the same issue. The plugin is loaded, but the ChatGPT command just returns:

E492: Ikke en editor-kommando: ChatGPT which translates to 'E492: Not an editor command: ChatGPT'.

TheJoeSchr commented 1 year ago

On arch linux this worked, plugin was installed via Plug 'terror/chatgpt.nvim', { 'do': 'pip install -r requirements.txt' } .

I created this file: ~/.local/share/nvim/rplugin.vim

call remote#host#RegisterPlugin('python3', '$HOME/.vim/plugged/chatgpt.nvim/rplugin/python3/chatgpt_nvim.py', [
      \ {'sync': v:false, 'name': 'ChatGPT', 'type': 'command', 'opts': {'nargs': '1'}},
     \ ])

observe the different path to .vim/plugged in comparion with @yingzhu146 post.

now :ChatGPT is active and autocompletes

TheJoeSchr commented 1 year ago

now I get this error

Encountered ImportError loading plugin at $HOME/.vim/plugged/chatgpt.nvim/rplugin/python3/chatgpt_nvim.py: No mo
dule named 'chatgpt_nvim'
Traceback (most recent call last):
  File "/home/joe/.py3nvim/lib/python3.10/site-packages/pynvim/plugin/host.py", line 164, in _load
    file, pathname, descr = find_module(name, [directory])
  File "/home/joe/.py3nvim/lib/python3.10/site-packages/pynvim/compat.py", line 30, in find_module
    return original_find_module(fullname, path)
  File "/usr/lib/python3.10/imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'chatgpt_nvim'
TheJoeSchr commented 1 year ago

After replacing $HOME with my absolute file path, I get

no notification handler registered for "/home/joe/.vim/plugged/chatgpt.nvim/rplugin/python3/chatgpt_nvim.py:comm
and:ChatGPT"
Encountered ModuleNotFoundError loading plugin at /home/joe/.vim/plugged/chatgpt.nvim/rplugin/python3/chatgpt_nv
im.py: No module named 'dotenv'
Traceback (most recent call last):
  File "/home/joe/.py3nvim/lib/python3.10/site-packages/pynvim/plugin/host.py", line 165, in _load
    module = imp.load_module(name, file, pathname, descr)
  File "/usr/lib/python3.10/imp.py", line 235, in load_module
    return load_source(name, filename, file)
  File "/usr/lib/python3.10/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 719, in _load
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
ModuleNotFoundError: No module named 'dotenv'
TheJoeSchr commented 1 year ago

So now I found out my python host path via :let g:python3_host_prog => $PY_PATH and then called it and installed the requirements again $PY_PATH -m pip install -r ~/.vim/plugged/chatgpt.nvim/requirements.txt

now I can use :ChatGPT write me something without any ModuleNotFoundError

but I got an error about Notification not registered for ChatGPT plugin. I could "solve" this by actually opening an existing file :D

marwuint commented 1 year ago

i get sameE492: Not an editor command: ChatGPT. installed with packer, says plugin is loaded.

pannet1 commented 1 year ago

i have tried all steps mentioned by @TheJoeSchr but i still get the notification error

no notification handler registered for "/home/pannet1/.loc al/share/nvim/site/pack/packer/start/chatgpt.nvim/rplugin/ python3/chatgpt_nvim.py:command:ChatGPT"

i am on EOS a derivative of Arch LInux