tabstop: number of spaces that <Tab> in file uses
:set tabstop=4
또는 줄여서 :se ts=4

softtabstop: number of spaces that <Tab> uses while editing
:set softtabstop=4
또는 줄여서:se sts=4

shiftwidth: number of spaces to use for (auto)indent step
:set shiftwidth=4
또는 줄여서:se sw=4

vim 는 역시 

1. 기능을 보고
2. 사용을 하고
3. 사용을 또 해봐야
4. 익혀집니다.


[ 추가 TIP ]

ESC 키 대신 ctrl+[ 키 조합을 사용할 수 있습니다.
ESC 키까지 손가락을 뻗치는 것보다,
왼손 새끼손가락으로 control 키를 누르고 
오른손 약지로 [ 키를 누르는 게 손을 덜 움직입니다.

아래는 vi help 내용입니다.
'tabstop' 'ts'          number  (default 8)
                        local to buffer
        Number of spaces that a <Tab> in the file counts for.  Also see
        |:retab| command, and 'softtabstop' option.

        Note: Setting 'tabstop' to any other value than 8 can make your file
        appear wrong in many places (e.g., when printing it).

        There are four main ways to use tabs in Vim:
        1. Always keep 'tabstop' at 8, set 'softtabstop' and 'shiftwidth' to 4
           (or 3 or whatever you prefer) and use 'noexpandtab'.  Then Vim
           will use a mix of tabs and spaces, but typing <Tab> and <BS> will
           behave like a tab appears every 4 (or 3) characters.
        2. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use
           'expandtab'.  This way you will always insert spaces.  The
           formatting will never be messed up when 'tabstop' is changed.
        3. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use a
           |modeline| to set these values when editing the file again.  Only
           works when using Vim to edit the file.
        4. Always set 'tabstop' and 'shiftwidth' to the same value, and
           'noexpandtab'.  This should then work (for initial indents only)
           for any tabstop setting that people use.  It might be nice to have
           tabs after the first non-blank inserted as spaces if you do this
           though.  Otherwise aligned comments will be wrong when 'tabstop' is
           changed.

'softtabstop' 'sts'     number  (default 0)
                        local to buffer
                        {not in Vi}
        Number of spaces that a <Tab> counts for while performing editing
        operations, like inserting a <Tab> or using <BS>.  It "feels" like
        <Tab>s are being inserted, while in fact a mix of spaces and <Tab>s is
        used.  This is useful to keep the 'ts' setting at its standard value
        of 8, while being able to edit like it is set to 'sts'.  However,
        commands like "x" still work on the actual characters.
        When 'sts' is zero, this feature is off.
        'softtabstop' is set to 0 when the 'paste' option is set.
        See also |ins-expandtab|.  When 'expandtab' is not set, the number of
        spaces is minimized by using <Tab>s.
        The 'L' flag in 'cpoptions' changes how tabs are used when 'list' is
        set.
        NOTE: This option is set to 0 when 'compatible' is set.

'shiftwidth' 'sw'       number  (default 8)
                        local to buffer
        Number of spaces to use for each step of (auto)indent.  Used for
        |'cindent'|, |>>|, |<<|, etc.

:[range]ret[ab][!] [new_tabstop]
                        Replace all sequences of white-space containing a
                        <Tab> with new strings of white-space using the new
                        tabstop value given.  If you do not specify a new
                        tabstop size or it is zero, Vim uses the current value
                        of 'tabstop'.
                        The current value of 'tabstop' is always used to
                        compute the width of existing tabs.
                        With !, Vim also replaces strings of only normal
                        spaces with tabs where appropriate.
                        With 'expandtab' on, Vim replaces all tabs with the
                        appropriate number of spaces.
                        This command sets 'tabstop' to the new value given,
                        and if performed on the whole file, which is default,
                        should not make any visible change.
                        Careful: This command modifies any <Tab> characters
                        inside of strings in a C program.  Use "\t" to avoid
                        this (that's a good habit anyway).
                        ":retab!" may also change a sequence of spaces by
                        <Tab> characters, which can mess up a printf().
                        {not in Vi}
                        Not available when |+ex_extra| feature was disabled at
                        compile time.


'OS > linux / unix' 카테고리의 다른 글

unixtime 변환  (0) 2010.08.25
Draw It! - vim plugin  (0) 2010.08.12
fedora 12 - core dump file 생성 안되는 문제  (0) 2010.07.22
od 명령어 (octal dump)  (0) 2010.07.09
howtoforge.com  (0) 2010.06.22
Latest update: 2010. 7. 31. 08:07