Restart your gVim
vim-scripts/restart.vim
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a mirror of http://www.vim.org/scripts/script.php?script_id=2910 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.