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

Lag, (probably not related with known matchparen issue #2951

Open
945fc41467 opened this issue May 8, 2024 · 4 comments
Open

Lag, (probably not related with known matchparen issue #2951

945fc41467 opened this issue May 8, 2024 · 4 comments
Labels

Comments

@945fc41467
Copy link

945fc41467 commented May 8, 2024

Description

Using basic motion key lag on certain specific places when vimtex is activated

For example ([ ] representing the position of the cursor) :

  \begin{Defin[i]tion}[Produit matriciel :]
    Soient $A,[ ]B \in M_{m;l}(\R)×M_{l;n}(\R)$, $A \cdot B = 
    \left(\sum_{k=1}^{l}{a_{i;k}\cdot b_{k;j}}\right)_{
      {i\in\llbracket 1; m \rrbracket}\atop
      {j\in\llbracket 1; n \rrbracket}}$
  \end{Definition}

the switch between [ ] and [i] is ok, but it lag in the reverse order.

You can reproduce it with your minimal example :

\documentclass{minimal}
\begin{document}
Hello world!
\end{document}

Just try to navigate in the text with hjkl keys.

I tried with let g:vimtex_matchparen_enabled = 0. It doesn’t change anything. I added let loaded_matchparen = 1. Still the same.
The use of vim-matchup doesn’t change anything. There is no lag if vimtex is disabled.

I use nvim, with neovide.

Here is my config:

" VIM Configuration

" --Thème
let &colorcolumn=join(range(81,160),",")

" -- Affichage
set title           " Met a jour le titre de votre fenêtre ou de votre terminal
set number          " Affiche le numéro des lignes
set textwidth=80    " Affiche les lignes trop longues sur plusieurs lignes
set linebreak       " Coupe le mot entier
set scrolloff=3     " Minimum de 3 lignes autour du curseur lors du scroll
set lines=80 columns=100
set cursorline

" -- Recherche
set ignorecase      " Ignore la casse lors d'une recherche…
set smartcase       " …sauf si la recherche contient une majuscule 

" -- Clipboard

set clipboard+=unnamedplus

" -- Beep
"set visualbell            " Empêche Vim de beeper
"set noerrorbells          " Empêche Vim de beeper

" Active le comportement 'habituel' de la touche retour en arrière
let mapleader = ","

" --Coloration syntaxique
filetype plugin on
filetype indent on
set listchars=tab:▸-,extends:>,precedes:<,leadmultispace:·,nbsp:~
autocmd BufRead,BufNewFile *.txt,*.md setlocal listchars+=multispace:·
set list
"autocmd BufRead,BufNewFile *.txt,*.md highlight NBSP guibg=darkblue
autocmd BufRead,BufNewFile *.txt,*.md syn match NBSP '\%xa0' conceal cchar=~
autocmd BufRead,BufNewFile *.txt,*.md syn match NNBSP '\%u202F' conceal cchar=·
" -- Typo
autocmd BufRead,BufNewFile *.txt,*.md highlight typo guibg=darkred
autocmd BufRead,BufNewFile *.txt,*.md syn match typo /\%u202F:/
autocmd BufRead,BufNewFile *.txt,*.md syn match typo /\%xa0[;?!]/
autocmd BufRead,BufNewFile *.txt,*.md syn match typo /—\%xa0.*\%xa0—/


"highlight ColorColumn guibg=#010101
highlight NbSp ctermbg=white guibg=green
match NbSp /\%xa0/


" --Tabulations
set tabstop=2 " Largeur de tabulation
set shiftwidth=2
set expandtab " Remplacer les tabulation par des espaces


:imap ’’ <Esc>
:map ’’ <Esc>


set foldmethod=indent
set foldlevelstart=99
set foldlevel=99
set autochdir
set signcolumn=yes

" -- Autocompletion
" Use <tab> to trigger completion.
inoremap <silent><expr> <tab> coc#refresh()

" Make <space> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <C-space>
      \ coc#pum#visible() ? coc#pum#confirm():
      \                     "\<C-g>u\<C-space>"

" Use <C-t> for trigger completion with characters ahead and navigate
inoremap <silent><expr> <C-t>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \                     CheckBackspace() ? "\<C-t>" :
      \                                        coc#refresh()
inoremap <expr><C-s> coc#pum#visible() ? coc#pum#prev(1) : "\<C-s>"

function! CheckBackspace() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" Remap keys for applying refactor code actions
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
xmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)
nmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)

