Vim์์ Auto Indent ์ฌ์ฉ
๊ฐ๋ vim์ ์ค์ ๋ด์ฉ์ ๋ถ์ฌ๋ฃ๊ธฐ ํ ๋ json์ indent๊ฐ ๋ฌด์๋๊ฑฐ๋ ์๋ง์ด ๋๋ ๊ฒฝ์ฐ๊ฐ ์๋ค.
์ด์ ๊น์ง๋ Virtual Mode๋ก ์์ญ์ ์ ํ ํ > ํน์ < ๋ก ์์์ ์ ๋ช๋ฒ ํด์ค์ผ ํ์๋๋ฐ,
์๋ ๋ช ๋ น์ด๋ก ๋ฐ๋ก ๊ฐ๋ฅํ๋ค.
gg
=G
- gg : go to beginning of the file
- G : go to end of the file
- = : indent
๋ง์ฝ ์ ์ฒดํ์ผ์ด ์๋๋ผ ํน์ ์์น์์๋ถํฐ indent๋ฅผ ๋จน์ด๊ณ ์ถ๋ค๋ฉด ๊ทธ ์์น์์ =G๋ฅผ ํ๋ฉด ๋๋ค.
์ค๊ฐ ๋ถ๋ถ๋ง indent๋ผ๋ฉด =ํ ๋ผ์ธ์ ์ ๋ ฅํ๋ฉด ๋๋ค.
์คํ์ค๋ฒํ๋ก์์ ๊ฐ์ ธ์จ ๋ด์ฉ์ด๋ค.
https://unix.stackexchange.com/questions/19945/auto-indent-format-code-for-vim
Auto indent / format code for Vim?
I'm trying to use Vim more and more when I can. One of my biggest grip between Vim and an IDE like Aptana is the ability to auto indent. Is there a means of auto formatting code (HTML, CSS, PHP) s...
unix.stackexchange.com