Ⅰ. 插件描述
manage vim sessions using dialogs and the command lineⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/session-dialog-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/session-dialog-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/session-dialog-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/session_dialog.vim
Ⅳ. 文档说明
session_dialog.vim provides a simple dialog and command-line based
interface to Vim's :mksession feature. There are commands to save sessions
and restore, delete, and list sessions from multiple locations. It works
well with the terminal as well as console dialogs in GVIM (set
guioptions+=c), and provides command-line completion of session names.
Usage:
:SessionSave [SESSION]
With no arguments, displays the save dialog. Otherwise, saves a new
session with the given name in SessionSaveDirectory. The session file on
disk will have the SessionFilePrefix and SessionFileSuffix attached (see
"Options" below). Spaces are allowed in the sesison name.
e.g. :SessionSave foo bar creates the session "foo bar"
:SessionRestore [GLOB_PATTERN]
With no arguments, displays the restore dialog. Otherwise searches for a
session to load in SessionPath. If more than one session was found (if
sessions with the same name were found in different paths or if the
given pattern matched multiple sessions), you will be prompted to choose
one.
e.g. :SessionRestore foo*
:SessionDelete [SESSION|GLOB_PATTERN]...
Displays the delete session dialog if no arguments were given, otherwise
deletes all the sessions that match the arguments. Spaces need to be
escaped since they would otherwise separate the arguments.
e.g. :SessionDelete foo will delete the session named "foo". If more
than one session is named "foo", you will be prompted to select one. You
can also use a pattern (e.g. :SessionDelete foo*). This will delete all
sessions beginning with "foo".
:SessionList [GLOB_PATTERN]...
Prints a list of all the sessions and their locations in SessionPath if
no arguments were given. Otherwise prints a list of sessions that match
the arguments.
e.g. :SessionList foo bar baz will show all the sessions named foo,
starting with bar, or ending with baz.
ZS ZR ZD ZL
The default normal mode mappings for :SessionSave, :SessionRestore,
:SessionDelete, and :SessionList, respectively. These can be disabled
with the option SessionCreateDefaultMaps. Note that these will time out,
unlike native commands such as ZZ. (see :help 'timeoutlen')
You can also map the commands yourself using:
<Plug>SessionSave
<Plug>SessionRestore
<Plug>SessionDelete
<Plug>SessionList
Options:
g:SessionSaveDirectory
Default is "$HOME"
Where to save new sessions. This can be set in your vimrc or while Vim
is running. For example, to get the default behavior of :mksession,
let SessionSaveDirectory = "."
g:SessionPath
Default is set to the initial value of SessionSaveDirectory
A comma-separated list of paths in which to look for session files to
restore or delete.
e.g. let SessionPath = ".,~,~/.vim/sessions"
g:SessionFilePrefix
Default is ".vimsession_" (on Windows, "_vimsession_")
g:SessionFileSuffix
Default is "" (on Windows, ".vim")
Strings to prepend and append to session names when saving to
SessionSaveDirectory. All files found in SessionPath with these
attributes will be identified as sessions, so the combination of the two
should uniquely identify session files (unless all files found in
SessionPath will be Vim sessions).
g:SessionDefault
Unset by default
The default session name to save to or restore from. This is overridden
by v:this_session. If both are unset, the Vim server name (v:servername)
will be used as the default.
g:SessionConfirmOverwrite
0 or 1 (default)
Set this to 0 to save over an existing session file without asking for
confirmation.
g:SessionQuitAfterSave
1 or 0 (default)
Whether to exit Vim after saving a new session.
g:SessionCreateDefaultMaps
0 or 1 (default)
Whether to create the default normal mode mappings (ZS, ZR, ZD, and ZL).