Aug 21, 2020
Git Diff Current File
It is brilliant how Vim
easily allows you to execute shell commands. Just enter last line mode
and write ! <your command>
. If you want to check the git diff on the current file you also want to know the filename of the file you are editing. This can be done by using %
. So by entering last line mode
and typing !git diff %
you get a quick git diff of the current file.
Code of the Day
Here is some typical code that adds another item to a linked list.
static void addTextureToCache(char* name, SDL_Texture *texture) {
Texture *newT;
newT = malloc(sizeof(Texture));
memset(newT, 0, sizeof(Texture));
STRNCPY(newT->name, name, MAX_NAME_LENGTH);
newT->texture = texture;
textureTail->next = newT;
textureTail = newT;
}