summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavi R Kiran <aine.marina@gmail.com>2021-06-28 03:21:10 (GMT)
committerRavi R Kiran <aine.marina@gmail.com>2021-06-28 03:21:10 (GMT)
commitadc6d48c4a776bbd6911f6d10ee3fd2981e84066 (patch)
tree957e46e0953d3b48317a96b66662eb3987f1c958
parent7c9f8477818a1690fdc3cea5f7a8fe4807bf844b (diff)
downloaddotemacs-adc6d48c4a776bbd6911f6d10ee3fd2981e84066.zip
dotemacs-adc6d48c4a776bbd6911f6d10ee3fd2981e84066.tar.gz
dotemacs-adc6d48c4a776bbd6911f6d10ee3fd2981e84066.tar.bz2
MWIM is slightly nicer
-rw-r--r--lisp/ravi-init-navigation.el36
1 files changed, 3 insertions, 33 deletions
diff --git a/lisp/ravi-init-navigation.el b/lisp/ravi-init-navigation.el
index 493381c..5a8c05b 100644
--- a/lisp/ravi-init-navigation.el
+++ b/lisp/ravi-init-navigation.el
@@ -175,40 +175,10 @@
;; C-: duplicates line, C-u C-: comments first line
(bind-key "C-:" 'ravi/kyle-sherman-duplicate-line)
-(use-package key-combo
- :config
- (progn
- (global-key-combo-mode 1)
- (key-combo-define-global (kbd "C-a")
- `(back-to-indentation move-beginning-of-line
- key-combo-return))))
-
-(defun ravi/Fuco-point-in-comment ()
- "Determine if the point is inside a comment"
- (interactive)
- (let ((syn (syntax-ppss)))
- (and (nth 8 syn)
- (not (nth 3 syn)))))
-
-(defun ravi/Fuco-end-of-code-or-line+ (arg)
- "Move to the end of line. If already there, move to the end of code.
+(use-package mwim
+ :bind (("C-a" . mwim-beginning)
+ ("C-e" . mwim-end)))
- Comments are recognized in any mode that sets syntax-ppss properly."
- (interactive "P")
- (let ((eoc (save-excursion
- (move-end-of-line arg)
- (while (ravi/Fuco-point-in-comment)
- (backward-char))
- (skip-chars-backward " \t")
- (point))))
- (cond ((eolp)
- (move-end-of-line arg)
- (while (ravi/Fuco-point-in-comment)
- (backward-char))
- (skip-chars-backward " \t"))
- (t
- (move-end-of-line arg)))))
-(bind-key "C-e" 'ravi/Fuco-end-of-code-or-line+)
;; Use current line for region-based commands if no region selected
(use-package whole-line-or-region