restart.vim


Ⅰ. 插件描述

Restart your gVim

Ⅱ. 基本信息

创建日期:  2009-12-31
使用用户:  110
Github星:  23
插件作者:  tyru

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'tyru/restart-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'tyru/restart-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'tyru/restart-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/tyru/restart.vim

Ⅳ. 文档说明

Usage:
  Commands:
      :Restart
          If modified buffer(s) exist, gVim won't restart.
          If you want to quit anyway, add bang(:Restart!).

  Global Variables:
      g:restart_command (default: 'Restart')
          command name to restart gVim.

      g:restart_save_window_values (default: 1)
          Save window values when restarting gVim.
          Saving values are as follows:
          - &line
          - &columns
          - gVim window position (getwinposx(), getwinposy())
          Before v0.0.1, restart.vim saves above values.
          So this variable is for compatibility.

      g:restart_save_fn (default: g:restart_save_fn is true: ['s:save_window_values'], false: [])
          This variable saves functions returning ex command.
          e.g., in your .vimrc:

              function! Hello()
                  return 'echomsg "hello"'
              endfunction
              let g:restart_save_fn = [function('Hello')]

          This meaningless example shows "hello" in new starting up gVim.
          When g:restart_save_window_values is true,
          this variable is ['s:save_window_values'].

              function! s:save_window_values()
                  return join([
                         printf('set lines=%d', &lines),
                         printf('set columns=%d', &columns),
                         printf('winpos %s %s', getwinposx(), getwinposy()),
                     ],
                     ' | '
                  )
              endfunction

         As you can see, this function saves current gVim's:
         - &line
         - &columns
         - getwinposx()
         - getwinposy()

      g:restart_vim_progname (default: "gvim")
         gVim program name to restart.

         FIXME:
         Under MS Windows, you must not assign .bat file path
         to this variable. Because cmd.exe appears and won't close.

      g:restart_sessionoptions (default: "")
         If this variable is not empty, make a session from this value.
         And restore the session after vim restarts.

TODO:
  - Support terminal vim
  - Support MacVim
      - MacVim support was implemented by ujihisa.
      But g:restart_sessionoptions is not recognized.

添加新评论