boolean () { if (myTerminalPanel.getTerminalTextBuffer().isUsingAlternateBuffer()) { return false; } ToolWindow toolWindow = myTerminalPanel.getContextToolWindow(); if (toolWindow == null) { return false; } if (JBTerminalWidget.isTerminalToolWindow(toolWindow) && !AdvancedSettings.getBoolean("terminal.escape.moves.focus.to.editor")) { return false; // For example, vi key bindings configured in terminal } return true; }