2015-06-15 09:05:52 +02:00
|
|
|
;;; defuns-editor.el
|
|
|
|
;; for ../core-editor.el
|
|
|
|
|
2015-11-08 17:59:11 -05:00
|
|
|
(defvar *linum-mdown-line* nil)
|
|
|
|
|
2016-05-20 22:37:30 -04:00
|
|
|
(defun doom--line-at-click ()
|
2015-11-08 17:59:11 -05:00
|
|
|
(save-excursion
|
|
|
|
(let ((click-y (cdr (cdr (mouse-position))))
|
|
|
|
(line-move-visual-store line-move-visual))
|
|
|
|
(setq line-move-visual t)
|
|
|
|
(goto-char (window-start))
|
|
|
|
(next-line (1- click-y))
|
|
|
|
(setq line-move-visual line-move-visual-store)
|
|
|
|
;; If you are using tabbar substitute the next line with
|
|
|
|
;; (line-number-at-pos))))
|
|
|
|
(1+ (line-number-at-pos)))))
|
|
|
|
|
|
|
|
;;;###autoload
|
2016-05-20 22:37:30 -04:00
|
|
|
(defun doom/mouse-drag-line ()
|
2015-11-08 17:59:11 -05:00
|
|
|
(interactive)
|
2016-05-20 22:37:30 -04:00
|
|
|
(goto-line (doom--line-at-click))
|
2015-11-08 17:59:11 -05:00
|
|
|
(set-mark (point))
|
|
|
|
(setq *linum-mdown-line* (line-number-at-pos)))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
2016-05-20 22:37:30 -04:00
|
|
|
(defun doom/mouse-select-line ()
|
2015-06-15 09:05:52 +02:00
|
|
|
(interactive)
|
2015-11-08 17:59:11 -05:00
|
|
|
(when *linum-mdown-line*
|
|
|
|
(let (mu-line)
|
2016-05-20 22:37:30 -04:00
|
|
|
(setq mu-line (doom--line-at-click))
|
2015-11-14 02:41:53 -05:00
|
|
|
(goto-line *linum-mdown-line*)
|
2015-11-08 17:59:11 -05:00
|
|
|
(if (> mu-line *linum-mdown-line*)
|
|
|
|
(progn
|
|
|
|
(set-mark (point))
|
|
|
|
(goto-line mu-line)
|
|
|
|
(end-of-line))
|
|
|
|
(set-mark (line-end-position))
|
|
|
|
(goto-line mu-line)
|
|
|
|
(beginning-of-line))
|
2015-11-14 02:41:53 -05:00
|
|
|
(setq *linum-mdown-line* nil))))
|
2015-06-15 09:05:52 +02:00
|
|
|
|
2016-03-20 12:18:51 -04:00
|
|
|
;;;###autoload
|
2016-05-20 22:37:30 -04:00
|
|
|
(defun doom/reselect-paste ()
|
2016-09-30 14:37:25 +02:00
|
|
|
"Go back into visual mode and reselect the last pasted region."
|
2016-03-20 12:18:51 -04:00
|
|
|
(interactive)
|
|
|
|
(evil-goto-mark ?\[)
|
|
|
|
(evil-visual-state)
|
|
|
|
(evil-goto-mark ?\]))
|
|
|
|
|
2016-05-24 22:15:44 -04:00
|
|
|
;;;###autoload
|
|
|
|
(defun doom/delete-forward-word ()
|
|
|
|
"Delete the word in front of the cursor."
|
|
|
|
(interactive)
|
|
|
|
(evil-forward-word)
|
|
|
|
(evil-delete-backward-word))
|
|
|
|
|
2015-06-15 09:05:52 +02:00
|
|
|
(provide 'defuns-editor)
|
|
|
|
;;; defuns-editor.el ends here
|