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

gq #648

Closed
johnfn opened this issue Aug 24, 2016 · 9 comments
Closed

gq #648

johnfn opened this issue Aug 24, 2016 · 9 comments

Comments

@johnfn
Copy link
Member

johnfn commented Aug 24, 2016


Please thumbs-up 👍 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.


gq is actually one of my favorite Vim features - it autoformats blocks of text, including comments, to be at most 80 characters long. (I think it may be a setting?) I actually started to forget about it since few Vim emulations do it correctly. That shouldn't stop us!! 😉

@ascandella
Copy link
Contributor

Yes, it's based off of the textwidth variable, so if you did :set tw=80<CR>ggVGgqq it would reflow your whole document to 80 chars.

I'm struggling to remember the difference between gq and gqq -- my muscle memory is always to gqq.

@johnfn
Copy link
Member Author

johnfn commented Aug 25, 2016

How could there be gqq? The first two letters would trigger gq immediately,
and then it would go into macro pending mode. At least that's what happens
to me.

On Thu, Aug 25, 2016 at 2:14 AM, Aiden Scandella notifications@github.com
wrote:

Yes, it's based off of the textwidth variable, so if you did :set
tw=80ggVGgqq it would reflow your whole document to 80 chars.

I'm struggling to remember the difference between gq and gqq -- my muscle
memory is always to gqq.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#648 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAKPQelm5kPTV3rQJlUltAyWb2avQ59Cks5qjPqIgaJpZM4JsV3X
.

Grant

@ascandella
Copy link
Contributor

I think it's whether you have a selection or not. In normal mode, hitting gq will wait for a motion. gqq does the current line (http://vim.wikia.com/wiki/Automatic_word_wrapping). You can apparently do fancy stuff like gqip.

gq executes immediately if you've got a visual selection.

@johnfn
Copy link
Member Author

johnfn commented Aug 25, 2016

Whoa, interesting. I've never done gq outside of visual mode.

On Thu, Aug 25, 2016 at 2:29 AM, Aiden Scandella notifications@github.com
wrote:

I think it's whether you have a selection or not. In normal mode, hitting
gq will wait for a motion. gqq does the current line (
http://vim.wikia.com/wiki/Automatic_word_wrapping). You can apparently do
fancy stuff like gqip.

gq executes immediately if you've got a visual selection.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#648 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAKPQc9JeqE43L4BIJYmCW6Leybh_8IPks5qjP4SgaJpZM4JsV3X
.

Grant

@tschijnmo
Copy link

A big +1 for this. Since the VSCode Python plugin does not reflow the paragraphs in comments and docstrings, this command can be enormously helpful for working on code with large chunks of textual documentation in docstrings, like NumPy, SciPy, and SymPy.

@johnfn
Copy link
Member Author

johnfn commented Oct 19, 2016

This one is annoying because you have to handle like 77 different commenting styles...

@tschijnmo
Copy link

@johnfn Yes indeed, a full-fledged comment formatter would be too heavy here. Maybe that should better be reserved for a code formatter like yapf. In vim, it seems that just the textwidth property is respected without detailed consideration of the commenting styles. But this is already immensely helpful.

Personally for me, the best thing about the vim gq command is its handling of the indentation (all follows the indentation of the first line) and its handling of sentence ending (as in Emacs). I guess it would be pretty awesome if VSCodeVim could have it.

@johnfn
Copy link
Member Author

johnfn commented Dec 3, 2016

Coming soon...

#1106

@johnfn
Copy link
Member Author

johnfn commented Dec 4, 2016

And it's done!

Feel free to leave feedback here. I know there'a bajillion different commenting styles; they should mostly be trivial to add if in a PR (get those open source karma points! 😉 ), or you can just nag me.

@johnfn johnfn closed this as completed Dec 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants