vim – Vim tip 34534

I’ve been looking for a way to delete up to a character, but not including the character from within vim, and I finally figured out how to do it.
Lets say you have something like this:

If the cursor is at the beginning of the line, and we want to change the name of the array completely, we could type this:

This will delete all the way to the bracket. Unfortunately, it deletes the bracket.
So instead, this works nicely to NOT remove the character you type:

This will delete every character up until the bracket, but leave the bracket. How nice.
So what does this “t” movement key do exactly?
It simply moves the cursor to the character right before the one specified, and it stays in “normal” mode.
If you wanted to immediately type after deleting the characters, you would use the following:

Which will delete the text, leave the “[” character, but change to insert mode right before the “[” character.

Another thing you can do is type:


vim – Monthly vim tips

If you want to search for the word right where your cursor is, you can do the following:

If you want to maximize your vertical or horizontal buffer splits, type one of the following:

If you want to equally resize all of your buffers, type the following:

To make a vertical split a horizontal one, or visa versa, type the following:

To center the cursor on your screen, press:

To bring up the build in “file explorer” window, type one of the following:

What is the difference between aggregation and composition?

This question has bothered me for some time and I always forget. So I wrote it down here and added an answer.

Composition : An object contains another object. When the container object dies, so does the composited objects.

Aggregation : An object pseudo-contains another object (contains a pointer to it). When the container object dies, the containees do not.

Sometimes aggregation is called composition when the difference doesn’t matter.
Note: In UML, aggregation is an unfilled diamond, whereas composition is a filled diamond.