首页 > 解决方案 > Vim 的 mksession 不保存窗口最大化状态

问题描述

我使用VimObsession 插件,但是每次我:source打开会话文件时,窗口都不记得它被最大化了(当我关闭它时)。它确实记得其他一切。

我的会话选项是:

sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize,terminal,resize,winpos

我在 Windows 10 上使用gVim 8.1和以下插件:

  Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
  Plug 'vim-airline/vim-airline'
  Plug 'vim-airline/vim-airline-themes'
  Plug 'hzchirs/vim-material'
  Plug 'kristijanhusak/vim-hybrid-material'
  Plug 'https://github.com/tpope/vim-surround.git'
  Plug 'https://github.com/tpope/vim-obsession.git'
  Plug 'https://github.com/tpope/vim-unimpaired.git'
  Plug 'https://github.com/tpope/vim-repeat.git'
  Plug 'https://github.com/terryma/vim-multiple-cursors.git'
  Plug 'airblade/vim-gitgutter'
  Plug 'https://github.com/ctrlpvim/ctrlp.vim.git'
  Plug 'scrooloose/nerdcommenter'
  Plug 'https://github.com/octol/vim-cpp-enhanced-highlight.git'
  Plug 'luochen1990/rainbow'
  Plug 'https://github.com/tomtom/tlib_vim.git'
  Plug 'https://github.com/MarcWeber/vim-addon-mw-utils.git'
  Plug 'https://github.com/garbas/vim-snipmate.git'
  Plug 'https://github.com/honza/vim-snippets.git'

我尝试从我的 _vimrc 文件中删除set linesandau GUIEnter * winpos只是为了尝试一些东西,但问题仍然存在。

有任何想法吗?谢谢!

标签: windowsvim

解决方案


SessionLoadPost加载会话后,您可以使用autocmd 执行其他工作。

augroup more_lines
    autocmd!
    autocmd SessionLoadPost * set lines=999
augroup END

如需更多帮助,请参阅:

:h 'lines'
:h SessionLoadPost

推荐阅读