2009/8/2 jochen:
>
> I'm looking for a way to automatically execute an rsync command when
> hitting (CMD+S / Save).
>
> I've been looking at menukeyequiv File.Save but to be honest I have no
> idea where to begin.
> If anyone has a clue, please let me know.

Hi Jochen,

I'm not the best person to answer this type of question...but I'll
give it a go anyway.  You'll probably get more answers if you try the
vim-use mailing list.

Anyway, add something like the following lines to your ~/.gvimrc:

--- 8< 8< ----------

an File.Save :cal DoSave()<CR>

function! DoSave()
    if expand("%")
        browse confirm w
    else
        " replace next line with your rsync command!
        !ls

        confirm w
    endif
endfunction

--- >8 >8 -------

Just replace the !ls with your own rsync command (starting with an
exclamation mark, i.e. !rsync ...).  All the scaffolding in th
DoSave() function I simply copied from the current File.Save menu --
it checks if a filename is given to decide whether or not to pop up a
file browser window.  In case a file name was given your custom
command will be executed (or the "ls" in the example above).

The "an" command in the beginning simply binds the menu item to call
this function.

Björn

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_mac" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to