Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
marvel
GitHub Repository: marvel/qnf
Path: blob/master/elisp/emacs-for-python/plugins/open-next-line.el
990 views
1
;; Behave like vi's o command
2
(defun open-next-line (arg)
3
"Move to the next line and then opens a line.
4
See also `newline-and-indent'."
5
(interactive "p")
6
(end-of-line)
7
(open-line arg)
8
(next-line 1)
9
(when newline-and-indent
10
(indent-according-to-mode)))
11
(global-set-key (kbd "C-o") 'open-next-line)
12
;; Behave like vi's O command
13
(defun open-previous-line (arg)
14
"Open a new line before the current one.
15
See also `newline-and-indent'."
16
(interactive "p")
17
(beginning-of-line)
18
(open-line arg)
19
(when newline-and-indent
20
(indent-according-to-mode)))
21
(global-set-key (kbd "M-o") 'open-previous-line)
22
23
;; Autoindent open-*-lines
24
(defvar newline-and-indent t
25
"Modify the behavior of the open-*-line functions to cause them to
26
autoindent.")
27
28
(provide 'open-next-line)
29