Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9011411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:43:23+00:00 2026-06-16T02:43:23+00:00

My Vim configuration includes set formatoptions=c,q,a . I am completely annoyed with the following

  • 0

My Vim configuration includes set formatoptions=c,q,a. I am completely annoyed with the following problem (| denotes cursor position, its exact position does not matter, as you probably know only the fact of its presence in this commented line matters):

" This is a long line which we would like to wrap. However, something sick is go|ing to happen if we hit "gqip" here!
if has('win32') || has('win64')
  set runtimepath^=~/.vim
  set runtimepath+=~/.vim/after
endif

Now we hit gqip:

" This is a long line which we would like to wrap. However, something sick is
" go|ing to happen if we hit "gqip" here!
if has('win32') || has('win64') set runtimepath^=~/.vim set
  runtimepath+=~/.vim/after endif

What it does is – it actually treats the whole thing as a single paragraph. (Yes, I know that separating with a blank line prevents this behavior, but it does not solve the problem!) What I would like it to be is indeed:

" This is a long line which we would like to wrap. However, something sick is
" go|ing to happen if we hit "gqip" here!
if has('win32') || has('win64')
  set runtimepath^=~/.vim
  set runtimepath+=~/.vim/after
endif

In other words, it would be great if gq could somehow forget about the code and work only with comments.

BONUS: How to do this formatting (wrapping comments only) on the whole buffer in one shot? Because, ideally I would like to move that stuff to a special formatting hook for file saving.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:43:24+00:00Added an answer on June 16, 2026 at 2:43 am

    With my SameSyntaxMotion plugin, you can use the ay text object to represent the entire block of comments the cursor is in, and re-format it using gqay.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using the autoindent configuration from VIM, it will automatically indent your cursor to
In my .vimrc I have the following configuration: " Sessionman set viminfo='100,<500,s10,h,! autocmd VimEnter
I use vim on both FreeBSD and Linux os, sharing the same .vimrc configuration
In my Vim setup I'd like to add a configuration that runs a shell
I want to do the following: open 9 files in vim, (3 x 3
Here is my complete vim configuration files https://bitbucket.org/tristan_ph/dotvim . And my vimrc https://bitbucket.org/tristan_ph/dotvim/src/tip/.vimrc Here
Sometimes I want to use a minimal vim configuration, so with pathogen I have
How do I add a comment in Vim's configuration files, like .vimrc?
Does VIM (or macvim) have a way to show a code-folding boxtree/circletree like Notepad++?
My Vim configuration file is getting bigger (15KB+) . And I try not to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.