多次按tab键不会将文本向右移动。有没有办法让它的行为像Visual Studio的智能缩进?第一个制表位缩进,随后的制表符将文本移动到下一个制表位。谢谢你。
发布于 2011-08-19 23:06:29
像这样的东西?
(defun even-more-tabby-indent (&optional arg)
"This indent function tries to be more like Microsoft's IDEs
than `C-INDENT-COMMAND' and does the following: If we're at the
beginning of the line or `C-TAB-ALWAYS-INDENT' is true or `ARG'
is non-nil, indent like a sensible text editor. Otherwise the
user probably WANTS MOAR TABS. So call `C-INSERT-TAB-FUNCTION'."
(interactive "P")
(if (or c-tab-always-indent (bolp) arg)
(c-indent-command arg)
(funcall c-insert-tab-function)))然后,您需要使用类似以下内容绑定制表符插入
(defun setup-tabby-indent ()
(local-set-key (kbd "<tab>") 'even-more-tabby-indent)
(setq c-tab-always-indent nil))
(add-hook 'c-mode-hook 'setup-tabby-indent)我已经很多年没有使用MS Visual Studio了,所以我不确定这是否是你想要的,但希望它是非常清楚如何修改的。
发布于 2011-08-19 23:08:37
M-i (制表符对制表位)带您到下一个制表位。
https://stackoverflow.com/questions/7120296
复制相似问题