Picon
Favicon

RE: diff mode mappings

why not just use the ftplugin directory?  create a directory inside one of
your 'runtimepath' directories called 'ftplugin' and place files called
html.vim, fortran.vim and vim.vim in there that contain the commands you
have for each filetype.

check out :help ftplugin for guidelines on writing them.

salman.

-----Original Message-----
From: G.Embery [mailto:G.Embery <at> BoM.gov.au]
Sent: Wednesday, February 06, 2002 7:23 PM
To: vim <at> vim.org
Subject: Re: diff mode mappings

On Tue, Feb 05, 2002 at 08:41:29AM +0100, Benoit Cerrina wrote:
> Hi,
> I'd like to use special mappings only in diff mode, I seem to recall that
> there was some
> provision for executing a script when entering and exiting the diff mode
but
> can't find it
> anymore, any help ?
> Benoit
> 

Hi Benoit,

In my .vimrc i use autocmd's depending on filetype, like this :-

    autocmd Filetype html                   :source ~/.htmlvimrc
    autocmd Filetype fortran                :source ~/.f90vimrc
    autocmd Filetype vim                    :source ~/.vimvimrc

This means that when vim starts up and detects a filetype of
`html' it will then source the file `.htmlvimrc' which contains
settings, mappings and the like relevant for html.  Similarly for
fortran, vim scripts etc.  You should be able to do the same for
diff, namely :-

    autocmd Filetype diff                   :source ~/.diffvimrc

A different approach which i use in my .gvimrc :-

    set guifont=9x15
   " in diff mode, drop fontsize and double number of columns available
    if version >= 600
        if &diff
            set guifont='-misc-fixed-medium-*-*-*-*-*-*-*-*-70-*-*'
            execute 'set columns=' . 2 * &columns
        endif
    endif

which gives me a better sized window when i start up via gvimdiff.
Notice the  "if &diff"  test

Gerry.

--

-- 
Gerald K. Embery ;                          e-mail: G.Embery <at> BoM.gov.au
Bureau of Meteorology Research Centre,  
Melbourne, Australia ;       http://www.bom.gov.au/  bmrc/medr/gke.html


Gmane