我試圖讓所有打開的緩衝區和yasnippet中的選項卡都與tab鍵一起工作。此刻我可以擁有一個或另一個。下面的代碼是我如何處理yasnippet展開,但因爲我不是一個lisp程序員,所以我在這裏看不到這個錯誤。emacs智能選項卡與yasnippets
如果它無法展開片段,我希望它嘗試從緩衝區中展開。
;; Auto complete settings/tab settings
;; http://emacsblog.org/2007/03/12/tab-completion-everywhere/ <-- in the comments
(global-set-key [(tab)] 'smart-tab)
(defun smart-tab()
"This smart tab is minibuffer compliant: it acts as usual in
the minibuffer. Else, if mark is active, indents region. Else if
point is at the end of a symbol, expands it. Else indents the
current line."
(interactive)
(if (minibufferp)
(unless (minibuffer-complete)
(dabbrev-expand nil))
(if mark-active
(indent-region (region-beginning)
(region-end))
(if (looking-at "\\_>")
(unless (yas/expand)
(dabbrev-expand nil))
(indent-for-tab-command)))))
目前,它並沒有使用dabbrev-擴大請擴大 – map7
謝謝。事情現在很清楚。我會更新這篇文章。 – alinsoar
我更新了帖子 – alinsoar