Emacs: Spaces to New Lines 🚀
Here's a command to convert spaces to newline characters.
For example,
cat dog cow
becomes
cat dog cow
Here's the code.
(defun xah-space-to-newline () "Replace space sequence to a newline char in current block or selection. URL `http://xahlee.info/emacs/emacs/emacs_space_to_newline.html' Created: 2017-08-19 Version: 2024-03-19" (interactive) (let (xp1 xp2) (seq-setq (xp1 xp2) (xah-get-pos-of-block-or)) (save-restriction (narrow-to-region xp1 xp2) (goto-char (point-min)) (while (re-search-forward " +" nil t) (replace-match "\n")))))
requires package Emacs: xah-get-thing.el