bash script to change the vim colorscheme from the list of locally available schemes

Image via Wikipedia

Today I was just wondering how good it would be to have a script to change the <a class="zem_slink freebase/en/vim" title="Vim (text editor)" rel="homepage" href="">vim colorscheme from the <a class="zem_slink freebase/en/cmd_exe" title="Command Prompt" rel="wikipedia" href="">command prompt. The plan for the script was simply to print the list of available schemes and then let the user select the actions from there on. So, here is the result:

#!/bin/bash –

#          FILE:

#         USAGE:  ./

#   DESCRIPTION: Change the vim colorscheme from command prompt

#       OPTIONS:  —
#          BUGS:  —
#         NOTES:  —
#        AUTHOR:  <a class="zem_slink" title="Amit Agarwal" rel="me" href="">Amit Agarwal (AKA),
#       COMPANY:  Individual
#       VERSION:  1.0
#       CREATED:  02/02/2010 10:30:07 PM IST
#      REVISION:  —

cd ~/.vim/colors
for i in *.vim
echo &#8221;${i%.vim}&#8221;

read -p &#8221;Enter one of the colorschemes :: &#8221; choice
if [ ! -f $file ]
echo &#8221;Colorscheme file &#8221;$file&#8221; does not exist&#8221;
exit -1

sed &#8217;s#\(^ *colorscheme\).*#\1 &#8217;$choice&#8217;#&#8217; ~/.vimrc > /tmp/vimrc
diff ~/.vimrc /tmp/vimrc
read -p &#8221;Do you want to make the changes (y/n) :: &#8221; yn
if [ $yn = &#8221;y&#8221; ]
echo {/tmp/,~/.}vimrc
cp {/tmp/,~/.}vimrc
echo &#8221;Modified changes are available in /tmp/vimrc&#8221;
fi<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="">gnome-disk-manager – the easier way to manage disks in Gnome with Palimpsest ( <li class="zemanta-article-ul-li"><a href="">Vim Plugins: snipMate ( <li class="zemanta-article-ul-li"><a href="">CLI Color and bash prompt.. some colored fun with prompts in bash ( <li class="zemanta-article-ul-li"><a href="">How to Hide Confidential Data In Text Files ( <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href=""><img class="zemanta-pixie-img" src="" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">


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