Closed cybardev closed 2 years ago
We don't currently support this natively. There are a few things you could try:
kited
process on VimLeave
(:h VimLeave
)vim-plugin
to start kited as a child process instead of a detached process, but this isn't recommended as Kite's plugin manager will overwrite the directory as a way to update the plugin.--plugin-launch
flag. But it looks like vim-plugin
may already be doing this. You can try :KiteEnableAutostart
to test this.BufWinEnter
/BufEnter
and check if kited is running. vim-plugin
doesn't look like it already does this. This can be considered a feature request that will likely not be high priority. If in the meantime you'd like to hook into this yourself in your nvim config, you can get some inspiration here: https://github.com/kiteco/vim-plugin/blob/90d0e6cdffb214047548fc880619b0f4da04bd25/autoload/kite/utils.vim#L169-L202Ok, sorry, I just read this. The request for Java was invalid then. I'll use something else for Java.
To terminate the kited process when you exit
nvim
, try killing the kited process onVimLeave
(:h VimLeave
)
I've tried the following, but the kited
process isn't started automatically now:
I can confirm the second command works correctly. If I start kited
separately and then edit a python file in nvim, the kite process is automatically terminated on nvim exit.
@cybarspace Try executing the launch command manually, and without suppressing messages, and see if there are any errors:
:execute '!/home/sage/.local/share/kite/kited --plugin-launch &'
:execute '!/home/sage/.local/share/kite/kited --plugin-launch &'
That started kited
but I don't get kite completions by doing this. I tried doing it in same window + same tab, same window + other tab, different window + different tab. Still nothing. pidof kited
does confirm that kited
process starts.
Going back to your original comment, you can enable support for Java and Python (only) with:
let g:kite_supported_languages = ['java', 'python']
See :help kite-g:kite_supported_languages
.
I don't get kite completions by doing this.
Is the BufEnter
autocommand present? :au Kite BufEnter
Is the
BufEnter
autocommand present?:au Kite BufEnter
It actually wasn't. Thanks. That works. Now, could you please tell me what exactly I need to add to my init.vim
config? I'm newb so I'll just copy what you say to the letter.
Launching for specific filetypes is harder since you have to hook into autocmds like
BufWinEnter
/BufEnter
and check if kited is running. vim-plugin doesn't look like it already does this.
@tonycheang The plugin does in fact run on BufEnter
. It first checks whether the buffer's language is one it should activate for, and if so launches kited if it's not already running before configuring various things.
... please tell me what exactly I need to add to my
init.vim
config?
@cybarspace I'm puzzled that the BufEnter
autocommand was missing. Please could you check your plugin version with :echo kite#utils#plugin_version()
? The current version is 1.0.88.
You should only need this in init.vim
:
let g:kite_supported_languages = ['java', 'python']
autocmd VimLeave * call system('kill -TERM $(pidof kited)')
And then open nvim normally.
This will start kited the first time you edit a Java or Python file, leave it running but not doing anything if you edit non-Java, non-Python files, and stop kited when you exit nvim.
I'm puzzled that the
BufEnter
autocommand was missing. Please could you check your plugin version with:echo kite#utils#plugin_version()
? The current version is 1.0.88.
Mine is 1.0.84
You should only need this in
init.vim
:
let g:kite_supported_languages = ['java', 'python']
autocmd VimLeave * call system('kill -TERM $(pidof kited)')
This will start kited the first time you edit a Java or Python file, leave it running but not doing anything if you edit non-Java, non-Python files, and stop kited when you exit nvim.
I might be asking for too much but is there any way to prevent kite from running at all on unsupported languages? It's fine if that's not available yet. The main issue is, even if I put those two in init.vim
and open a python file, there's no word completion. Should I put autocmd BufEnter * call kite#bufenter()
in there manually?
Mine is 1.0.84
It should get updated automatically by Kite but you can always update it manually yourself via git pull
.
...is there any way to prevent kite from running at all on unsupported languages?
Not at the moment; nobody has asked for this before ;)
Just to clarify, you would like the background kite process to be launched and killed as you switch between Java/Python and non-Java/Python buffers?
The BufEnter
autocommand is put there by the plugin; you don't need to do it yourself. If it's missing, something has gone wrong.
... there's no word completion.
What does :echo g:kite_auto_complete
say? Hopefully 1
.
Does it work with <C-X><C-U>
(ctrl-x ctrl-u) in insert mode?
It should get updated automatically by Kite but you can always update it manually yourself via
git pull
.
Mine was installed from the AUR (I'm on Manjaro testing, XFCE + i3wm). There are no updates currently. I'm not sure where I should do git pull
Not at the moment; nobody has asked for this before ;)
Ah, ok. No probs. It's not extremely important. Just feels inefficient to have Kite start even when I'm editing a few bytes of plaintext.
Just to clarify, you would like the background kite process to be launched and killed as you switch between Java/Python and non-Java/Python buffers?
No, that would be heavy on resources, which I'm trying to avoid. Though it wouldn't matter much to me since I'm not a vim power user. I rarely even use tabs, let alone multiple buffers. I just edit one file at a time.
The
BufEnter
autocommand is put there by the plugin; you don't need to do it yourself. If it's missing, something has gone wrong.
Could it be because Kite is turned off from system startup?
What does
:echo g:kite_auto_complete
say? Hopefully1
.
It does output 1
Does it work with
<C-X><C-U>
(ctrl-x ctrl-u) in insert mode?
This shows an error: E764: Option 'completefunc' not set
Mine was installed from the AUR...
Sorry, I don't know what that is. But if you do :filter kite scriptnames
you'll see where the plugin is installed; you should be able to go into that directory and git pull
.
Just feels inefficient to have Kite start even when I'm editing a few bytes of plaintext.
I agree, but it won't start if the plaintext is neither Python nor Java (or whatever you have configured in g:kite_supported_languages
).
Could it be because Kite is turned off from system startup?
No, that wouldn't affect the plugin itself (there's the (neo)vim plugin and also a separate kited process).
The E764
error is caused by the plugin's BufEnter
autocommand being missing. Something must be clearing it.
Is your nvim config online somewhere?
Sorry, I don't know what that is. But if you do
:filter kite scriptnames
you'll see where the plugin is installed; you should be able to go into that directory andgit pull
.
AUR is the Arch User Repository. And, that filter command outputs a path but I tried to go to the vim-plugin
directory and it seems it isn't installed as a git repo.
I agree, but it won't start if the plaintext is neither Python nor Java (or whatever you have configured in
g:kite_supported_languages
).
Oh, I didn't know that. That's probably what I wanted anyway. Thanks a lot.
Is your nvim config online somewhere?
init.vim
(click to expand):PS: I should clean that up, it's a complete mess. Sorry...
I can't see anything in your init.vim that would clear Kite's BufEnter
autocmd. So either the plugin isn't being loaded (but it must be because options like g:kite_auto_complete
are available) or something else is clearing the autocmd.
You could grep your installed plugins and any other nvim config you have for au!
or autocmd!
. Or you could start up neovim with nvim -V20log
, and grep the log
file for BufEnter
.
I actually switched to a different Linux distro and I haven't set up neovim or Kite yet. I will do that soon with a fresh new init.vim
from scratch, and post updates here if the issue persists or if it's all fine and was just something wrong with my config.
Closing because I'm not using Kite anymore. Nothing wrong with it; just not using it.
I would like to start kite as a daemon process with
nvim
and terminate thekited
process when I exitnvim
.I couldn't find anything online on how to do this (mostly because I probably don't know how to go about looking for it).
It'd be great if someone could help me with achieving this effect.
Currently I have the following function in my
.zshrc
, but it starts the kite GUI alongsidenvim
, which I don't want.PS: Ideally I'd like this to happen only for Python and Java files, since I want auto completion there. I don't want kite to start when I edit other filetypes (configs, shell scripts, plaintext, etc.)