The simile "snug as a gun" is startling when it appears in the poem "Digging." After just a line and a half, Heaney has already created an image of a writer sitting down to quietly reflect and contemplate, with the pen "resting" and "snug." When "gun" follows these two peaceful words, it suggests that the poem won't be as cozy and peaceful as we might expect.
One idea that Heaney might be introducing with this simile is the power of his tool. The poem puts a lot of focus on tools of a trade, particular the spades that the speaker's father and grandfather used to dig up peat and grow potatoes. The speaker knows that he doesn't have the kind of tool that can do manual labor like they did; he only has his pen. Still, this simile might be suggesting that his pen can be as powerful, or even more powerful, than the spades. The simile brings to mind the saying the pen is mightier than the sword. Perhaps the speaker is suggesting that with his pen, he will be able to access a power (and maybe even a violence?) that his father and grandfather couldn't.