-
Notifications
You must be signed in to change notification settings - Fork 98
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
Easily edit example files #65
Comments
Hmm that is an interesting thought. Are you wanting this to edit only custom directories (as shown with |
ultisnips, the vim plugin, offers commands to jump straight to snippet edition. I have always found it very convenient. I was surprised not to find such a command with Whether or not (and how) to allow users to edit the "official" examples (i.e. those that come with I do not know how This means the following commands would be more or less equivalent: $ eg -c <custom> -e <examples> edit <program> $ ( [ -e <custom>/<program>.md ] \
|| cp <examples>/<program>.md <custom> ) \
; $EDITOR <custom>/<program>.md So if we already have a such a custom example, we edit it. If we don't, we try to copy it from the official examples. If the copy works, we edit the copy. If the copy doesn't work (there is no official example) we start a new custom example. (of course I don't mean it to work only if there user supplies the |
Custom files are currently more supplements than full replacements. If you have a custom file its contents are shown first, with the stock file content below it. For this reason I don't think copying the original file content over would be a great fit, as you'd end up with the same content displayed twice. The benefit of the system as-is (or at least the way I made it this way), is that it is a place to put common personal commands that you might use frequently but that aren't appropriate for (or haven't yet been rolled into) the stock examples. Thinking about it some more, I prefer the idea of having the edit functionality edit or create a custom file for the command. This seems like a very elegant shortcut. Editing the original examples is possible with a custom I like the idea of having an edit shortcut for custom files, however, and will work on incorporating it. |
Problem solved then. Great, thanks a lot! Let me know how I can help, though my python knowledge is limited at best. |
I'm almost done with this, but it brought up a usability question that I'm yet to implement. If you don't have a I'm leaning toward just plopping them in a directory of my choosing, like
Does that seem reasonable to you? I've also decided to resolve an editor command in the following order: |
Hmm, better still might be something like:
|
I like the second solution, however in practice I think I would prefer if the tool I'm using doesn't tamper with my settings and just uses a default directory. The main reason being that I might have comments in that file as well, in a very specific order, etc (e.g. for housekeeping reasons). Does that make sense? On the other hand it doesn't apply to me directly since I do have a Either way, thanks for implementing this so quickly! |
Your reasoning does make sense. My thought was that if you're trying to
edit something it would be frustrating to be told you have to first set up
a bunch of configuration. Providing a sensible default seems like a
reasonable shortcut, especially since the egrc syntax is not immediately
obvious.
…On Fri, Jan 20, 2017, 5:03 PM Nicolas Mattia ***@***.***> wrote:
I like the second solution, however in practice I think I would prefer if
the tool I'm using doesn't tamper with my settings and just uses a default
directory. The main reason being that I might have comments in that file as
well, in a very specific order, etc (e.g. for housekeeping reasons). Does
that make sense? On the other hand it doesn't apply to me directly since I
*do* have a custom-dir entry, and it happens to be set to ~/eg/. I guess
~/.eg is a better default, since it aligns with ~/.vim, ~/.i3, etc.
Either way, thanks for implementing this so quickly!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#65 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGEWAZHIl64tRUTvQfP5_0bUXi48jfgPks5rUVlogaJpZM4Ljmrb>
.
|
It looks like by default using I'll probably implement the way I first laid out, saving it in a default location and explaining what a minimal |
I'm back to thinking that you're probably right, better not to tamper with people's setups. If you don't have a custom directory set, I'll likely just print a warning and an example |
I just pushed some some new changes to master that handle this. If you could clone and check it with your own setup, that would be great. I've tested with python 2.7 and 3.4 and everything looks good. |
Nice, works like a charm! pip version: 8.1.2
|
This should be added to the readme. It doesn't mention this easy way to edit an eg page at all. |
Good point. I added it to the configuration section. |
It would be great to have shorthand to edit example files. For instance:
would be equivalent to
(This particular syntax might be a bit ambiguous)
The text was updated successfully, but these errors were encountered: