Vim Tips Wiki


1,610pages on
this wiki
Revision as of 07:34, November 15, 2011 by JohnBot (Talk | contribs)

Use this page to discuss script 1839 IndentAnything: write indentations or enhance existing indentations without writing code

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on
  • This page may be out of date: check the script's page above, and its release notes.

Documentation error

Comments in /plugin/IndentAnything.vim read:

"   Included with this script is Javascript indentation, an example that
"   explains the configurable values.
" Installation:
"   Place this file in your home directory under ~/.vim/indent/, or replace
"   the system indent/javascript.vim file to affect all users.

Both wrong (I suppose you mean that HTML script?) and highly confusing (which file should I put there? The plugin?).


How do you use this, once it's installed? As an example, I also installed javascript.vim in the indent directory, but I have no idea how it's used.

I have neither used nor looked at this script. However, from the note above, it sounds like this plugin has 2 files. One, the IndentAnything.vim file, sounds like a global plugin that provides functions used by indent plugins which you create. This means you should place IndentAnything.vim in your ~/.vim/plugin directory.

The second, javascript.vim, is an example indent plugin. This means that you place javascript.vim in your ~/.vim/indent directory.

In general, indent plugins all work the same way. First, you need to turn on per-filetype indentation, usually in your .vimrc:

:filetype plugin indent on

Then, check the filetype of the buffer you wish to use the javascript indent rules on. If Vim has not automatically set it for you, you can set the filetype manually to javascript to use the indent rules. Vim will automatically apply the indent rules as you type, or you can manually re-indent lines using the = command.

Use :set filetype? to see the current filetype for your buffer, or :set filetype=javascript to set it as you need for this plugin.

--Fritzophrenic 18:48, July 2, 2010 (UTC)

Around Wikia's network

Random Wiki