简体   繁体   中英

Use TAB for expand and C-i for indent-relative in emacs

how can i use TAB for dexpand and still have Ci for indent-relative?

Im trying: (global-set-key (kbd "TAB") 'dabbrev-expand) (global-set-key "\\Ci" 'indent-relative)

but it wont work, because both TAB and Ci are used for dabbrex-expand.

If you never use emacs in terminal then you can do the following

First separate Ci and tab by doing

(define-key key-translation-map [tab] [?\t])
(define-key key-translation-map [?\C-\i] [(control i-key)])
(define-key function-key-map [tab] nil)
(define-key function-key-map [?\t] nil)

Then you can bind commands to the keys as usual

(global-set-key (kbd "TAB") 'dabbrev-expand) 
(global-set-key (kbd "<C-i-key>") 'indent-relative)

Credits: I picked this up from this comment by Fuco .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM