User Tools

Site Tools


vim:vim_bash

Bash Addon for Vim

I found this nice little tool here
Official Site: Here

Installation

wget -O bash-support.zip http://www.vim.org/scripts/download_script.php?src_id=9890
mkdir ~/.vim # if the directory does not exist already
cd ~/.vim
unzip ~/downloads/bash-support.zip

Make sure to enable Plugins in your .vimrc!

64   filetype plugin on
65   filetype indent on

Headers

Everything here is taken from here
The bash-support plugins adds a File header to each .sh file you edit.
To change the settings you just have to edit the Template:

vi ~/.vim/bash-support/templates/Template

Add your individual credentials into your ~/.vimrc:

let g:BASH_AuthorName   = 'SathiyaMoorthy'
let g:BASH_Email        = 'subscribe@thegeekstuff.com'
let g:BASH_Company      = 'Open Source Corporation'

Now you have the following header each time you create a .sh File:

  1 #!/bin/bash
  2 #===============================================================================
  3 #
  4 #          FILE:  asdf.sh
  5 #
  6 #         USAGE:  ./asdf.sh
  7 #
  8 #   DESCRIPTION:
  9 #
 10 #       OPTIONS:  ---
 11 #  REQUIREMENTS:  ---
 12 #          BUGS:  ---
 13 #         NOTES:  ---
 14 #        AUTHOR:  SKull (), skull@darktemple.ch
 15 #       COMPANY:
 16 #       VERSION:  1.0
 17 #       CREATED:  06/11/2011 10:14:51 AM CEST
 18 #      REVISION:  ---
 19 #===============================================================================
 20
 21
 ...

Commands

Command Effect
\sfu Adds a bash function
\cfu Inserts function header
\cfr Adds a Text Frame
\sc case in … esac
\sl elif then
\sf for in do done
\sfo for (…) do done
\si if … then … fi
\sie if then else fi
\ss select in do done
\st until do done
\sw while do done
\sfu function
\se echo ­e “\n”
\sp printf “\n”

skull 2011/06/12 21:32
skull 2011/06/18 19:41Corrected the stuff about the headers

vim/vim_bash.txt · Last modified: 2011/06/18 19:41 by skull@darktemple.ch