NPCs need a personality as well. One way to give them one is to play up any feature about them that the players latch onto. You may not have planned the merchant in the market square to be a ruthless haggler who will do anything to rip off a passing adventurer, but after a single encounter with the heroes he may come across that way. Since the players have now pigeonholed the character, you can play it up in any later encounters, and they'll always remember who they're dealing with.
The alternative is to have the NPC turn out to be completely the opposite in truth, just to give the players a lesson in judging books by their covers. This can be a good twist and add some spice to a later encounter, but don't do it often, otherwise your NPCs will get a reputation for being unpredictable above any other personality features.
Chewbacca: Mayhap it were some sort of Imperial probe droid.
General Rieekan: I'm not droidist, but geez Louise, you just can't trust 'em, can ya?
C-3PO: I don't like this general.
Leia: We have to assume the Empire knows we're here.
Leia: Initiate evacuation. Prepare for possible attack.
General Rieekan: Have you considered Operation Codename: Kamikaze Droid Decoy?
C-3PO: I really don't like this general.
General Rieekan: See, they pretend they're nice but really they hate us. Always happens!
R2-D2: Have you considered Operation Codename: Explosive Meat Dispersal?