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

Added some actions (gist copy & gist paste into working buffer) and enhanced the listing layout. #206

Closed
wants to merge 1 commit into from

Conversation

pablocobelli
Copy link

@pablocobelli pablocobelli commented Oct 8, 2016

While on the gist-vim listing split, the following mappings are now working:

  • Both 'o' or 'Enter' open the gist file in a new buffer, and close the gist-vim listing one.
  • 'b' opens the gist file in a browser; this is necessary because Shift-Enter (as was originally) only works for GUI vim.
  • 'y' copies the contents of the selected gist to the clipboard, and closes the gist-vim buffer.
  • 'p' pastes the contents of the selected gist to the buffer from where gist-vim was called, and closes the gist-vim buffer.
  • Hitting Escape at the gist-vim buffer closes it.

Extra stuff:

  • Gist listing has fixed-length columns now, more amenable to eye inspection. Every line on the gist-listing buffer contains the gist id, name and description, in that order. Columns are now padded and truncated to offer a faster browsing, in the following way:

  • The gist id string is fixed at 32 characters.

  • The length (in characters) of the name of the gist is fixed and can be set by the user using, for example:

    let g:gist_namelength = 20

  • The default value for gist_namelength is 30. If the gist (file)name exceeds that length, it is truncated to the specified length.

  • Finally, the gist description is truncated in length to fit the remaining of the line, avoiding wrapped lines that mess up the table layout.

  • Note that the gist listing buffer now does not show the field 'code' (not sure what that did in the first place).

  • Now the listing is complete (no need to select 'more' to see the following gists on the list), in this way the user can later perform a search (using vim's /, for instance) for the sought gist by name, description, etc.

  • The first line on the gist-listing states the number of gists listed and the user whose gists are being listed.

  • The height of the gist-listing buffer is now determined in the following way. If the number of gists listed equals or exceeds 10, then the height is fixed at 10. If it is smaller than 10, then the height is adjusted so that there are no empty lines displayed on the buffer.

All this information has been added (with better phrasing) to the documentation.

@mattn
Copy link
Owner

mattn commented Oct 9, 2016

Thanks. Totaly, seems good to me. Could you please squash commits?

Added functionalities to GistListing function, see README file for details.

Added pasting into current buffer capability. Also enhanced the formatting of the gist listing.

Correcting an error in the previous upload.

Enhanced visualization of gist listing and added yank and insert capabilities.

Updated README to account for changes.

Corrected errors on README.

Corrected errors on README.

Now opening a gist buffer with Enter closes the listing afterwards.

Added documentation to doc/gist-vim.txt, code is now clean for a PR.
@pablocobelli
Copy link
Author

Done.

@mattn
Copy link
Owner

mattn commented Oct 10, 2016

Thanks. But you still have some mistakes or breaks in this change.

  • you break more... action
  • no need to use s: scope
  • forgot to rename shift to mode

I'll do fixes until merge into master.

@mattn
Copy link
Owner

mattn commented Oct 10, 2016

merged. thanks.

but I reverted few changes you did. sorry.

@mattn mattn closed this Oct 10, 2016
@pablocobelli
Copy link
Author

pablocobelli commented Oct 10, 2016

Thanks for the merge.

It's ok if you reverted some changes, as it is true that I broke (intentionally) the 'more...' action. I couldn't figure out how that was supposed to work, because the 'more...' appears at the bottom of the vsplit even when all the available gists have been listed. In that case, pressing 'Enter' on the 'more...' updates the vsplit contents to an empty buffer where there's still another 'more...' offered, and so on, ad infinitum.

Moreover, even when the 'more...' feature worked well, I think it's kind of unpractical. Searching for a specific gist 'by hand' now implies clicking a lot of 'more...' lines until finding it. Whereas if there's no 'more...' and all gists are listed, then the user can take advantage of vim functionalities to search within that buffer for the sought gist (by name, by description, etc).

Anyway, that's just my opinion, in case you are interested.

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.

2 participants