Skip navigation.

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'
  silent exec 'write !savebox ' . fname . ' > ' . tmpname
  let newname = system('cat ' . tmpname)
  let tmp = system('rm ' . tmpname)
  if tmpname != ''
    exec 'file ' . escape(newname, ' ')
    set nomodified
command! Save call Save()
map <F3> :Save<CR>

You'll need the savebox command from http
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