add 'cmd-capitalize-word' to upcase letter
This commit is contained in:
parent
bc67283f2a
commit
0c672fef6f
1
doc.go
1
doc.go
@ -73,6 +73,7 @@ keybindings:
|
||||
cmd-interrupt (default '<c-c>')
|
||||
cmd-word (default '<a-f>')
|
||||
cmd-word-back (default '<a-b>')
|
||||
cmd-capitalize-word (default '<a-c>')
|
||||
|
||||
The following options can be used to customize the behavior of lf:
|
||||
|
||||
|
@ -77,6 +77,7 @@ keybindings:
|
||||
cmd-interrupt (default '<c-c>')
|
||||
cmd-word (default '<a-f>')
|
||||
cmd-word-back (default '<a-b>')
|
||||
cmd-capitalize-word (default '<a-c>')
|
||||
|
||||
The following options can be used to customize the behavior of lf:
|
||||
|
||||
|
12
eval.go
12
eval.go
@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
@ -630,6 +631,17 @@ func (e *callExpr) eval(app *app, args []string) {
|
||||
app.ui.cmdAccRight = append(app.ui.cmdAccLeft[ind:], app.ui.cmdAccRight...)
|
||||
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:ind]
|
||||
}
|
||||
case "cmd-capitalize-word":
|
||||
if len(app.ui.cmdAccRight) > 0 {
|
||||
app.ui.cmdAccRight[0] = unicode.ToUpper(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, app.ui.cmdAccRight[:ind]...)
|
||||
app.ui.cmdAccRight = app.ui.cmdAccRight[ind:]
|
||||
}
|
||||
default:
|
||||
cmd, ok := gOpts.cmds[e.name]
|
||||
if !ok {
|
||||
|
1
opts.go
1
opts.go
@ -144,6 +144,7 @@ func init() {
|
||||
gOpts.cmdkeys["<c-c>"] = &callExpr{"cmd-interrupt", nil, 1}
|
||||
gOpts.cmdkeys["<a-f>"] = &callExpr{"cmd-word", nil, 1}
|
||||
gOpts.cmdkeys["<a-b>"] = &callExpr{"cmd-word-back", nil, 1}
|
||||
gOpts.cmdkeys["<a-c>"] = &callExpr{"cmd-capitalize-word", nil, 1}
|
||||
|
||||
// TODO: implement the rest of readline keys
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user