Ⅰ. 插件描述
Please Vim, stop with these swap file messages. Just switch to the correct window!Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'gioele/vim-autoswap'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'gioele/vim-autoswap'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'gioele/vim-autoswap'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/gioele/vim-autoswap
Ⅳ. 文档说明
vim-autoswap
Please Vim, stop with these swap file messages. Just switch to the correct window!
Why autoswap?
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.
Limitations
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.
Installation
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
Make sure that the title option is enabled and the titlestring
variable contains the filename and the string VIM (the defaulttitlestring will work just fine). To enable the title option
set it in your ~/.vimrc file:
$ 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
the vim-konsole plugin.
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 tmux addlet g:autoswap_detect_tmux = 1 to your .vimrc.
If you use Arch Linux you can install via the [vim-autoswap-git
package in the AUR](https://aur.archlinux.org/packages/vim-autoswap-git/).
The package will install this plugin and all the needed dependencies.
Authors
- Gioele Barabucci http://svario.it/gioele (made the plugin Linux-compatible, maintainer)
- Damian Conway http://damian.conway.org (original author)
- Greg Lutostanski (tmux support)
Development
Code
: http://svario.it/vim-autoswap (redirects to GitHub)
Report issues
: http://svario.it/vim-autoswap/issues
License
This is free software released into the public domain (CC0 license).
See the COPYING.CC0 file or http://creativecommons.org/publicdomain/zero/1.0/
for more details.