Vim Tips Wiki
Register
No edit summary
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  +
{{ScriptComments|Super Shell Indent: improved indentation for shell scripts}}
  +
  +
==Instructions==
 
Some instructions for this script state: "Place in ~/.vim/indent/ and let 'er rip!"
 
Some instructions for this script state: "Place in ~/.vim/indent/ and let 'er rip!"
   
This may be cryptic to some users. To elaborate a bit...
+
This may be cryptic to some users. To elaborate a bit:
   
 
The script specifically redefines "indentexpr" to be a new function "SuperShIndent()".
 
The script specifically redefines "indentexpr" to be a new function "SuperShIndent()".
   
After the script is in that directory, when you are running vim you can ":source ~/.vim/indent/sh.vim" to cause the redefinition. Thereafter, any time you use indentexpr, you will be using the new function.
+
After the script is in that directory, when you are running Vim you can ":source ~/.vim/indent/sh.vim" to cause the redefinition. Thereafter, any time you use indentexpr, you will be using the new function.
  +
 
To learn about indentexpr, run Vim and execute ":help indentexpr". --January 6, 2012
  +
  +
==Comments==
  +
  +
# Excellent utility - Thanks!
   
  +
* Minor issue: Using a visual select to reformat ... SuperShellIndent will indent the closing EOF of an "<<EOF" which throws off syntax highlighting for the rest of the shell script (and causes other side-effects). This is more of an annoyance once figure out why.
To learn about indentexpr, run vim and execute ":help indentexpr".
 

Revision as of 18:32, 7 March 2014

Use this page to discuss script 1215 Super Shell Indent: improved indentation for shell scripts

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

Instructions

Some instructions for this script state: "Place in ~/.vim/indent/ and let 'er rip!"

This may be cryptic to some users. To elaborate a bit:

The script specifically redefines "indentexpr" to be a new function "SuperShIndent()".

After the script is in that directory, when you are running Vim you can ":source ~/.vim/indent/sh.vim" to cause the redefinition. Thereafter, any time you use indentexpr, you will be using the new function.

To learn about indentexpr, run Vim and execute ":help indentexpr". --January 6, 2012

Comments

  1. Excellent utility - Thanks!
  • Minor issue: Using a visual select to reformat ... SuperShellIndent will indent the closing EOF of an "<<EOF" which throws off syntax highlighting for the rest of the shell script (and causes other side-effects). This is more of an annoyance once figure out why.