diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-09-27 22:19:57 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-09-27 22:20:15 +0100 |
commit | 0fe6c046b20614769d253546213aa999824903ef (patch) | |
tree | c06ce9048f75e380c38e7b4fcebf931b648c83de /Emacs/.config | |
parent | c5999d6bffa28a3bb31a3c09411a729c970593ca (diff) | |
download | dotfiles-0fe6c046b20614769d253546213aa999824903ef.tar.gz dotfiles-0fe6c046b20614769d253546213aa999824903ef.tar.bz2 dotfiles-0fe6c046b20614769d253546213aa999824903ef.zip |
(Emacs)-function to delete sentence, vim motions work fine
The vim motion "d)" works fine
Diffstat (limited to 'Emacs/.config')
-rw-r--r-- | Emacs/.config/emacs/config.org | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 58ad305..b23dbc6 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -1465,40 +1465,6 @@ Auto fill mode is nice for most text modes, 80 char limit is great. #+begin_src emacs-lisp (add-hook 'text-mode-hook #'auto-fill-mode) #+end_src -*** Delete a sentence in auto fill -In long lines via truncate lines, deleting till the end of the -sentence was easy via vim motions. However, the same action is -difficult with auto-fill-mode where sentences are separated through -(potentially several) newlines which makes vim motions -difficult. Thus, I propose some form of functionality which allows you -to: - -- Find the next closest period denoting the end of the sentence -- Delete the region between the point of invocation and the found period - -This essentially does the same task as vim motion based deletion, but -can handle the newlines. To not trample on the toes of any package, -I'll set it to "M-d" (kill-word), the most inoffensive binding -possible which is still mnemonic. - -First, the function. I'll use search-forward (from zap* lib) to find -the period. Then auto-fill to make it look nice. -#+begin_src emacs-lisp -(defun +text/delete-till-sentence () - "Delete all text from current point to the next closest period." - (interactive) - (set-mark-command nil) - (search-forward ". ") - (kill-region (region-beginning) (region-end)) - (fill-paragraph)) -#+end_src - -Now, the binding -#+begin_src emacs-lisp -(general-def - :states '(normal insert) - (kbd "M-d") #'+text/delete-till-sentence) -#+end_src *** Smartparens Smartparens is a smarter electric-parens, it's much more aware of stuff and easier to use. |