Search code examples
vimcharacterex

vim: how to remove 6 leader characters of a whole file?


I've got a text file like

00001 This is line 1
00002 This is line 2
10001 ??
30004 xccddd

I wish to delete the leading 6 characters of all lines. Is there a one line vim normal mode command that could do this?


Solution

  • You can delete them by:

    • :%normal! 6x

    %: All lines of the file

    normal!: Execute command in normal mode

    6x: Delete 6 characters

    or

    • :%s/^.\{6}//