Taming Vim's Limits

Vim has a handy command-line option for opening files in multiple windows: -p. If I wanted to open all of the tests in a JavaScript project, I could type vim -p test/**/*_test.js, and Vim would dutifully open each file. But what if there are dozens of files? Fortunately, Vim guards against this with 'tabpagemax'. You can use set tabpagemax= to change the limit in your .vimrc.

Also, the number of undo levels is limited by 'undolevels'. You can change this if you don't mind using more memory, or set it to 0 for one level of undo.

Vim has other limits. If your system uses 32 bit long integers, then the largest a file or line can be is 2,147,483,647 characters. I think that's about two gigabytes. It's also the eighth Mersenne prime. To put this into perspective, Jacob's Room by Virginia Woolf on Project Gutenberg is 340062 characters. A single text file in Vim could contain all of Woolf's work, as well as Hemingway, Joyce, and Kafka.

That means Vim completely obliterates fiction, but will start to struggle with gigabyte log files.

blog comments powered by Disqus