Posted by
chrisd
on from the vim-is-the-one-true-editor dept.
vimbigot writes "A nice summary of where Vim 6.0 has come from, with some insights into Bram Moolenaar's thoughts on Open Source, Charityware and large cooperative software projects. (a bit of irony in the `powered by emacs logo at the bottom !')"
Interesting bits from the page
by
f00zbll
·
· Score: 5, Interesting
I found this particular paragraph interesting and shows Bram took a lot of care designing VIM.
The blocks with text lines are stored in the swap file without a specific ordering. If the blocks were ordered, inserting a block halfway
into the file would require all remaining blocks to be shifted, which is very slow. To be able to find a line by its number, index blocks
are used. An index block contains a list that tells which line is in which block. If a file is big, this list doesn't fit in a single block. It is then split over several blocks, and another index block is made to refer to these index blocks. This forms a balanced tree of index
blocks, with the text blocks as the leaves. This construction has proven to be very reliable and efficient.
There are several text/html editors and IDE's that would benefit from this type of swap file. I'm sure everyone could list atleast 2-4 programs that have a difficult time handling large files. It's no wonder VIM is able to handle really large files and still respond quickly.
Hats off to bram!
My latest spot of Vim-magic
by
DeadVulcan
·
· Score: 5, Interesting
This would only be of interest to a select few
Vim-geeks, but what the hey. (I've been using Vim
since v1.2, and I want to have a chance to boast.
Humour me.:-)
This morning, I checked on the progress of a
nightly script I have, downloading the Debian tree
over a modem. I wanted to see how much more I had
left to go. The difficulty in this stemmed from
the fact that not all directories were being
downloaded, and not all files in those directories
were being downloaded, either.
But with Vim, I was able to grab the
ls-lR.gz file, and massage it to produce
a du-like table of directories and sizes
from which I was able to assess how much remainded
of my download.
First, I removed most of the extraneous
information; my region of interest was a
subdirectory called pool, so I did some
searching (/) and deleted everything
before and after this subdirectory.
Then, among these directories, there was only a
subset targeted for downloading. I pulled that
list from a separate file, into the top of the
buffer (:r).
Then came some cool magic. First, in
preparation, I replaced all the slashes in the
directory list with backslash-slash
(ggV}:g/\//s//\\\//g). With that done, I
put the cursor at the beginning of the first
directory name, and started recording a macro
(qa). I yanked the directory name with
the escaped slashes (y$), searched for
the other occurance of that string in this file
(/^<Ctrl-r>"$<CR>), yanked
the block of text that followed (V}y),
returned to the point where I was before the
search (''), and pasted the block of text
after the directory name (p). Finally, I
cursored down (}j), to position the
cursor at the beginning of the next directory
name, and finished off the macro (q).
Then I could invoke my macro with @a,
and continue to re-invoke it with @@.
Just holding down @ had the effect of
slowly working through the list of directories,
and inserting the list of files within each
directory after it. Very cool to watch.
I then removed the rest of the file, since it
didn't interest me (dG).
Then (without exiting Vim, mind) I used
grep to filter out certain files from my
list (ggVG!grep -v <pattern>).
Now I wanted to reduce the listings of files to
a size summary for each directory. I made another
macro that used the visual commands
(<Ctrl-v>) to eliminate all but the
file size column. Used the column-insert
(<Ctrl-v>I) to add a "+" before all
the numbers except the first. Packed them all
together onto one line (V}J) and added
the numbers together by invoking bc on it
(V!bc<CR>). Cursor down to the
next directory entry, and finished off the macro.
Again, I held @, and this time, it
worked its way through the file listing,
condensing each group of files to a single number:
the total occupied space in that directory.
A bit of tweaking, and I had a nice neat table
containing directory names and sizes.
Admittedly, it's taken me almost ten years to
reach this level of proficiency, but I wouldn't
trade it for anything. (Not even Emacs!:-)
-- Accountability on the heads of the powerful.
Power in the hands of the accountable.
The blocks with text lines are stored in the swap file without a specific ordering. If the blocks were ordered, inserting a block halfway into the file would require all remaining blocks to be shifted, which is very slow. To be able to find a line by its number, index blocks are used. An index block contains a list that tells which line is in which block. If a file is big, this list doesn't fit in a single block. It is then split over several blocks, and another index block is made to refer to these index blocks. This forms a balanced tree of index blocks, with the text blocks as the leaves. This construction has proven to be very reliable and efficient.
There are several text/html editors and IDE's that would benefit from this type of swap file. I'm sure everyone could list atleast 2-4 programs that have a difficult time handling large files. It's no wonder VIM is able to handle really large files and still respond quickly.
Hats off to bram!
This would only be of interest to a select few Vim-geeks, but what the hey. (I've been using Vim since v1.2, and I want to have a chance to boast. Humour me. :-)
This morning, I checked on the progress of a nightly script I have, downloading the Debian tree over a modem. I wanted to see how much more I had left to go. The difficulty in this stemmed from the fact that not all directories were being downloaded, and not all files in those directories were being downloaded, either.
But with Vim, I was able to grab the ls-lR.gz file, and massage it to produce a du-like table of directories and sizes from which I was able to assess how much remainded of my download.
First, I removed most of the extraneous information; my region of interest was a subdirectory called pool, so I did some searching (/) and deleted everything before and after this subdirectory.
Then, among these directories, there was only a subset targeted for downloading. I pulled that list from a separate file, into the top of the buffer (:r).
Then came some cool magic. First, in preparation, I replaced all the slashes in the directory list with backslash-slash (ggV}:g/\//s//\\\//g). With that done, I put the cursor at the beginning of the first directory name, and started recording a macro (qa). I yanked the directory name with the escaped slashes (y$), searched for the other occurance of that string in this file (/^<Ctrl-r>"$<CR>), yanked the block of text that followed (V}y), returned to the point where I was before the search (''), and pasted the block of text after the directory name (p). Finally, I cursored down (}j), to position the cursor at the beginning of the next directory name, and finished off the macro (q).
Then I could invoke my macro with @a, and continue to re-invoke it with @@. Just holding down @ had the effect of slowly working through the list of directories, and inserting the list of files within each directory after it. Very cool to watch.
I then removed the rest of the file, since it didn't interest me (dG).
Then (without exiting Vim, mind) I used grep to filter out certain files from my list (ggVG!grep -v <pattern>).
Now I wanted to reduce the listings of files to a size summary for each directory. I made another macro that used the visual commands (<Ctrl-v>) to eliminate all but the file size column. Used the column-insert (<Ctrl-v>I) to add a "+" before all the numbers except the first. Packed them all together onto one line (V}J) and added the numbers together by invoking bc on it (V!bc<CR>). Cursor down to the next directory entry, and finished off the macro.
Again, I held @, and this time, it worked its way through the file listing, condensing each group of files to a single number: the total occupied space in that directory.
A bit of tweaking, and I had a nice neat table containing directory names and sizes.
Admittedly, it's taken me almost ten years to reach this level of proficiency, but I wouldn't trade it for anything. (Not even Emacs! :-)
Accountability on the heads of the powerful.
Power in the hands of the accountable.