Emacs雜項

expand-region

 
  1. (add-to-list 'load-path "expand-region.el所在的目錄")  
  2. (require 'expand-region)  
  3. (global-set-key (kbd "C-=") 'er/expand-region)  

 

  1. 智能擴展標記:

    Expand region increases the selected region by semantic units. Just keep pressing the key until it selects what you want.html

    An example:python


    With the cursor at the , it starts by marking the entire word , then expand to the contents of the quotes , then to the entire quote ,
    then to the contents of the sexp  and finally to the entire sexp.(setq alphabet-start "abc def")cabcabc def"abc def"setq alphabet-start "abc def"

    mark-multiple

    (add-to-list 'load-path "mark-multiple.el所在目錄")  
    (require 'mark-more-like-this)  
    (global-set-key (kbd "C-<") 'mark-previous-like-this)  
    (global-set-key (kbd "C->") 'mark-next-like-this)  
    (global-set-key (kbd "C-M-m") 'mark-more-like-this) ; like the other two, but takes an argument (negative is previous)  
    (global-set-key (kbd "C-*") 'mark-all-like-this)  
    選中region後,按下C-> 會同時選擇下一個內容相同的region,對一個region的操做即對全部選中region的操做。
     
    PS:此mode中還有一個inline-string-rectangle mode,我的感受用處不是很大,由於Emacs自帶有cua-mode,已經比較好用了。

     

 

session

配合desktop能夠保存咱們上一次的工做狀態。也就是從新打開Emacs的時候,會變成上次關閉的狀態。固然也能夠 分項目保存不一樣的session ,這樣就和IDE保存工做區同樣了。git

undo-tree

Emacs的undo很是詭異,只有undo,沒有redo。若是要redo,那只有undo undo。github

不過這樣的設計,讓Emacs的撤銷變得異常強大。Emacs能夠幫你全部的修改記錄都保存下來,咱們能夠肆意地修改、undo完修改,各類修改,咱們均可以回到曾經的狀態。這個是其餘編輯器難以作到的。shell

undo-tree能夠將全部的狀態用樹狀結構繪製出來。而後咱們輕鬆地能夠找到咱們須要的狀態,甚至能夠diff不一樣的狀態。vim

咱們按 C-x u 能夠進入undo-tree-visualizer-mode, 而後 p 、 n 上下移動,在分支以前 b 、 f 左右切換, t 顯示時間戳, d 打開diff,選定須要的狀態後, q 退出。這是主要的操做,其它的本身摸索好了……session

 

 

一些有趣的快捷鍵

  • C-M-h 標記一個函數定義
  • C-h C-a about-emacs
  • C-h C 查看當前文件的編碼
  • C-u M-! date 插入當前時間
  • C-u M-= 計算整個緩衝區的行數、字數和單詞數
  • C-x <RET> f utf-8 (set-buffer-file-coding-system),設置當前buffer的文件的編碼
  • C-x C-+ and C-x C-- to increase or decrease the buffer text font size
  • C-x C-q 開關read-only-mode,在dired-mode中能夠進入修改模式,能夠批量修改文件名。
  • C-x C-t 交換兩行。能夠用來調整python中import
  • M-x sort-lines 排序選中行。
  • C-x C-v or M-x find-alternate-file 從新打開當前文件,在高亮後者插件出了bug能夠用這個命令從新加載。
  • C-x z 重複上一條命令。能夠一直按 z 不斷執行,很是方便!
  • M-& 異步運行一個shell命令
  • M-: 運行一句lisp
  • M-@ mark-word,連續按連續mark單詞。
  • M-g M-g linenum 跳到某行,同vim中的 [linenum]G
  • M-h 標記一段
  • M-x dig
  • M-x ifconfig
  • M-x ping
  • M-x telnet
  • M-z 刪除到某個字符,同Vim的 df
  • C-u M-! date 插入當前時間
  • C-q C-i 插入tab
  • M-x list-colors-display 顯示Emacs全部的顏色,方便咱們來進行配色
相關文章
相關標籤/搜索