vim - get mappings from the help tex files available with the scripts.

2010-05-27 2 min read Fedora Learning Linux Vim Tips

Here is a simple script that will show all the vim mappings from the tex file (help file that comes with the vim scripts).

This will prove to be very useful in usin gthe mappings 🙂

#!/bin/bash –
#===============================================================================

#          FILE:  get_mappings_from_tex_for_vim.sh

#         USAGE:  ./get_mappings_from_tex_for_vim.sh

#   DESCRIPTION:  Get the mappings from tex file

#       OPTIONS:  —
#  REQUIREMENTS:  —
#          BUGS:  —
#         NOTES:  —
#        AUTHOR:  <a class="zem_slink" title="Amit Agarwal" rel="self" href="http://blog.amit-agarwal.co.in">Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in
#       COMPANY:  Individual
#       VERSION:  1.0
#       CREATED:  09/06/2009 09:19:19 PM IST
#      REVISION:  —
#===============================================================================
file=$1
IFS=$(echo -e &#8217;\n&#8217;)
for i in $(cat $file |<a class="zem_slink freebase/en/grep" title="Grep" rel="wikipedia" href="http://en.wikipedia.org/wiki/Grep">grep &#8221;^..line&#8221;)
do
#echo $i |<a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk -F&#8221;&#8217;&#8221; '{print $2&#8221; &#8221; $3&#8221; &#8221;$4}&#8217;|awk -F&#8221;&&#8221; '{print $1&#8221; &#8221;$2}&#8217;
echo $i |awk -F&#8221;&#8217;&#8221; '{
if ( NF >= 4 )
{
print ($2&#8221;\t ->&#8221;$4&#8221;\t==»&#8221;$NF);
}
else
{
print($2&#8221;\t–>&#8221;$3);
}
fi
}&#8217;  |<a class="zem_slink freebase/en/sed" title="Sed" rel="wikipedia" href="http://en.wikipedia.org/wiki/Sed">sed &#8217;s/\h.*(/(/&#8217; |sed &#8217;s/>.*&/>/&#8217; |sed &#8217;s/\t*-.>$//&#8217; |sed &#8217;s/\//&#8217;

Continue reading