Redzarf
Redzarf

Reputation: 2699

Keyboard shortcut for word-wrap in Cloud9

In Cloud9 you can turn word-wrap on/off by going to View > Wrap Lines, or the cog in the bottom-right. But there's no keyboard shortcut for it. The Keybindings editor also doesn't have any commands that match the word "wrap" (except one for Emmet.)

The files my users work on have parts that are best viewed with word wrap on, and parts that are best viewed with it off, so turning word-wrap on globally isn't enough.

Is there some other term I should search for to set up a keyboard shortcut? Or is there no way to turn wrap on/off without the mouse+menus?

Upvotes: 4

Views: 1926

Answers (2)

user764357
user764357

Reputation:

As of November 2016 you can toggle 'soft' word-wrap with Crtl+q.

You can also find a list of commands in the Commands tab on the left

enter image description here

Upvotes: 1

a user
a user

Reputation: 24169

There is no built-in command for this, but you can use the init script feature from the Cloud9 menu. Just add:

services.commands.addCommand({
    name: "toggleWordWrap",
    bindKey: {win: "alt-shift-w", mac: "alt-shift-w", position: 1000},
    exec: function(editor) {
        editor.setOption("wrap",  editor.getOption("wrap") == "off")
    }, 
    isAvailable: function(editor) {return editor && editor.ace}
}, plugin);

position: 1000 is to ensure command get's higher priority than default commands with the same keybinding

Upvotes: 3

Related Questions