按下Tab键多次不会将文本向右移动。是否有一种方法使其像Visual Studio的智能缩进一样行为?第一个Tab键缩进,后续的Tab键将文本移至下一个制表符位置。谢谢。
类似这样的吗?
(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了,所以我不确定这是否完全符合你的要求,但希望修改方法非常清楚。
M-i(tab-to-tab-stop)将带您到下一个制表位。