2012-03-28 12 views

回答

5

假设你正在谈论dabbrev-expandM-/是通常的结合),然后有各种各样的根据您的需求选择。

要搜索的缓冲区只有特定的白名单中,最简单的方法是设置变量dabbrev-search-these-buffers-only

"If non-nil, a list of buffers which dabbrev should search. 
If this variable is non-nil, dabbrev will only look in these buffers. 
It will not even look in the current buffer if it is not a member of 
this list." 

下面是我的一个自定义模式为例(我重新绑定M-/这个功能对于此模式)

(defun tks-dabbrev-expand (arg) 
    "Expand either aliases or descriptions, depending on context." 
    (interactive "*P") 
    (let* ((candidates 
      (if (looking-back "^\\S-+") 
       " *tks-aliases*" 
      " *tks-descriptions*")) 
     (dabbrev-search-these-buffers-only (list (get-buffer candidates)))) 
    (dabbrev-expand arg))) 

注意,有在其中您可以滤除dabbrev将内搜索缓冲区列表中的其他几个方面。该dabbrev自定义组有细节:
M-Xcustomize-groupRETdabbrevRET

相关问题