Ⅰ. 插件描述
a simple solution to managing sessions cleanly and quickly in vimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'isaacmorneau/vim-simple-sessions'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'isaacmorneau/vim-simple-sessions'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'isaacmorneau/vim-simple-sessions'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/isaacmorneau/vim-simple-sessions
Ⅳ. 文档说明
# vim-simple-sessions
a little plugin to allow easy session management
this was created because in large projects after a computer restart manually opening both files and using session directly is annoying.
configuration
the defaults are as follows:
g:ss_auto_enter 1
g:ss_auto_exit 0
g:ss_auto_alias 1
g:ss_dir = has(nvim) ? stdpath('data') . '/session/' : '~/.vim/session'
g:ss_file = substitute(getcwd(), '/', '_', 'g')
g:ss_open_with_args= 0- auto enter will load sessions for that directory automatically if they exist
- auto exit will save sessions for that directory automatically on :q or :qa if they exist
- auto alias will create the commands Srm, Sld, Smk, and Sss for removing, loading, making, and saving sessions respectively
- dir is the folder to store all the sessions in
- file is how to identify this folder as unique compared to other sessions
- open the session even if arguments are specified
ease of use
i have the following function in my bashrc to allow me to use fzf to fuzzy select existing sessions
# select a saved session and open it
function nvimp() {
vcmd="$(command -v nvim &>/dev/null && echo nvim || echo vim)"
if [ $vcmd == "nvim" ]; then
vfl="$HOME/.local/share/nvim/session"
else
vfl="$HOME/.vim/session"
fi
file="$(find $vfl -type f | fzf +m -1)"
if [ -n "$file" ]; then
vcd="$(grep -em 1 'cd ' "$file")"
if [ -n "$vcd" ]; then
${vcd//\~/$HOME}
fi
$vcmd
fi
}todo
- make a help page because some people like those