lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.55k stars 390 forks source link

Too slow to work with #1899

Closed bataak closed 3 years ago

bataak commented 3 years ago

It's too slow to moving cursor or writing new command. Here is my vimtexinfo:

System info
  OS: Mac OS X 10.15.7 (19H114)
  Vim version: VIM 8.2 (1-1500)
  Has clientserver: false

vimtex project: Algorithms
  base: Algorithms.tex
  root: /Users/bataak/Documents/Projects/Algorithm
  tex: /Users/bataak/Documents/Projects/Algorithm/Algorithms.tex
  out: 
  log: /Users/bataak/Documents/Projects/Algorithm/Algorithms.log
  aux: /Users/bataak/Documents/Projects/Algorithm/Algorithms.aux
  fls: /Users/bataak/Documents/Projects/Algorithm/Algorithms.fls
  main parser: recursive search
  source files:
    Algorithms.tex
    main.tex
  compiler: latexmk
    configuration: 
      continuous: 1
      callback: 1
      latexmk options:
        -verbose
        -file-line-error
        -synctex=1
        -interaction=nonstopmode
      latexmk engine: -pdf
  viewer: General
  qf: LaTeX logfile
    addqflist: 325
    fix_paths: 326
    set_errorformat: 324
  document class: scrbook
  packages:
    amsbsy
    amsgen
    amsmath
    amsopn
    amstext
    amsthm
    array
    babel
    centernot
    enumerate
    epstopdf-base
    etoolbox
    exercise
    expl3
    float
    fontaxes
    fontenc
    graphics
    graphicx
    grfext
    iftex
    ifthen
    infwarerr
    inputenc
    keyval
    kvdefinekeys
    kvoptions
    kvsetkeys
    listings
    lstlang1
    lstmisc
    ltxcmds
    makeidx
    newpxmath
    newpxtext
    nomencl
    pdftexcmds
    scrbase
    scrkbase
    scrlfile
    tasks
    textcomp
    tocbasic
    trig
    typearea
    xkeyval
    xparse
    xpatch
    xtemplate
lervag commented 3 years ago

Thanks for posting the issue, but

It's too slow to moving cursor or writing new command.

Can you please help me: how do you propose I address this issue? Do you think vimtex is too slow for other people? If it were, it would obviously not be popular. So, let's assume it is not slow for most people. Then, how do you think I can improve vimtex based on your description?

Did you notice that there was prefilled content when you started to post your issue? Did you read that?

bataak commented 3 years ago

Actually I don't know for other people. But in my case, it's obviously slow if I open tex file. In case of other files, I don't see any slowness. Maybe the reason is my vim (not neovim)?

lervag commented 3 years ago

Please, read the issue template carefully. Notice how the following is clearly stated:

Provide a clear and short description of the issue. Use simple english.

Provide relevant files and commands in detail, so everybody can reproduce the issue!

In particular, there is no way of knowing why things are slow for you based on your current feedback, which is basically just "things are slow". So, to be explicit:

  1. Please post your relevant Vim configuration. Preferably, create a minimal vimrc as suggested in the issue template. I am 99% sure that you will see that Vimtex is not slow with a minimal configuration. That is, your problem is very likely to be related to your configuration.

  2. Please post an explicit description on how to reproduce your issue. E.g.: i) open Vim with vim test.tex, ii) do "whatever actions", and iii) observe slowness.

Notice how all of the above is explained/outlined in the issue template.

Please don't take my bluntness badly: I don't mean to be rude, but I do spend quite a lot of time on developing and maintaining Vimtex. Responding to posts like this where I explain how to post issues in a way that makes it possible for me to actually help reduces the time I have to actually improve and fix bugs.

bataak commented 3 years ago

There is no particular configuration on my vimrc for vimtex. To be clear I've posted the whole file. I'm pretty sure that if I put around 3000 lines of simple latex text it happens (at this point I've disabled my autocomplete plugin too)

set encoding=utf-8
syntax enable
set number
set laststatus=0
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set hlsearch
set tws=10x0
set noequalalways
set shortmess-=S
set spelllang=mn
set backspace=indent,eol,start

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'lervag/vimtex'
Plugin 'ycm-core/YouCompleteMe'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'preservim/nerdtree'
Plugin 'majutsushi/tagbar'
Plugin 'morhetz/gruvbox'
Plugin 'rhysd/vim-clang-format'
Plugin 'psf/black'
Plugin 'tpope/vim-endwise'
Plugin 'devinceble/Tortoise-Typing'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-commentary'
Plugin 'ap/vim-css-color'
Plugin 'rstacruz/sparkup'
Plugin 'dense-analysis/ale'
Plugin 'maxmellon/vim-jsx-pretty'
Plugin 'prettier/vim-prettier'
Plugin 'aklt/plantuml-syntax'
Plugin 'tyru/open-browser.vim'
Plugin 'weirongxu/plantuml-previewer.vim'
Plugin 'christoomey/vim-sort-motion'

call vundle#end()

filetype off
filetype plugin indent on

let g:tex_flavor = 'latex'
let g:clang_format#style_options = {
            \ "IndentWidth" : 4,
            \ "AccessModifierOffset" : -4,
            \ "UseTab" : "Never",
            \ "AllowShortIfStatementsOnASingleLine" : "false",
            \ "AlwaysBreakTemplateDeclarations" : "true",
            \ "Standard" : "C++11"}

autocmd FileType c,cpp,objc,java nnoremap <buffer><leader>f :ClangFormat<CR>
autocmd FileType c,cpp,objc,java ClangFormatAutoEnable
autocmd FileType python nnoremap <buffer><leader>f :Black<CR>
autocmd BufWritePre *.py Black
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync

let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:UltiSnipsEditSplit="vertical"
let g:AutoPairsFlyMode = 1

let g:ale_linters = {'javascript': ['eslint']}
let g:ale_fixers = { 'javascript': ['eslint'], 'typescript': ['prettier', 'tslint'], 'scss': ['prettier'], 'html': ['prettier'], 'reason': ['refmt'] }

let g:prettier#quickfix_enabled = 0

colorscheme gruvbox
set background=dark

map <leader>l :TagbarToggle<CR>
map <leader>n :NERDTreeToggle<CR>
nnoremap <C-p> :Files<CR>

nnoremap <silent> <C-j> :res +5<CR>
nnoremap <silent> <C-k> :res -5<CR>

nnoremap <silent> <Leader><Space> :Files<CR>

let g:ycm_autoclose_preview_window_after_completion = 1
lervag commented 3 years ago

Thanks, but it is still not possible for me to help you. Do you expect me to copy your configuration and type 3000 lines of LaTeX to try and reproduce?

I assume you have one or more documents where you experience the slowness. Let's choose one of these, and for simplicity, I'll call it test.tex. Can you do the following:

  1. In a terminal, go to the folder containing test.tex with cd ~/path/to/test.tex.

  2. Create a simple test.vim file:

    set nocompatible
    let &rtp = '~/.vim/bundle/vimtex,' . &rtp
    let &rtp .= ',~/.vim/bundle/vimtex/after'
    filetype plugin indent on
    syntax enable
    
    nnoremap q :qall!<cr>
  3. Now start Vim with vim --servername VIM test.vim test.tex (obv., you must use the correct file name here).

After step 3: can you reproduce the slowness? If so, how exactly. Please describe in full.

bataak commented 3 years ago

The problem was in my config file (ale). Thanks for your time!

lervag commented 3 years ago

No problem, happy to hear you figured it out.