Emacs
Movements
C-v= Move forward of a screenfulM-v= Move backwards of a screenfulC-l= Center the screen on the cursorC-f= Move 1 character forwardC-b= Move 1 character backwardM-f= Go to next wordM-b= Go to previous wordC-M-f= Go to next s-expression (usually this means parentheses, quotes, colon, periods etc.)C-M-b= Go to the previous s-expressionC-n= Go to next lineC-p= Go to previous lineC-a= Go to the beginning of current lineC-e= Go to the end of current lineM-a= Go to the beginning of phraseM-e= Go to the end of phraseM-<= Go back to the beginning of current fileM->= Move forward till the end of current fileM-g g= Go to a specific line number (to be inserted)C-x r j a= Go to the position saved in register “a”M-r= Alternatively jump between the top, the bottom and the middle of the current screenC-M-a= Go at the beginning of current or previous functionC-M-e= Go at the end of current or previous function
Basic commands
C-g= Cancel the currently active commandC-x u= Undo last commandC-x C-c= Exit from EmacsC-h= Open the help for a commandC-s= Find text forwardC-r= Find text backwardC-s C-w= Find forward the word where the cursor isC-r C-w= Find backward the word where the cursor isC-x r a= Save current position in a register “a”C-x z= Repeat last executed command. Pressingzrepeats it againC-h m= Show info about current buffer’s modeC-h b= Get all currently available key bindings grouped by modesC-x C-e= Execute the code where the cursor is at (it needs to be ELisp)
Windows/Buffers
C-x 1= Close all open windows but for the currentC-x o= Jump between windowsC-u M-x shell= Go to the buffer called shellC-x C-b= Show buffer list
Editing
C-d= Delete character after to the cursorM-<Delete>= Delete word before the cursorM-d= Delete word after the cursorC-k= Delete everything from the cursor till the end of lineM-k= Delete the phrase from the cursor onwardC-<Space>= Set a mark. The text between the mark and the cursor will be highlighted and can be then copied or cutC-x C-x= Switch position between the cursor and the previously set markC-y= Paste from the clipboardM-y= Paste last deleted text. This, unlike the above, permits to paste also previously deleted text up until 4 deletionsC-w= Cut text currently highlighted and copy it to the clipboardM-w= Paste highlighted text, without cutting itC-x h= Select the whole bufferM-x auto-fill-mode= Enable automatic text formattingC-u 20 C-x f= Set text margin to 20 rowsC-x f= Restore text margin to the default value (70 rows)M-q= Format the current paragraphC-x <Return> f= Select the encoding for the current bufferM-x re-builder= Open the re-builder that allows to search with a regexp and see where it matches while typingM-x tabify= Convert whitespaces in tabsM-x untabify= Convert tabs in whitespacesC-x 8= Open the Unicode insertion mode. The hexadecimal code is needed. Press <Tab> twice to see a full list. Alternatively, it’s possible to directly insert with a combination of keys, likeC-x 8 ' efor the éM-x flush-lines= Open the mode permitting to delete lines that matche a regexpC-t= Switch position between the character under and the one before the cursorM-t= Switch position between the word under and the one before the cursorC-x C-t= Switch position between the current and previous lineM-c= Capitalize the first character of next word or the one under the cursor (if it’s in the middle of a word)M-x replace-string= Open the replace string mode, to replace a string with anotherM-x replace-regexp= As above but allows the use of regexps
Files
C-x C-f= Open a fileC-x C-s= Save a fileC-x i= Insert the content of a file at the current position
Dired
M-x dired= Open dired, the Emacs file managerC-x C-q= Enable the edit mode in dired, whereas editing file names can be made permanent withC-x C-slike it was a normal text buffer
when in dired mode these keys are available:
Enter= Open file or directoryq= Close directoryC,R,D= Respectively, copy, rename and delete a file+= Make a new directorym= Mark a fileu= Remove a mark on a fileU= Remove all marks% m= Mark according to a regexp^= Go to the parent directory
Shell
M-x shell= Open a shellM-x term= Open a terminalM-x ansi-term= Open a ANSI terminalM-x eshell= Open the internal Emacs shell, in ELisp
Various
M-x compile= Compile (with make)M-x gdb= Launch gdbM-x grep= Launch grepM-x man= Open a man pageM-x calculator= Launch a small calculatorM-x calendar= Open a calendarM-x tetris= Play tetris (really!)M-x list-packages= List available packages. Choose the one you want to install withIand execute the installation withx