- Image via Wikipedia
Here\’s one script that you may find useful. A little variation or wrapper for this script can make your life colorful 🙂
You can write a wrapper to this to take one of the inputs randomly and then use it in alias to start vim.
#!/bin/bash –
#===============================================================================
#
#Â Â Â Â Â Â Â Â Â FILE:Â change_vim_colorscheme.sh
#
#Â Â Â Â Â Â Â Â USAGE:Â ./change_vim_colorscheme.sh
#
#Â Â DESCRIPTION: Change the vim colorscheme from command prompt
#
#Â Â Â Â Â Â OPTIONS:Â —
#Â REQUIREMENTS:Â —
#Â Â Â Â Â Â Â Â Â BUGS:Â —
#Â Â Â Â Â Â Â Â NOTES:Â —
#Â Â Â Â Â Â Â AUTHOR:Â Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in
#Â Â Â Â Â Â COMPANY:Â Individual
#Â Â Â Â Â Â VERSION:Â 1.0
#Â Â Â Â Â Â CREATED:Â 02/02/2010 10:30:07 PM IST
#Â Â Â Â Â REVISION:Â —
#===============================================================================#Change the directory to where we will find all colors and then print them 🙂
cd ~/.vim/colors
for i in *.vim
do
echo \”${i%.vim}\”
done
#Read the choice of the userread -p \”Enter one of the colorschemes :: \” choice
file=~/.vim/colors/$choice.vim
if [ ! -f $file ]
then
echo \”Colorscheme file \”$file\” does not exist\”
exit -1
fi#Do the susbstitution in new file in /tmp
sed \’s#\\(^ *colorscheme\\).*#\\1 \’$choice\’#\’ ~/.vimrc > /tmp/vimrc
diff ~/.vimrc /tmp/vimrc
read -p \”Do you want to make the changes (y/n) :: \” yn
if [ $yn = \”y\” ]
then
echo {/tmp/,~/.}vimrc
cp {/tmp/,~/.}vimrc
else
echo \”Modified changes are available in /tmp/vimrc\”
fi
Related articles by Zemanta
- vim understanding the various modes and using the yanking more efficiently. (amit-agarwal.co.in)
- Vim Plugins: snipMate (spf13.com)
- VIM Crash Course (spf13.com)
Please tell me it worked right? I dont want to sumit it again if i do not have to! Either the blog glitced out or i am an idiot, the second option doesnt surprise me lol. thanks for a great blog!
Actually the first one would not be a surprise to me… 🙂
This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.
Thanks for the nice words