How to check if everything is in Vim shell mode

In vim, the type : sh switches to the shell, and exit can exit the shell and return to vim. Is there any command to check if it works in vim shell mode? So that I accidentally could not open the same file again. I want to avoid the below scenario:

vim myfile > :sh > exit > vim myfile// receive a warning that another instance of vim is editing the same file

This is a normal scenario:
vim myfile > :sh > exit// continue editing vim myfile > :wq > vim myfile// continue editing

+5
source share
2 answers

In addition to @ a3nm's answer, what you can do is

  • use pstree -h: highligted, , , vim .
  • - ps t: vim , :sh. ps -oargs t , , vim.

, VIMRUNTIME, vim MYVIMRC (BTW, vim vimscripts, :sh). , , - .

<C-z> :suspend/:stop Ex, vim, . , vim, .

<C-z>, , vim, ( ), pstree, , pstree . : jobs .

<C-z>, fg ( % zsh bash), , type, exit ( <C-d>).

+3

:sh vim, , VIMRUNTIME, vim MYVIMRC, , . , , echo $VIM, - /usr/share/vim vim.

+3

All Articles