Blog

I heard all things in the heaven and in the earth. I heard many things in hell. How, then, am I mad? Hearken! and observe how healthily — how calmly I can tell you the whole story.
- From The Tell-Tale Heart .

Latest Posts:

Git Exclude Folder: Explained

A cartoon image depicting a bipedal octo-cat with pink skin, green eyes, and blue suckers on his tentacles. The octo-cat has white whiskers and bushy white mustache and eyebrows. He is wearing a suit vest with dress shirt, pants, and a tie teaching a complex topic using many charts, graphs and diagrams written on a chalkboard. There is a single student wearing a suit that is probably a school uniform.

To exclude a directory from git diff, use the following command:

git diff -- . ':!directory_name'

You can find this exceptionally terse answer at at least a dozen search results, but not a single one offers an explanation. Well, that's not enough info for me...

The "pathspec" is documented under git help gitglossary and is used for many git commands even if their syntax statement shows <path> instead of <pathspec> :

https://git-scm.com/docs/gitglossary#def_pathspec

Here are the important points:

I wanted to see what had changed in an Eleventy site, excluding the generated output files. So, here's the command I used:

git status -- ':!:_output'

Note that I needed to terminate the magic signature with another colon because the path I wanted to exclude started with an underscore (_). Without that second colon, I got an error message:

fatal: Unimplemented pathspec magic '_' in ':!_output'`

VSCodeVim Broke Quick Open

VSCodeVim Cartoon Character Breaking VSCode

VSCodeVim broke VSCode's file Quick Open keybinding. Now, CTRL-P just moves the cursor up a line instead of opening the file finder as expected.

Based on the GitHub issue linked in the commit, it was meant to enable MacOS's default cursor movement keys.

Issue #8574 shows some easy fixes. I chose to disable the plugin's handling of the keybinding:

"vim.handleKeys": {
    "<C-p>": false
}

This is in settings.json and I got there by opening Settings, entering "handlekeys" into the search box, and clicking on the "Edit in settings.json" link.

References

Use Vim as a Pager

I wanted to be able to scroll a man page in the terminal with my mouse wheel. While looking for a setting to change I learned that Vim can be used as a pager allowing mouse support and much more. Inspired by this entry at the Vim Tips Wiki, I decided to set it up for myself, but with a few minor changes. I did all this in WSL with Ubuntu 20.04.6 and Zsh on Windows 11, but it should work as well with any Unix or Linux variant:

~/.zshrc:

export PAGER="/bin/sh -c \"unset PAGER;col -b -x | vim -R \
    -c 'set ft=man mouse=a nonumber t_te=' \
    -c 'highlight Normal ctermbg=NONE guibg=NONE' \
    -c 'map q :q<CR>' \
    -c 'map <SPACE> <C-D>' \
    -c 'map b <C-U>' \
    -c 'nmap K :Man <C-R>=expand(\\\"<cword>\\\")<CR><CR>' -\""

This is very similar to what was documented in the Vim Tips Wiki, but I've made a few changes to suit my needs...