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

Textidote - spelling check #1857

Closed
Princeofthebow opened this issue Nov 17, 2020 · 13 comments
Closed

Textidote - spelling check #1857

Princeofthebow opened this issue Nov 17, 2020 · 13 comments

Comments

@Princeofthebow
Copy link

Princeofthebow commented Nov 17, 2020

Hi sorry it is me again from yesterday!
As I'm navigating my way trough I'm now looking to make use of a spell checker. From the documentation from what I understand using textidote is possible solution.

I have therefore set the followin .vimrc file:

call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
call plug#end()

let g:tex_flavor = 'latex'
let g:vimtex_view_method = 'mupdf'
let g:vimtex_grammar_textidote = {
            \ 'jar': '/usr/local/bin/textidote.jar',
            \ 'args': '--check en',
            \}

This is my MWE tex file:

\documentclass{article}
\begin{document}
Hellor Worlsd!
\end{document}

but after running :compiler textidote | lmake
I get the following outcome:

make: *** No targets specified and no makefile found.  Stop.

Press ENTER or type command to continue
make: *** No targets specified and no makefile found.  Stop.

and then after i hit enter an empty vim with:

(1 of 1): make: *** No targets specified and no makefile found.  Stop.

This has puzzled me since I as mentioned I'm rather new to vim and vimtex (but not latex).
I have run textidote on the textfile and it appears to be working correctly

ps is there any other way to handle spellcheck that may be better?

Thanks in advance!

@lervag
Copy link
Owner

lervag commented Nov 17, 2020

Can you show the output of :echo &makeprg and echo &errorformat after you do :compiler textidote (without lmake!)?

@Princeofthebow
Copy link
Author

Princeofthebow commented Nov 17, 2020

I get the following error message:

vimtex: g:vimtex_grammar_textidote is not properly configured!
        Please see ":help vimtex-grammar-textidote" for more details.

Hum - I wonder why I get this error as it appears that the config in my vimrc file is correct. :-(

:echo &makeprgonly prints make

while :echo &errorformat gives me

%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),
%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%
*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%
D%*\a[%*\d]: Entering directory %*[`']%f',%X%*\a[%*\d]: Leaving directory %*[`']%f',%D%*\a: Entering directory %*[`']%f',%X%*\a: Leaving dir
ectory %*[`']%f',%DMaking %*\a in %f,%f|%l| %m

@lervag
Copy link
Owner

lervag commented Nov 17, 2020

I think the problem is that your configuration is not correct.

let g:vimtex_grammar_textidote = {
            \ 'jar': '<PATHTO>\textidote.jar',
            \ 'args': '--check en',
            \}

The path in the .jar key is not valid. I would write the path like this: /path/to/textidote.jar. Not sure if the backslash is itself the reason.

@Princeofthebow
Copy link
Author

Princeofthebow commented Nov 17, 2020

This is what I have in the config, i.e. the whole path:

let g:vimtex_grammar_textidote = {
            \ 'jar': '/usr/local/bin/textidote.jar',
            \ 'args': '--check en',
            \}

I had omitted it in the previous post. BTW textidote can be called even from $HOME. I have edited the previous post.

EDIT

Hum, could it be possible that I have used the Debian installation (ie. a *.deb file) for Textidote this does not work as expected as it is not running from a jar file?
When I have time tomorrow I will try to use the *.jar version of Textidote and report back. If so I maybe you could state it in the docs?

@Princeofthebow
Copy link
Author

Ok I confim that the problem was indeed the installation of Textidote as via the jar file it works with :compiler textidote|lmake

Perhaps highlighting this in the documentation might be a good idea as I was convinced the the *.deb file would have placed me the textidote jar file somewhere on system but it did not and in particular it was not a jar file.

I'm starting to have a nice workflow now - once again excellent job on both sw and support. consider that I'm a novice and now I cannot event think of going back to winedt.

@lervag
Copy link
Owner

lervag commented Nov 18, 2020

I'm not quite sure I understand what you mean: did you first try to specify a textidote executable (e.g. /usr/bin/textidote), i.e. not the jar file specifically?

I'm not quite sure exactly what has been confusing, but I don't mind updating and improving the docs. Do you have a concrete suggestion?

I'm starting to have a nice workflow now - once again excellent job on both sw and support. consider that I'm a novice and now I cannot event think of going back to winedt.

Thanks, I'm glad to hear it! :) Btw, I've never heard of WinEdt before (http://www.winedt.com/). There's several other dedicated LaTeX editors, e.g. texmaker and texsuite; I've heard a lot of people find these to be good. But I guess once you go Vim (or neovim), you don't go back :)

@Princeofthebow
Copy link
Author

Princeofthebow commented Nov 18, 2020

Perhaps I have been unclear,sorry: Texidote for Debian (the distro I use) offers a *.deb package (see here). Such package does not place the texitidote jar file anywhere(i.e. /usr/bin/textidote was not a jar file that vimtex could fetch - I used whereis to search the file).
I then downloaded the jar file (not the *.deb package) and after pointing .vimrc to the right folder (where I had placed the textidote jar file) it all started working.

In other words the *.deb package of textidote did not work and maybe highlighting this on the docs could be a good idea. I.e. specify that the actual jar file is needed

Vim for the win!

@lervag
Copy link
Owner

lervag commented Nov 18, 2020

Thanks, I've updated the docs. Do you think it suffices?

lervag added a commit that referenced this issue Nov 18, 2020
@ChasingZenith
Copy link

ChasingZenith commented Dec 23, 2020

Texidote for Debian (the distro I use) offers a *.deb package (see here). Such package does not place the texitidote jar file anywhere(i.e. /usr/bin/textidote was not a jar file that vimtex could fetch - I used whereis to search the file).

Hi @Princeofthebow, I am a Manjaro user and I find that textidote.jar exists on my computer even if I install textidote with a repository. Since I think that package in AUR repository seems to be based on the .deb package. I think these two Linux distributions may have similar behavior.

In fact when I look at what /usr/bin/textidote is, I find that it is a bash script that wraps up textidote.jar.

#! /bin/bash
java -jar /opt/textidote/textidote.jar --name textidote "$@"

EDIT

When I rearranging the functions, the Unknown function error does not come up.

So I think that the following configuration might also works for you

let g:vimtex_grammar_textidote = {
            \ 'jar': '/opt/textidote/textidote.jar',
            \ 'args': '',
            \}

BTW, in this process, I find that the first time I run :compiler textidote|lmake, nvim gives me an error which says that function s:get_textidote_lang is unknown. But execute it again textidote can do proof-reading (but no quickfix windows pop up but just like something were excuted in the integral terminal).

Error detected while processing /home/user/.cache/vimfiles/repos/github.com/lervag/vimtex/compiler/textidote.vim:
line   24:
E117: Unknown function: s:get_textidote_lang
E15: Invalid expression: 'java -jar ' . shellescape(fnamemodify(s:cfg.jar, ':p')) . (has_key(s:cfg, 'args') ? ' ' . s:cfg.args : '') . ' --no-color --
textidote_lang(s:language) . ' %:S'
/opt/textidote/textidote.jar

I look at vimtex/compiler/textidote.vim and find that this function is called before it is defined. Is it the reason why it happened? ( perhaps I need to open a new Issue? @lervag

lervag added a commit that referenced this issue Dec 23, 2020
@lervag
Copy link
Owner

lervag commented Dec 23, 2020

So I think that the following configuration might also works for you

let g:vimtex_grammar_textidote = {
            \ 'jar': '/opt/textidote/textidote.jar',
            \ 'args': '',
            \}

I can confirm that this should work well on Arch Linux.

BTW, in this process, I find that the first time I run :compiler textidote|lmake, nvim gives me an error which says that function s:get_textidote_lang is unknown.

Thanks, fixed now!

@ChasingZenith
Copy link

Thank you for your instant response!!!

BTW, is that no quickfix window the normal way it behave?

@lervag
Copy link
Owner

lervag commented Dec 23, 2020

No problem! :)

And yes, it is. See :help vimtex-lint (as suggested in intro of :help vimtex-grammar) for an introduction on how to use this feature. The idea is to rely on the built-in feature as much as possible.

@lervag lervag closed this as completed Dec 23, 2020
@ChasingZenith
Copy link

Thank you. I will read it later.

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

No branches or pull requests

3 participants