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

Create plugin for vim #38

Closed
suchow opened this issue Jan 29, 2015 · 25 comments
Closed

Create plugin for vim #38

suchow opened this issue Jan 29, 2015 · 25 comments
Milestone

Comments

@suchow
Copy link
Member

suchow commented Jan 29, 2015

No description provided.

@suchow suchow added this to the eventually milestone Jan 29, 2015
@suchow suchow added the plugin label Jan 29, 2015
@mynameisfiber
Copy link

I agree... the current installation method for vim is a headache and breaks people's standard vim plugin workflow!

@suchow
Copy link
Member Author

suchow commented Mar 8, 2016

@mynameisfiber Want to take a stab at fixing this?

@mynameisfiber
Copy link

@suchow I may have some time later this week... vim plugins aren't my forte but it'd be worth a crack!

@AlexMooney
Copy link

@lcd047, I've tried using the plugin through Vundle, with neovim like so:

Plugin 'amperser/proselint', {'rtp': 'plugins/vim/syntastic_proselint/'}
<...>
let g:syntastic_text_checkers = ['proselint']

and get this error when running :SyntasticInfo:

Syntastic version: 3.7.0-77 (Vim 704, Darwin)
Info for filetype: text
Global mode: active
Filetype text is active
The current file will be checked automatically
Error detected while processing function 342:
line    9:
E605: Exception not caught: Syntastic: Checker text/proselint redirects to unregistered checker text/proselint
line    5:
E171: Missing :endif
Available checker: proselint
Currently enabled checker: proselint

Did I make a mistake, or is there a bug with the plugin?

@lcd047
Copy link
Contributor

lcd047 commented Mar 14, 2016

@AlexMooney Please upgrade syntastic to 0f82191 or later and try again.

@nit142
Copy link

nit142 commented Mar 18, 2016

I have just found that there is an issue for this!
I have extracted this into a plugin myself a few days ago, which you can find here. I'll try to drop some README soon but it's configuration is the same as the one embedded in this repository.

@lcd047
Copy link
Contributor

lcd047 commented Mar 18, 2016

@Nitwoe Why, thank you so much for taking an older version of my patch, putting your name on it, and re-distributing it under a different license. That's an inspiration for us all, keep up the good work :)

@nit142
Copy link

nit142 commented Mar 18, 2016

@lcd047 I'm sorry for that, all I meant was to extract it and use it in the common workflow with vundle. It didn't work for me out of the box from the proselint's repository so I found this to be a solution. If you want me to nuke the repository or anything - just tell me, I mean no harm and just want to use it within my vim config.

@lcd047
Copy link
Contributor

lcd047 commented Mar 18, 2016

@Nitwoe The method mentioned by @AlexMooney above works fine with Vundle:

Plugin 'amperser/proselint', {'rtp': 'plugins/vim/syntastic_proselint/'}

The method mentioned in the readme, to add a link, also works. You don't need to "extract" anything.

@nit142
Copy link

nit142 commented Mar 18, 2016

@lcd047 Well that's what I get for not knowing the rtp option. I'll nuke the repository then, thanks and sorry for being a dummy.

@suchow
Copy link
Member Author

suchow commented Mar 18, 2016

Are we all set here? Can this be closed?

@smitec
Copy link

smitec commented Apr 4, 2016

This worked for me with vim-plug too. Perhaps a line could be added to the README for the vim plugin.

@lcd047
Copy link
Contributor

lcd047 commented Apr 4, 2016

@smitec There's a lot to explain if you want to get into that kind of details. With Vundle, the effect of the above incantation is that a copy of proselint sources is cloned from GitHub and then managed by Vundle. This copy has nothing to do with the proselint installed by Python, and thus it can potentially go out of synch with it. It's up to you to make sure that doesn't happen.

The equivalent commands for NeoBundle and Plug are

NeoBundle 'amperser/proselint', {'rtp': 'plugins/vim/syntastic_proselint/'}

and respectively

Plug 'amperser/proselint', {'rtp': 'plugins/vim/syntastic_proselint/'}

They have the same caveat as Vundle.

With Pathogen you need to do something like this:

execute pathogen#infect('bundle/{}', '/path/to/proselint/plugins/vim/{}')

-- but Pathogen doesn't try to download or update anything. It's still up to you to manage versions and keep them consistent with each other.

I have no idea how to achieve the same with VAM. It's likely possible, but I have yet to summon the patience to read enough of VAM's manual and / or sources to figure out how to do that.

Finally, with recent versions of Vim you can also manage packages with :packadd, :packloadall, and friends. With these, something like this should be enough:

set runtimepath+=/path/to/proselint/plugins/vim/syntastic_proselint/

Oh, and the explanation has to be concise, so that the user doesn't run screaming before reading it. I'm not arrogant enough to pretend that my English is nearly good enough for that task. I'd just rather hope the potential Vim users would either use the dumb symlink way described in the README, or that they are knowledgeable enough to do the right thing with their favourite package manager. :)

@smitec
Copy link

smitec commented Apr 4, 2016

