If you missed getting this in the beginning like me to get it later on you can just hold Y to pull out your sword by itself if you want to know how to get rid of your gun. Then just hold RT when fighting ranged enemies to progress towards this achievement.
You can also put Default guard on (Thanks triplewitching!)
To make it easier and go for another achievement at the same time you can remove your primary and secondary weapon to where you are just using the sword.
Achievement you can also work on:
The The Sword Alone achievement in Warframe worth 85 pointsComplete 10 missions without any primary or secondary weapons equipped.
I do believe just using your sword increases the XP you get for it thus being the only weapon, I cannot confirm this but it looks to me like I gained more from a mission without my other weapons.