Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamouse/66d4533360521d14d4373bc369b95ba3 to your computer and use it in GitHub Desktop.
Save tamouse/66d4533360521d14d4373bc369b95ba3 to your computer and use it in GitHub Desktop.
(defun comment-or-uncomment-line-or-region ()
"DWIM comment or uncomment line or region"
(interactive)
(let (start end )
(if mark-active
(progn
(setq start (mark))
(setq end (point)))
(progn
(setq start (line-beginning-position))
(setq end (line-end-position))))
(comment-or-uncomment-region start end)))
(global-set-key (kbd "C-x /") 'comment-or-uncomment-line-or-region)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment