No
Your gun is simply a portable Tesla coil.
Tesla coil arcs, like all expressions of electricity, needs somewhere to go. The electric arcs they produce aren't aimed, they're attracted to a ground.
Theoretically, if the opposing ship target were at a significantly lower electrical potential than your own and all the surrounding ground, that would attract the arc (as long as something else wasn't lower still, like every inch of ground between you and your target). However, that's a bit of a gamble, and as soon as your enemy realized what was going on, they'd charge their hulls in the same way that horse fences are charged step under a tree, or onto a higher point of ground, or near a river or wet area, to ensure anything else is a better ground than they are. The result is that your ship attracts the arcs your lightning will hit anywhere other than them.
Finally, electrical arcs weaken substantially (or require tremendous amounts of energy) as distance increases. Most arcs fired from a hand-held weapon would want to be measured in a distance of fractions of a meter meters in a space ground battle where distances are likely to be more along the lines of kilometers (or thousands of kilometers). It's not a particularly efficient weapon.
Please note that the arcs tesla coils produce are not electron beams, which is a directed form of electricity. Check that out — it might be more what you're looking for.
Reproduced and modified for this question from my answer to "Tesla coils as spaceship weaponry - would they work?" because non-electical-engineers actually think there's an intrinsic difference between space and a planet when it comes to "shooting electricity."
The simple reality is this: Electricity follows the shortest path to a lower charge potential. The higher the resistance between the electrical source and the charge potential, the lower that charge potential must be to attract the electricity. The Earth is a fairly low charge potential and human skin is fairly high resistance. When people are struck by lightning, it's not because the lightning struck them (they were NOT the lowest potential), it was because they were unlucky enough to be in the wrong place at the wrong time and the lightning passed through them to get to a low enough potential that the electricity didn't care about the resistance of human skin.