vim - what's a smarttab?

7

7stud

Is smarttab one of these:

1) Expands tabs into the number of spaces set with tabstop at the
start of a line, and uses a tabstop sized tab elsewhere.

2) Expands tabs into the number of spaces set with shiftwidth at the
start of a line, and expands tabs into the number spaces set with
tabstop elsewhere.

3) Doesn't do any expanding: uses shiftwidth sized tabs at beginning
of line, and tabstop sized tabs elsewhere.

Alternatively, what is a smarttab?

Thanks.
 
M

Marco

Hi "7stud",
Alternatively, what is a smarttab?

in VIM type :help smarttab and you'll see the following:

'smarttab' 'sta' boolean (default off)
global
{not in Vi}
When on, a <Tab> in front of a line inserts blanks according to
'shiftwidth'. 'tabstop' or 'softtabstop' is used in other places. A
<BS> will delete a 'shiftwidth' worth of space at the start of the
line.
When off, a <Tab> always inserts blanks according to 'tabstop' or
'softtabstop'. 'shiftwidth' is only used for shifting text left or
right |shift-left-right|.
What gets inserted (a Tab or spaces) depends on the 'expandtab'
option. Also see |ins-expandtab|. When 'expandtab' is not set, the
number of spaces is minimized by using <Tab>s.
NOTE: This option is reset when 'compatible' is set.

If you'd like to use VIM for Python make sure you have the following
settings for the best result:
http://www.vex.net/~x/python_and_vim.html

Marco
 
B

Ben Finney

7stud said:
Alternatively, what is a smarttab?

(Marco has already shown that you can read the Vim help for this
topic, so I won't repeat that.)

There's no such thing as "a smarttab", and that's not what the option
means. It's the name of an option that enables or disables a certain
behaviour. You can think if it, rather, as "smart handling of the
<Tab> key".
 
7

7stud

in VIM type :help smarttab and you'll see the following:

Thanks! I spent an hour hunting around on google with no success. :(

Another question if you don't mind. I'm using vim 6.2, and I am
trying to setup vim to use different tab sizes based on different file
types. I've searched around, and as far as I can tell, this should
work:

filetype indent on

Somehow that is supposed to let vim decide what type of file is being
edited. But, it doesn't work for me. Is there a list of file types
vim can recognize? This is what my ~/.vimrc file looks like:

"python settings:
set tabstop=4 "4 space tab
set shiftwidth=4 "The amount to block indent when using <
and >
set smarttab "Uses shiftwidth instead of tabstop at
start of lines
set expandtab "Replaces a <TAB> with spaces--more
portable
set softtabstop=4 "Causes backspace to delete 4 spaces =
converted <TAB>

"general settings:
filetype indent on "new in vim 6.0+; file type specific
indenting
set nu "line numbers on (set nonu)
syntax on "turns on syntax highlighting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top