On 09/09/11 20:51, Tim Chase wrote:
On 09/09/11 13:45, John Goche wrote:
Hello,
I like the autoindent feature which works when I code in javascript.
However I don't want any tabs in there, I just want spaces.
I'd check your 'expandtab' setting:
:set et?
To get the behavior you want, it should be set to 'expandtab' instead of
'noexpandtab'.
:help 'et'
If you want it across the board, you can put the following line in your
vimrc:
set et
To control the number of spaces expanded, twiddle the 'shiftwidth' and
'tabstop' settings to your preferred number of spaces-per-tab.
-tim
Also, to set it in one specific JS file, you can use a |modeline|, near
the top or bottom of the file (usually among the first or last 5 lines):
for javascript (or C or C++) you could use something like
/* vim: set et sts=4 :*/
where 'sts' (or 'softtabstop') is the number of spaces to add each time
you hit <Tab> repeatedly in Insert mode
To set it in _all_ javascript files, then add a file named (on Windows,
and I'm writing it the way you would name it within Vim, as e.g. the
operand to :edit) $HOME/vimfiles/after/ftplugin/javascript.vim or (on
Unix) ~/.vim/after/ftplugin/javascript.vim (creating directories as you
go) with (for example) the following contents:
" after-plugin for JavaScript files
" use as many spaces as needed, no hard tabs, 4 columns at a time
setlocal expandtab softtabstop=4
see :help after-directory
Best regards,
Tony.
--
History, n.:
Papa Hegel he say that all we learn from history is that we
learn nothing from history. I know people who can't even learn from
what happened this morning. Hegel must have been taking the long
view.
-- Chad C. Mulligan, "The Hipcrime Vocab"
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php