Skip to content

Instantly share code, notes, and snippets.

@daxanya2
Last active November 8, 2015 14:11
Show Gist options
  • Save daxanya2/00c1ed13d0c25f740669 to your computer and use it in GitHub Desktop.
Save daxanya2/00c1ed13d0c25f740669 to your computer and use it in GitHub Desktop.
NYAGOSとconemuでキーボード操作の拡張 ref: http://qiita.com/daxanya1/items/7d4b51bba6c8f3a6016b
-- ref) http://stackoverflow.com/questions/17386792/how-to-implement-string-rfind-in-lua
nyagos.bindkey("M_A",
function(this)
local pos = (this.text:sub(1,this.pos-1)):match'.*() '
if pos and (pos < this.pos) then
for i = 1, this.pos-pos do
this:call("BACKWARD_CHAR")
end
else
this:call("BEGINNING_OF_LINE")
end
return nil
end
)
nyagos.bindkey("M_B",
function(this)
local pos = this.text:find(' ',this.pos+1)
if pos and (pos > this.pos) then
for i = 1, pos-this.pos do
this:call("FORWARD_CHAR")
end
else
this:call("END_OF_LINE")
end
return nil
end
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment