https://github.com/captainflasmr/wowee

I have been continuing to tinker with this project over the last week…

Overview

WOWEE is a set of AutoHotKey scripts designed to bring Emacs-like commands and keybindings to the Windows operating system. Based on the concept of EWOW (Emacs Way of Operating Windows), WOWEE allows you to use Emacs-style navigation and commands throughout your Windows environment.

Whats New

Version 0.3.0 <2024-06-28 Fri>

This commit has split out ahk files into apps, core and init:

  • Added comment-line
  • Added mark-whole-buffer
  • Refined isearch
  • Added application specific bindings in keybinds-apps.ahk for Visual Studio and VSCode
  • Update README to reflect design changes
  • Added beginning_of_buffer and end_of_buffer core mappings
  • Added mark_whole_buffer core mapping

Version 0.2.0 <2024-06-26 Wed>

This commit introduces several new functions to enhance the usability and functionality of the `commands.ahk` script. Notable additions include:

  • Implementation of `isearch_backward` and `isearch_forward` functions for improved search capabilities, allowing for backwards and forwards in-document searches with initialization and continuation logic.
  • Addition of `recenter_line`, `indent_line`, and `backward_kill_word` functions to enrich text editing commands.
  • Enhancement of `select_line` and `goto_line` functions for better line selection and navigation.
  • The `quit_g` function extends quitting capabilities to also reset the `selecting` and `searching` states.
  • Modifications to `next_lines` and `previous_lines` to increase the number of lines navigated with each command from 3 to 6, improving scroll efficiency.
  • Update to `kill_ring_save` to include an escape key press, ensuring a more comprehensive cleanup post-operation.
  • Improved the README.org kanban to more easily differentiate between command sections and to define those commands I am not implementing (IGNORE) and those additional commands (EXTRA)

Version 0.1.0 <2024-06-19 Wed>

Initial version

Features

  • Emacs-like commands and keybindings in Windows
  • Based on EWOW – Emacs Way of Operating Windows
  • Written in AutoHotKey v2
  • Includes various Emacs style navigation commands
  • Ergonomic keyboard layout options
  • Easily add your own keybindings by modifying AHK source files
  • Bindings bespoke to individual applications

My current thoughts

Bindings bespoke to individual applications

  • I am playing around with the idea of application specific bindings within the keybinds.ahk file, for example something like :

    ;; -------------
    ;; Visual Studio
    ;; -------------
    ;; Shortcut rebindings:
    ;;
    ;; Control+p Control+s : Text Editor : Incremental Search
    ;; Control+p Control+r : Text Editor : Incremental Search Reverse
    ;; Control+p Control+l : Text Editor : Scroll Recenter
    ;; Control+p Control+f : Text Editor : Format selection
    
    #HotIf WinActive("ahk_class VisualStudio")
    ^r::isearch_backward("{Shift down}{F3}{Shift up}" "^p^r")
    ^s::isearch_forward("{F3}" "^p^s")
    ^l::recenter_line()
    ^i::indent_line()
    ^+i::indent_line()
    

    These will be placed in a separate ahk file called keybinds-apps.ahk.

    The comments would indicate which commands require re-bindings, or redefining the shortcuts. For example, in Visual Studio, Control+I is an incremental search which in emacs is used for multiple actions including indentation, cycling, e.t.c, so at times rather than relying on either default application keybindings or the general windows keybindings an explicit mapping may be required for full functionality.

    So as part of the application definition, why not add in the re-mappings in a comment!

    Also I might have to create some more generic functions to accept arguments defining application specific commands, as demonstrated above with isearch_forward and isearch_backward.

    As part of this I might have to expand the kanban per application, or maybe separate kanbans on which functions have been implemented.

kanban

This kanban board is keeping track of those original EWOW functions.

The IGNORE column includes functions that I am definitely not going to implement.

The EXTRA section are additional commands that I am adding.

TODO DOING DONE IGNORE
CORE REGION COMMANDS —- VISUAL STUDIO —- CORE MOTION COMMANDS - scroll_left
- mark_word - recenter_line - forward_char - scroll_right
- kill_region - indent_line - backward_char - open_line
- yank_pop —- VSCODE —- - forward_word - transpose_chars
- delete_backward_char - isearch_backwards - backward_word - transpose_words
- kill_word - isearch_forwards - next_line - transpose_lines
- kill_whole_line ADD PROGRAM SPECIFIC PRESETS - previous_line CORE CASE CONVERSION COMMANDS
CORE NEWLINE AND INDENT COMMANDS CORE JUMPING AROUND COMMANDS - upcase_region
- newline - scroll_down - downcase_region
- delete_indentation - scroll_up - upcase_word
CORE EDIT COMMANDS - move_beginning_of_line - downcase_word
- redo - move_end_of_line - capitalize_word
- query_replace - beginning_of_buffer CORE MACRO RECORDING COMMANDS
- overwrite_mode - end_of_buffer CORE ADD IGNORE FRAMES
CORE INSERT PAIRS COMMANDS - goto_line CORE ADD MOUSE EVENTS
- insert_parentheses - mark_whole_line
- insert_comment - mark_whole_buffer
- indent_new_comment_line - kill_ring_save
CORE OTHER COMMANDS - yank
- shell - delete_char
- shell_command - backward_kill_word
- facemenu - kill_line
- help - indent_for_tab_command
CORE SYSTEM COMMANDS - undo_only
- ignore - search_forward
- repeat - search_backward
CORE DIGIT ARGUMENT COMMANDS - set_mark_command
CORE FILES COMMANDS - set_cx_command
- write_file - keyboard_quit
- find_file - save_buffer
- dired CORE ADD C-X
CORE WINDOWS FRAMES COMMANDS - isearch_backwards
- kill_frame - isearch_forwards
- delete_window - comment_line
- split_window - comment_line
- next_window
- previous_window
- suspend_frame
CORE ADD HOOKS
ADD GENERIC GOTO LINE
CORE ADD KILL RING
- recenter_line
- indent_line
EXTRA ERGO PRESET SELECTION
EXTRA
- ctrl_mapping

Usage

  1. Install AutoHotKey: Download and install AutoHotKey from AutoHotKey’s official website.
  2. Run WOWEE: Double-click on the `wowee.ahk` script to start WOWEE. Once running, Emacs commands will be available in your Windows environment.
  3. Quit WOWEE: To quit WOWEE, right-click the AutoHotKey icon in the task tray and select “Exit.”

Configuration

WOWEE is composed of several AutoHotKey scripts, each serving a specific purpose to replicate Emacs functionalities:

wowee.ahk

The top level script to be run, contains the following scripts along with some potential ergonomic key-mappings which if not desired can be commented out:

RAlt::Control
CapsLock::Control
#Include fundamental.ahk
#Include commands.ahk
#Include keybinds-apps.ahk
#HotIf !WinActive("ahk_class Emacs")
#Include keybinds-core.ahk
#Include keybinds-init.ahk
#HotIf

fundamental.ahk

This script provides a set of fundamental functions and variables that are used to implement Emacs-like commands and keybindings.

commands.ahk

This script includes the basic implementation of Emacs commands.

commands_util.ahk

This script contains simple utility functions used by the command scripts.

keybinds-core.ahk

This script defines the default core keybindings for Emacs-like commands, which will be a fallback for any windows application.

keybinds-apps.ahk

This script defines the application specific commands, typically commands that have been remapped to accommodate the chosen commands.

Comments within the ahk file indicate the potential re-mappings.

keybinds-init.ahk

Analogous to the init.el file or Emacs init file in which all the users bespoke keybindings will exist. An example of my preferred keybindings has been supplied.