Vim scroll setting overridden

I am trying to apply the following parameter to my .tex files:

 set scroll=4 

I put this in both my ~/.vimrc and my ~/.vim/ftplugin/tex.vim file. For shared files, this works great. For .tex files, all other parameters in these files apply. But not scroll setting.

Note. I have a latex package installed, which I suspect overrides the configuration.

When i type

 :verbose set scroll 

I get:

  scroll=22 Last set from ~/.vim/ftplugin/tex.vim 

Note: 22 is half the height (number of lines) of the gvim window.

If I edit the ~/.vim/ftplugin/tex.vim while editing, the scroll option applies fine, but I want it to be applied along with other settings at startup.

thanks

Update:

Thanks for the good advice. However, this did not work. I looked at scriptnames and here is the output:

  62: /home/patrick/.vim/after/ftplugin/tex.vim 63: /home/patrick/.vim/indent/tex.vim 64: /usr/share/vim/vim72/syntax/bib.vim 65: /home/patrick/.vim/ftplugin/bib_latexSuite.vim 66: /home/patrick/.vim/after/ftplugin/bib.vim 67: /usr/share/vim/vim72/indent/bib.vim 68: /home/patrick/.vim/nerdtree_plugin/exec_menuitem.vim 69: /home/patrick/.vim/nerdtree_plugin/fs_menu.vim 

As you can see, I also added the bib.vim file in the after/ftplugin , because when I load, I load 4 tabs, one of which is the BIB file. However, it still does not work.

Update 2

Well, I still have the same problem, but with more information. Now I run the vim build of Windows. Again vim claims the scrolling of the latter is set to ~/.vimrc . But it becomes redefinable whenever

  • I open a new tab (with any old file, so the vimrc parameter should still apply)
  • I am resizing the gvim window

Therefore, I no longer believe that this has anything to do with the latex set or the order in which the settings are called.

+6
source share
5 answers

I decided to fix / hack. It probably has nothing to do with the latex package or all of this. It is overridden when you open a new tab or resize the window. A quick fix is ​​to use

 noremap <Cu> 4<Cu> 

Which, therefore, is always used when scrolling. This also sets the scroll variable to 4, so it will also apply.

+4
source

Put your tex.vim in the ~/.vim/after/ftplugin . See :help after more details.

Also see output :scriptnames to check the order in which vim downloads all script files.

+1
source

Try adding this line to the vimrc file:

 autocmd FileType tex setlocal scroll=4 
0
source

In my case, the scroll parameter was overridden with the command :set laststatus=2 .

 VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 27 2010 17:51:38) 

Even if I add :set scroll=4 before or after :set laststatus=2 in .vimrc, scroll=4 is still overridden.



If I manually reload the .vimrc file, follow these steps:

 :so ~\.vimrc 

Then the scroll setting is performed.

0
source

Patricks redialing answers definitely work. Another option for this being reset, each time vim changes, it will use a different autocmd

  autocmd VimResized * :set scroll=10 
0
source

Source: https://habr.com/ru/post/911852/


All Articles