Closed casr closed 6 years ago
I think htmlcomplete
change cursor position.
https://github.com/vim/vim/blob/master/runtime/autoload/htmlcomplete.vim#L97
Interesting. I take from your response that it is not a great idea for a complete function to do that but I am not too familiar with them. Do you think I should look for a different complete function or that the problem should be handled by asyncomplete.vim
/asyncomplete-omni.vim
? /cc @prabirshrestha
I searched the Vim source for call cursor
and it comes up in phpcomplete.vim
, rubycomplete.vim
and sqlcomplete.vim
so there may be potential problems there too.
It can't be fixed by in asyncomplete. The omni-func needs to be fixed. One temporary option would be to do this.
Plug 'Shougo/neco-syntax'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-necosyntax.vim'
call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({
\ 'name': 'omni',
\ 'whitelist': ['*'],
\ 'blacklist': ['html'],
\ 'completor': function('asyncomplete#sources#omni#completor')
\ }))
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#necosyntax#get_source_options({
\ 'name': 'necosyntax',
\ 'whitelist': ['*'],
\ 'completor': function('asyncomplete#sources#necosyntax#completor'),
\ }))
https://github.com/prabirshrestha/asyncomplete-necosyntax.vim
I usually don't spend time in html much since I use react with typescript language server. There is a LSP for html but I haven't tried it yet. https://www.npmjs.com/package/vscode-html-languageservice
For php I reocmmend using LSP. https://github.com/prabirshrestha/vim-lsp/wiki/Servers-PHP. LSP adds support for things like go to def, rename, find symbols, linting, code completion and much more.
here is how my vimrc looks like. https://gist.github.com/prabirshrestha/279d8b179d9353fe8694/7a291666de64748efe32c24b13c9263198a4fe1c#file-vimrc-L178-L248.
@casr might be good to start the discussion on https://github.com/vim/vim about call cursor
Thank you both very much for your responses and suggestions. I think as the problem is isolated to a few filetypes I am quite happy to disable them for now.
I could not get the vscode-html-languageservice
package to work. I think it might need a wrapper around it to launch a more LSP-y server.
@prabirshrestha thanks for a sharing your vimrc
. Lots of useful things in there!
I have noticed an issue when using HTML where the cursor jumps away from where it should be. It also seems to corrupt the undo history making the change hard to undo. The issue is present in Vim and Neovim.
Here is a bare minimum
vimrc
to make testing easier:Use the command:
vim -u ~/minimalrc a.html
and then go into insert mode and type:You should notice that after typing 'a' the cursor jumps to the beginning of the line.