Closed igorf-27 closed 2 years ago
That is to be expected -- if you disable syntax
, you will not get any syntax-related features!
(It's a common misconception that syntax
controls "syntax highlighting", but that is actually not true. There's no way in Vim to disable only highlighting and still have other syntax features. If you just want to get rid of "all the colors", you need to set a monochrome color scheme.)
Ok, thanks.
I'm not yet convinced though. The vim documentation says it's just highlighting. http://vimdoc.sourceforge.net/htmldoc/syntax.html
aP
and daP
work fine without this stuff on.
If it is really necessary to turn this on for a$
to work, then you should probably mention it in VimTeX documentation. I spent quite a while trying to understand why it won't work (actually, I only realized that switching the "syntax" on fixes the problem when typing this bug report, because it was in the "minimal.vim" example).
I'm not yet convinced though. The vim documentation says it's just highlighting. http://vimdoc.sourceforge.net/htmldoc/syntax.html
Yes, but if you keep on reading, it'll tell you what that actually means.
"daP" works fine without highlighting.
P
does not rely on syntax files.
If it is really necessary to turn this on for a$ to work, then you should probably mention it in vimtex documentation. I spent quite a while trying to understand why it won't work (actually, I only realized that switching the "syntax" on fixes the problem when typing this bug report, because it was in the "minimal.vim" example).
I think that is just basic Vim knowledge (which, admittedly, is not a low bar)...
@clason is right, but I can see how this is still unexpected for most users. Perhaps I should try and recognize if a user has syntax enabled during VimTeX initialization and add a warning unless the user also explicitly disables vimtex syntax?
Personally, I think I would not need run-time warnings. I would rather have the warning in the documentation.
You may consider adding the following to the end of the "Installation" section of your README file. (This is a rough draft, probably containing mistakes. Feel free to modify it as you will. I just thought I'd let you know the noob's point of view.)
After the installation, you should edit your .vimrc file. It must contain something similar to the following:
" This is necessary for VimTeX to load properly when you start editing a .tex file.
filetype plugin on
" This turns syntax highlighting on, and enables Vim's syntax-related features.
" If you don't turn this on, some features of VimTeX won't work properly.
" If you don't like the highlighting, you may change your color scheme (type ':help syntax' for details).
syntax enable
" Compiler options
" This is a generic example. For specific recommendations please refer to VimTeX's documentation.
let g:vimtex_compiler_method = 'generic'
" Here you specify the command your TeX compiler will be executed with.
" expand('%:p') turns into the full path to the file you are editing.
let g:vimtex_compiler_generic = { 'command': '/usr/bin/pdflatex -synctex=1 '.expand('%:p') }
" Viewer options
" This is the executable:
let g:vimtex_view_general_viewer = '/usr/bin/okular'
" This will be sent to the viewer as command-line parameters;
" @pdf gets substituted with the full path to the tex file you are editing, the final '.tex' being replaced with '.pdf',
" @line with the line number you are staying at in Vim,
" and @tex with the full path to the tex file you are editing.
let g:vimtex_view_general_options = '--unique file:@pdf\#src:@line@tex'
" In normal mode, type <localleader>li to view the command which has been executed
" and <localleader>lo to view the compiler output.
" By default, the local leader is the symbol \.
Thanks! I've done this now with some changes. Note that I believe the default compiler is good for most people. I do NOT want most people to use the generic compiler.
Well, I never used latexmk and I don't think I really need it. So the first thing I got when I installed the plugin was an error (and no output pdf). Naturally, I wanted to know what had been executed and what it had responded... Thank you, in any case!
Well, I never used latexmk and I don't think I really need it.
latexmk
is very convenient, and I strongly suggest you install it. It should be easy to install on any system.
Thanks for your suggestion! I will certainly set latexmk up when I have any trouble with invoking the compiler directly (when I start writing a book maybe).
In my turn, I suggest you enhance your README just a little further. This would have saved me time if I had it.
" The supported compilation methods should suit most people.
" latexmk is the default one, if you use it, you probably don't have to configure anything.
" If you want another supported compiler method (see the docs for a list), change it like this:
let g:vimtex_compiler_method = 'latexrun'
" If you want to use your own method (which is strongly not recommended), add the following lines.
let g:vimtex_compiler_method = 'generic'
" Here you specify the command your TeX compiler will be executed with.
" expand('%:p') turns into the full path to the file you are editing.
let g:vimtex_compiler_generic = { 'command': '/usr/bin/pdflatex -synctex=1 '.expand('%:p') }
" If the compiler or the viewer doesn't start properly,
" type <localleader>li to view the exact commands which have been executed and <localleader>lo to view the compiler output.
No, sorry. The generic compiler is not good enough, and I don't want to address that too much. Your suggested setting will fail in many cases. E.g. expand('%:p')
will be expanded when you start Vim and will not work if you change to another project.
The main idea is to rely on latexmk, because this will just work. Really. The generic compiler backend is useful in certain cases, but I don't want people to use it unless they know what they are doing.
Maybe like this?
" The default compilation method is latexmk. If you use it, which is strongly suggested, you probably don't have to configure anything.
" If you want another compiler method (see the docs for a list), change it like this:
let g:vimtex_compiler_method = 'latexrun'
" If the compiler or the viewer doesn't start properly,
" type <localleader>li to view the exact commands which have been executed and <localleader>lo to view the compiler output.
Sorry if I'm bothering you.
Sorry if I'm bothering you.
No need to be sorry; I'm glad you're being insistant, as it forces me to think twice. My previous reply was short and may have come off more "aggressive" then I meant it - I was at work and did not have time to think too much.
" The default compilation method is latexmk. If you use it, which is strongly suggested, you probably don't have to configure anything. " If you want another compiler method (see the docs for a list), change it like this: let g:vimtex_compiler_method = 'latexrun' " If the compiler or the viewer doesn't start properly, " type <localleader>li to view the exact commands which have been executed and <localleader>lo to view the compiler output.
This is better, thanks. I'll push a variant of this now. Let me know what you think!
See: c3991f8a
Thank you, surely, these explanations would have been useful for me, I only hope they will help other users too.
It is not clear from the current version of README that the viewer will also work without configuration in most cases, unless the user wants forward search. But then, I think, users usually do want forward search, so they will have to configure the viewer anyway. So it's OK, I think.
Description
When syntax highlighting is off, in normal mode,
da$
anddi$
produce either no effect or long error messages (a detailed example below); in visual mode,a$
andi$
behave the same way.Setting
:syntax on
makes everything work fine though!Maybe the problem is on my side, because I currently use a weird linux distro; on the other hand, everything else seems to work as it should do. I can't test it on another computer now.
The version info for the vim I actually use follows. (I tried building the most recent version of vim and observed the same problem.)
Steps to reproduce
vim -u minimal.vim minimal.tex
3Glda$
$hda$
Expected behavior
The first and the last copy of
$a$
deleted.Actual behavior
After step 2, nothing happens. After step 3, a long error message (I attach it as a text file). It seems to happen when
da$
is typed inside of a formula which is at least 25th from the beginning (I am not really sure though).vimtex-error-message.txt
Do you use a latexmkrc file?
no
VimtexInfo