Byte Sized: Remapping paste in macOS to always match style
Table of Contents
The problem
Paste and retain formatting is the default paste option and is almost never want I want. I use Obsidian to take notes and I find it constantly adding double lines to content I paste - even from Markdown pasted from vscode. I used to paste to something like notepad to strip the formatting then paste on to the next app but that’s suboptimal. I just want paste to “paste and match format” which is macOS way of saying strip formatting ¯_(ツ)_/¯
The fix
In macOS you can remap keys, so I’m going to switch paste and paste and match format. The keyboard shortcut for paste and match style is CTRL + SHIFT + V
so I am simply going to swap the commands around so that CTRL + V
calls paste and match style whereas CTRL + SHIFT + V
will paste.
There is a catch though! If an app doesn’t have the paste and match style option in the menu (such as vscode) then paste won’t work (!!) and I would have to default to revert to CTRL + SHIFT + V
which is not ideal. So what I am going to do is create an app specific keyboard layout for Obsidian which will reverse the commands for Obsidian only.
Find the Keyboard section of System Preferences and press the Keyboard Shortcuts… button, the option we want is App Shortcuts. Press the + sign to create a new shortcut.
Click on the application dropdown and select the app you want to remap your shortcut for. The text in menu title must precisely match the menu command including (I think!) case sensitivity. So add the title Paste and Match Style
then enter the keyboard shortcut CTRL + V
. Then create a second shortcut called Paste
and enter the keyboard shortcut CTRL + SHIFT + V
.
Your shortcuts should look like this:
Close down system preferences and you should be ready to go.
The result
Now I can paste cleanly in Obsidian, this is an efficiency fix because the amount of times I go through the pattern of paste-undo-paste-and-match-style is silly. The only flaw with macOS’s implementation of this is it’s either all apps or one app. You cannot map a shortcut for multiple apps at once which is a bit of an oversight in my opinion.