In the close confines of a room or hallway of a house I’m thinking that a longsword would be one of the more frightening things to confront. Sure a gun is scary too, and he’s lucky this intruder wasn’t (apparently) armed, but still. In a small darkened space that sight of a long glint of sharp steel reaches deep into a very primal place in the human psyche. Instant fear.
Longsword would be awkward inside, especially in a small room or hallway.
Might not be as scary, but I suspect a kukri or similar weapon would be more effective.
Inside the home, a sword has a few advantages over a gun. You can keep a few laying around, even though you have kids, because kids understand “Sharp! Don’t touch!”. And within a few yards, you can draw and run a guy through with a sword just as fast as you can draw and fire a gun.
The sound of a 12 Ga. pump shotgun being racked has a very chilling effect as well.