emacs & vi editor

emacs gnu

Opening up the editor, and exiting the editor

  • emacs -nw ;
  • Cntrl : x c ; # exiting the emacs program ;
  • Cntrl : z ; # temporarily suspending a session ;

Window, Frame, and Buffer

  • Cntrl : x_0 ; x_1 ; x_2 ; x_3 ; x_0 ; x_o ; x_ Cntrl_b ; c_b (fileName in Buffer) ;

Navigating inside a text file

  • Cntrl : a ; e ; v ; f ; b ; n ; p ; l ;
  • Meta : a ; e ; v ; f ; b ;
  • Meta : < & > ; # move the cursor to the very start, and to the very end of the file ;

Jump to a certain line

  • Meta : x glo<tab>numb<tab> ; # global-display-line-number-mode ;
  • Meta : g_g <lineNumber> ; # Jumps to lineNumber ;

Looking up how to use emacs, or HELP

  • Meta : x_help ; # help ;
  • Cntrl : h_? ; # ;
  • Cntrl : h_c <command> ; # ;
  • Cntrl : h_k <function> ; # more explanation than the previous, c ;
  • Cntrl : h_x <descriptive command> ; # long string commands ;
  • Cntrl : h_a <command Apropos> ; # show related commands ;
  • Cntrl : h_r ; # manual ;
  • Cntrl : h_i ; # Info, browse manual ;
  • Cntrl : h_t ; # tutorial ;

Deletion

  • Cntrl : _u #NUMBer Cntrl_???
  • Cntrl : d ; # deletes the character just after the cursor ;
  • Meta : d ; # deletes the word just after the cursor ;
  • _Delete : # deletes the character just before the cursor ;
  • Meta : _Delete ; # deletes the word just before the cursor ;

Undo

  • Cntrl : / ; Cntrl _ ; Cntrl x u ; # undo ;
  • Cntrl : g ; # cancel a command before executing

Kill and Yank, or cut and paste

  • Cntrl : k ; # kill/cuts to the end of line ;
  • Meta : k ; # kill/cuts to the end of sentence ;
  • Cntrl : _Space ; # select ;
  • Cntrl : y ; # copy/yank the buffer selected by Cntrl_Space ;
  • Meta : y ; # cycle through the buffers ;
  • Cntrl : w ; # kill/cut the buffer selected by Cntrl_Space ;
  • Cntrl : t ; # move the character on the left of the cursor to a place on the right ;
  • Meta : t ; # move the word on the left of the cursor to a place on the right side in word unit ;
  • Meta : c ; # capitalize the word ;
  • Cntrl : x Cntrl +/- ; # zoom in/out ;

Search, Find, and Replace

  • Cntrl : s ; # search forward ;
  • Cntrl : r ; # search reverse ;
  • Meta : x replace string

Dealing with a File

  • Cntrl : x s ; # saving files in the buffer by asking one by one ;
  • Cntrl : x Cntrl_s (fileName) ; # save the specific file ;
  • Cntrl : x f (fileName) ; # dealing with a file ;

Modes, on mode line

  • One major mode, and a combination of minor modes that are independently toggled on and off

Echo line/area

ESC : explode bubbles or recursive editing level

Cntrl x ; Meta x ;

Repeating a command

  • Cntrl : u <number/4> COMMAND ; # making number of the same command ;

vi

  • modes
  • wq
  • escape
  • :set numbers
  • ! ls -ali |nl
  • r! echo $SHELL