code: def parse_redir(self, redir_cmd):
          
          redir_cmd_str = redir_cmd['str']
  
          matched = re.match(r'redir?!?\s*(=>>?\s*)(\S+)', redir_cmd_str)
          if matched:
              redir_cmd_op = matched.group(1)
              redir_cmd_body = matched.group(2)
  
              arg_pos = redir_cmd['ea']['argpos']
  
              # Position of the "redir_cmd_body"
              start_pos = {
                  'col': arg_pos['col'] + len(redir_cmd_op),
                  'i': arg_pos['i'] + len(redir_cmd_op),
                  'lnum': arg_pos['lnum'],
              }
  
              # NOTE: This is a hack to parse variable node.
              raw_ast = self.parse_string('echo ' + redir_cmd_body)
  
              # We need the left node of ECHO node
              redir_cmd_ast = raw_ast['body'][0]['list'][0]
  
              def adjust_position(node):
                  pos = node['pos']
                  # Care 1-based index and the length of "echo ".
                  pos['col'] += start_pos['col'] - 1 - 5
  
                  # Care the length of "echo ".
                  pos['i'] += start_pos['i'] - 5
  
                  # Care 1-based index
                  pos['lnum'] += start_pos['lnum'] - 1
  
              traverse(redir_cmd_ast, on_enter=adjust_position)
  
              return redir_cmd_ast
  
          return None
docs: Parse a command :redir content.