When using the vi editor, vi is stuck. What is the reason for vi to be stuck? Let me share with you the solution to vi stuck. Friends who encounter similar situations can take a look.

After opening another terminal to enter and exit strace, I found that it was stuck in the connect function.
Process 12251 attached–interrupt to quit
connect(4, {sa_family=AF_FILE, path="/dev/gpmctl"...}, 13
Blocking occurred while connecting to /dev/gpmctl.
/dev/gpmctl is a mouse-related driver that provides mouse support for virtual terminals.
There are settings for this parameter in the .vimrc file:
“In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
set mouse=a can be used normally when the terminal type is xterm, but will cause problems when the terminal is linux (gpm is not available).
Solution:
1) Comment out the settings
2) Change this setting:
if $TERM ! =”linux”
set mouse=a
endif
The above is the editor’s summary of the solutions to Linux vi often getting stuck. Have you also experienced stuck situations when using vi? Is it stuck in the connect function? You can try the method in this article to solve it.