I'm playing my first gunslinger and I have no idea how I would do a melee attack with my pistol. Would I take a penalty because I'm not proficient and what would that penalty be? Or, because it's a gun, would I be considered proficient or partially proficient? Let me know!
Using it in a way it's not meant to be used makes it an improvised weapon. As such, you take a -4 penalty on attack rolls with it, even if you are otherwise proficient in it.
Usage of either the Pistol-Whip deed or Empty Quiver Style will allow you to use it as a melee weapon without penalties.
When using the Pistol Whip deed a Gunslinger is considered proficient. One-handed firearm deals 1d6+Str+Enhancement, and a two-handed firearm deals 1d10+Str+Enhancement.
But if used as an Improvised Weapon, none of that would be the case.