Set style by name?

Is it possible to apply styles by name, similar to how “Search Commands” allows executing commands by name?

I am thinking along the lines of how LyX works. There you can press Alt+P, SPC and get a drop-down menu of available paragraph styles, that can be filtered by typing fragments of the style name. So, instead of either having to click around the Styles side bar or having to assign separate keybindings for all important styles, I’d be able to just type Style-Selector-Hotkey, Heading 4, Enter.

There is no official way to do it. However I found a workaround which could be close to what you’re looking for. A bit convoluted but it works.

  • when you want to change a paragraph style, press F11
  • then type the beginning of the style name; you’ll see the selection move in the style side pane
  • when you’re on the desired style, press Enter.

The paragraph is assigned the selected style and focus returns into the edit window.

Caution! This works for the currently displayed list category. In other word, if the style side pane displays character styles, you’ll select character styles. You need to use the mouse to switch to another category.

Also, if you like Hierarchical view like me, you can’t reach non expanded subfamilies. This means, to keep full choice of styles, you must display them as All Styles.

IMHO, the keyboard shortcut is far superior because you can apply any category as the effect is not dependent on what is presently displayed. In principle, a document is written with a dozen (para + char) repeating styles. Infrequent styles can be accessed through mouse clicks without being a real inconvenience.

Thanks for the suggestion. It does indeed solve the use-case partly.

Apparently, in 7.2 it works. For instance, I have a sub-style TODO of TextBody, that gets selected, if TextBody is folded and I type TODO.

The advantage of text-based selection would be, that it would work equally for all documents, regardless of defined styles.

Since I mostly reuse a slowly-developing set of styles across documents, it will likely mostly be fine though.

The troublesome part is that I use a mixture of character- and paragraph styles, which throws a wrench into the F11 solution :frowning: