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
|
The following command line commands are provided by lf with default
|
||||||
keybindings:
|
keybindings:
|
||||||
|
|
||||||
cmd-escape (default '<esc>')
|
cmd-escape (default '<esc>')
|
||||||
cmd-comp (default '<tab>')
|
cmd-comp (default '<tab>')
|
||||||
cmd-enter (default '<c-j>' and '<enter>')
|
cmd-enter (default '<c-j>' and '<enter>')
|
||||||
cmd-hist-next (default '<c-n>')
|
cmd-hist-next (default '<c-n>')
|
||||||
cmd-hist-prev (default '<c-p>')
|
cmd-hist-prev (default '<c-p>')
|
||||||
cmd-delete (default '<c-d>' and '<delete>')
|
cmd-delete (default '<c-d>' and '<delete>')
|
||||||
cmd-delete-back (default '<bs>' and '<bs2>')
|
cmd-delete-back (default '<bs>' and '<bs2>')
|
||||||
cmd-left (default '<c-b>' and '<left>')
|
cmd-left (default '<c-b>' and '<left>')
|
||||||
cmd-right (default '<c-f>' and '<right>')
|
cmd-right (default '<c-f>' and '<right>')
|
||||||
cmd-beg (default '<c-a>' and '<home>')
|
cmd-beg (default '<c-a>' and '<home>')
|
||||||
cmd-end (default '<c-e>' and '<end>')
|
cmd-end (default '<c-e>' and '<end>')
|
||||||
cmd-delete-beg (default '<c-u>')
|
cmd-delete-beg (default '<c-u>')
|
||||||
cmd-delete-end (default '<c-k>')
|
cmd-delete-end (default '<c-k>')
|
||||||
cmd-delete-word (default '<c-w>')
|
cmd-delete-word (default '<c-w>')
|
||||||
cmd-put (default '<c-y>')
|
cmd-put (default '<c-y>')
|
||||||
cmd-transpose (default '<c-t>')
|
cmd-transpose (default '<c-t>')
|
||||||
cmd-interrupt (default '<c-c>')
|
cmd-interrupt (default '<c-c>')
|
||||||
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>')
|
||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
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
|
The following command line commands are provided by lf with default
|
||||||
keybindings:
|
keybindings:
|
||||||
|
|
||||||
cmd-escape (default '<esc>')
|
cmd-escape (default '<esc>')
|
||||||
cmd-comp (default '<tab>')
|
cmd-comp (default '<tab>')
|
||||||
cmd-enter (default '<c-j>' and '<enter>')
|
cmd-enter (default '<c-j>' and '<enter>')
|
||||||
cmd-hist-next (default '<c-n>')
|
cmd-hist-next (default '<c-n>')
|
||||||
cmd-hist-prev (default '<c-p>')
|
cmd-hist-prev (default '<c-p>')
|
||||||
cmd-delete (default '<c-d>' and '<delete>')
|
cmd-delete (default '<c-d>' and '<delete>')
|
||||||
cmd-delete-back (default '<bs>' and '<bs2>')
|
cmd-delete-back (default '<bs>' and '<bs2>')
|
||||||
cmd-left (default '<c-b>' and '<left>')
|
cmd-left (default '<c-b>' and '<left>')
|
||||||
cmd-right (default '<c-f>' and '<right>')
|
cmd-right (default '<c-f>' and '<right>')
|
||||||
cmd-beg (default '<c-a>' and '<home>')
|
cmd-beg (default '<c-a>' and '<home>')
|
||||||
cmd-end (default '<c-e>' and '<end>')
|
cmd-end (default '<c-e>' and '<end>')
|
||||||
cmd-delete-beg (default '<c-u>')
|
cmd-delete-beg (default '<c-u>')
|
||||||
cmd-delete-end (default '<c-k>')
|
cmd-delete-end (default '<c-k>')
|
||||||
cmd-delete-word (default '<c-w>')
|
cmd-delete-word (default '<c-w>')
|
||||||
cmd-put (default '<c-y>')
|
cmd-put (default '<c-y>')
|
||||||
cmd-transpose (default '<c-t>')
|
cmd-transpose (default '<c-t>')
|
||||||
cmd-interrupt (default '<c-c>')
|
cmd-interrupt (default '<c-c>')
|
||||||
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>')
|
||||||
|
|
||||||
The following options can be used to customize the behavior of lf:
|
The following options can be used to customize the behavior of lf:
|
||||||
|
|
||||||
|
12
eval.go
12
eval.go
@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"unicode"
|
||||||
"unicode/utf8"
|
"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.cmdAccRight = append(app.ui.cmdAccLeft[ind:], app.ui.cmdAccRight...)
|
||||||
app.ui.cmdAccLeft = app.ui.cmdAccLeft[:ind]
|
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:
|
default:
|
||||||
cmd, ok := gOpts.cmds[e.name]
|
cmd, ok := gOpts.cmds[e.name]
|
||||||
if !ok {
|
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["<c-c>"] = &callExpr{"cmd-interrupt", nil, 1}
|
||||||
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}
|
||||||
|
|
||||||
// TODO: implement the rest of readline keys
|
// TODO: implement the rest of readline keys
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user