code: def handle_command(editor, input_string):
      
      # Match with grammar and extract variables.
      m = COMMAND_GRAMMAR.match(input_string)
      if m is None:
          return
  
      variables = m.variables()
      command = variables.get('command')
      go_to_line = variables.get('go_to_line')
      shell_command = variables.get('shell_command')
  
      # Call command handler.
  
      if go_to_line is not None:
          # Handle go-to-line.
          _go_to_line(editor, go_to_line)
  
      elif shell_command is not None:
          # Handle shell commands.
          editor.application.run_system_command(shell_command)
  
      elif has_command_handler(command):
          # Handle other 'normal' commands.
          call_command_handler(command, editor, variables)
      else:
          # For unknown commands, show error message.
          editor.show_message('Not an editor command: %s' % input_string)
          return
  
      # After execution of commands, make sure to update the layout and focus
      # stack.
      editor.sync_with_prompt_toolkit()
docs: Handle commands entered on the Vi command line.