# Basic Emacs Shortcuts for Vim user

Recently I’m learning Standard ML, and by the way trying to use Emacs as editor. On advantage of using Emacs for SML, is convenient that we can directly use REPL(Read-Eval-Print-Loop) of SML without leaving the editor.

I’ve been a Vim user for many years. For a freshman in Emacs, like me, I found there is a big difference bewteen Emacs and Vim: no command mode. Every shortcut commands are using Ctrl and Alt. So you don’t need press ESC before every commands.

So at here, I made a memo of some basic Emacs shortcuts, as a survival guide for Vim user.

In the following, C stands for Ctrl，and M stands for Alt.

C-f/C-b: move forward/backward one character, equivalent to l and h in vim

C-p/C-n: move to previous/next line, equivalent to k and j in vim

M-f/M-b: move forward/backward a word, equivalent to w and b in vim

C-a/C-e: move to beginning/end of the line, equivalent to \$ and ^ in vim

M-a/M-e: move to beginning/end of the sentence, equivalent to ( and ) in vim

C-v/M-v: move to previous/next page, equivalent to Ctrl-f and Ctrl-b in vim

M-/: call auto-complete, equivalent to Ctrl-N or Ctrl-P in vim

C-x C-c: exit Emacs, equivalent to :q in vim

C-g: cancel current action

C-x C-f: open file

C-x C-s: save file

C-x C-w: save as

C-c C-s: open SML repl

C-Space: highlight some text, equivalent to v in vim

C-w: cut the highlighted text

M-w: copy highlighted text, equivalent to y in vim

C-k: cut text from current cursor to end of line

C-y: paste, equivalent to p in vim

C-x 2: split current file to two buffers, equivalent to :split in vim

C-x o: switch between two buffers, equivalent to Ctrl-W in vim

C-x 0: close splitted buffer, i.e. return to one buffer

C-x b: enter a name of buffer, and switch to in

C-x k: kill a buffer with buffer name

C-x C-b: show all buffers