2011-08-19 4 views
4

탭을 여러 번 눌러도 텍스트가 오른쪽으로 이동하지 않습니다. Visual Studio의 들여 쓰기와 같이 동작하도록 만드는 방법이 있습니까? 첫 번째 탭 들여 쓰기, 후속 탭은 텍스트를 다음 탭 중단 지점으로 이동합니다. 고맙습니다.이맥스 cc 모드 탭 동작

답변

5

이와 비슷한?

(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 비주얼 스튜디오를 사용하지 않은 것처럼 뭔가 탭 삽입을 바인딩 할 것이다, 그래서이 정확히 무엇인지 확실하지 않다 당신 다시 시도해 봤지만 잘하면 수정하는 방법이 분명합니다.

+0

Lazylabs가 말했듯이 어쩌면 내가 제안한 (funcall c-insert-tab-function) 대신 (탭 - 탭 - 멈춤)을 사용하고 싶을 수도 있습니다. –

1

M-i (탭에서 탭으로 이동)를 누르면 다음 탭 정지로 이동합니다.

관련 문제