vim search multiple files

2010-03-25 1 min read Linux Vim Tips

Searching some pattern in multiple files is something that is required very often. There are multiple ways to do it, like <a class="zem_slink freebase/en/grep" title="Grep" rel="wikipedia" href="http://en.wikipedia.org/wiki/Grep">grep, <a class="zem_slink freebase/guid/9202a8c04000641f8000000006b66ec6" title="Ack (command-line utility)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Ack_%28command-line_utility%29">ack, find and so on so forth. But if your editor already has the capability to do that, then why leave your favourite vi and go to shell. I will point you to some scripts and some wiki pages on how to do this πŸ™‚

Continue reading

eclim for Fedora – Leonidas – installation.

2010-03-08 1 min read Linux Vim Tips

Here is the installation instruction for Eclim for vim. I have not tried it as I did not require it, but if you need it.

http://downloads.sourceforge.net/project/eclim/eclim/1.4.8/eclim_1.4.8.tar.gz?use_mirror=biznetnetworks

sudo ant -Declipse.home=/usr/lib/eclipse -Dvim.files=/home/amitag/.vim -Dplugins=cdt

create ctgs using

ctags -R /usr/include/<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://spf13.com/post/vim-crash-course">VIM Crash Course (spf13.com) <li class="zemanta-article-ul-li"><a href="http://go.theregister.com/feed/www.theregister.co.uk/2010/01/26/sourceforge_ip_address_filtering/">SourceForge bars 5 nations from open source downloads (go.theregister.com) <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2010/01/22/my-project-in-sourceforgenet-gnomedesktopwal/">My project in sourceforge.net gnomedesktopwal (amit-agarwal.co.in) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/0fb78d60-4b1a-4563-8ffa-f572041a3a64/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b13.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

Continue reading

Built-in lists in vim

2010-02-03 1 min read Learning Linux Vim Tips

<a class="zem_slink freebase/en/vimscript" title="Vimscript" rel="wikipedia" href="http://en.wikipedia.org/wiki/Vimscript">Vimscript provides excellent support for operating on collections of <a class="zem_slink freebase/en/data" title="Data" rel="wikipedia" href="http://en.wikipedia.org/wiki/Data">data, a cornerstone of programming. In this third article in the series, learn how to use Vimscript&#8217;s built-in lists to ease everyday operations such as reformatting lists, filtering sequences of filenames, and sorting sets of line numbers. You&#8217;ll also walk through examples that demonstrate the power of lists to extend and enhance two common uses of <a class="zem_slink freebase/en/vim" title="Vim (text editor)" rel="homepage" href="http://www.vim.org/">Vim: creating a <a class="zem_slink freebase/en/user_defined_function" title="User-defined function" rel="wikipedia" href="http://en.wikipedia.org/wiki/User-defined_function">user-defined function to align assignment operators, and improving the built-in text completions mechanism.

Continue reading

using cscope with vim

2010-01-08 0 min read Linux Vim Tips
\"Google
Image by schoschie via Flickr

Here&#8217;s the best of the two links that I found with <a class="zem_slink freebase/en/google" title="Google" rel="homepage" href="http://google.com">Google and <a class="zem_slink" title="Bing" rel="homepage" href="http://bing.com/">Bing combined out of lots of links that I think can help you understand how to use cscope with vim, if you dont know already.

<a href="http://cscope.sourceforge.net/cscope_vim_tutorial.html">http://cscope.sourceforge.net/cscope_vim_tutorial.html
<a href="http://www.faqs.org/docs/ldev/0130091154_242.htm">http://www.faqs.org/docs/ldev/0130091154_242.htm

Continue reading

Finding all numbers that are bigger than 1 in vim

2009-12-24 1 min read Fedora Linux Vim Tips

/^([2-9]d*|1d+)
If we have a csv like structure

The trick here is simple, lets look at the regex from the begining:

^ – start from the begining
() – start and end of block
[] – digits within this. So we are looking from 2 to 9 to exclude the numbers begining with 1
d – search for digits

  • – search for one or more
    | – or operation
    1 – search for numbers begining with 1
  • – containing atleast one occurence or more.<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://sparksspace.blogspot.com/2009/10/adding-leading-zeros-in-excel.html">Adding Leading Zeros in Excel (sparksspace.blogspot.com)
  • <li class="zemanta-article-ul-li"><a href="http://blog.creativethink.com/2009/11/the-best-thing-about-2010.html">The Best Thing About &#8221;2010&#8221; (creativethink.com) <li class="zemanta-article-ul-li"><a href="http://www.revenews.com/jackbusch/google-goggles-the-world-is-your-hyperlink/">Google Goggles: The World is Your Hyperlink (revenews.com)
<div class="zemanta-pixie"><a class="zemanta-pixie-a" href="http://reblog.zemanta.com/zemified/e022d83e-669e-4cad-894c-cdab54a1946c/" title="Reblog this post [with Zemanta]"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e34.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">

Know when you will type :q in your term instead of vi(m), the alias will chewed you out.

2009-12-20 1 min read Bash Vim Tips

most simple solution is to alias :q like so:
alias :q=`echo &#8221;This is not vim&#8221;`

but as someone suggested in commandlinefu, you can use tput to put some color and fun into this.
alias :q=&#8217;tput setaf 1; echo >&2 &#8221;this is NOT vi(m) :/&#8221;; tput sgr0&#8217;

Add current date and time in vim

2009-11-20 1 min read Linux Vim Tips

Last few days I was quite busy. So this time very quick tip πŸ™‚

Add the following to the ~/.vimrc file

imap dt :r! dateA

And now whenever you type dt in the insert mode in vi, date will be inserted.

Older posts Newer posts