Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mulitple citations (more than 3 or 4) on a single line slows down typing and motion movement #77

Open
samtrek opened this issue Apr 16, 2024 · 15 comments

Comments

@samtrek
Copy link

samtrek commented Apr 16, 2024

Including more than 3 citations on a single line greatly reduces the typing speed and motion movement in that line, but other lines without citations are not affected.
Still use able but things become sluggish as typing continues, and their may even be a millisecond land between what is typed and and what is shown on the screen.

@jalvesaq
Copy link
Owner

Are you using Vim or Neovim? Is nvim-treesitter installed and is tree-sitter highlighting enabled?

@samtrek
Copy link
Author

samtrek commented Apr 16, 2024

neovim and nvim-treesitter is installed, but I removed highlighting for markdown, can it still affect zotcite performance?

@jalvesaq
Copy link
Owner

Thanks for the feedback!
I'll investigate this later. It seems to be possible to use treesitter for conceal...

@jalvesaq
Copy link
Owner

With four citations in a line, I can see a delay after pressing the space bar in Insert mode, but only if I have the following lines in my init.lua:

vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.keymap.set('',  '<Space>', '<Nop>')

There is no delay with the default mapleader and maplocalleader.

@samtrek
Copy link
Author

samtrek commented Apr 18, 2024

vim.g.maplocalleader = ','
The above is my default maplocalleader, let me check and test the performance once again.

@samtrek
Copy link
Author

samtrek commented Apr 18, 2024

I reverted back to the default keybinds for nvim, however, the same problem still persists, when in insert mode the slight delay is manageable (when calling on citations), however when writing normal sentences it can slow down work flow a little bit, especially when moving with the motion jklh vim-motion keys.

@jalvesaq
Copy link
Owner

I didn't see any slowness in Vim. But, in Neovim, the slowness persists even if I comment out line 652 of autoload/zotcite.vim:

        syn match zoteroKey  /@\S*[A-Z0-9]\{8}#/ conceal

So, my idea of using treesitter to conceal the Zotero key would probably make no difference.

@jalvesaq
Copy link
Owner

I just discovered that the delay that I was seeing was caused by a new feature that is being introduced in this pull request: R-nvim/R.nvim#116

I changed the default configuration to insert a native R pipe from <LocalLeader>m (my <LocalLeader> is a <Space>) to ;; and now there is no delay. Of course, the cursor seems to be put when pressing h and l keys in Normal mode while moving from one character of the Zotero key to another because the characters are concealed and we can't see the cursor movement, but this is the expected behavior.

@PMassicotte
Copy link

PMassicotte commented Apr 19, 2024

<loacalLeader>m was not used for sending motion?

@samtrek
Copy link
Author

samtrek commented Apr 19, 2024

Trying to see if the lag is CPU dependent, will check it out on a more modern CPU.

I just discovered that the delay that I was seeing was caused by a new feature that is being introduced in this pull request: R-nvim/R.nvim#116

I changed the default configuration to insert a native R pipe from <LocalLeader>m (my <LocalLeader> is a <Space>) to ;; and now there is no delay. Of course, the cursor seems to be put when pressing h and l keys in Normal mode while moving from one character of the Zotero key to another because the characters are concealed and we can't see the cursor movement, but this is the expected behavior.

the above is mainly in *.r or *.rmd documents, I am using it in *.md files and the lag is visible, when moving with the jkhl keys.

@jalvesaq
Copy link
Owner

I'll soon merge the branch nvim into the master branch. The nvim branch replaced VimScript with Lua, but I don't think it will make any difference for this issue. Anyway, could you try it?

@samtrek
Copy link
Author

samtrek commented Jul 15, 2024

yes I will give it a try.

@jalvesaq
Copy link
Owner

The nvim branch is the master branch now.

@samtrek
Copy link
Author

samtrek commented Oct 17, 2024

I am sorry, I have being encountering this error,
Error executing lua callback: TextChangedI Autocommands for "*"..function provider#python3#Call, line 1: Vim(return):E5108: Error executing lua Vim:Error invoking 'python_eval' on channel 7 (python3-script-host):
Traceback (most recent call last):
File "", line 1, in
NameError: name 'ZotCite' is not defined
stack traceback:
[C]: at 0x5904f7c7733c
[C]: in function 'py3eval'
...cal/share/nvim/lazy/cmp-zotcite/lua/cmp_zotcite/init.lua:126: in function 'complete'
...mtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/source.lua:326: in function 'complete'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:299: in function 'complete'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:169: in function 'callback'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:229: in function 'autoindent'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:161: in function 'on_change'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:346: in function 'callback'
...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:49: in function 'emit'
...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:23: in function <...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:22>
stack traceback:
[C]: in function 'py3eval'
...cal/share/nvim/lazy/cmp-zotcite/lua/cmp_zotcite/init.lua:126: in function 'complete'
...mtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/source.lua:326: in function 'complete'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:299: in function 'complete'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:169: in function 'callback'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:229: in function 'autoindent'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:161: in function 'on_change'
...samtrek/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:346: in function 'callback'
...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:49: in function 'emit'
...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:23: in function <...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:22>

the main reason I could not get back to you, I thought something went wrong and it will be fixed in the next update, but this is what I keep getting once I type @ and one or two letters, maybe the error is coming from me but I have gone through all my configs and I could not find what was wrong.

@jalvesaq
Copy link
Owner

NameError: name 'ZotCite' is not defined

ZotCite is a Python object, and the message above means that it wasn't created. Perhaps a Python dependency (PyYAML or sqlite3) is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants