Reputation: 8055
I read a post here by @grgarside. He answered a question with a beautifully labelled command using what seems to be only Unicode characters:
┌── ln(1) link, ln -- make links
│ ┌── Create a symbolic link.
│ │ ┌── the path to the intended symlink
│ │ │ can use . or ~ or other relative paths
│ │ ┌─────┴────────┐
ln -s /path/to/original /path/to/symlink
└───────┬───────┘
└── the path to the original file/folder
can use . or ~ or other relative paths
How did he do this? It seems hard to believe that he manually typed the whole thing into a text editor. Is there some type of Unicode editor that makes it easy to create such graphics?
Edit:
as per @grgarside's instruction, except with my Keyboard-en.plist
file being in a slightly different location:
Resources ❯ readlink Keyboard-en.plist
/System/Library/Input Methods/PressAndHold.app/Contents/Resources/Keyboard-en.plist
and with the addition towards to the top of the file (note that I needed to use sudo vim Keyboard-en.plist
as sublime didn't let me save the file even with sudo subl
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Roman-Accent-k</key>
<dict>
<key>Direction</key>
<string>right</string>
<key>Keycaps</key>
<string>└ ─ ┬ ┘ ┌ ┴ ┐</string>
<key>Strings</key>
<string>└ ─ ┬ ┘ ┌ ┴ ┐</string>
</dict>
<key>Roman-Accent-A</key>
<dict>
<key>Direction</key>
<string>right</string>
<key>Keycaps</key>
<string>A À Á Â Ä Æ Ã Å Ā</string>
<key>Strings</key>
<string>A À Á Â Ä Æ Ã Å Ā</string>
</dict>
...
</dict>
</plist>
Upvotes: 1
Views: 239
Reputation: 113906
I personally just use the Wikipedia page on unicode box-drawing characters to copy-paste the lines into my answers to write answers such as javascript can't access private properties and Does javascript process using an elastic racetrack algorithm.
Yes it's not as fancy as implementing a custom keyboard binding but I thought I'd just have to write this answer to say that yes, there are people who manually craft answers using only the internet and Stackoverflow's "Your Answer" textarea.
Upvotes: 0
Reputation: 5874
I'm the one who wrote the answer in question, and I did craft it manually. I use PressAndHold.app (part of macOS) to add the unicode quickly by holding a character down on the keyboard to insert the characters.
You can use the following in the relevant keyboard plist located at /System/Library/Input Methods/PressAndHold.app/Contents/Resources/Keyboard-en.plist
to use the same thing yourself. In my plist, I set ‘k’ as the key to hold.
<key>Roman-Accent-k</key>
<dict>
<key>Direction</key>
<string>right</string>
<key>Keycaps</key>
<string>└ ─ ┬ ┘ ┌ ┴ ┐</string>
<key>Strings</key>
<string>└ ─ ┬ ┘ ┌ ┴ ┐</string>
</dict>
Upvotes: 2