Skip navigation.
Home

Drag-and-drop saving with Vim

You need something like this in your ~/.vimrc file:

function! Save()
  let tmpname = tempname()
  let fname = expand('%')
  if fname == ''
    let fname = 'TextFile'
  endif
  silent exec 'write !savebox ' . fname . ' > ' . tmpname
  let newname = system('cat ' . tmpname)
  let tmp = system('rm ' . tmpname)
  if tmpname != ''
    exec 'file ' . escape(newname, ' ')
    set nomodified
  endif
endfunction
 
command! Save call Save()
map <F3> :Save<CR>

You'll need the savebox command from httphttp://rox.sourceforge.net/snapshots/gui_utils.tgz.
Extract the archive and run './configure && make install' as root to install savebox.
Once you have the script saved to .vimrc or .gvimrc, you can then hit F3 to
get a savebox from which you may then drag and drop to a ROX-Filer window;
updating the text within this box will change the name under which it is saved.

Syndicate content