Search code examples
vim

How do you delete all text above a certain line


How do you delete all text above a certain line. For deletion below a line I use "d shift g"


Solution

  • dgg
    

    will delete everything from your current line to the top of the file.

    d is the deletion command, and gg is a movement command that says go to the top of the file, so when used together, it means delete from my current position to the top of the file.

    Also

    dG
    

    will delete all lines at or below the current one