Re: configure vim to produce a default program format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/27/2010 06:41 PM, L wrote:
> Hi
>
> I come cross a remote server, when I type vim x.pl, it pops up a
> default format as below. It is nice. I look through my server,  can't
> figure out how to set up the vi parameters. Could some one show me
> how?
>
> I am on gnome desktop of F12.
>

There are a couple of ways to do this. The one I prefer is the one I first 
learned from Fedora's default /etc/vimrc file.

That file has a nice example of loading a spec file template when you create a 
new .spec file (ie: when you execute "vim does-not-exist.spec"). Look it up and 
adapt it to suit your needs.

FWIW, I've added this bit to include the name of the file in the new buffer:

" autocommands
if has("autocmd")
     ...
     ...
     " spec files
     autocmd BufNewFile *.spec
     \ 0r $HOME/.vim/template.spec | ks | call NewSpec() | 's
         fun NewSpec()
             exe "g/Name:/s/Name:/Name:\t\t" . expand("%:t:r")
         endfun
     ...
     ...
endif

The other (and possibly easier way) if you see yourself doing this very 
frequently is:

http://www.vim.org/scripts/script.php?script_id=1172

HTH,
cheers,
- steve

-- 
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux