Most protagonists are depicted as imperfect; though heroic, they aren't flawless paragons of perfection, and will have some minor shortcomings to help the audience identify with them better. SuperBob can selflessly save the world on a daily basis, but mild-mannered Bob Trope will regularly leave the refrigerator door open.
Even so, some characters have a Heroic Vow: a commitment or standard that they will not cross for whatever reason. Perhaps it's a promise to a dear one, a sense of pride, a personal Moral Event Horizon, or just because the hero is a Nice Guy. If a villain takes a Heroic Vow, it's usually because Even Evil Has Standards.
Key to the Heroic Vow is that it is a commitment the character keeps because he willingly wants to. There are no talismans or failsafes preventing the breaking of the Vow, nor are they needed — the character's willpower and resolve are the only bonds needed.
Note that the Heroic Vow doesn't necessarily have to be spoken (or written); a hero's behavior enforced with sheer personal willpower counts. If the vow is spoken/written, it may become a Badass Creed.
Some Heroic Vows are so commonplace, they have their own tropes:
If you ever lose your mind, don't worry. I'll destroy you myself.
Naruto's vow to bring Sasuke back to Konoha. Arguably in the series every character has one, but Naruto's is the most important plotwise.
The latest arc in the story may be subverting this a bit, by showing the burden and increasing impossibility that this vow seems to entail.
He has not (so far) gone back on it, but he tells Sakura that it's no longer the main reason why he wants to bring Sasuke back.
Lately he's added an addendum, he'll bring Sasuke back or settle for mutual death to eliminate the threat Sasuke has become.
Edward Elric from Fullmetal Alchemist made a vow to his brother to restore his body without resorting to the Philosopher's Stone, which drives him for most of the story. He also refuses to kill people but unfortunately sometimes his two vows clash.
Also, and similar to the Super Robot Wars example, Riza Hawkeye has promised Roy Mustang that if he ever deviates from the righteous path, she will shoot him rather than let him go against his ideals. In an odd twist, this was his idea.
In Mobile Suit Gundam Unicorn, Banagher gave his word to Audrey that he would protect her, and he's sticking to it, no matter what fights he gets plunged into and whether Audrey would like this or not.
Shinn from Gundam SEED Destinyvows to protect Stella, even if it means handing her over to the Earth Alliance for medical treatment (and handing them a powerful combat asset), not attacking her while she wipes Berlin off the map, or attacking the Freedom in order to stop it from doing so.
Balsa from Seirei no Moribito has vowed to save one life for everyone who died to protect her. When her childhood friend and healer called her out on how many lives she was taking in her efforts to accomplish that goal, she further swore never to kill.
In Eureka Seven, Renton make a personal vow that he will protect his beloved Eureka. He nearly broke his vow when he ran away from Gekkostate in episode 21, but this vow eventually motivates him to go back.
In Yu-Gi-Oh! GX, Aster Phoenix had his fortune told that he would one day save his Childhood Friend Sartorius from evil, and Aster promised him he would. During the actual conflict years later, Sartorius is under Demonic Possession by the Light of Destruction and the real Sartorius appears in Aster's mind apologizing that he involved Aster in his attempt to save himself, but Aster admits he really does want to save his friend from the Light because Sartorius has helped him so much as a friend.
Kenzou Tenma in Monster is bound and resolved to do two things: save every life he possibly can (as a wanted fugitive, he more than once has to hold people at gunpoint in order to get them the emergency care they need), and kill Johan. The inconsistency between these two vows is not missed, to put it mildly.
Spider-Man has the infamous quote, "With great power comes great responsibility."
After J. Jonah Jameson's wife is murdered by Alistair Smythe thanks to his Spider-Sense burning out, Spidey adds a new one "As long as I live, no-one else dies."
The Astro City story "Old Times" features Supersonic, a Flying Brick who pledged to always use an original method against each of his opponents. When he's called out of retirement to stop a rampaging robot, he feels shamed because his impending senility has reduced him to simply hitting it until it stops.
In The Princess Bride, Inigo Montoya devotes his entire life to finding the six-fingered man who killed his father.
Similarly, Inigo insists on a fair fight with his opponents, to the point of helping the Man in Black up the cliff and waiting for him to be rested before beginning their duel.
Inigo: I promise I will not kill you until you reach the top. Man in Black: That's very comforting, but I'm afraid you'll just have to wait. Inigo Montoya: Isn't there any way you trust me? Man in Black: Nothing comes to mind. Inigo Montoya: I swear on the soul of my father, Domingo Montoya, you will reach the top alive. Man in Black: ... throw me the rope.
In Pixar's Up, Carl and Ellie Fredriksen make a vow to visit Paradise Falls... even if it takes them an entire lifetime to do so.
In Kung Fu Panda, Po endures everything thrown at him in his Training from Hell to become the Dragon Warrior. Noting that "a real warrior never quits," Po vows to persevere no matter what, and endures everything inflicted on him without complaint.
There's a Running Gag in Galaxy Quest where Sir Alexander Dane winces every time he hears or says his Catch Phrase. It becomes a Heroic Vow after the death of his protege Quellek.
In Terry Pratchett's Thud!, Sam Vimes will stop whatever he's doing and go home to read "Where's My Cow?" to his son at 6 o'-clock... even if he's halfway across town or buried underground at the time.
Every day. Read to Young Sam. No excuses. He'd promised himself that. No excuses. No excuses at all. Once you had a good excuse, you opened the door to bad excuses.
The Discworld novels also suggest that this is the only reason Granny Weatherwax doesn't become a stereotypical Wicked Witch.
"Oh dear," muttered Aziraphale, not swearing with the practiced ease of one who has spent six thousand years not swearing, and who wasn't going to start now.
Sparhawk of David Eddings' Elenium, who maintains an ironclad sense of personal honor and dignity despite his own world-weary cynicism and the criminals and evils he has to deal with.
Gawyn Trakand from The Wheel of Time swears an oath to protect his sister to the death, even when she makes his childhood a living hell with her antics, she runs off in the middle of training twice, leaving him behind. It gets worse, yet he never waivers.
Two major ones from Animorphs. Firstly, the kids will never morph a sentient species without the individual's express permission. The other vow is a little more vague: The kids "fight Yeerks, but won't become them". This essentially means the kids agree to not use the same underhanded tactics Yeerks use (cold-blooded murder, ganging up on a single enemy, etc.) They end up breaking both of these vows.
These are a major element in C.J. Cherryh's Morgaine Cycle. They form a big part of Vanye's characterization due to his Nhi obsession with honor, and when he does something stupid to keep his honor he's generally well aware of the stupidity of what he's doing. Oaths, their making, their consequences and the attendant difficulties, anguish and so on make for some major drama.
In Pyrates, George van Gelder and his friends pledge to protect each other no matter what.
I will unite instead of divide. I will bring men together.
The Second Ideal of the Edgedancers:
I will remember those who have been forgotten.
Lightweavers make no oaths beyond the first, and only need to speak truths (especially about themselves) to advance.
Live Action TV
Star Trek's Prime Directive: every Starship captain swears a solemn oath that he will risk his ship and crew, rather than interfere with a planet's normal development.
It may seem to be violated so often it is hardly a vow at all, but many of the cases are actually a case of Loophole Abuse, especially early on: the Prime Directive forbids interfering with a planet's normal or healthy development, depending on the quote in question. A captain may argue that failing to develop at all is not normal or healthy development, especially if it is not by the free choice of the members of the culture in question, and Starfleet itself originally mandated discreet interference in the most severe case of ceasing to develop, namely ceasing to exist. The Prime Directive is also superseded by a Starfleet vessel's requirement under interstellar law to respond to distress calls and render any possible aid, which was a plot point in one episode of TNG.
The principle is generally expressed as a right of self-determination for any society. Even if this means that society making choices which harm or even destroy itself (like oppressive government or civil war). It is also taken much more seriously in the case of civilizations which have not yet developed interstellar travel, that's where the "normal development" part really comes into play; these civilizations have to find their own way to the stars while figuring out how best to run their society (or not). They are treated some-what like under-age minors, simply off-limits even if you might have the best of intentions. In-universe, opinions differ on whether "normal development" includes acts of nature (like the local sun going supernova or a naturally occurring disease which threatens to wipe out a sentient species who possess inadequate medical technology).
More than one writer in the Expanded Universe has portrayed the Prime Directive as extremely problematic in-universe, a knee-jerk reaction to a couple of incidents where Giving Radio to the Romans went catastrophically wrong that was too vaguely-worded and poorly thought out, but which nobody can figure out how to revise for the better.
In CSINY, Mac Taylor will categorically not allow evidence fabrication or tampering within his lab.
Derek Reese from Terminator: The Sarah Connor Chronicles. He will stop at absolutely nothing in order to fight the coming cybernetic invasion, simply because no matter how hopeless it gets, it's not just the right thing to do... it's the only thing to do.
The Doctor, from Doctor Who, holds such a vow. It is that vow which defines what it means to be the Doctor.
The Doctor: Never cruel or cowardly. Never give up, never give in.
The Dungeons & DragonsSplat book, The Book of Exalted Deeds, has various vow Feats that carry advantages and disadvantages. The Vow of Poverty for instance disallows you from owning equipment, but gives you roughly 80% of your estimated wealth in bonuses).
In Exalted, the Charm Righteous Lion Defense causes a magically enforced version of this: one of the character's Intimacies becomes utterly inviolate, and nothing, not even Mind Control, can persuade him to act against it.
In Warhammer 40,000, the Black Templars chapter of space marines, an army of particularly pious warrior monks, may choose a vows that affects how they fight a battle. One for example gives all models a weak saving throw against ranged attacks that would normally ignore their Power Armor, but keeps them from taking cover, while another forces units to charge at the nearest enemy but grants them significant combat bonuses when doing so.
In Dissidia: Final Fantasy when Cosmos, worrying for his life tires to convince the Warrior not to continue. He instead encourages her to have faith in him and the other heroes in the form of a vow that he will never give up. Cosmos is so moved by his vow that she in turn makes one of her own, to not lose faith in him and the others.
Warrior of Light: I have made a vow to obtain the crystal and save the world. That vow gives me strength.
Cosmos: I understand your determination. Then I shall also make a vow...to believe in all of you until the end.
Shirou in Fate/stay night has an interesting personal vow. Apart from the one about saving everyone, that is. This one is about how he can accept losing to an enemy, but he refuses to let his own weakness or body get in the way. Basically, he refuses to give up until you kill him outright where he stands.And in one HF ending, he appears to surpass even that to save Sakura.
From Persona, Yukino Mayuzumi pledges to rescue Saeko-sama from the Snow Queen, no matter what.
In the Windham Classics text-adventure adaptation of The Wonderful Wizard of Oz, the Tin Man swears an oath to "Guard [the party] with my axe, and shield you with my tin" upon being recruited.
Valvatorez from Disgaea 4 has made a vow to never drink human blood until he can show a certain woman true fear. He does not care that the woman in question is long dead, the vow has depleted him of all his former power and standing, and that everybody except for him agrees that the vow is utterly unnecessary - he made a promise and he's going to keep it. He eventually does show Artina (now an angel) true fear in one of the epilogues: the fear of losing him.
Kin of Goblins tried to free herself from Goblinslayer by escaping, but it always failed. Finally she came to the conclusion that fleeing would solve nothing, and that it was necessary for her to stand and solve her problems. So, even as she lay bleeding and weak, she swore to never run away again.
Chevalier the mouse, hero of the webcomic CHEVALIER makes one to determine his destiny. Read it here.
The Global Guardians PBEM Universe has Thunderfist, a former Seattle cop who vowed to never violate proper police procedure when it came to evidence collection or the treatment of suspects.
In Ben 10: Ultimate Alien, after Aggregor recaptures the last of his escaped prisoners, Ben makes one to save the aliens and stop Aggregor.
Rarity: ...I've waited all my life... Fluttershy:...for this moment... Pinkie Pie:...and I'm not going to... Applejack:...let it slip by!... Rainbow Dash:...If it's the last thing I do... Twilight Sparkle: ...I'm gonna make this... All:...the best night ever!
Also appears in "Applebuck Season", with Applejack vowing to bring in the harvest without anybody's help.