Last Updated: February 25, 2016
· badunk

Delete lines in a block of code in vim

If you had this bit of code:

request.post('http://someurl', function(){
    request.get('http://someurl', function(){

And you wanted to delete the get request to get to here:

request.post('http://someurl', function(){


With the cursor on the end of the 2nd line (on the {, just do:

  1. <Ctrl+v> Visual block mode
  2. % to navigate to the matching }
  3. d to delete

1 Response
Add your response


You can use simpler and faster di} (assume you are inside the block).

over 1 year ago ·