Skip to content

Instantly share code, notes, and snippets.

@dsjt
Created June 19, 2014 20:01
Show Gist options
  • Save dsjt/60efeb4ea6ae44cd041b to your computer and use it in GitHub Desktop.
Save dsjt/60efeb4ea6ae44cd041b to your computer and use it in GitHub Desktop.
elisp insert below/above [arg]th line like vim command "o" and "O" (but different)
(defun add-new-line-below(&optional arg)
"adds new line [arg]th below current line.
This command is compatible with relative-linum.el."
(interactive "p")
(if (not (numberp arg))
(setq arg 1))
(next-line (- arg 1))
(move-end-of-line 1)
(newline-and-indent))
(defun add-new-line-above(&optional arg)
"adds new line [arg]th above current line.
You have to
This command is compatible with relative-linum.el.
You have to pay attention to the difference between c-add-new-line-below and this. If you execute this simply, you give this function argument '1' genetally。And please (setq line-move-visual nil)"
(interactive "p")
(setq arg (or arg 0))
(if (not (numberp arg))
(setq arg 0))
(previous-line arg)
(back-to-indentation)
(split-line))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment