Reputation: 13207
This is so easy in vim, I just select the lines and type gq
. Surely there is a simple way or extension to do the same in Visual Studio Code. To be clear, I am not looking to automatically wrap every line. I want to select a block of text, such as this example JavaScript template literal in a .js
file:
div.innerHTML = `<p>Tempore voluptatem cupiditate ullam. Et eum possimus et qui placeat sit voluptatem. Aut omnis similique eum nisi molestias laborum officia. Consectetur debitis sequi sapiente. Vero incidunt perspiciatis aut ut libero tenetur saepe eaque. Hic voluptates quis quasi expedita nemo hic omnis.</p>`;
Then do something to have it wrapped to a maximum line length of say, 80 characters.
This is what I tried already. By "no changes" I mean that nothing visible happened, i.e. the long lines remained:
prettier
extension. If does format a larger selection, but no changes to the long lines.Rewrap
extension. After selecting the block I do ALT + Q
but no changes. I also did CTRL + SHIFT + P
and chose the Rewrap Comment / Text
command, but no changes.So what is the way to do it that just works? I am happy to use vim but I quite like using VS Code as well, so would like to know this basic feature. Thank you!
Note: At the time of writing, I am on version 1.60.1 on Windows and WSL.
Upvotes: 1
Views: 1709
Reputation: 2874
I'm not sure if this is the answer you want to hear but, there is an extension for vscode called vscodevim. Ctrl+Shift+X to open the extensions tab and just search for vim
. This extension runs an emulation of vim on vscode and it includes the gq command since this.
So after you install this you should be all fine!
P.S I tried opening the keybind debug tool with the command palette => (Ctrl+Shift+P) => "toggle keyboard shortcuts troubleshooting" to see what happens when you press g and then q and how it translates to vscode but unsuccessfully did so.
Upvotes: 1