[SATLUG] Vim Kung-Fu

Robert Pearson e2eiod at gmail.com
Sun Oct 17 14:21:40 CDT 2010


I ran Google "edit csv OR vcf with vim" as Alan suggests and got some
really interesting results.
* One interesting result is Christopher's "Vim Kung-Fu" post here:
<http://forum.nginx.org/read.php?26,141450>
Some very good answers using OO (OpenOffice) instead of Vim.
*** This is the most interesting hit---
<http://www.raffy.ch/projects/vim.html>
The entire page is an excellent reference for Vim. I put it on my Vim
reference bookmarks.
Search within the page for "CSV Files". Short paragraph but to the point.
CSV Files
Columnise a csv file for display only. This may crop wide columns:
:let width = 20
:let fill=' ' | while strlen(fill) < width | let fill=fill.fill | endwhile
Highlight a particular csv column (put in .vimrc)
function! CSVH(x)
    execute 'match Keyword /^\([^,]*,\)\{'.a:x.'}\zs[^,]*/'
    execute 'normal ^'.a:x.'f,'
endfunction
command! -nargs=1 Csv :call CSVH(<args>)
:Csv 5            highlight fifth column
Another method is the following to work with CVS files: mmfield.vim
navigating CSV files (I love it!). However, I changed the script a
bit:
function MMsetfield()
  let need_field = input('Jump to field? ')
  execute 'match Keyword /^\([^,]*,\)\{'.need_field.'}\zs[^,]*/'
  execute 'normal ^'.need_field.'f,'
endfunction

HTH

On Sun, Oct 17, 2010 at 12:37 PM, Alan Lesmerises
<alesmerises at satx.rr.com> wrote:
> I can't help you with the VIM stuff, but wouldn't you want to search for CSV
> (comma-separated values) rather that CVS?  Just a thought ...
>
> Al Lesmerises
>
>
> Christopher Lemire wrote:
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> My contacts list in google (used for most google web apps, google
>> voice, gmail, etc.) is very messy. I could edit it through google on
>> the web, but that is tedious. I exported the contacts list in all 3
>> available formats. None are very readable or understandable. I'd like
>> to edit with vim (mostly in command mode) one of these files, and then
>> import it back into Google. I googled "edit cvs OR vcf with vim" and I
>> came up with unrelated search results, mostly CVS as in Control
>> Version System. Any thoughts? How can this be done?
>>
>> - --
>> Christopher Lemire <christopher.lemire at gmail.com>
>> Ubuntu 64 bit Linux Raid Level 0
>>
>> gpg --recv-keys E13B0909
>>
>> Key fingerprint = 3E1A 9103 EF3D 4885 6866  E9DE C69F 18B3 E13B 0909
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.10 (GNU/Linux)
>> Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.8)
>>
>> iEYEARECAAYFAky6g1EACgkQxp8Ys+E7CQl24wCffwUAeF6ZMTQWYkdX4akT0hIi
>> 58UAn3ELuDsqjwGb/qZGR5566ffmCmPC
>> =7dBo
>> -----END PGP SIGNATURE-----
>>
>
> --
> _______________________________________________
> SATLUG mailing list
> SATLUG at satlug.org
> http://alamo.satlug.org/mailman/listinfo/satlug to manage/unsubscribe
> Powered by Rackspace (www.rackspace.com)
>


More information about the SATLUG mailing list