Monday, July 27, 2015

Minecraft 1.8 Forge, Liteloader, Optifine (and throw in Voxel Map --- might as well).

Say you wanted to install the Optifine mod for Minecraft and you've read my previous post on setting up Forge, Liteloader and VoxelMap for Minecraft 1.8 (or maybe you already have working mods).  Installing the Optifine mod could be as simple as getting the latest 1.8 version of Optfine .jar file (specifically the 1.8 version since as of this writing the other 1.8 versions aren't supported yet by Forge or Liteloader) and sticking it into the mods directory.

Now, there is a good chance that this didn't work for you at all especially if you just read the setup post.  I saw a number of posts on the 'net where people are asking why their Optifine doesn't work and people give answers who some say works and some says they don't.  The main reason is that if you got the latest version of Forge and Liteloader there is a good chance that Optifine isn't compatible with it.

Go to the Optifind Download page and you'll see a link to the changelog link besides each version of Optifine.  Read it and it will say which version of Forge it works with.  If you have a version of Forge that is newer then that, Optifine won't work.

The solution is the install the latest version of Forge that works along with the latest version of Liteloader that works with that version of Forge.  Then you can drop Optifine's jar file into the mods directory.

Friday, July 24, 2015

Use VIM-like HJKL Instead Of Arrow Keys in Linux and OSX

Okay, I admit it...  I move around the file even while in the insert mode of Vim instead of going back to normal mode.  I don't always stay in insert mode, but if I'm typing and notices a typo a few characters back I will go back to the typo without leaving insert mode.  I do this by mapping the CTRL-[HJKL] to left, down, up, right so at least my fingers stays on the home row and not move to the arrows (I have disabled arrow keys in normal mode when I was training myself on Vim and never re-enabled it).

I found that after spending time in VIM if  I switch to other apps I will start using HJKL for navigation.  Of course that usually doesn't work and I end up using the arrow keys (e.g. when moving down menu options in the browser).  Naturally if I'm using those apps a lot more then when I go back into Vim I'll get lazy and start trying to use the arrow keys.  I decided what I want is to use HJKL even when I'm not in Vim and I wanted it to be consistent across Linux and OSX.

On OSX, this is easy to do.  Simply install Karabiner and select the option to use VI mode using the control key.  Then, in any app, simply use CTRL-[HJLK] for the equivalent behavior as using the arrow keys.  To add more consistency between OSX and Linux, I remapped Caps-Lock to the CTRL key (which is also easier to type on a mabook pro).

On Linux, it's a little more work.  I use Caps_Lock as the Switch_mode (SM) key and then defined that SM-[HJLK] combination to be like the arrow keys.  To do this:

xmodmap - pke > ~/.Xmodmap

Add this line to the top of the .Xmodmap file to disable the Caps_Lock key:

clear Lock

Then set the Caps-Lock key to be the Switch-mode key:

keycode 66 = Mode_switch Caps_Lock

This means to set the caps_lock to be the mode_switch key (and caps-lock when it is Shift-Caps_Lock)

Next, add the Left/Down/Up/Right to the third column of the key code record that maps to the letters, HJKL.

keycode 43 = h H Left
keycode 44 = j J Down
keycode 45 = k K Up
keycode 46 = l L Right

This means that for key 45, print "k" when the key is pressed, "K" when it is SHIFT-k and Up when CapsLock-k is pressed (since CapsLock is now the mode_switch key).

Once you save the file, load it with

xmodmap .Xmodmap

Most current desktops will load .Xmodmap when logging in.
You can find out what keycodes maps to what by using xev.