I am using viemu in VS 2010. Is there a reliable command to delete an entire method in C# source code?
Here are things I have tried:
The movement commands }
and ]]
are not smart enough to pick out a method. Although at times they do happen to grab the correct amount of text.
From just within the method i can do diB
which will delete the entire body of the method. That's not too bad, but then I'm left to delete the signature and outer brackets.
If I move the cursor to the visibility modifier (ie public
, private
, etc) then do d*
, it will kill the entire method if the next method has the same visibility.
Any vi/viemu experts have a way to do this?
I like to use zadd
to fold it and delete that fold (which will get the declaration too).
Another way to do it if you're inside the level of the method/if statement that you want to delete is da{dd
which I find a little easier to type than some of the other suggestions. It says to delete around the {
bracket pair that the cursor is currently in, then dd
to delete the remaining function declaration.
If you're nested inside control structures in a method, you can put a number before it to delete that many levels up.
In Vim, this is how I do it. I'm not sure if viemu is compatible enough, but:
It's not super-duper automatic or anything, but it works and is relatively easy to do once muscle memory kicks in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With