mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 10:01:39 -05:00
Add Ctrl-Enter: execute completion and keep commandline
This commit is contained in:
parent
e11008a616
commit
d835d363b4
2 changed files with 14 additions and 9 deletions
|
@ -179,16 +179,9 @@ export function getCommandlineFns(cmdline_state: {
|
||||||
return messageOwnTab("controller_content", "acceptExCmd", [command])
|
return messageOwnTab("controller_content", "acceptExCmd", [command])
|
||||||
},
|
},
|
||||||
|
|
||||||
execute_ex_on_completion_args: (excmd: string) => {
|
execute_ex_on_completion_args: (excmd: string) => execute_ex_on_x(true, cmdline_state, excmd),
|
||||||
const args = cmdline_state.getCompletion(true)
|
|
||||||
|
|
||||||
const cmdToExec = excmd + " " + args
|
execute_ex_on_completion: (excmd: string) => execute_ex_on_x(false, cmdline_state, excmd),
|
||||||
cmdline_state.fns.store_ex_string(cmdToExec)
|
|
||||||
|
|
||||||
return messageOwnTab("controller_content", "acceptExCmd", [
|
|
||||||
cmdToExec,
|
|
||||||
])
|
|
||||||
},
|
|
||||||
|
|
||||||
copy_completion: () => {
|
copy_completion: () => {
|
||||||
const command = cmdline_state.getCompletion()
|
const command = cmdline_state.getCompletion()
|
||||||
|
@ -199,3 +192,14 @@ export function getCommandlineFns(cmdline_state: {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function execute_ex_on_x(args_only: boolean, cmdline_state, excmd: string){
|
||||||
|
const args = cmdline_state.getCompletion(args_only) || cmdline_state.clInput.value
|
||||||
|
|
||||||
|
const cmdToExec = (excmd ? excmd : "") + " " + args
|
||||||
|
cmdline_state.fns.store_ex_string(cmdToExec)
|
||||||
|
|
||||||
|
return messageOwnTab("controller_content", "acceptExCmd", [
|
||||||
|
cmdToExec,
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ export class default_config {
|
||||||
*/
|
*/
|
||||||
exmaps = {
|
exmaps = {
|
||||||
"<Enter>": "ex.accept_line",
|
"<Enter>": "ex.accept_line",
|
||||||
|
"<C-Enter>": "ex.execute_ex_on_completion",
|
||||||
"<C-j>": "ex.accept_line",
|
"<C-j>": "ex.accept_line",
|
||||||
"<C-m>": "ex.accept_line",
|
"<C-m>": "ex.accept_line",
|
||||||
"<Escape>": "ex.hide_and_clear",
|
"<Escape>": "ex.hide_and_clear",
|
||||||
|
|
Loading…
Add table
Reference in a new issue