Editing a huge file - Vim or something else?

  • I am Vim fan for most of my editing purposes.
  • But these days when I have to open huge file ~1-2 gigs, its is vert slow to load and perform operations
  • What are the other ways I can edit such huge files efficiently

Solution 1:

vim you can

:set binary

first.

or use hexedit. as https://stackoverflow.com/questions/699785/edit-very-large-sql-dump-text-file-on-linux

Solution 2:

Set

:syntax off
:se binary nospell 
:setgl noswap
:set undolevel=0
:set undofile=

You can also use directory/undodir to put swapfiles and undofiles in another location

Solution 3:

Look here: https://askubuntu.com/questions/28847/text-editor-to-open-4-3-gb-plain-text-file

  • Divide the file in parts : split -b 53750k <your-file>
  • Edit sigle parts with vim ( I don't like it but it works fast here )
  • Merge the parts cat xa* > <your-file>

Done :)

Sorry but free editor larks good support for big files ( cannot find a reason for that )

p.s.
learn Vim is not so difficult: http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/

Solution 4:

This article explains what you can do to Vim itself to reduce the overhead associated with opening a large file.