diff --git a/doc.go b/doc.go index 2b7da17..ccb1221 100644 --- a/doc.go +++ b/doc.go @@ -76,6 +76,7 @@ keybindings: cmd-capitalize-word (default '') cmd-delete-word (default '') cmd-uppercase-word (default '') + cmd-lowercase-word (default '') The following options can be used to customize the behavior of lf: diff --git a/docstring.go b/docstring.go index ebf6da4..36a615a 100644 --- a/docstring.go +++ b/docstring.go @@ -80,6 +80,7 @@ keybindings: cmd-capitalize-word (default '') cmd-delete-word (default '') cmd-uppercase-word (default '') + cmd-lowercase-word (default '') The following options can be used to customize the behavior of lf: diff --git a/eval.go b/eval.go index 8a29b98..57d0baa 100644 --- a/eval.go +++ b/eval.go @@ -661,6 +661,16 @@ func (e *callExpr) eval(app *app, args []string) { app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(strings.ToUpper(string(app.ui.cmdAccRight[:ind])))...) app.ui.cmdAccRight = app.ui.cmdAccRight[ind:] } + case "cmd-lowercase-word": + if len(app.ui.cmdAccRight) > 0 { + loc := reWordEnd.FindStringIndex(string(app.ui.cmdAccRight)) + if loc == nil { + return + } + ind := loc[0] + 1 + app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, []rune(strings.ToLower(string(app.ui.cmdAccRight[:ind])))...) + app.ui.cmdAccRight = app.ui.cmdAccRight[ind:] + } default: cmd, ok := gOpts.cmds[e.name] if !ok { diff --git a/opts.go b/opts.go index 746b39e..e38123a 100644 --- a/opts.go +++ b/opts.go @@ -147,6 +147,7 @@ func init() { gOpts.cmdkeys[""] = &callExpr{"cmd-capitalize-word", nil, 1} gOpts.cmdkeys[""] = &callExpr{"cmd-delete-word", nil, 1} gOpts.cmdkeys[""] = &callExpr{"cmd-uppercase-word", nil, 1} + gOpts.cmdkeys[""] = &callExpr{"cmd-lowercase-word", nil, 1} // TODO: implement the rest of readline keys