Atom에서 들여 쓰기 모드를 변경하는 방법은 무엇입니까?
나는 이것을 아직 알아낼 수 없었다. Atom은 공백을 기본 들여 쓰기 모드로 사용하는 것 같습니다. 그래도 탭을 선호합니다. Sublime Text에는 들여 쓰기 전환 및 변환을위한 기능이 내장되어 있습니다.
Atom의 들여 쓰기 모드를 변경하는 방법을 아는 사람이 있습니까?
Sublime Text의 일부 스크린 샷 :
설정> 편집기 설정 에서 소프트 탭 및 탭 길이를 참조하십시오 .
들여 쓰기 모드를 빠르게 전환하려면 Ctrl-Shift-P를 사용 하고 편집기 : 소프트 탭 전환을 검색하십시오 .
파일-> 설정으로 이동
여기에는 3 가지 옵션이 있습니다.
- 소프트 탭
- 탭 길이
- 탭 타입
나는 몇 가지 테스트를 수행했으며 각각의 기능에 대한 결론을 내 렸습니다.
소프트 탭 -이 옵션을 활성화하면 기본적으로 공백이 사용됩니다 (예 : 새 파일).
탭 길이 -탭 문자가 표시되는 폭 또는 소프트 탭이 활성화 된 경우 탭에 삽입되는 공간 수입니다.
탭 유형 -기존 파일에 사용할 들여 쓰기 모드를 결정합니다. 자동으로 설정하면 기존 들여 쓰기 (탭 또는 공백)가 사용됩니다. 소프트 또는 하드로 설정하면 기존 들여 쓰기와 상관없이 공백이나 탭이 강제됩니다. 이것을 자동으로 두는 것이 가장 좋습니다.
참고 : 소프트 = 공백, 하드 = 탭
이것을 당신의 ~/.atom/config.cson
editor:
tabLength: 4
OS X :
Atom -> prefrences
또는로 이동CMD + ,
아래로 스크롤하여 원하는 "탭 길이" 를 선택하십시오 .
"Atom> Preferences> Editor"로 이동하여 탭 길이를 4로 설정할 수 있습니다.
This is for mac. For windows you will have to find the appropriate menu.
Adding @Manbroski answer here that worked for me:
try Ctrl-Shift-P
Editor: Toggle Soft Tabs
Late to the party, but a clean way to do this on a per-project basis, is to add a .editorconfig file to the root of the project. Saves you from having to change Atom's settings when you're working on several projects simultaneously.
This is a sample of a very basic setup I'm currently using. Works for Atom, ST, etc...
# Automatically add new line to end of all files on save.
[*]
insert_final_newline = true
# 2 space indentation for SASS/CSS
[*.{scss,sass,css}]
indent_style = space
indent_size = 2
# Set all JS to tab => space*2
[js/**.js]
indent_style = space
indent_size = 2
This is built into core: See Settings ⇒ Tab Type
and choose auto
:
When set to "auto", the editor auto-detects the tab type based on the contents of the buffer (it uses the first leading whitespace on a non-comment line), or uses the value of the Soft Tabs config setting if auto-detection fails.
You may also want to take a look at the Auto Detect Indentation package. From the docs:
Automatically detect indentation of opened files. It looks at each opened file and sets file specific tab settings (hard/soft tabs, tab length) based on the content of the file instead of always using the editor defaults.
You might have atom configured to use 4 spaces for tabs but open a rails project which defaults to 2 spaces. Without this package, you would have to change your tabstop settings globally or risk having inconsistent lead spacing in your files.
I just had the same problem, and none of the suggestions above worked. Finally I tried unchecking "Atomic soft tabs" in the Editor Settings menu, which worked.
If you're using Babel you may also want to make sure to update your "Language Babel" package. For me, even though I had the Tab Length set to 2 in my core editor settings, the Same setting in the Language Babel config was overriding it with 4.
Atom -> Preferences -> Packages -> (Search for Babel) -> Grammar -> Tab Length
Make sure the appropriate Grammar, There's "Babel ES6 Javascript Grammar", "language-babel-extension Grammar" as well as "Regular Expression". You probably want to update all of them to be consistent.
Tab Control gives nice control in a similar manner to that described in your question.
Also nice, for JavaScript developers, is ESLint Tab Length for using ESLint config.
Or if you're using an .editorconfig
for defining project-specific indentation rules, there is EditorConfig
If global tab/spaces indentation settings no longer fit your needs (I.E. you find yourself working with legacy codebases with varied indentation formats, and you need to quickly switch between them, and the auto-detect isn't working) you might try the tab-control plugin, which sort of duplicates the functionality of the menu in your screenshot.
When Atom auto-indent-detection got it hopelessly wrong and refused to let me type a literal Tab character, I eventually found the 'Force-Tab' extension - which gave me back control. I wanted to keep shift-tab for outdenting, so set ctrl-tab to insert a hard tab. In my keymap I added:
'atom-text-editor': 'ctrl-tab': 'force-tab:insert-actual-tab'
If you are using the version 1.21.1:
- Click on Packages / Settings View / Open
- Select "Editor" on the left side panel
- Scrool down until you see "Tab Length"
- 값을 편집하십시오. 4로 설정하고 싶습니다.
이제 활성 탭 창을 닫으면 완료됩니다.
여기에서 가장 인기있는 답변은 모두 훌륭한 답변이며 탭을위한 공간을 켤 것입니다.하지만 모두 한 가지가 빠져 있습니다. 기존 코드에 탭 대신 공백을 적용하는 방법
이렇게하려면 서식을 지정할 모든 코드를 선택한 다음 편집-> 줄-> 자동 들여 쓰기로 이동하면 선택한 모든 항목이 수정됩니다.
또는 서식을 지정할 모든 코드를 선택한 다음 Ctrl Shift P를 사용하여 자동 들여 쓰기를 검색하십시오. 검색 결과에서 클릭하면 선택한 모든 내용이 수정됩니다.
참고 URL : https://stackoverflow.com/questions/22608160/how-to-change-indentation-mode-in-atom
'Programming' 카테고리의 다른 글
IISExpress는 원격 컴퓨터에서 503 오류를 반환합니다 (0) | 2020.05.19 |
---|---|
컨테이너 요소 상단에 인라인 블록 DIV 정렬 (0) | 2020.05.19 |
발생하기 전에 취소 / kill window.setTimeout () (0) | 2020.05.19 |
git reset --hard origin / master의 의미는 무엇입니까? (0) | 2020.05.19 |
물체를 수화시키는 것은 무엇을 의미합니까? (0) | 2020.05.19 |