Properties: Command to delete individual property from the current note

Use case or problem

TL;DR
Users need a efficient way to delete individual properties using the keyboard.

When a file contains multiple or complex properties, or if a user mistakenly adds a property through the add file property command, how can they delete it? At present, they are required to switch to the mouse, precisely click on the property icon, and select “remove”.

In versions prior to 1.4.x, Users could move the cursor up and delete the property line directly without any mouse action.

Proposed solution

What I’ve noticed is that we now have commands related to properties, such as clear file properties. However, the clear file properties command is only practical when a user has a few properties at a time. When a file contains multiple complex properties, using clear file properties can be problematic.

Current workaround

If I’m committed to maintaining a full keyboard workflow, I would use the command to open in the default app, edit the property line in another application, and then switch back to Obsidian. It’s a convoluted process, but it does allow for a full keyboard operation.

2 Likes

On MacOS, I can use Cmd-Delete to delete a property. I assume Ctrl-Delete would be the Windows or Linux equivalent.

Also works to shift select multiple ones (with the keyboard) and delete them all at once.

2 Likes

Ahh. Great to learn that! Thanks for the tip.

In macOS, the standard shortcut for deleting a file is Command + Delete, which sends the file to the Trash. Conversely, in Windows, it’s Ctrl + Delete, moving the file to the Recycle Bin. For user familiarity and consistency, it would be beneficial if software shortcuts align with these system defaults.
Aligning software keyboard shortcuts with system defaults can greatly enhance user experience.

On the other hand, when typing on a macOS system, the shortcuts Ctrl-p/n/b/f are convenient for cursor movement. However, Ctrl-p doesn’t allow movement to property lines. Yet, regardless of cursor placement, using the add file property (shortcut command + ;) can add a property effortlessly.

It does that in Finder, but in text it deletes everything from the insertion point to the start of the line.

2 Likes

Thank you for highlighting that.

The difference in certain functionalities, like the one you mentioned in comparison to Finder, is another way to show the properties are different concept and may need a better way to manipulate.

Currently, Obsidian offers the delete current file command for file. Given this, wouldn’t it be more intuitive to introduce a delete current property command for properties? Relying on the cmd+delete shortcut at property can be misleading.

Appreciate the insight.

Cmd+Backspace is only available for macOS. But you can also press the “Delete” key on your keyboard to delete the focused property.

1 Like

While the suggestion for a delete key command is understandable, it’s worth noting that default keyboards on both iMac and MacBook Pro lack a dedicated Delete key; they only provide a backspace. This absence further complicates the user experience and underscores the need for an intuitive command like delete/select file property.


Furthermore, users can add a property in Obsidian through several methods:

  1. Clicking the Add Property button.
  2. Pressing Enter when the selection is on the Add property line.
  3. Using the command add file property with the default shortcut cmd + ;.

For symmetry and consistency in user experience, there should similarly be multiple methods available for deleting a property.

Doesn’t cmd-backspace work on mac? what are we missing?

I also need this command, and would prefer if there is a way to do it without needing to go through the properties in the YAML, selecting the one to delete, and pressing the ‘delete key.’

The best I could manage (which works out for me, though it isn’t a good universal method) is using the Obsidian Linter third-party plugin, and turning off every setting except for “Remove the YAML keys specified” in the “YAML” section of the plugin settings. In the “YAML Keys to Remove” setting, I set the key I wanted to remove. Then it was as simple as setting a keyboard shortcut or adding to the right click menu the command “Linter: Lint the current file” and this deleted that specific key I wanted to remove.

This method works if the key you want to remove from any particular page is the same key and if you don’t want to use Linter for anything else, but as soon as you want to change it to a different key or as soon as you want to use Linter for anything else, this method becomes disadvantageous.

Hopefully someone can come up with a better fix. I think there are some third-party plugins that allow for editing frontmatter properties in different ways, it could be one of them.