Last active
December 19, 2015 01:09
-
-
Save gonz/5874226 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Join next line or join all lines in region | |
(defun smart-join-line () | |
"Join the current line with the line beneath it or all region lines." | |
(interactive) | |
(if (use-region-p) | |
(save-excursion | |
(let ((start-line (line-number-at-pos (region-beginning))) | |
(current-line (line-number-at-pos (region-end)))) | |
(goto-char (region-end)) | |
(while (> current-line start-line) | |
(join-line) | |
(setq current-line (line-number-at-pos))))) | |
(delete-indentation 1))) | |
(global-set-key (kbd "C-S-j") 'smart-join-line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment