I do some low level programming which involves a decent about of bit manipulation. It would be very useful if I could somehow flip 1 to 0 and vice versa under my cursor. I couldn't find any built in function or installable plugin, and I don't really know to write a macro for that.
My go to so far is r and then typing the bit I want to flip it to, but if there is a way to do this easier (IE, without remembering the previous bit and what I want to flip it to) that would be great.
Currently I just use r and then typing the bit, which works but isn't ideal.
Put this code into your
vimrcfile, restart Vim, put cursor where you want to change bit, and hit ` (backtick / key to the left of 1).This code checks whether bit under cursor is '1', if it is, change it to 0 else change to 1.