@lcd047 I agree it is complex to cover all bases, I would say that adding a line with the rtp example may be a good intermediate as that seems to be a rarely used option and should cover a large proportion of plugin managers as they share fairly similar syntax.

@drcjar
Copy link

drcjar commented May 19, 2016

I'm a vim newbie using github.com/amix/vimrc.

I have tried to follow readme and can see proselint in :scriptnames but not in :SyntasticCheck.

I think I would find a single reproducible full installation example (using whatever plugin manager) in the readme helpful.

@lcd047
Copy link
Contributor

lcd047 commented May 20, 2016

I have tried to follow readme and can see proselint in :scriptnames but not in :SyntasticCheck.

@drcjar You aren't supposed to see proselint in the output of :SyntasticCheck. The readme file doesn't imply that, either.

I think I would find a single reproducible full installation example (using whatever plugin manager) in the readme helpful.

From the readme:

Copy or link syntastic_proselint next to your other Vim plugins, and enable it in your plugin manager.

If your plugin manager is pathogen this is a full installation example, it should just work. Glad I could help. 😄

More realistically: please explain what you did, what did you expect to happen, and what happened instead. What is your OS, what is your setup, what versions of Vim, proselint, and syntastic you have, what kind of files you were trying to check, what is the output of :SyntasticInfo.

@drcjar
Copy link

drcjar commented May 30, 2016

Thank-you @lcd047

I'm running ubuntu 14.04. I'm new to Vim. I'm using Awesome version.

I cloned proselint into/.vim_runtime/sources_non_forked/

I added

" markdown
let g:syntastic_markdown_checkers = ['proselint']

to
/.vim_runtime/vimrcs/plugins_config.vim

I opened a markdown file and typed things. I expected that :SyntasticInfo would report proselint being available and that I would be able to use it.

Here is the output of my :SyntasticInfo.

Syntastic version: 3.7.0-137 (Vim 704, Linux)
Info for filetype: markdown
Global mode: active
Filetype markdown is active
The current file will be checked automatically
Available checkers: -
Currently enabled checkers: -

@lcd047
Copy link
Contributor

lcd047 commented May 30, 2016

@drcjar You aren't running any standard package manager, so this is really something you should have asked the author of vimrc. Still, vimrc sources are pretty clean, and it looks like vimrc is actually running pathogen under the hood. So I believe something like this should do:

mv ~/.vim_runtime/sources_non_forked/proselint /some/path
ln -s /some/path/proselint/plugins/vim/syntastic_proselint ~/.vim_runtime/sources_non_forked

Basically you need to link proselint/plugins/vim/syntastic_proselint rather than proselint itself next to the other plugins.

@chreekat
Copy link
Contributor

fwiw, proselint works out of the box with vim. Just set makeprg appropriately:

setl makeprg=proselint\ %

Then run :make to have the current file linted, complete with automatic jumps to problem areas.

@lcd047
Copy link
Contributor

lcd047 commented Sep 23, 2016

fwiw, proselint works out of the box with vim.

@chreekat Oh absolutely, syntastic is useless. That is, until you want to check a file named file (#1).txt. Or maybe until you want to hide some of the less useful messages? 😄

@chreekat
Copy link
Contributor

I'm not anti syntastic, sorry if you got that impression! I just don't think it gets in the way of using proselint within vim.

You're right about funny file names, so;

setl mp=proselint\ '%'

tada!

Is it a good idea to push features like ignoring certain messages into the plugins? Why not centralize that in proselint itself?

@lcd047
Copy link
Contributor

lcd047 commented Sep 23, 2016

setl mp=proselint\ '%'

@chreekat Then I rise you: John's report (draft #1).txt.

@chreekat
Copy link
Contributor

On Fri, Sep 23, 2016 at 02:57:17AM -0700, LCD 047 wrote:

setl mp=proselint\ '%'

@chreekat Then I rise you: John's report (draft #1).txt.

All I meant to imply is that this issue has been open for a year and a
half, presumably held up because of trying to integrate with
syntastic, which some people don't even need. Now that I poke around
some more, I see that the README even lists the vim plugin as
completed. So maybe this issue can just be closed.

I look forward to meeting the person who both uses vim and names files
like the example you've given. But since I've been nerd sniped:

let &l:mp= "proselint " . shellescape(expand('%'), 1)

@lcd047
Copy link
Contributor

lcd047 commented Sep 23, 2016

let &l:mp= "proselint " . shellescape(expand('%'), 1)

@chreekat Then I rise you: Have fun!.txt.

We can stop here. I've been at this a lot longer than you, trying to make it work for syntastic. I eventually switched to system() and getexpr. If you read Vim's sources you'd eventually find out you can't make it work robustly with makeprg.

My best approximation was this:

let &l:mp='proselint ' . escape(fnameescape(expand('%', 1)), '&()')

This works on UNIX, but not on Windows. I don't have a solution for Windows.

@lcd047
Copy link
Contributor

lcd047 commented Oct 11, 2016

The Vim plugin has been merged into syntastic.

@mpacer mpacer closed this as completed Nov 17, 2016
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

9 participants