mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 09:57:51 +08:00
newedit: Add $edit:commit-eof~.
This commit is contained in:
parent
bacedb1b7d
commit
21860df2ce
|
@ -23,9 +23,18 @@ func exitBinding() error {
|
|||
|
||||
//elvish:doc-fn commit-code
|
||||
//
|
||||
// Causes the current editor session to terminate, committing the code that is
|
||||
// being edited. Internally, this works by raising a special exception.
|
||||
// Causes the Elvish REPL to end the current read iteration and evaluate the
|
||||
// code it just read. Internally, this works by raising a special exception.
|
||||
|
||||
func commitCode() error {
|
||||
return editutil.ActionError(types.CommitCode)
|
||||
}
|
||||
|
||||
//elvish:doc-fn commit-eof
|
||||
//
|
||||
// Causes the Elvish REPL to terminate. Internally, this works by raising a
|
||||
// special exception.
|
||||
|
||||
func commitEOF() error {
|
||||
return editutil.ActionError(types.CommitEOF)
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package newedit
|
|||
// Elvish code for default bindings, assuming the editor ns as the global ns.
|
||||
const defaultBindingsElv = `
|
||||
insert:binding = (binding-map [
|
||||
&Ctrl-D= $commit-eof~
|
||||
&Default= $insert:default-handler~
|
||||
])
|
||||
`
|
||||
|
|
|
@ -33,6 +33,7 @@ func NewEditor(in, out *os.File, ev *eval.Evaler) *Editor {
|
|||
"binding-map": makeBindingMap,
|
||||
"exit-binding": exitBinding,
|
||||
"commit-code": commitCode,
|
||||
"commit-eof": commitEOF,
|
||||
})
|
||||
|
||||
// Hooks
|
||||
|
|
Loading…
Reference in New Issue
Block a user