sponsor Vim development Vim logo Vim Book Ad

autoswap.vim : Switch to open editor window instead of asking what to do with swapfile

 script karma  Rating 33/14, Downloaded by 1315  Comments, bugs, improvements  Vim wiki

created by
Gioele Barabucci
script type
Dealing with swap files is annoying. Most of the time you have to deal with a swap file because you either have the same file open in another window or it is a swap file left there by a previous crash.

This plugin does for you what you would do in these cases:

1. Is file already open in another Vim session in some other window?
2. If so, swap to the window where we are editing that file.
3. Otherwise, if swapfile is older than file itself, just get rid of it.
4. Otherwise, open file read-only so we can have a look at it and may save it.

Homepage: http://svario.it/vim-autoswap
Report issues: http://svario.it/vim-autoswap/issues


Damian Conway presented this plugin at OSCON 2013 in his talk "More instantly better Vim" (http://programming.oreilly.com/2013/10/more-instantly-better-vim.html).

This version has been modified to work also on Linux systems. Both Vim and GVim are supported.

The original version of this plugin (only for Mac OX) is available at http://is.gd/IBV2013, together with other plugins presented in the same talk.

install details
Copy the `autoswap.vim` file in your `~/.vim/plugin` directory.

Or use Pathogen and just clone the git repository:

    $ cd ~/.vim/bundle
    $ git clone https://github.com/gioele/vim-autoswap.git

Linux users: you must install `wmctrl` to be able to automatically switch to the Vim window with the open file. `wmctrl` is already packaged for most distributions.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-autoswap-0.3.tar.gz 0.3 2014-04-25 7.0 Gioele Barabucci Fixed the display of delayed messages.
vim-autoswap-0.2.tar.gz 0.2 2014-04-14 7.0 Gioele Barabucci Removed debug logging
vim-autoswap-0.1.tar.gz 0.1 2014-04-14 7.0 Gioele Barabucci Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github