emacs shortcuts

[Reprinted from emacs china ]

Editor movement of the cursor is the most common operation must be known.

  • C-f To forward a character,  f represents the forward.
  • C-b After the shift to a character,  b represents the backward.
  • C-p Move to the previous line,  p represents the previous.
  • C-n It is on to the next line,  n represents the next.
  • C-a To move to the first row,  a on behalf ahead.
  • C-e Move to end of line,  e it represents the end.

Common file operations shortcut key combination must be memorized.

  • C-x C-f Open the target file,  f on behalf of find / file
  • C-x C-s To save the current buffer (Buffer),  s on behalf of save

C-x Emacs is a shortcut of commonly used prefixes command. These prefixes command often represents a series of instructions associated, is very important, please keep in mind in particular. Other common there  C-cC-h . Interrupt key combination  C-g , it is used to cancel the instruction before the terminal. Shortcut is to use pre-bundled good way of telling Emacs to execute the specified command. (Later will be introduced to more about bindings)

Built-in functions

Emacs is powerful, but some features by default does not open. Here there are a few examples,

Display the line numbers may use the editor  M-x linum-mode to open.

Getting Help

Emacs is a rich document editor (Self document, extensible editor) and the following three methods are also very important in the learning process of Emacs. They are,

  • C-h k Need help shortcuts information
  • C-h v Looking for help with variables
  • C-h f Looking for help function

 

Before you begin configuring Let us first distinguish the difference in Emacs Major Mode and the Minor Mode. Major Mode is usually defined for editing a file type of core rules, such as syntax highlighting, indentation, shortcuts and other bindings. The Minor Mode is the core function other than the removal of the Major Mode provides additional editing functions (auxiliary functions). For example, in the following configuration file  tool-bar-mode and  linum-mode so are the Minor Mode *.

In simple terms it is that only one file type at the same time there is a Major Mode but it can simultaneously activate one or more Minor Mode. If you want to know the current mode information can be used  C-h m to display information about all Minor Mode of all currently open.

Here are some simple editor configuration information, you need to do is to write your configuration file (  ~/.emacs.d/init.el ) can be.

;; close the toolbar, Tool-bar- the MODE namely a Minor Mode
(tool-bar-mode -1)

;; slide control to close the file
(scroll-bar-mode -1)

Display line numbers ;;
( Global -linum mode 1 )

;; change the style of cursor (will not be effective, solutions to see the second episode)
(setq cursor-type 'bar)

;; turn off the startup screen help
(setq inhibit-splash-screen 1)

;; close indent (to be removed in the next day)
;; (electric-indent-mode -1)

Change the display font size 16pt ;;
;; http://stackoverflow.com/questions/294664/how-to-set-the-font-size-in-emacs
(set-face-attribute 'default nil :height 160)

;; quickly you open the configuration file
(defun open-init-file()
  (interactive)
  (find-file "~/.emacs.d/init.el"))

;; this line of code, the function Open -init File-bound to <f2> the key
(global-set-key (kbd "<f2>") 'open-init-file)

After each edit the configuration file, and not just make changes take effect immediately. Then you need to restart editor or reload the configuration file. Reload the configuration file you need to use in the current configuration file  M-x load-file , double-click Enter twice to confirm the default file name, or use  M-x eval-buffer to perform all the Lisp command of the current buffer. You can also use  C-x C-e to perform a line of Lisp code. These can just modify the configuration file to take effect. Of course, you also can use these functions to bind the key.

Guess you like

Origin www.cnblogs.com/huanmin/p/12571340.html