From 13bac97c078cf4ec0fc4b5565a88849942b30aa9 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 16 Mar 2019 23:58:43 -0400 Subject: [PATCH] feature/evil: update README & ex commands - Fix :sl[oad] and :ss[ave] - Disable MIA :debug +debug/run - Remove unnecessary comments --- modules/feature/evil/+commands.el | 10 +-- modules/feature/evil/README.org | 144 +++++++++++++++++++----------- 2 files changed, 96 insertions(+), 58 deletions(-) diff --git a/modules/feature/evil/+commands.el b/modules/feature/evil/+commands.el index 72ed9c464..82dedee36 100644 --- a/modules/feature/evil/+commands.el +++ b/modules/feature/evil/+commands.el @@ -66,10 +66,6 @@ buffers." ;; ;; Commands -;;; these are defined in feature/evil -;;(evil-ex-define-cmd "al[ign]" #'+evil:align) -;;(evil-ex-define-cmd "g[lobal]" #'+evil:global) - ;;; Custom commands ;; Editing (evil-ex-define-cmd "@" #'+evil:macro-on-all-lines) ; TODO Test me @@ -151,7 +147,7 @@ buffers." ;;; Project tools (evil-ex-define-cmd "compile" #'+evil:compile) (evil-ex-define-cmd "mak[e]" #'+evil:make) -(evil-ex-define-cmd "debug" #'+debug/run) +;; (evil-ex-define-cmd "debug" #'+debug/run) (evil-ex-define-cmd "er[rors]" #'flycheck-list-errors) ;;; File operations @@ -161,8 +157,8 @@ buffers." ;;; Sessions/tabs (evil-ex-define-cmd "sclear" #'+workspace/kill-session) -(evil-ex-define-cmd "sl[oad]" #'+workspace:load-session) -(evil-ex-define-cmd "ss[ave]" #'+workspace:save-session) +(evil-ex-define-cmd "sl[oad]" #'doom/quickload-session) +(evil-ex-define-cmd "ss[ave]" #'doom/quicksave-session) (evil-ex-define-cmd "tabc[lose]" #'+workspace:delete) (evil-ex-define-cmd "tabclear" #'doom/kill-all-buffers) (evil-ex-define-cmd "tabl[ast]" #'+workspace/switch-to-last) diff --git a/modules/feature/evil/README.org b/modules/feature/evil/README.org index b3b089d1d..b6f6bf5ed 100644 --- a/modules/feature/evil/README.org +++ b/modules/feature/evil/README.org @@ -4,26 +4,25 @@ #+STARTUP: inlineimages * Table of Contents :TOC_3:noexport: -- [[Description][Description]] - - [[Module Flags][Module Flags]] - - [[Plugins][Plugins]] - - [[Hacks][Hacks]] -- [[Prerequisites][Prerequisites]] -- [[Features][Features]] - - [[Ported vim plugins][Ported vim plugins]] - - [[Custom Text Objects][Custom Text Objects]] - - [[Custom Ex Commands][Custom Ex Commands]] - - [[A hybrid code-folding system][A hybrid code-folding system]] - - [[Differences from vim][Differences from vim]] -- [[Configuration][Configuration]] - - [[Removing evil-mode][Removing evil-mode]] +- [[#description][Description]] + - [[#module-flags][Module Flags]] + - [[#plugins][Plugins]] + - [[#hacks][Hacks]] +- [[#prerequisites][Prerequisites]] +- [[#features][Features]] + - [[#ported-vim-plugins][Ported vim plugins]] + - [[#custom-text-objects][Custom Text Objects]] + - [[#custom-ex-commands][Custom Ex Commands]] +- [[#configuration][Configuration]] + - [[#removing-evil-mode][Removing evil-mode]] + - [[#restoring-old-substitution-behavior-on-ss][Restoring old substitution behavior on s/S]] * Description This holy module brings the vim experience to Emacs. ** Module Flags -+ =+everywhere= Enables evilified keybinds everywhere possible, utilizing the - ~evil-collection~ plugin. ++ =+everywhere= Enables evilified keybinds everywhere possible. Uses the + [[https://github.com/emacs-evil/evil-collection][evil-collection]] plugin as a foundation. ** Plugins + [[https://github.com/emacs-evil/evil][evil]] @@ -48,10 +47,9 @@ This holy module brings the vim experience to Emacs. + When a window is split, the new window will be focused. + The o/O keys will respect and continue commented lines (can be disabled by setting ~+evil-want-o/O-to-continue-comments~ to ~nil~). -+ From visual mode, =*= and =#= will search for the current selection instead of ++ In visual mode, =*= and =#= will search for the current selection instead of the word-at-point. -+ The ~:g[lobal]~ ex command has been modified to highlight matches - incrementally. ++ The ~:g[lobal]~ ex command has been modified to highlight matches. + More of vim's filename modifiers are supported in ex commands (like ~:p~, ~:p:h~ or ~:t~) than vanilla evil-mode offers. + A custom filename modifier is available in Doom: ~:P~, which expands to the @@ -64,45 +62,77 @@ This module has no external prerequisites. ** Ported vim plugins The following vim plugins have been ported to evil: -| Vim Plugin | Emacs Plugin | Keybind(s) | -|-----------------------+--------------------------------+---------------------| -| vim-commentary | evil-commentary | omap =gc= | -| vim-easymotion | evil-easymotion | omap =gs= | -| vim-seek or vim-sneak | evil-snipe | mmap =s=/=S= | -| vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= | +| Vim Plugin | Emacs Plugin | Keybind(s) | +|-----------------------+--------------------------------+--------------------------------------| +| vim-commentary | evil-commentary | omap =gc= | +| vim-easymotion | evil-easymotion | omap =gs= | +| vim-seek or vim-sneak | evil-snipe | mmap =s=/=S=, omap =z=/=Z= & =x=/=x= | +| vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= | In other modules: -+ The tools/neotree & tools/treemacs modules contain a =NERDTree= equivalent. -+ The editor/multiple-cursors module contains: - + ~vim-multiedit~ => evil-multiedit - + ~vim-multiple-cursors~ => evil-mc ++ The tools/neotree & tools/treemacs modules provide a =NERDTree= equivalent. ++ The editor/multiple-cursors module contains functionality equal to the + following vim plugins: + + evil-multiedit => vim-multiedit + + evil-mc => vim-multiple-cursors ** Custom Text Objects -+ A list of new text objects: - + Blocks: ~B~ (from ~evil-textobj-anyblock~) - + Args: ~a~ (from ~evil-args~) - + Indentation: ~i~ / ~I~ / ~J~ (from ~evil-indent-plus~) +This module provides a couple extra text objects, along with the built-in ones. +For posterity, here are the built-in ones: + ++ =w W= words ++ =s= sentences ++ =p= paragraphs ++ =b= parenthesized blocks ++ =b ( ) { } [ ] < >= braces, parentheses and brackets ++ =' " `= quotes ++ =t= tags ++ =o= symbols + +And these are text objects added by this module: + ++ =B= any block delimited by braces, parentheses or backets (provided by + ~evil-textobj-anyblock~) ++ =a= C-style fucntion arguments (provided by ~evil-args~) ++ =i I J= By indentation (I includes on line above and J includes one line + below) (provided by ~evil-indent-plus~) ++ =x= XML attributes (provided by ~exato~) ** Custom Ex Commands -| Ex Command | Description | -|----------------------+----------------------------------------------------------------------------------| -| ~:al[ign][!] REGEXP~ | Align text to the first match of REGEXP. If BANG, align all matches on each line | -| ~:mv[!] NEWPATH~ | Move the current file to NEWPATH | -| ~:cp[!] NEWPATH~ | Copy the current file to NEWPATH | -| ~:rm[!] [PATH]~ | Delete the current buffer's file and buffer | - -** A hybrid code-folding system -This module combines ~vimish-fold~ and ~hideshow~. The former allows arbitrary -folds and the latter allows folds on markers and indentation. Together, they -create a more consistent (and feature-complete) code-folding system. - -Most vim folding keys should work, e.g. =zr=, =zm=, =za=, =zo=, etc. - -** Differences from vim -+ Column-wise ranges in ex commands are enabled by default. i.e. the range in - =:'<,'>s/a/b= will only affects the visual selection, not full lines (see - ~evil-ex-visual-char-range~). -+ =:g= will incrementally highlight buffer matches. +| Ex Command | Description | +|----------------------+--------------------------------------------------------------------------------------| +| ~:@~ | Apply macro on selected lines | +| ~:ag[!] REGEXP~ | Perform a project search with ag | +| ~:agcwd[!] REGEXP~ | Perform a project search with ag | +| ~:al[ign] REGEXP~ | Align text that matches REGEXP | +| ~:al[ign][!] REGEXP~ | Align text to the first match of REGEXP. If BANG, align all matches on each line | +| ~:cp[!] NEWPATH~ | Copy the current file to NEWPATH | +| ~:dash QUERY~ | Look up QUERY (or the symbol at point) in dash docsets | +| ~:dehtml [INPUT]~ | HTML decode selected text / inserts result if INPUT is given | +| ~:enhtml [INPUT]~ | HTML encode selected text / inserts result if INPUT is given | +| ~:grep[!]~ | Perform a project search with git-grep | +| ~:grepcwd[!]~ | Perform a project search with git-grep | +| ~:iedit REGEXP~ | Invoke iedit on all matches for REGEXP | +| ~:k[ill]all[!]~ | Kill all buffers (if BANG, affect buffer across workspaces) | +| ~:k[ill]b~ | Kill all buried buffers | +| ~:k[ill]m[!] REGEXP~ | Kill buffers whose name matches REGEXP (if BANG, affect buffers across workspaces) | +| ~:k[ill]o~ | Kill all other buffers besides the selected one | +| ~:k[ill]~ | Kill the current buffer | +| ~:lo[okup] QUERY~ | Look up QUERY on an online search engine | +| ~:mc REGEXP~ | Invoke multiple cursors on all matches for REGEXP | +| ~:mv[!] NEWPATH~ | Move the current file to NEWPATH | +| ~:na[rrow]~ | Narrow the buffer to the selection | +| ~:pad~ | Open a scratch pad for running code quickly | +| ~:pt[!]~ | Perform a project search with pt | +| ~:ptcwd[!]~ | Perform a project search with pt | +| ~:ral[ign] REGEXP~ | Right-align text that matches REGEXP | +| ~:repl~ | Open a REPL and/or copy the current selection to it | +| ~:retab~ | Convert indentation to the default within the selection | +| ~:rev[erse]~ | Reverse the selected lines | +| ~:rg[!]~ | Perform a project search with ripgrep | +| ~:rgcwd[!]~ | Perform a project search with rigprep | +| ~:rm[!] [PATH]~ | Delete the current buffer's file and buffer | +| ~:tcd[!]~ | Send =cd X= to tmux. X = the project root if BANG, X = ~default-directory~ otherwise | * Configuration ** Removing evil-mode @@ -125,3 +155,15 @@ ignored without evil present (and stripped out when byte-compiling). Unfortunately, since Doom was designed by a vimmer, for vimmers, little consideration into a keybinding scheme for vanilla Emacs users. + +** Restoring old substitution behavior on s/S +Doom replaces the =s= and =S= keys with the =evil-snipe= package (a port of +vim-seek/vim-sneak for 2-character versions of f/F/t/T). + +To disable evil-snipe on s/S, you can either: + +1. Disable ~evil-snipe-mode~ by adding ~(after! evil-snipe (evil-snipe-mode + -1))~ to =$DOOMDIR/config.el=, +2. Or disable =evil-snipe= completely with ~(package! evil-snipe :disable t)~ + added to =$DOOMDIR/packages.el=, but this will also disable incremental + highlighting for the f/F/t/T motions keys.