agzam / exwm-edit

Edit mode for EXWM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description

Edit mode for EXWM

Similar to atomic-chrome

except this package is made to work with EXWM and it works with any editable element of any app

The idea is very simple - when you invoke the edit, it simulates C-a + C-c (select all & copy), or simply C-c if you already have something pre-selected. Then it opens a buffer and yanks (pastes) the content so you can edit it, after you done - it grabs (now edited text) and pastes back to where it’s started

howitworks.gif

Now that opens interesting possibilities, for example:

  • when typing in ChromeDevTools console, you can initiate exwm-edit, then change major mode to whatever your favorite javascript mode is, have all the JS syntax highlighting, flycheck, etc;
  • you can edit GitHub issues and wiki pages using markdown-mode and use your syntax checker and thesaurus;
  • quickly modify url in browser address bar using multiple-cursors and regexp-replace things;
  • edit and modify code snippets with ease in Slack;
  • etc. and etc.

Customization

In your init.el file, put the following use-package declaration before the call to exwm-enable, since adjustments to exwm-input-global-keys only take effect before EXWM is enabled.

(use-package exwm-edit
  :config
  ;; Edit text in an *exwm-edit* buffer
  (add-to-list 'exwm-input-global-keys '([?\C-c ?\'] . exwm-edit--compose))
  (add-to-list 'exwm-input-global-keys '([?\C-c ?\'] . exwm-edit--compose))

  ;; You can use hooks to, e.g., set desired mode:
  (defun ag-exwm/on-exwm-edit-compose ()
    (spacemacs/toggle-visual-line-navigation-on)
    (funcall 'markdown-mode))

  (add-hook 'exwm-edit-compose-hook 'ag-exwm/on-exwm-edit-compose))

Keybindings

In the *exwm-edit* buffer, you can use C-c '~, ~C-c C-'~, ~C-c C-c, or whatever key you have bound to save-buffer to insert the buffer contents into the X program. To discard the contents of the *exwm-edit* buffer and go back to the X program, press C-c C-k.

Changelog

v0.0.4-pre

Nothing new yet…

v0.0.3

  • Autoload exwm-edit--compose and exwm-edit--compose-minibuffer
  • Just loading exwm-edit no longer binds any keys
  • Window display now uses standard display-buffer actions. Customize exwm-edit-display-buffer-action instead of exwm-edit-split.
  • Require Emacs 27.1 or later
  • Bug fixes

About

Edit mode for EXWM

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 100.0%