summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/km-func.el10
-rw-r--r--init/km-keychord.el2
2 files changed, 12 insertions, 0 deletions
diff --git a/init/km-func.el b/init/km-func.el
index 4b3db51..1f2c809 100644
--- a/init/km-func.el
+++ b/init/km-func.el
@@ -63,3 +63,13 @@ user."
(interactive)
(save-buffer)
(kill-this-buffer))
+
+(defun km/toggle-line-or-region-comment ()
+ "Comment/uncomment the current line or region"
+ (interactive)
+ (let (beg end)
+ (if (region-active-p)
+ (setq beg (region-beginning) end (region-end))
+ (setq beg (line-beginning-position) end (line-end-position)))
+ (comment-or-uncomment-region beg end))
+ (forward-line))
diff --git a/init/km-keychord.el b/init/km-keychord.el
index 720855b..75017a8 100644
--- a/init/km-keychord.el
+++ b/init/km-keychord.el
@@ -15,3 +15,5 @@
(key-chord-define-global ",e" 'eval-region)
(key-chord-define-global ",w" 'km/sync-mail)
+
+(key-chord-define-global ",c" 'km/toggle-line-or-region-comment)