I have some (edit: a bunch of) theories specific to gun vs saber. Take these with a grain of salt, and by salt I mean experimentation. Gun v gun is more straightforward: go for headshots (using pistol, or walking for very brief moments in order to have a stable shot), use cover, use any other weapons you have like grenades, concussion/ion blobs, whatever. I can spell out more gun v gun stuff if you want.
Now then, the vs. saber stuff.
First off: Certain tips here will become less valid after the next patch, which changes some gunner/saberist interactions.
Now then,
General tip: Do not shoot Jedi at long range unless they are running. You have to get within a certain distance of them before your shots do meaningful FP drain to them. (FP drains are being revised next patch)
General tip: Killing a saberist is a matter of depleting their FP and then depleting their HP. So you need to commit. Shoot, shoot, shoot, shoot, shoot, and keep shooting (while staying in close range, of course.) Once they get below 20 FP they can't push, so if you're SURE they're that low on FP, you can run after them while firing. I recommend playing as saberist to get a sense of how FP drains/regen works, so you can start to tell when an enemy saberist is likely to be low on FP.
E-11 tip: Use primary fire to drain FP, use secondary fire when the saberist gets REALLY close and you're trying to flinch him. (Flinch is probably being removed next patch and replaced with knockback. You'll need to go for headshots more instead.)
Tactics:
In general when an enemy Jedi/Sith is near, you have to walk, of course. Otherwise you're just a free push kill.
When he does a vertical slash or diagonal slash, run and sidestep it quickly, while also trying to shoot him for extra security. Note that running backwards is slower than running sideways/straight, so if you're trying to evade a slash entirely, by running straight away from the saberist, you really oughta do a 180 first.
When he does a horizontal slash, if you read it from a mile away you can switch to Melee and crouch while looking downwards and holding still, to duck under it, then you can go for a nutty kick, and if you land it, you can switch back to E-11 as quickly as possible and get some free shots. This is all a series of nutty risks that require precision, tho. Also requires buying Close Combat.
On that note, you move faster with Close Combat out, so for the sake of evading swings it might be worth it to switch to Melee just for the speed boost to dodge a swing (especially a horizontal swing, although a well-spaced horizontal swing is almost impossible to dodge without ducking.)
But the main way to counter horizontal swings is, of course, to shoot him, cuz that's a counter to every swing. But it also requires really good aim against people who know how to move evasively. I have a separate post somewhere about how to have "really good aim," but honestly my aim varies most wildly just depending on the "purity of my focus." When I'm at peak focus I am a flinching machine. I am always trying to figure out how to reach and maintain peak focus. My current best theory is to toss every thought out of my mind and just "observe" the thing I'm trying to shoot, and then "move" or "modify" the thing I'm trying to shoot, using the blaster as a natural extension of my mind. This probably only works cuz I have a lot of experience, but it sure does work.
Back on topic, if he jumps at you, there's a big mindgame puzzle. First off, if you have a good grasp on aiming-at-that-angle (and most people don't at all), you can probably get some shots on him as he's not likely to be blocking the whole time he's jumping. I find it much easier to aim at people in the air if I play in first person. Makes things less convoluted. I recommend binding an easy to reach key (maybe even a mouse button) to quick switch between 1p and 3p.
As he's jumping at you, he's either gonna go for a slash or a push. If he's going for a slash and not thinking of pushing, you might even be able to run under him or otherwise evade, but if he reads your intent to run and pushes you instead, you're dead, son. People tend to horizontal slash after jumping, so Melee Ducking works pretty often but if someone reads your melee duck they can probably use a different slash and hit you, or slash, dodge your kick, and slash again.
If he jumps at you and lightnings, your only real hope is I suppose to be in Melee so you move faster and can run backwards a little faster. Really, stuff like Lightning and Mindtrick+Speed seem to exist to give Jedi/Sith easy kills on single gunners who aren't teaming up with ally Jedi/Sith. So the main counter to lightning as a Soldier is "have friends." If you can drain the Sith's FP below uhhhh 50 I think, then he can't Lightning any more.
let's see, what other interactions am I forgetting...
Ah, deflect. If he just sits in block and stares at you like an asshole, baiting you to shoot yourself, I personally tend to take it as a challenge, and carefully fire lots of Primary shots at as-close-a-range-as-possible while running in tiny spurts to evade the deflect. If the jedi's a true idiot you can also go for a jumping melee grapple or at least a flying kick, but smarter jedi will hear you switch to Melee and dodge on reaction to that noise. You can also get REAAAAlly close to the jedi and shove the gun down his throat, since deflect stops working at "flinch range", but this is wildly risky for obvious reasons. But everything about gunVsaber is risky.
Oh yes, as Manyo said, reload extremely often. Try to keep your ammo topped off. The longer your reload times are, the easier it is for a smart jedi to just slash you while you're reloading. This is part of why I recommend using E-11 primary fire to drain FP. Not only does it drain FP ALMOST as quickly as landing every E-11 secondary fire shot, it's easier to land every shot, and it actually uses less ammo per shot than the secondary fire, while also firing slower. Meaning it's way more ammo-efficient.