You are not logged in.

#1 2011-01-13 17:21:25

geo909
Member
Registered: 2008-09-07
Posts: 309

[SOLVED] Vim extremely slow with .tex files

Hello all,

I just installed arch again after a couple of years and I found myself having the following
problem, any help would be greatly appreciated, as this problem has been decreasing
my productivity in a somewhat crucial moment!

I have a few .tex files. When I open then with vim, vim becomes *extremely* slow.
Opening a new line may take a second and moving across the document using
the j and k keys may take ages. Please note the following:

- The files that I'm working with are something like 100 lines, nothing big, really.
- I've been using latex-suite, but disabling it didn't improve things
- Opening a larger .c file didn't cause vim to get slower; somehow this only happens
  with .tex files..
- The problem stays the same when using different several terminal emulators (xterm,
  lxterminal, terminator).

And finally,

- If I comment out big part of the latex code (with %'s), vim becomes responsive again!

Btw I just installed arch, so things are still quite minimal. I'm using the dwm
window manager. Please let me know if you need any further information.

Thank  you in advance!

This is my .vimrc file:
(please also tell me how to insert code here, and I'll fix it asap..) EDIT: fixed

[jorge@flamingo ~]$ cat .vimrc
" General options:

set nocompatible      " explicitly get out of vi-compatible mode
syntax on        " syntax highlighting on
set backup        " make backup files
set noexpandtab                " use tabse, not spaces
set tabstop=5                  " tabstops of 8
set shiftwidth=5               " indents of 8
set textwidth=100              " wrap there
set autoindent smartindent     " turn on auto/smart indenting
set hlsearch         " highlight search
"set guifont=DejaVu\ Sans\ Mono\ 9 
"
" Show information at bottom
set modeline
"set ls=2

" toggle line numbering
map <F5> :set number!<CR>:set number?<CR>

" Vim UI
set cursorline " highlight current line
set number " turn on line numbers

" Store all these *~ files in a backup directory to prevent clutter
set backupdir=~/.vim/backup/

" Press Space to turn off highlighting and clear any message already displayed.
:noremap <silent> <Space> :silent noh<Bar>echo<CR>
set noerrorbells     " don't make noise

" Yankring and yanking:
nnoremap <silent> <F4> :YRShow<CR> " Open YankRing Buffer 
set clipboard=unnamed    "Interact with OS
" Do not put the yankring_history_v2 file in Home, but in .vim directory
let g:yankring_history_dir='$HOME/.vim/'

" Toggle highlight search
function ToggleHLSearch()
       if &hls
            set nohls
       else
            set hls
       endif
endfunction

nmap <silent> <C-n> <Esc>:call ToggleHLSearch()<CR>

" GUI Settings {
"if has("gui_running")
"        colorscheme metacosm         " my color scheme (only works in GUI)
"        set columns=180         " perfect size for me
"        set guifont=Consolas:h10     " My favorite font
"        set lines=55             " perfect size for me
"        set mousehide             " hide the mouse cursor when typing

"endif
" }

" Moving between buffers
map <C-Up> <Esc>:w<CR>:bn<CR>
map <C-Down> <Esc>:w<CR>:bp<CR> 

imap <C-Up> <Esc>:w<CR>:bn<CR>
imap <C-Down> <Esc>:w<CR>:bp<CR> 

imap <F2> <Esc>:w<CR>i
map <F2> <Esc>:w<CR>

"""""""""""""""""""" LATEX SUITE """""""""""""""""""""""""""""""""""""""""""
"
"
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
" (commented out for test purposes, regarding my problem)
"filetype plugin on 

" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*

" OPTIONAL: This enables automatic indentation as you type.
filetype indent on

" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'

"Latex stuff found in this nice webpage:
let g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode --src-specials $*'
let g:Tex_ViewRuleComplete_dvi = 'xdvi -s 8 -keep -editor "gvim --servername vimlatex --remote +\%l \%f" $* &'

 map \lg :execute '!xdvi -s 6 -editor "gvim --servername 'v:servername' --remote +\%l \%f" -sourceposition ' . line(".") . expand("%") . " " . expand(Tex_GetMainFileName(':r')) . ".dvi >/dev/null&" <CR><CR>

imap <F3> <Esc>:w<CR><Bslash>ll<Bslash>lg<CR><C-l>
map <F3> <Esc>:w<CR><Bslash>ll<Bslash>lg<CR><C-l>

" greek stuff:
" always edit in utf-8:
set encoding=utf-8
" but be ready to change encoding with a couple of shortcuts:
map _u :set encoding=utf-8
map _1 :set encoding=iso-8859-1
map _7 :set encoding=iso-8859-7

" assign keyboard commands while using the greek keyboard:
map Α A
map Β B
map Ψ C
map Δ D
map Ε E
map Φ F
map Γ G
map Η H
map Ι I
map Ξ J
map Κ K
map Λ L
map Μ M
map Ν N
map Ο O
map Π P
map Q Q

map Ρ R
map Σ S
map Τ T
map Θ U
map Ω V
map W W
map Χ X
map Υ Y
map Ζ Z
map α a
map β b
map ψ c
map δ d
map ε e
map φ f
map γ g
map η h
map ι i
map ξ j

map κ k
map λ l
map μ m
map ν n
map ο o
map π p
map q q
map ρ r
map σ s
map τ t
map θ u
map ω v
map ς w
map χ x
map υ y
map ζ z

Last edited by geo909 (2011-01-19 18:28:58)

Offline

#2 2011-01-13 17:37:52

zyxon
Member
From: Hungary
Registered: 2010-08-31
Posts: 36
Website

Re: [SOLVED] Vim extremely slow with .tex files

Hi, somewhat offtopic, but this is how you insert code:

Use the [ code ] BBCode tag (without of spaces)

, or an external "code hoster" like pastebin.com

Last edited by zyxon (2011-01-13 17:38:37)

Offline

#3 2011-01-13 17:50:41

geo909
Member
Registered: 2008-09-07
Posts: 309

Re: [SOLVED] Vim extremely slow with .tex files

zyxon wrote:

Hi, somewhat offtopic, but this is how you insert code:

Use the [ code ] BBCode tag (without of spaces)

, or an external "code hoster" like pastebin.com

Many thanks! I fixed the code above, it should be more readable now.

Offline

#4 2011-01-13 18:09:39

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: [SOLVED] Vim extremely slow with .tex files

Try opening the file with:

vim -u NONE filename.tex

(This will disable your .vimrc and other scripts from loading for the session.)

....and see if it's slow then.

Offline

#5 2011-01-13 23:46:16

geo909
Member
Registered: 2008-09-07
Posts: 309

Re: [SOLVED] Vim extremely slow with .tex files

frabjous wrote:

Try opening the file with:

vim -u NONE filename.tex

(This will disable your .vimrc and other scripts from loading for the session.)

....and see if it's slow then.

Thanks for the reply.

Hmm.. Indeed, by doing something like that to the same .tex file, vim is fully responsive.
So it seems that the .vimrc is 'causing all that. I guess that I should start commenting
out things in the .vimrc until I see where the problem is...

Offline

#6 2011-01-19 18:27:19

geo909
Member
Registered: 2008-09-07
Posts: 309

Re: [SOLVED] Vim extremely slow with .tex files

Just wanted to say that highlighting cursor lines
was the reason that made vim painfully unresponsive.
Commenting out the option:

set cursorline 

in .vimrc did the job.

Apparently drawing this cursor line makes vim redrawing the screen all the time, making it slow.

Last edited by geo909 (2011-01-19 18:28:39)

Offline

#7 2013-12-06 23:37:03

yiuin
Member
Registered: 2010-02-02
Posts: 15

Re: [SOLVED] Vim extremely slow with .tex files

I had a similar issue, especially when doing large scale latex math. Adding this to my .vimrc helped more than nocursorline

autocmd FileType tex :NoMatchParen
au FileType tex setlocal nocursorline

Offline

Board footer

Powered by FluxBB