WASHINGTON — President Trump has in his first year marginalized American diplomats, sought to slash the State Department’s budget and reversed crucial pieces of his predecessor’s economic and diplomatic opening to Cuba. But Mike Pompeo promised on Thursday to reverse nearly all of that if he becomes the next secretary of state.

In five hours of testimony before the Senate Foreign Relations Committee, Mr. Pompeo, now the C.I.A. director, said he was hoping for a diplomatic solution to the North Korean nuclear crisis, still believed that the Iran nuclear deal could be saved, disagreed with the president’s assertion that poor relations with Russia had been caused by the special counsel’s investigation and, perhaps most remarkably, promised to defend gay rights around the world.

He was voluble, charming and gracious, which meant he was the opposite of how he had presented himself during the 2015 Benghazi hearings, the last time he had the nation’s attention. Then, he was the scowling, scathing attack dog hounding Hillary Clinton. On Thursday, he smiled throughout the hearing, occasionally even agreeing with Democrats.

“At the State Department, there are too many holes, too many vacancies, too many unfilled positions,” Mr. Pompeo said in one of his many promises to restore the department to its former glory after his predecessor, Rex W. Tillerson, pushed out hundreds of diplomats. The vow was greeted with relief by nearly all on the panel.