1

I'm a Vim user trying out spacemacs for the first time. In Vim, I have a keybind that when I press L (jump to bottom of screen), it also centers the screen on the cursor. In my .vimrc, this is done with nnoremap L L<bar>zz <CR>, but I'm unsure of how to chain two keypresses like this in emacs.

  • 1
    The Emacs way is to write a custom command instead of coming up with a sequence of keystrokes. Therefore there's no general answer to this type of question as every situation requires its own special command. – wasamasa Mar 4 '18 at 18:46
1

In Emacs the standard practice is to write an elisp function to do this sort of thing. For instance, you could implement your command and bind it like this:

(defun center-last-line ()
  (interactive)
  (goto-char (point-max))
  (beginning-of-line)
  (recenter))

(global-set-key (kbd "C-c l") #'center-last-line)
|improve this answer|||||
  • Thanks! I'll look more into elisp functions. This worked function worked as well. – Aquova Mar 5 '18 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.