kassio / neoterm

Wrapper of some vim/neovim's :terminal functions.
Other
1.32k stars 117 forks source link

Undefined variable on fresh install #338

Open D00mch opened 2 years ago

D00mch commented 2 years ago

Fresh install with vim native plugin support (vim/pack), no setup, NVIM v0.6.0, osx monterey.

When open clj, python, kotlin, etc, I have some errors (examples below).

I just want to use Tnew, I don't want to think about repl in every environment. Shouldn't plugin ignore this issues when it cant find 'python' on my local setup, unless I set it explicitly in my vimrc?

Error detected while processing FileType Autocommands for "python":
E121: Undefined variable: g:neoterm_repl_python
E116: Invalid arguments for function neoterm#repl#python#is_valid

or with clojure

Error detected while processing /Users/a18385139/dotfiles/.vim/pack/plugins/start/neoterm/autoload/neoterm/repl.vim:
line    1:
E121: Undefined variable: g:neoterm
line    3:
E121: Undefined variable: g:neoterm
line    4:
E121: Undefined variable: l:self
E116: Invalid arguments for function has_key
line   15:
E133: :return not inside a function
line   16:
E193: :endfunction not inside a function
line   87:
E121: Undefined variable: g:neoterm
line   88:
E461: Illegal variable name: l:ft_exec
line   89:
E121: Undefined variable: a:command
E116: Invalid arguments for function s:bracketed_paste
line   92:
E121: Undefined variable: l:ft_exec
E116: Invalid arguments for function function
Error detected while processing function neoterm#repl#set:
line    4:
E121: Undefined variable: g:neoterm_eof
kassio commented 2 years ago

@Liverm0r, that's totally unexpected, these variables are dynamically created to avoid this problem.

E121: Undefined variable: g:neoterm_eof, are you using the latest neoterm version? Did the neoterm download worked properly? By reading the error messages looks like neoterm is incomplete somehow.

D00mch commented 2 years ago

Using 533d311 master (tried it today). Try to reinstall it

cd ~/dotfiles
rm -rf .git/modules/.vim/pack/plugins/start/neoterm
rm -rf .vim/pack/plugins/start/neoterm
# remove lines from .git/config and .gitmodules
cd .vim/pack/plugins/start   
git submodule add https://github.com/kassio/neoterm.git
# everything is cloned & :Tnew works, but I can't open some files like *.py without seeing this error

try setting up my vimrc

set nocompatible
filetype off
let &runtimepath.=',~/dotfiles/.vim/pack/plugins/start/neoterm'
filetype plugin on

nothing helps

kassio commented 2 years ago

@Liverm0r, when you say When open clj, python, kotlin, etc, I have some errors (examples below), you mean you opened a file of these types and got the error? When you open neovim, without any files, does :Tnew works properly?

D00mch commented 2 years ago

yes & yes.

kassio commented 2 years ago

@Liverm0r,

I'm not being able to replicate this behavior, can you please provide me a bit more information:

  1. From your shell:
    • $ tree ~/dotfiles/.vim/pack/plugins/start/neoterm Let me check what was git cloned
  2. From within neovim :echo g:neoterm
D00mch commented 2 years ago
  %  tree ~/dotfiles/.vim/pack/plugins/start/neoterm                                                                                                                                  !4212
/Users/a18385139/dotfiles/.vim/pack/plugins/start/neoterm
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── autoload
│   ├── neoterm
│   │   ├── args.vim
│   │   ├── default.vim
│   │   ├── origin.vim
│   │   ├── repl
│   │   │   └── python.vim
│   │   ├── repl.vim
│   │   ├── target.vim
│   │   ├── term
│   │   │   ├── neovim.vim
│   │   │   └── vim.vim
│   │   └── term.vim
│   └── neoterm.vim
├── bin
│   └── test
├── doc
│   ├── neoterm.txt
│   └── tags
├── ftdetect
│   └── set_repl_cmd.vim
├── plugin
│   └── neoterm.vim
├── test-config
│   ├── nvim
│   │   └── init.vim
│   └── vim
│       └── vimrc
└── vmtest
    ├── args_test.vim
    ├── default_test.vim
    ├── neoterm.vim
    └── origin_test.vim

Opened .py and eval :echo g:neoterm

{'last_id': 0, 'managed': [], 'has_any': function('3'), 'ids': function('2'), 'repl': {'instance': function('274'), 'loaded': 0, 'exec': function('275')}, 'open': 0, 'next_id': function('1
'), 'instances': {}, 'last_command': v:null, 'last': function('4'), 'last_active': 0}
Press ENTER or type command to continue
mfilej commented 2 years ago

I'm seeing the same issue, but if I open Elixir files directly (.ex, .exs, .lock), e.g.:

nvim mix.exs

If I launch nvim first, then :e mix.exs I don't see this error.

Also if I just nvim README.md for example, no error either.

Hope this helps, happy to provide more info.

DanielSiepmann commented 2 years ago

I've same issue with PHP (I guess this is not related to specific file types).

Error detected while processing FileType Autocommands for "php":
E121: Undefined variable: g:neoterm_repl_php
E116: Invalid arguments for function split

I'm Using neovim:

nvim --version
NVIM v0.6.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by nixbld

I then start (for debugging) via: nvim -V localPackages/ds_site/Classes/Frontend/DataProcessing/CategoriesCounts.php That one will show me:

line 2380: sourcing "/nix/store/6s7higrhy066kmjc4dxc1wrx08i0n2ps-vim-pack-dir/pack/home-manager/start/vimplugin-neoterm/ftdetect/set_repl_cmd.vim"
finished sourcing /nix/store/6s7higrhy066kmjc4dxc1wrx08i0n2ps-vim-pack-dir/pack/home-manager/start/vimplugin-neoterm/ftdetect/set_repl_cmd.vim
continuing in /nix/store/9lh249lpifh9kg697kky83b66d3kw52m-neovim-unwrapped-0.6.1/share/nvim/runtime/filetype.vim

But it seems this is loaded prior to the plugins. Resulting in the error as the variables are not defined yet.

I'm encountering this issue while migrating my own custom neovim (0.4.x) with pathogen setup to nix home-manager using native plugin handling. I'm still new to the native plugin handling and don't know much about it. Maybe these files are just not shown with -V

I hope these insights might help to find the cause, or provide info how to properly use the plugin together with native plugin handling.