An adress like 1~2 is a GNU extension, it's not available in the BSD sed which is part of macOS.
The probably easiest way out of this is to install GNU sed with
brew install gnu-sed
and then run gsed '1~2d' sample.txt.
If you don't want to install additional software see https://stackoverflow.com/questions/2560411/how-to-remove-every-other-line-with-sed for ...
Elaborating on @jmrk answer. His code works well for the so called "aluminum" keyboard, but apple also released wireless keyboards, under the name "magic keyboard", with product id 0x022d. (They also have aluminum chassis, and I think that my model is from 2008 or so.) This product has the same caps lock issue, and almost the same code ...
This is not related to fish nor macOS in general, the resulting symlink is just broken
$ mkdir a b
$ touch a/foo.txt
$ ln -s a/foo.txt b/
$ cd b
$ cat foo.txt
cat: foo.txt: No such file or directory
$ ll foo.txt
lrwxr-xr-x 1 pse staff 9 Feb 1 13:14 foo.txt@ -> a/foo.txt
Basically you need to think ahead when creating symlinks in a directory which ...
Xmodmap only works for X11 applications, the ones you've listed for sure are not X11 applications. Most likely you don't use any X11 at all.
To remap keys on macOS see the answer on Karabiner quit working in Sierra. How do I map my menu/application key to be Command? instead.
Another app commonly used to remap MacOS keys is Ukelele.
Note that this is about the filesystem and does not matter which shell you are using.
The issue is that the symbolic link just contains the text you passed to it and then the OS tries to resolve it from the actual path of the link. The link works as if you cd to where you store the link
So what happens is when you want to see b/file.txt the OS tries to open ...