Open hungpham3112 opened 1 year ago
I've run into the very same problem today.
While debugging the code, I found that if the system both respond to the 'python' and 'python3' then the initialization prosess does not begin in the plug in.
Check this commend
:echo !has('python3') && !has('python')
if it returns 1, then the plugin would just exit without running.
I guess the original author designed this way when the plugin does not sure which python to use.(I gave up too. this is really annoying problem)
I'm the original author. Would love a PR to fix this! :)
I think we just favour python3 if found first. Otherwise fallback to others.
I've run into the very same problem today. While debugging the code, I found that if the system both respond to the 'python' and 'python3' then the initialization prosess does not begin in the plug in. Check this commend
:echo !has('python3') && !has('python')
if it returns 1, then the plugin would just exit without running.I guess the original author designed this way when the plugin does not sure which python to use.(I gave up too. this is really annoying problem)
This is the way it should be, isn't it? If you don't have python3 nor python how the plugin is supposed to run? Note that with the exception of the plugin script, the whole plugin is basically written in Python.
As it is today (2023) I guess you should have python3, therefore be sure that :echo has('python3')
returns 1.
If not, then you should set your pythonthreedll
option in vim.
This is the way I set it on my .vimrc
(based on this : https://stackoverflow.com/questions/74718716/how-to-get-my-vim-and-macvim-to-find-python3) :
if has("gui_win32") || has("win32")
set pythonthreehome=$HOME."\\Miniconda3"
set pythonthreedll=$HOME."\\Miniconda3\\python39.dll"
elseif has("mac")
&pythonthreehome = fnamemodify(trim(system("which python")), ":h:h")
&pythonthreedll = trim(system("which python"))
endif
Also, try to run :python3 print('Hello world')
and see what happens.
Unrelated: at startup, I get the following message:
Could not find a matching env in the list.
This probably means that you are using a local
(prefix) Conda env.
This should be fine, but changing to a named env
may make it difficult to reactivate the prefix env.
may that be because in conda
now the default environment is called base
instead of root
?
Unrelated: at startup, I get the following message:
Very possible. I haven't personally used vim-conda in a very long time. I will still merge PRs though so if you can fix it to be better for how conda is today, I'll happily accept that.
I was thinking to do that but in-spite the code looks very neat and not super hard to understand that would require me to study how to use Python in a different context than "data-science" + how to vimscript with python (I only used 100% vim9script) = lot of time which unfortunately at the moment I don't have (other life's priorities).
Nevertheless, if I will find some time in the future I will definitely try to send some PR :)
I actually found some time this morning and I just issued a PR. :)
Thank you, I merged the PR and sent you an invite to be a collaborator on this project. Can this issue be closed now?
I don't know, I wasn't the issue opener :)
Hi, I'm an issue opener. I will check and return feedback.
I'm tested with Windows 11 terminal vim , the plugin works correctly when apply Lazy load in plug.vim settings.
Plug 'https://github.com/cjrh/vim-conda.git', {'for': ['python']}
I have some concerns towards the performance.
It took ~2-3 seconds to run at startup. It is within acceptable range but I believe startup time can improve for the better
The plugin will show the message and I have to confirm if not lazy load.
vim-terminal:
https://github.com/cjrh/vim-conda/assets/75968004/a93146e0-319b-4fc8-be99-2cfcba15a09f
in the video, first time I loaded plugin without lazy behavior, then I set it back so we can see the different result.
gvim:
https://github.com/cjrh/vim-conda/assets/75968004/5a45f737-c464-4aa2-a50c-62f5676aea53
Hi!
Same here. I think that is the combination of two factors: conda itself is not very fast in changing environment and the plugin is written in Python which is notoriously slow. I think that this plugin is super useful and perhaps today it could be rewritten in VimScript for at least two reasons that come on top my head: Vim9 is faster and Vim9Script is much easier to write; Conda has changed in the meantime; we have LSP today so we don't need to consider a dedicated path for Jedi perhaps. I am personally considering to rewrite it "as-is" in Vim9script but don't hold your breath because I don't know "if" nor "when".
The second does not look like an error message but rather a notification. What you get when you type :messages
after Vim started up?
For the linting I suggest you to use this. You can give the LSP server complete path so you don't have to bother about changing environment. You can check my .vimrc profile that I store in my github profile to take some inspiration, but if you have any question feel free to ask.
2. The second does not look like an error message but rather a notification. What you get when you type `:messages` after Vim started up?
Yes, it's a notification. It's show base
at the first time I open vim if I'm in conda base
. My thought in here is another way to this message because opening without lazy load cause you have to confirm to enter vim, it's noisy.
How about adding
autocmd VimEnter * silent call ActivateEnv()
function! ActivateEnv() " Your function code here echo "base" endfunction
@hungpham3112 You could try this: https://github.com/ubaldot/vim-conda-activate It is brand new so it will most likely have some bugs, and it has been tested only on OSX. You could give it a shot anyway, it should be faster as it is 99% in VimScript.
I wrote a new plugin due to that this plugin is not being maintained anymore (but still accept PR:s) and because conda has changed throughout the years, Vim script has substantially improved. So, I thought it would have been easier to rewrite it in Vim9. I hope it does not bother :)
I wrote a new plugin due to that this plugin is not being maintained anymore (but still accept PR:s) and because conda has changed throughout the years, Vim script has substantially improved. So, I thought it would have been easier to rewrite it in Vim9. I hope it does not bother :)
I checked your plugin. It's nice and clean with popup feature, I love that. @cjrh How about adding new reference to README.md to help new people know about @ubaldot plugin? It would be good for community. Thanks
I suggested same to @ubaldot in the other issue. He is a collaborator on this project and I've encouraged him to add at reference in the README. Higher up is better.
I downloaded the plugin today but not found the command on my machine. Maybe I missed something?
https://user-images.githubusercontent.com/75968004/216567523-ff27e4e3-2f94-4bd3-a64f-521b0b257c01.mp4