A novel composite of hierarchically porous carbon (HPC) supported PDMcT–PANI (HPC/PDMcT–PANI) was synthesized through an in situ oxidative polymerization. Field emission scanning electron microscopy (FESEM), transmission electron microscopy (TEM) and Raman spectra showed that a partial amount of PDMcT was parasitized inside of pores of HPC and some other amount of PDMcT formed interpenetrated fibrous electron donor–acceptor PDMcT–PANI adduct with PANI and distributed onto surface of HPC in HPC/PDMcT–PANI composite. X-ray diffraction (XRD) revealed that the interconnected nanoporous structure of HPC and formation of PDMcT–PANI adduct significantly influenced the crystal growth and orientation of PDMcT. As confirmed by the cyclic voltammetry and galvanostatic charge–discharge tests, the incorporation of HPC and PANI had significantly improved the electrochemical performance of PDMcT. It was found that the initial discharge capacity of HPC/PDMcT–PANI composite reached 310mAhg−1 and its specific capacity remained 150mAhg−1 after 20 cycles. Moreover, the HPC/PDMcT–PANI composite also showed higher specific capacity and better cycling stability than that of its two binary composites [PDMcT–PANI (291mAhg−1) or HPC/PDMcT (253mAhg−1)].