dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

RStudio Colemak script no longer works in version 1.3

Open gregrs-uk opened this issue 5 years ago • 1 comments

I've got this working by changing the mapCommand calls to pass individual arguments rather than an object. My script is adapted from yours as I use a different HJKL mapping, but see below for my working version:

// Inspired by https://github.com/jimhester/dotfiles
//
// These lines need to be pasted into an open RStudio session in the object inspector
// Right-click anywhere in the source file -> Inspect Element -> Console -> Right-click -> Paste
window.ace.config.loadModule("ace/keyboard/vim", function(m) {
  var vim = require("ace/keyboard/vim").CodeMirror.Vim

  // Remap hjkl
  vim.mapCommand("k", "motion", "moveByLines", {forward: true, linewise: true})
  vim.mapCommand("h", "motion", "moveByLines", {forward: false, linewise: true})
  vim.mapCommand("l", "motion", "moveByCharacters", {forward: true})
  vim.mapCommand("j", "motion", "moveByCharacters", {forward: false})

  // Fix key-to-key mappings that mapped to the old locations
  vim.map('<Right>', 'l')
  vim.map('<Left>', 'j')
  vim.map('<Up>', 'h')
  vim.map('<Down>', 'k')
})

gregrs-uk avatar Jul 05 '20 18:07 gregrs-uk

Thanks!

jimhester avatar Jul 06 '20 14:07 jimhester