GitHub - gioele/vim-autoswap: Please Vim, stop with these swap file messages. Ju...
source link: https://github.com/gioele/vim-autoswap
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Please Vim, stop with these swap file messages. Just switch to the correct window!
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:
- Is file already open in another Vim session in some other window?
- If so, swap to the window where we are editing that file.
- Otherwise, if swapfile is older than file itself, just get rid of it.
- Otherwise, open file read-only so we can have a look at it and may save it.
Damian Conway presented this plugin at OSCON 2013 in his talk "More instantly better Vim".
The original version of this plugin (only for MacOS) is available at http://is.gd/IBV2013, together with other plugins presented in the same talk. This version has been modified to work also on Linux systems. Both Vim and GVim are supported.
At the moment this plugin does not reliably detect files open within tabs in Apple Terminal and iTerm2 as it matches based on the window name, not tab name.
autoswap.vim file in your
Or use pathogen and just clone the git repository:
$ cd ~/.vim/bundle $ git clone https://github.com/gioele/vim-autoswap.git
Make sure that the
title option is enabled and the
variable contains the filename and the string
VIM (the default
titlestring will work just fine). To enable the
set it in your
$ echo 'set title titlestring=' >> ~/.vimrc
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.
KDE/Konsole users: in addition to
wmctrl you must install also
tmux users: if
tmux is detected, autoswap can change the current
pane to the one where vim is already open.
tmux support is disabled
by default. To enable support for
let g:autoswap_detect_tmux = 1 to your
If you use Arch Linux you can install via the
package in the AUR.
The package will install this plugin and all the needed dependencies.
- Gioele Barabucci http://svario.it/gioele (made the plugin Linux-compatible, maintainer)
- Damian Conway http://damian.conway.org (original author)
- Greg Lutostanski (tmux support)
Code : http://svario.it/vim-autoswap (redirects to GitHub)
Report issues : http://svario.it/vim-autoswap/issues
This is free software released into the public domain (CC0 license).
COPYING.CC0 file or http://creativecommons.org/publicdomain/zero/1.0/
for more details.
Aggregate valuable and interesting links.
Joyk means Joy of geeK