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

document workflow for local plugin development #317

Closed

Conversation

TomasTomecek
Copy link
Contributor

Fixes #316

@bfredl
Copy link
Member

bfredl commented Mar 24, 2018

This should probably be in docs/usage/remote-plugins.rst

Though I wonder if recommending a dedicated vimrc is a bit overblown. Most plugin managers can add a explicit path, or one could just

set rtp+=~/dev/nvim-myplugin/

in the normal init.vim

@justinmk
Copy link
Member

Though I do think the readme should have a self-contained quick start sample.

@TomasTomecek
Copy link
Contributor Author

This should probably be in docs/usage/remote-plugins.rst

Moved.

Though I wonder if recommending a dedicated vimrc is a bit overblown. Most plugin managers can add a > explicit path, or one could just

set rtp+=~/dev/nvim-myplugin/

in the normal init.vim

I think that you don't understand my use case: I want to invoke my plugin while being in my upstream git repository using nvim ... without the need of crippling my global vimrc or committing real paths anywhere in the plugin. The proposed solution by @Shougo does it very nice. If you have a better idea, I would like to hear it.

Also please advise me on what I should do in order to get this PR merged.

symlinking it.
The easiest way to do this is to create a dedicated vimrc file just for sake of
development of your plugin. If you are in a root of the git repo with the
plugin, consider creating this vimrc file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather verbose, it could be 1 sentence.

For local plugin development, it's a good idea to use an isolated vimrc:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, I wanted to be precise. Will shorten.

let &runtimepath.=','.escape(expand('<sfile>:p:h'), '\,')

It will append your current work directory to the runtime path so neovim is
able to find and load your plugin. You can now invoke neovim:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"neovim" is spell "Nvim" in technical resources (i.e., almost everywhere except the website).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I did s/neovim/Neovim/g to match rest of the doc.

@bfredl
Copy link
Member

bfredl commented Mar 25, 2018

I want to invoke my plugin while being in my upstream git repository using nvim ... without the need of crippling my global vimrc or committing real paths anywhere in the plugin.

I fail to see what is "crippling" with adding the main repository directly to the runtime paths. This is how I manage all developed plugins, and instead use branches to switch between "stable" and "development" if needed, just as with all other vcs managed projects. I even "cripple" my rtp with a pure test rplugin which does crazy stuff in methods, because if a method is not called, a remote plugin by design does nothing.

To be clear I'm not against adding any text for this usecase, but is shouldn't be worded as the "desirable" or "easiest" for local development.

@TomasTomecek
Copy link
Contributor Author

I fail to see what is "crippling" with adding the main repository directly to
the runtime paths. This is how I manage all developed plugins, and instead use
branches to switch between "stable" and "development" if needed, just as with
all other vcs managed projects. I even "cripple" my rtp with a pure test
rplugin which does crazy stuff in methods, because if a method is not called, a
remote plugin by design does nothing.

Sounds like a good idea to describe in detail in the document (or maybe
write a blog post).

To be clear I'm not against adding any text for this usecase, but is shouldn't
be worded as the "desirable" or "easiest" for local development.

I agree this an easier approach. Personally I don't work like this - I instead
prefer to sandbox projects I'm working on.

@TomasTomecek
Copy link
Contributor Author

The CI failure is unrelated:

The build phase is set to "MSBuild" mode (default), but no Visual Studio project or solution files were found in the root directory. If you are not building Visual Studio project switch build mode to "Script" and provide your custom build command.

ping, what do I have to do in order to get this merged?

@@ -98,7 +98,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why did you delete the _static dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because you are not using it and is causing warnings during build of documentation:

9e8a9d0

WARNING: html_static_path entry u'docs/_static' does not exist

.. code-block:: console

:scriptnames
1: ~/path/tp/your/plugin-git-repo/vimrc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ~/path/to/... I guess, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

Fixes neovim#316

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
```
WARNING: html_static_path entry u'docs/_static' does not exist
docs/usage/remote-plugins.rst:2: WARNING: Explicit markup ends without a blank line; unexpected unindent.
```

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
@TomasTomecek
Copy link
Contributor Author

Updated.


If you are working on your plugin locally, it may be desirable to run the
plugin from a git repository directly without the need of installing or
symlinking it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of thing does not need to be spelled out in extreme detail, we have to assume some basic level of familiarity with software development. So we really need to keep the documents concise, to avoid reader fatigue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be honest, this is something I prefer myself: having documentation as clear as possible. I don't like when I have to read between the lines and figure out details myself the hard way (such as, how do I make nvim pick up my plugin from $PWD?).

I completely understand if you don't prefer this style and I have no problem adapting. That's why we do these pull requests and reviews, right?


.. code-block:: console

$ cat vimrc
Copy link
Member

@justinmk justinmk Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $ makes copy-pasting commands really annoying. Even if it's ambiguous, it's generally not a problem. And it confuses Windows users.

@justinmk
Copy link
Member

justinmk commented Apr 5, 2018

merged, thanks. Made some edits for brevity.

@justinmk justinmk closed this Apr 5, 2018
@TomasTomecek TomasTomecek deleted the document-local-dev-workflow branch April 6, 2018 07:38
@TomasTomecek
Copy link
Contributor Author

Thanks Justin! I hope it will help some nvim-plugin-devs newbies (such as myself).

bfredl added a commit that referenced this pull request Apr 29, 2018
This release adds support for Python 3.7 which now is in beta. `async`
is a keyword in python3.7, and it should be replaced with `async_` when
used as a keyword argument to API methods. `async` is still supported
with python 2.7 and 3.6 for the moment, but considered deprecated.

Also, integration with the in-process lua interpreter in Nvim is now supported.

Changes since 0.2.4:

* debcde0 clean up remote object implementation (#313)
* e880fe7 Guidelines for local plugin development (#317)
* 1ab98e8 Update the working directory on DirChanged for legacy plugins (#296)
* d53415d Fix SyntaxError in py3.7: use `async_` instead of `async` (#274)
* b65f62d Use `pytest` as `nosetests` are not longer maintained (#266)
* d9aed96 Support using lua functions. `buf.update_higlights` as an internal example (#325)
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

Successfully merging this pull request may close these issues.

None yet

4 participants