[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vim-dev
Subject:    Associating extensions to Vim (was RE: Win32 improvement: ...)
From:       "Dan Sharp" <dwsharp () hotmail ! com>
Date:       2003-01-14 15:42:32
[Download RAW message or body]

>From: Ben Peterson <ben.peterson@riskcare.com>
>
>If it's okay to add a windows-only feature, how about being able to type,
>say:
>
>:associate %:e
>
>and
>
>:noassociate %:e
>
>to associate/unassociated vim with the extension of the current file?

Warning!!!   Messes with registry!! Play with caution!

On NT-derivatives, at least:
--------------
function! s:Associate(ext, remove)
    if a:remove
        silent exec '!assoc ' . a:ext . '='
    else
        silent exec '!assoc ' . a:ext . '=OpenInVim'
        silent !ftype OpenInVim=path\to\gvim "$*"
    endif
endfunction

command! Associate call s:Associate('.' . expand("%:e"), 0)
command! DeAssociate call s:Associate('.' . expand("%:e"), 1)

command! -nargs=1 AssociateArg call s:Associate('.' . <args>, 0)
command! -nargs=1 DeAssociateArg call s:Associate('.' . <args>, 1)
--------------

should do something similar to what you describe.

Dan Sharp


_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic