[GH-ISSUE #3145] vim 打开文件关闭之后历史命令行消失 #2091

Open
opened 2026-02-27 00:06:01 +03:00 by kerem · 3 comments
Owner

Originally created by @fanjikang on GitHub (Dec 1, 2023).
Original GitHub issue: https://github.com/electerm/electerm/issues/3145

Electerm Version and download file extension(Electerm版本和下载文件后缀)

electerm-1.37.20-win-x64.tar.gz

Platform detail (平台详情)

win10中的wsl2,ubuntu22.04

What steps will reproduce the bug?(重新问题的详细步骤)

bug后
bug前

What should have happened?(期望的结果)

像图片中描述一样看不到历史命令行的内容了

Would this happen in other terminal app(是否能够在其他同类软件重现这个问题)

xshell等没有类似问题,用的同样的vimrc

Additional information(其他任何相关信息)

vimrc:
`if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=ucs-bom,utf-8,latin1
endif

set nocompatible " Use Vim defaults (much better!)
set bs=indent,eol,start " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time

" Only do this part when compiled with support for autocommands
if has("autocmd")
augroup redhat
autocmd!
" In text files, always limit the width of text to 78 characters
" autocmd BufRead .txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'"") > 0 && line ("'"") <= line("$") |
\ exe "normal! g'"" |
\ endif
" don't write swapfile on most commonly used directories for NFS mounts or USB sticks
autocmd BufNewFile,BufReadPre /media/
,/run/media/,/mnt/ set directory=~/tmp,/var/tmp,/tmp
" start with spec file template
autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
augroup END
endif

if has("cscope") && filereadable("/usr/bin/cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add $PWD/cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif

filetype plugin on

if &term=="xterm"
set t_Co=8
set t_Sb=m
set t_Sf=m
endif

" Don't wake up system with blinking cursor:
" http://www.linuxpowertop.org/known.php
let &guicursor = &guicursor . ",a:blinkon0"`

Originally created by @fanjikang on GitHub (Dec 1, 2023). Original GitHub issue: https://github.com/electerm/electerm/issues/3145 ### Electerm Version and download file extension(Electerm版本和下载文件后缀) electerm-1.37.20-win-x64.tar.gz ### Platform detail (平台详情) win10中的wsl2,ubuntu22.04 ### What steps will reproduce the bug?(重新问题的详细步骤) ![bug后](https://github.com/electerm/electerm/assets/146172937/7eed72d2-9a08-4ef1-ab21-cb5256da8908) ![bug前](https://github.com/electerm/electerm/assets/146172937/d8f2cc60-176b-447a-841d-26b680043046) ### What should have happened?(期望的结果) 像图片中描述一样看不到历史命令行的内容了 ### Would this happen in other terminal app(是否能够在其他同类软件重现这个问题) xshell等没有类似问题,用的同样的vimrc ### Additional information(其他任何相关信息) vimrc: `if v:lang =~ "utf8$" || v:lang =~ "UTF-8$" set fileencodings=ucs-bom,utf-8,latin1 endif set nocompatible " Use Vim defaults (much better!) set bs=indent,eol,start " allow backspacing over everything in insert mode "set ai " always set autoindenting on "set backup " keep a backup file set viminfo='20,\"50 " read/write a .viminfo file, don't store more " than 50 lines of registers set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time " Only do this part when compiled with support for autocommands if has("autocmd") augroup redhat autocmd! " In text files, always limit the width of text to 78 characters " autocmd BufRead *.txt set tw=78 " When editing a file, always jump to the last cursor position autocmd BufReadPost * \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal! g'\"" | \ endif " don't write swapfile on most commonly used directories for NFS mounts or USB sticks autocmd BufNewFile,BufReadPre /media/*,/run/media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp " start with spec file template autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec augroup END endif if has("cscope") && filereadable("/usr/bin/cscope") set csprg=/usr/bin/cscope set csto=0 set cst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add $PWD/cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb endif " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif filetype plugin on if &term=="xterm" set t_Co=8 set t_Sb=m set t_Sf=m endif " Don't wake up system with blinking cursor: " http://www.linuxpowertop.org/known.php let &guicursor = &guicursor . ",a:blinkon0"`
Author
Owner

@zxdong262 commented on GitHub (Dec 1, 2023):

我试了这个.vimrc没有复现,可以electerm恢复为默认设置试试吗?

<!-- gh-comment-id:1835673400 --> @zxdong262 commented on GitHub (Dec 1, 2023): 我试了这个.vimrc没有复现,可以electerm恢复为默认设置试试吗?
Author
Owner

@fanjikang commented on GitHub (Dec 5, 2023):

这个vimrc之前xshell wetrem等用也没发现问题,刚刚恢复默认设置了,还是这样
image

<!-- gh-comment-id:1840096720 --> @fanjikang commented on GitHub (Dec 5, 2023): 这个vimrc之前xshell wetrem等用也没发现问题,刚刚恢复默认设置了,还是这样 ![image](https://github.com/electerm/electerm/assets/146172937/690fdff0-a01b-4611-b45f-3a697ca66e90)
Author
Owner

@fanjikang commented on GitHub (Dec 5, 2023):

刚刚发现远程登录到另一台开发机没有这个问题,这是本地wsl2 会出现的问题,有什么可能得原因吗,xshell连接本地wsl2没有这个问题
image
image

<!-- gh-comment-id:1840102494 --> @fanjikang commented on GitHub (Dec 5, 2023): 刚刚发现远程登录到另一台开发机没有这个问题,这是本地wsl2 会出现的问题,有什么可能得原因吗,xshell连接本地wsl2没有这个问题 ![image](https://github.com/electerm/electerm/assets/146172937/224ecda0-399e-487c-9bad-6a58e8cbe2ca) ![image](https://github.com/electerm/electerm/assets/146172937/5d0952d6-c925-4eeb-b2de-e52ce9b33588)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/electerm#2091
No description provided.