add 'cmd-capitalize-word' to upcase letter
This commit is contained in:
parent
bc67283f2a
commit
0c672fef6f
39
doc.go
39
doc.go
@ -54,25 +54,26 @@ The following commands are provided by lf without default keybindings:
|
||||
The following command line commands are provided by lf with default
|
||||
keybindings:
|
||||
|
||||
cmd-escape (default '<esc>')
|
||||
cmd-comp (default '<tab>')
|
||||
cmd-enter (default '<c-j>' and '<enter>')
|
||||
cmd-hist-next (default '<c-n>')
|
||||
cmd-hist-prev (default '<c-p>')
|
||||
cmd-delete (default '<c-d>' and '<delete>')
|
||||
cmd-delete-back (default '<bs>' and '<bs2>')
|
||||
cmd-left (default '<c-b>' and '<left>')
|
||||
cmd-right (default '<c-f>' and '<right>')
|
||||
cmd-beg (default '<c-a>' and '<home>')
|
||||
cmd-end (default '<c-e>' and '<end>')
|
||||
cmd-delete-beg (default '<c-u>')
|
||||
cmd-delete-end (default '<c-k>')
|
||||
cmd-delete-word (default '<c-w>')
|
||||
cmd-put (default '<c-y>')
|
||||
cmd-transpose (default '<c-t>')
|
||||
cmd-interrupt (default '<c-c>')
|
||||
cmd-word (default '<a-f>')
|
||||
cmd-word-back (default '<a-b>')
|
||||
cmd-escape (default '<esc>')
|
||||
cmd-comp (default '<tab>')
|
||||
cmd-enter (default '<c-j>' and '<enter>')
|
||||
cmd-hist-next (default '<c-n>')
|
||||
cmd-hist-prev (default '<c-p>')
|
||||
cmd-delete (default '<c-d>' and '<delete>')
|
||||
cmd-delete-back (default '<bs>' and '<bs2>')
|
||||
cmd-left (default '<c-b>' and '<left>')
|
||||
cmd-right (default '<c-f>' and '<right>')
|
||||
cmd-beg (default '<c-a>' and '<home>')
|
||||
cmd-end (default '<c-e>' and '<end>')
|
||||
cmd-delete-beg (default '<c-u>')
|
||||
cmd-delete-end (default '<c-k>')
|
||||
cmd-delete-word (default '<c-w>')
|
||||
cmd-put (default '<c-y>')
|
||||
cmd-transpose (default '<c-t>')
|
||||
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:
|
||||
|
||||
|
39
docstring.go
39
docstring.go
@ -58,25 +58,26 @@ The following commands are provided by lf without default keybindings:
|
||||
The following command line commands are provided by lf with default
|
||||
keybindings:
|
||||
|
||||
cmd-escape (default '<esc>')
|
||||
cmd-comp (default '<tab>')
|
||||
cmd-enter (default '<c-j>' and '<enter>')
|
||||
cmd-hist-next (default '<c-n>')
|
||||
cmd-hist-prev (default '<c-p>')
|
||||
cmd-delete (default '<c-d>' and '<delete>')
|
||||
cmd-delete-back (default '<bs>' and '<bs2>')
|
||||
cmd-left (default '<c-b>' and '<left>')
|
||||
cmd-right (default '<c-f>' and '<right>')
|
||||
cmd-beg (default '<c-a>' and '<home>')
|
||||
cmd-end (default '<c-e>' and '<end>')
|
||||
cmd-delete-beg (default '<c-u>')
|
||||
cmd-delete-end (default '<c-k>')
|
||||
cmd-delete-word (default '<c-w>')
|
||||
cmd-put (default '<c-y>')
|
||||
cmd-transpose (default '<c-t>')
|
||||
cmd-interrupt (default '<c-c>')
|
||||
cmd-word (default '<a-f>')
|
||||
cmd-word-back (default '<a-b>')
|
||||
cmd-escape (default '<esc>')
|
||||
cmd-comp (default '<tab>')
|
||||
cmd-enter (default '<c-j>' and '<enter>')
|
||||
cmd-hist-next (default '<c-n>')
|
||||
cmd-hist-prev (default '<c-p>')
|
||||
cmd-delete (default '<c-d>' and '<delete>')
|
||||
cmd-delete-back (default '<bs>' and '<bs2>')
|
||||
cmd-left (default '<c-b>' and '<left>')
|
||||
cmd-right (default '<c-f>' and '<right>')
|
||||
cmd-beg (default '<c-a>' and '<home>')
|
||||
cmd-end (default '<c-e>' and '<end>')
|
||||
cmd-delete-beg (default '<c-u>')
|
||||
cmd-delete-end (default '<c-k>')
|
||||
cmd-delete-word (default '<c-w>')
|
||||
cmd-put (default '<c-y>')
|
||||
cmd-transpose (default '<c-t>')
|
||||
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