Skip to content

Instantly share code, notes, and snippets.

@setkyar
Created December 24, 2014 04:24
Show Gist options
  • Save setkyar/c6fc9302f716bad09493 to your computer and use it in GitHub Desktop.
Save setkyar/c6fc9302f716bad09493 to your computer and use it in GitHub Desktop.
VIM
//Deteact keyboard code when user type to the input
$('input').on('keydown', function (e) {
console.log(e.keyCode);
})
//For esc/i/j and k
$(document).keyup(function(e) {
if (e.keyCode == 27) { alert('esc') } // esc
if (e.keyCode == 73) { alert('i') } // i insert mode
if (e.keyCode == 74) { alert('j') } // j left
if (e.keyCode == 75) { alert('k') } // k right
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment