Command to delete the whole method?

I use viemu in VS 2010. Is there a reliable command to remove the whole method in the C # source code?

Here is what I tried:

  • Motion commands }and ]]insufficient for intelligent selection method. Although from time to time they do capture the right amount of text.

  • From the whole method, I can do diBthat will delete the entire piece of the method. This is not so bad, but then I have to remove the signature and the outer brackets.

  • If you move the cursor to the visibility modifier (i.e. public, privateetc.), then execute it d*, it will kill the whole method if the next method has the same visibility.

Do all vi / viemu experts have a way to do this?

+5
source share
3 answers

In Vim, this is how I do it. I'm not sure if viemu is compatible enough, but:

  • Skip to the beginning of the method declaration (accessibility modifier, etc.).
  • Click vto enter visual mode.
  • Place the cursor over the brace that launches the body of the method.
  • Press %to move the cursor to the corresponding bracket.
  • Click dto delete everything that is selected.

This is not a super duper with automatic mode or something else, but it works and is relatively easy to do as soon as the muscle memory strikes.

+2
source

zadd, ( ).

, method/if, , - da{dd, , . , { bracket, , dd, .

, , .

+2

dap ( ) , . , , diBdap ( , ). rc . ex: :nmap <C-d> diBdap

+1

All Articles