add 'cmd-delete-word' to delete word to end
This commit is contained in:
parent
afefc30a67
commit
1a95df7b64
1
doc.go
1
doc.go
@ -74,6 +74,7 @@ keybindings:
|
|||||||
cmd-word (default '<a-f>')
|
cmd-word (default '<a-f>')
|
||||||
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>')
|
||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ keybindings:
|
|||||||
cmd-word (default '<a-f>')
|
cmd-word (default '<a-f>')
|
||||||
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>')
|
||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
|
|
||||||
|
9
eval.go
9
eval.go
@ -642,6 +642,15 @@ func (e *callExpr) eval(app *app, args []string) {
|
|||||||
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, app.ui.cmdAccRight[:ind]...)
|
app.ui.cmdAccLeft = append(app.ui.cmdAccLeft, app.ui.cmdAccRight[:ind]...)
|
||||||
app.ui.cmdAccRight = app.ui.cmdAccRight[ind:]
|
app.ui.cmdAccRight = app.ui.cmdAccRight[ind:]
|
||||||
}
|
}
|
||||||
|
case "cmd-delete-word":
|
||||||
|
if len(app.ui.cmdAccRight) > 0 {
|
||||||
|
loc := reWordEnd.FindStringIndex(string(app.ui.cmdAccRight))
|
||||||
|
if loc == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ind := loc[0] + 1
|
||||||
|
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
@ -145,6 +145,7 @@ func init() {
|
|||||||
gOpts.cmdkeys["<a-f>"] = &callExpr{"cmd-word", nil, 1}
|
gOpts.cmdkeys["<a-f>"] = &callExpr{"cmd-word", nil, 1}
|
||||||
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}
|
||||||
|
|
||||||
// TODO: implement the rest of readline keys
|
// TODO: implement the rest of readline keys
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user