반응형
Emacs에 공백을 표시하려면 어떻게해야합니까?
Emacs에 공백 (공백, 탭, 줄넘기 등)을 표시하려면 어떻게해야합니까? Kate 및 Eclipse와 같은 다른 많은 편집기에는이 기능이 있으며 공백과 탭 (특히 Python)의 혼합으로 인해 코드가 들여 쓰기가 끊어진 경우를 확인하는 것이 매우 유용합니다.
WhiteSpace 모드는 현재 버퍼의 모든 공백 문자를 시각화하기위한 Emacs 부 모드입니다.
다음은 Emacs 위키에서 직접 가져온 WhiteSpace의 스크린 샷입니다.
참고 : WhiteSpaceMode는 이제 BlankMode를 대체했습니다.
가능한 모든 설정 은 여기 (빈 모드) 와 여기 와 여기 (ShowWhiteSpace)에 요약되어 있습니다.
또한:
(if (>= emacs-major-version 22)
(progn
;; Mode to use with Emacs 22
;; http://emacswiki.org/cgi-bin/wiki/BlankMode
(require 'blank-mode)
;; Mode not active by default: let's activate it
(global-blank-mode t)
;; ... activate it when text mode where color syntax is not active by default
(add-hook 'text-mode-hook 'blank-mode-on)
;; All invisible chars are shown, except newline char.
(setq blank-chars '(tabs spaces trailing lines space-before-tab))
;; Show only for one color, no mark inserted
(setq blank-style '(color))
;; Use for normal space (not shown)
(set-face-background 'blank-space-face nil)
(set-face-foreground 'blank-space-face "black")
;; used for non breakable space
(set-face-background 'blank-hspace-face "PaleGreen")
(set-face-foreground 'blank-hspace-face "black")
;; Used for spaces left of a tab
(set-face-background 'blank-space-before-tab-face "orange")
(set-face-foreground 'blank-space-before-tab-face "black")
;; Used for tab
(set-face-background 'blank-tab-face "lemonchiffon")
(set-face-foreground 'blank-tab-face "black")
;; used for extra space at the end of a line
(set-face-background 'blank-trailing-face "gold")
(set-face-foreground 'blank-trailing-face "black")
;; Used for line too long
(set-face-background 'blank-line-face "snow2")
(set-face-foreground 'blank-line-face "black")
)
(progn
;; For older Emacs prior to version 22.
;; http://www.emacswiki.org/cgi-bin/wiki/show-wspace.el
(require 'show-wspace)
(add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs)
(add-hook 'font-lock-mode-hook 'show-ws-highlight-hard-spaces)
(add-hook 'font-lock-mode-hook 'show-ws-highlight-trailing-whitespace)
)
)
들여 쓰기가 끊어 졌습니까? -코드에 탭을 사용하지 마십시오. 요즘에는 디스크 공간이 저렴합니다.
(setq-default indent-tabs-mode nil)
.emacs 파일을 넣으십시오 . C-x h M-x untabify
전체 버퍼를 untabify 하기 위해 입력 하는 데 익숙해집니다 . 탭을 검색하려면을 입력하십시오 C-s C-i
. 버퍼에 모호한 제어 문자가있는 경우 M-x hexl-mode
.
또한 C-x h M-x indent-region
전체 버퍼를 들여 씁니다. vhdl-mode와 같은 일부 모드에는 beautify region 명령이 있습니다.
참고 URL : https://stackoverflow.com/questions/293761/how-do-i-make-emacs-show-blank-spaces
반응형
'Program Tip' 카테고리의 다른 글
Subversion에서 삭제 된 분기를 복원해야합니다. (0) | 2020.11.16 |
---|---|
PHPUnit으로 개인 메서드 모의 (0) | 2020.11.16 |
Path.GetTempPath ()의 반환 값을 결정하는 것은 무엇입니까? (0) | 2020.11.15 |
g ++에서 프로필 기반 최적화를 사용하는 방법은 무엇입니까? (0) | 2020.11.15 |
Objective-C의 정방향 선언 열거 (0) | 2020.11.15 |