add 'cmd-uppercase-word' to upcase word to end
This commit is contained in:
parent
1a95df7b64
commit
18f6d954a7
1
doc.go
1
doc.go
@ -75,6 +75,7 @@ keybindings:
|
|||||||
cmd-word-back (default '<a-b>')
|
cmd-word-back (default '<a-b>')
|
||||||
cmd-capitalize-word (default '<a-c>')
|
cmd-capitalize-word (default '<a-c>')
|
||||||
cmd-delete-word (default '<a-d>')
|
cmd-delete-word (default '<a-d>')
|
||||||
|
cmd-uppercase-word (default '<a-u>')
|
||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ keybindings:
|
|||||||
cmd-word-back (default '<a-b>')
|
cmd-word-back (default '<a-b>')
|
||||||
cmd-capitalize-word (default '<a-c>')
|
cmd-capitalize-word (default '<a-c>')
|
||||||
cmd-delete-word (default '<a-d>')
|
cmd-delete-word (default '<a-d>')
|
||||||
|
cmd-uppercase-word (default '<a-u>')
|
||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
|
|
||||||
|
10
eval.go
10
eval.go
@ -651,6 +651,16 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
ind := loc[0] + 1
|
ind := loc[0] + 1
|
||||||
app.ui.cmdAccRight = app.ui.cmdAccRight[ind:]
|
app.ui.cmdAccRight = app.ui.cmdAccRight[ind:]
|
||||||
}
|
}
|
||||||
|
case "cmd-uppercase-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.ToUpper(string(app.ui.cmdAccRight[:ind])))...)
|
||||||
|
app.ui.cmdAccRight = app.ui.cmdAccRight[ind:]
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
cmd, ok := gOpts.cmds[e.name]
|
cmd, ok := gOpts.cmds[e.name]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
1
opts.go
1
opts.go
@ -146,6 +146,7 @@ func init() {
|
|||||||
gOpts.cmdkeys["<a-b>"] = &callExpr{"cmd-word-back", nil, 1}
|
gOpts.cmdkeys["<a-b>"] = &callExpr{"cmd-word-back", nil, 1}
|
||||||
gOpts.cmdkeys["<a-c>"] = &callExpr{"cmd-capitalize-word", nil, 1}
|
gOpts.cmdkeys["<a-c>"] = &callExpr{"cmd-capitalize-word", nil, 1}
|
||||||
gOpts.cmdkeys["<a-d>"] = &callExpr{"cmd-delete-word", nil, 1}
|
gOpts.cmdkeys["<a-d>"] = &callExpr{"cmd-delete-word", nil, 1}
|
||||||
|
gOpts.cmdkeys["<a-u>"] = &callExpr{"cmd-uppercase-word", nil, 1}
|
||||||
|
|
||||||
// TODO: implement the rest of readline keys
|
// TODO: implement the rest of readline keys
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user