" Use <TAB> to trigger orthograph corrector
nmap <TAB>  <Plug>(coc-codeaction-cursor)

"hi LanguageToolGrammarError  guisp=green gui=undercurl guifg=NONE guibg=NONE ctermfg=white ctermbg=blue term=underline cterm=none
"hi GrammalecteSpellingError guisp=red  gui=undercurl guifg=NONE guibg=NONE ctermfg=white ctermbg=red  term=underline cterm=none
":let g:grammalecte_win_height=-1
"set spl=fr spell

" -- Latex configuration
" Viewer options: One may configure the viewer either by specifying a built-in
" with a generic interface:
"let g:vimtex_view_general_viewer = 'evince'
"let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
let loaded_matchparen = 1
let g:vimtex_matchparen_enabled = 0
let g:matchup_override_vimtex = 1
let g:matchup_matchparen_deferred = 1

" -- csv configuration
let g:csv_bind_B = 1
let g:csv_start = 1
let g:csv_end = 100
let g:csv_arrange_align = 'l*'

call plug#begin('~/.local/share/nvim/site/plugged')
Plug 'rakr/vim-one'
Plug 'altercation/solarized'
Plug 'vim-airline/vim-airline'
Plug 'neovim/neovim-ruby'
"Plug 'vim-scripts/LustyExplorer'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'chrisbra/csv.vim'
Plug 'lervag/vimtex'
Plug 'andymass/vim-matchup'
Plug 'michamos/vim-bepo'
call plug#end()


colorscheme one

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

For the moment I use default configuration. I am still trying to learn how it works

VimtexInfo

System info:
  OS: Manjaro Linux
  Vim version: NVIM v0.9.5
  Has clientserver: true
  Servername: /run/user/1000/nvim.79898.0

VimTeX project: example
  base: example.tex
  root: ~/
  tex: ~/example.tex
  main parser: current file verified
  document class: extarticle
  packages: authoraftertitle derivative enumitem fancyhdr fontspec geometry linegoal mathtools multicol ntheorem paracol polyglossia siunitx stmaryrd titlesec unicode-math xcolor xltabular
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile
@945fc41467 945fc41467 added the bug label May 8, 2024
@lervag
Copy link
Owner

lervag commented May 8, 2024

Using basic motion key lag on certain specific places when vimtex is activated …

You can reproduce it with your minimal example : …

I'm sorry if I'm daft, but the minimal example here that you claim should reproduce this is:

\documentclass{minimal}
\begin{document}
Hello world!

\begin{Definition}[Produit matriciel :]
  Soient $A,█B \in M_{m;l}(\R)×M_{l;n}(\R)$, $A \cdot B = 
  \left(\sum_{k=1}^{l}{a_{i;k}\cdot b_{k;j}}\right)_{
    {i\in\llbracket 1; m \rrbracket}\atop
    {j\in\llbracket 1; n \rrbracket}}$
\end{Definition}

\end{document}

where indicates the initial cursor position. You are saying that moving the cursor with k is ok, but moving it back down with j is laggy. Did I understand correctly?

@lervag
Copy link
Owner

lervag commented May 8, 2024

For the record: I can not reproduce this lag on my end.

@945fc41467
Copy link
Author

That’s right. I tried with you example and I have the same behavior. I didn’t identify the logic in which move is laggy or not. It look rather random. But the navigation is very difficult like this.

@lervag
Copy link
Owner

lervag commented May 19, 2024

Ok. So, the main approahc for helping you with this is to have you create a minimal configuration that reproduces this. But before we start doing that, can you do this:

  1. Open the example LaTeX file provided above with neovim as you usually do.
  2. Report output of :scriptnames (I would prefer if you could paste the output verbatim in your reply instead of using a screenshot).
  3. :profile start profile.log
  4. :profile func *
  5. :profile file *
  6. Navigate for a while, make sure you experience the lag.
  7. :profile pause
  8. :qa!
  9. Please provide the contents of profile.log here.

I may be able to figure out your problem from this output.

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

No branches or pull requests

2 participants