In the new SAP ABAP Speak Your Voice; New ABAP Editor for Older Releases, it’s sort-of possible to remap the keybindings you use. If you’re a regular Emacs user, you often find yourself pressing the wrong key combination accidentally – for instance C-a to go to the beginning of a line, only to find that the new ABAP editor by default respects the regular windows CUA keybindings – so C-a does a “Select All” as it does in many windows programs.
I’ve redefined many of the new editor keybindings that I use to be more Emacs-like. If you’re interested, here is a PDF document listing all of my defined keybindings for the “emacs” schema. This is a stylesheet transformation of the file “keymap.xml” that is stored in your SAP work directory (so, in my case this is C:Documents and SettingsJonathan UserSapWorkDirab4_datakeymap.xml). Here is my keymap.xml file, I would say simply replace your own keymap.xml file with mine BUT I’ve had sufficient grief doing it even when upgrading my SAP GUI from one release to another, so doubt this will work for you. If you do want to try that, please backup your entire SapWorkDir first (as a point of reference, I’ve had this blog post in draft form since December 2008 due to not being sure how to share my keybindings with others).
What is probably more sensible if you want to try a similar Emacs keybinding scheme is to take a look at the PDF containing my keybindings and to manually create your own Emacs keybinding scheme. To do so, start by clicking on the little yellow icon on the far right bottom of your editor screen (indicated by the arrow):
Why do I say that its only “sort-of” possible to remap the keybindings? Well, there are limitations : (1) Our nice custom keybindings can’t be used when in display only mode, like when we’re on a non-development system (2) We can’t do complicated key sequences, eg. C-x C-w can’t be bound to “File.Saveas”. (3) Meta key bindings are difficult as pressing the ALT key on its own makes the menu bar at the top of the screen active, so the ALT key must always be combined with other modifiers like control (4) The windows key cannot be bound. In fact, we seem to be stuck with Shift, Control and Alt as modifiers. (5) Some things like kill-line (C-k) have no equivalent command in the front-end editor. (5) Block mode in the two editors is different in concept.
There are some windows CUA keybindings that you may be particularly fond of that get lost if you rebind them – for instance C-v does a “Clipboard Paste”. I’ve also bound that to C-y in the keybindings file above to be more like Emacs, but you may not like that, so I guess whatever keybindings you end up using will become a matter of personal taste, which is as for all things Emacs. Still, some sensible substitutions for cut-copy-paste are also defined by default in the new editor – for instance Shift-Insert performs a paste as it does on many terminal emulators.
By the way, as far as I know the new editor mode only is available for the windows SAP GUI. 1 The option to select the new editor does not appear in all the versions of the Java GUI that I’ve tried. It would be a shame if the new editor was never ported to the Java GUI, and my Linux street cred has suffered enormously as a consequence.
I have considered developing a proper “abap-mode” for the stand-alone Emacs editor as well, but it does seem it would have very little benefit for the effort involved – the benefit would apply if you opened a saved file with ABAP code in it in Emacs, or if you pasted into an Emacs window outside of your SAP GUI. If it were feasible to embed Emacs into the SAP GUI as the default editor then an abap-mode would be a real consideration. However, I don’t see how it’ll be feasible due to the tight integration that the new editor enjoys. For instance, one would have to allow for drill-down into other sections of code, allow for integration with the SE80 code browser and so forth. So I personally see a truly embedded Emacs as a wonderful thing (that will never happen!).
I also have a wish-list for commands that I’d love the new ABAP editor to support. Top of this list would be an Emacs kill-ring. Luckily, there is something similar – pressing “Edit.PasteExtended” (By default bound to Control-Shift-V) pops up a list of the clipboard history, so all is not lost however, and if you didn’t know about this feature it’s great.
1 The new front-end editor is available for SAP GUI for Windows 6.40 Patch level 10 and onwards, also your server must be able to support it – the first official server version that supports it is SAP NetWeaver2004s, although since then the editor has been New ABAP Editor Backport!, you can also run with it on older versions going back to 6.20 (but your system must be at one of the newer patch levels).