Emacs-like keybindings in Writer

So, I tried to setup some key bindings to make LibreOffice Writer behave like Emacs in terms of navigation.

I remapped:

  • C-f (Ctrl+F) – char forward
  • C-b – char backward
  • C-a – beginning of line
  • C-e – end of line
  • C-n – next line
  • C-p – previous line
  • M-f (Alt+F) – word forward
  • M-b – word backward
  • C-k – delete line to the end
  • M-d – delete word to the right
  • M-Backspace – delete word to the left
  • C-d – delete character to the right
  • C-o – open line above

For C-d and C-k I defined (recorded) macros.

But what I miss now is the ability to search by Ctrl+S.
What I need now is programmatically open “Find” bar and focus the cursor in there. (Though Emacs’s search is more elaborate, simple opening of toolbar would suffice.)
How do I do it?

I tried recording macro to no avail: nothing is recorded when I open “Find” toolbar from the Menu and focus it.

Many of these can be implemented without macros, simply by customising keyboard shortcuts. Have you had a look at Tools>Customize, Keyboard` tab?

Yes, I only recorded two macros, the rest are remapped in Tools - Customize.

vnd.sun.star.findbar:FocusToFindbar
e.g.
Execute find focuse via script or dispatch - #2 by sokol92
Macro basic programming: Function for Search Bar (Ctrl+F) - #2 by linuxyz

or you can play with uno:ExecuteSearch e.g. Apache OpenOffice Community Forum - ExecuteSearch versus createSearchDescriptor - (View topic)
and the numerous other commands : https://wiki.documentfoundation.org/Development/DispatchCommands

1 Like