2010-05-27 275 words 2 mins read

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;

done<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/04/12/mappings-tex-file-vim-plugins/">Get the mappings from tex file for vim plugins (amit-agarwal.co.in) <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/02/02/bash-script-to-change-the-vim-colorscheme-from-the-list-of-locally-available-schemes/">bash script to change the vim colorscheme from the list of locally available schemes (amit-agarwal.co.in) <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/04/11/bash-script-change-vim-colorscheme-based-themes/">bash script to change vim colorscheme based on the available themes (amit-agarwal.co.in) <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/03/04/mod-and-hack-the-gnome-main-menu-with-automated-scripts-to-create-a-menu-of-the-directory/">Mod and hack the GNome main menu with automated scripts to create a menu of the directory. (amit-agarwal.co.in) <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/05/05/find-program-access-file/">Find out why a program can&#8217;t seem to access to a file (amit-agarwal.co.in) <li class="zemanta-article-ul-li"><a href="http://almirkaric.com/2010/5/2/sed-vs-awk/">sed vs awk (almirkaric.com) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/5536f878-8091-4635-a648-833cb8ce5acf/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b71.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it