Sublime Forum

Quickly switch between inline and side-by-side diff layout

#1

I would like to define a key binding that I can use to quickly switch Text Diff Style (similar to the way I can use ctrl-k ctrl-b to quickly toggle the side bar). Is this possible? As a workaround, I use the “Auto” Text Diff Style and decrease the width of the panel if I want to see diffs inline. This works okay but a key binding would be preferred.

0 Likes

#2

Hi @mtraudt,

Thank you for sharing this question with us!

This can definitely be achieved with a custom keybinding. To do this, open the keybindings file (Preferences > Edit Keybindings...).

Add the following to the file:

[
    { "keys": ["ctrl+5"], "command": "set_preference", "args": {"setting": "diff_style", "value": "side-by-side"} },
    { "keys": ["ctrl+6"], "command": "set_preference", "args": {"setting": "diff_style", "value": "inline"} },
]

(It’s worth noting that valid values for the diff_style setting are auto, inline, and side-by-side, with the default being auto)

You can replace the ctrl+5 / ctrl+6 with whichever keybinding you’d prefer.
When you get a chance, also take a look at the keybindings documentation to learn more about custom keybindings!

Hope this helps,
- Dylan

5 Likes