Do a first phase of command renaming

This commit is contained in:
Maxime Coste 2016-11-14 00:27:14 +00:00
parent 9d9beb7e3a
commit dcd733e5fa
4 changed files with 41 additions and 41 deletions

View File

@ -58,13 +58,13 @@ command *q!* has to be used).
*colorscheme* <name>:: *colorscheme* <name>::
load named colorscheme load named colorscheme
*nameclient* <name>:: *rename-client* <name>::
set current client name set current client name
*namebuf* <name>:: *rename-buffer* <name>::
set current buffer name set current buffer name
*namesession* <name>:: *rename-session* <name>::
set current session name set current session name
*echo* [options] <text>:: *echo* [options] <text>::
@ -99,7 +99,7 @@ command *q!* has to be used).
remove an alias if its current value is the same as the one passed remove an alias if its current value is the same as the one passed
as an optional parameter, remove it unconditionally otherwise as an optional parameter, remove it unconditionally otherwise
*decl* [-hidden] <type> <name> [<value>]:: *declare-option* [-hidden] <type> <name> [<value>]::
declare a new option, the -hidden hides the option in completion declare a new option, the -hidden hides the option in completion
suggestions (c.f. the 'options' documentation page) suggestions (c.f. the 'options' documentation page)
@ -114,7 +114,7 @@ command *q!* has to be used).
execute commands, as if they were entered in the command prompt execute commands, as if they were entered in the command prompt
(c.f. the 'execeval' documentation page) (c.f. the 'execeval' documentation page)
*def* [<flags>] <name> <command>:: *define-command* [<flags>] <name> <command>::
define a new command (c.f. the 'Declaring new commands' section below) define a new command (c.f. the 'Declaring new commands' section below)
*map* <scope> <mode> <key> <keys>:: *map* <scope> <mode> <key> <keys>::
@ -134,15 +134,15 @@ command *q!* has to be used).
execute a command whenever an event is triggered (c.f. the 'hooks' execute a command whenever an event is triggered (c.f. the 'hooks'
documentation page) documentation page)
*rmhooks* <scope> <group>:: *remove-hooks* <scope> <group>::
remove every hooks in *scope* that are part of the given *group* remove every hooks in *scope* that are part of the given *group*
(c.f. the 'hooks' documentation page) (c.f. the 'hooks' documentation page)
*addhl* [<flags>] <highlighter_name> <highlighter_parameters> ...:: *add-highlighter* [<flags>] <highlighter_name> <highlighter_parameters> ...::
add a highlighter to the current window (c.f. the 'highlighters' add a highlighter to the current window (c.f. the 'highlighters'
documentation page) documentation page)
*rmhl* <highlighter_id>:: *remove-highlighter* <highlighter_id>::
remove the highlighter whose id is *highlighter_id* (c.f. the remove the highlighter whose id is *highlighter_id* (c.f. the
'highlighters' documentation page) 'highlighters' documentation page)
@ -206,9 +206,9 @@ backslash (\;) to be considered as a literal semicolon argument
Declaring new commands Declaring new commands
---------------------- ----------------------
New commands can be defined using the *def* command: New commands can be defined using the *define-command* command:
*def* [flags] <command_name> <commands>:: *define-command* [flags] <command_name> <commands>::
*commands* is a string containing the commands to execute, and *flags* *commands* is a string containing the commands to execute, and *flags*
can be any combination of the following parameters: can be any combination of the following parameters:

View File

@ -12,7 +12,7 @@ addhl -group / regions -default code kakrc \
# Grammar # Grammar
keywords="hook|rmhooks|addhl|rmhl|exec|eval|source|runtime|def|alias" keywords="hook|rmhooks|addhl|rmhl|exec|eval|source|runtime|def|alias"
keywords="${keywords}|unalias|decl|echo|edit|set|map|face|prompt|menu|info" keywords="${keywords}|unalias|decl|echo|edit|set|map|face|prompt|menu|info"
keywords="${keywords}|try|catch|nameclient|namebuf|cd|colorscheme" keywords="${keywords}|try|catch|rename-client|rename-buffer|rename-session|change-directory|colorscheme"
values="default|black|red|green|yellow|blue|magenta|cyan|white" values="default|black|red|green|yellow|blue|magenta|cyan|white"
# Add the language's grammar to the static completion list # Add the language's grammar to the static completion list

View File

@ -128,7 +128,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n
printf %s "edit '$msgfile' printf %s "edit '$msgfile'
hook buffer BufWritePost '.*\Q$msgfile\E' %{ %sh{ hook buffer BufWritePost '.*\Q$msgfile\E' %{ %sh{
if git commit -F '$msgfile' --cleanup=strip $@ > /dev/null; then if git commit -F '$msgfile' --cleanup=strip $@ > /dev/null; then
printf %s 'eval -client $kak_client echo -color Information Commit succeeded; delbuf' printf %s 'eval -client $kak_client echo -color Information Commit succeeded; delete-buffer'
else else
printf %s 'eval -client $kak_client echo -color Error Commit failed' printf %s 'eval -client $kak_client echo -color Error Commit failed'
fi fi

View File

@ -348,7 +348,7 @@ void write_all_buffers()
} }
const CommandDesc writeall_cmd = { const CommandDesc writeall_cmd = {
"writeall", "write-all",
"wa", "wa",
"write all buffers that are associated to a file", "write all buffers that are associated to a file",
no_params, no_params,
@ -449,8 +449,8 @@ void write_quit(const ParametersParser& parser, Context& context,
} }
const CommandDesc write_quit_cmd = { const CommandDesc write_quit_cmd = {
"write-quit",
"wq", "wq",
nullptr,
"write current buffer and quit current client", "write current buffer and quit current client",
no_params, no_params,
CommandFlags::None, CommandFlags::None,
@ -460,8 +460,8 @@ const CommandDesc write_quit_cmd = {
}; };
const CommandDesc force_write_quit_cmd = { const CommandDesc force_write_quit_cmd = {
"write-quit!",
"wq!", "wq!",
nullptr,
"write current buffer and quit current client, even if other buffers are " "write current buffer and quit current client, even if other buffers are "
"not saved", "not saved",
no_params, no_params,
@ -472,8 +472,8 @@ const CommandDesc force_write_quit_cmd = {
}; };
const CommandDesc writeall_quit_cmd = { const CommandDesc writeall_quit_cmd = {
"write-all-quit",
"waq", "waq",
nullptr,
"write all buffers associated to a file and quit current client", "write all buffers associated to a file and quit current client",
no_params, no_params,
CommandFlags::None, CommandFlags::None,
@ -537,9 +537,9 @@ void cycle_buffer(const ParametersParser& parser, Context& context, const ShellC
} }
const CommandDesc buffernext_cmd = { const CommandDesc buffernext_cmd = {
"buffernext", "buffer-next",
"bn", "bn",
"buffernext: move to the next buffer in the list", "buffer-next: move to the next buffer in the list",
no_params, no_params,
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
@ -548,9 +548,9 @@ const CommandDesc buffernext_cmd = {
}; };
const CommandDesc bufferprev_cmd = { const CommandDesc bufferprev_cmd = {
"bufferprev", "buffer-prev",
"bp", "bp",
"bufferprev: move to the previous buffer in the list", "buffer-prev: move to the previous buffer in the list",
no_params, no_params,
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
@ -570,9 +570,9 @@ void delete_buffer(const ParametersParser& parser, Context& context, const Shell
} }
const CommandDesc delbuf_cmd = { const CommandDesc delbuf_cmd = {
"delbuf", "delete-buffer",
"db", "db",
"delbuf [name]: delete current buffer or the buffer named <name> if given", "delete-buffer [name]: delete current buffer or the buffer named <name> if given",
single_optional_name_param, single_optional_name_param,
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
@ -581,9 +581,9 @@ const CommandDesc delbuf_cmd = {
}; };
const CommandDesc force_delbuf_cmd = { const CommandDesc force_delbuf_cmd = {
"delbuf!", "delete-buffer!",
"db!", "db!",
"delbuf! [name]: delete current buffer or the buffer named <name> if " "delete-buffer! [name]: delete current buffer or the buffer named <name> if "
"given, even if the buffer is unsaved", "given, even if the buffer is unsaved",
single_optional_name_param, single_optional_name_param,
CommandFlags::None, CommandFlags::None,
@ -593,9 +593,9 @@ const CommandDesc force_delbuf_cmd = {
}; };
const CommandDesc namebuf_cmd = { const CommandDesc namebuf_cmd = {
"namebuf", "rename-buffer",
nullptr, nullptr,
"namebuf <name>: change current buffer name", "rename-buffer <name>: change current buffer name",
single_name_param, single_name_param,
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
@ -673,9 +673,9 @@ Highlighter& get_highlighter(const Context& context, StringView path)
} }
const CommandDesc add_highlighter_cmd = { const CommandDesc add_highlighter_cmd = {
"add-highlighter",
"addhl", "addhl",
"ah", "add-highlighter <type> <type params>...: add an highlighter",
"addhl <type> <type params>...: add an highlighter",
ParameterDesc{ ParameterDesc{
{ { "group", { true, "Set the group in which to put the highlighter. " { { "group", { true, "Set the group in which to put the highlighter. "
"If starting with /, search in shared highlighters, " "If starting with /, search in shared highlighters, "
@ -719,9 +719,9 @@ const CommandDesc add_highlighter_cmd = {
}; };
const CommandDesc rm_highlighter_cmd = { const CommandDesc rm_highlighter_cmd = {
"remove-highlighter",
"rmhl", "rmhl",
"rh", "add-highlighter <path>: remove highlighter <name>",
"rmhl <path>: remove highlighter <name>",
ParameterDesc{ {}, ParameterDesc::Flags::None, 1, 1 }, ParameterDesc{ {}, ParameterDesc::Flags::None, 1, 1 },
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
@ -780,9 +780,9 @@ const CommandDesc add_hook_cmd = {
}; };
const CommandDesc rm_hook_cmd = { const CommandDesc rm_hook_cmd = {
"remove-hooks",
"rmhooks", "rmhooks",
nullptr, "remove-hooks <scope> <group>: remove all hooks whose group is <group>",
"rmhooks <scope> <group>: remove all hooks whose group is <group>",
ParameterDesc{ {}, ParameterDesc::Flags::None, 2, 2 }, ParameterDesc{ {}, ParameterDesc::Flags::None, 2, 2 },
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
@ -985,9 +985,9 @@ void define_command(const ParametersParser& parser, Context& context, const Shel
} }
const CommandDesc define_command_cmd = { const CommandDesc define_command_cmd = {
"define-command",
"def", "def",
nullptr, "define-command <switches> <name> <cmds>: define a command <name> executing <cmds>",
"def <switches> <name> <cmds>: define a command <name> executing <cmds>",
ParameterDesc{ ParameterDesc{
{ { "params", { true, "take parameters, accessible to each shell escape as $0..$N\n" { { "params", { true, "take parameters, accessible to each shell escape as $0..$N\n"
"parameter should take the form <count> or <min>..<max> (both omittable)" } }, "parameter should take the form <count> or <min>..<max> (both omittable)" } },
@ -1254,9 +1254,9 @@ const CommandDesc unset_option_cmd = {
}; };
const CommandDesc declare_option_cmd = { const CommandDesc declare_option_cmd = {
"declare-option",
"decl", "decl",
nullptr, "declare-option <type> <name> [value]: declare option <name> of type <type>.\n"
"decl <type> <name> [value]: declare option <name> of type <type>.\n"
"set its initial value to <value> if given and the option did not exist\n" "set its initial value to <value> if given and the option did not exist\n"
"Available types:\n" "Available types:\n"
" int: integer\n" " int: integer\n"
@ -1909,7 +1909,7 @@ const CommandDesc face_cmd = {
}; };
const CommandDesc set_client_name_cmd = { const CommandDesc set_client_name_cmd = {
"nameclient", "rename-client",
"nc", "nc",
"nameclient <name>: set current client name to <name>", "nameclient <name>: set current client name to <name>",
single_name_param, single_name_param,
@ -1954,9 +1954,9 @@ const CommandDesc select_cmd = {
}; };
const CommandDesc change_working_directory_cmd = { const CommandDesc change_working_directory_cmd = {
"change-directory",
"cd", "cd",
nullptr, "change-directory [<directory>]: change the server's working directory to <directory>, or the home directory if unspecified",
"cd [<directory>]: change the server's working directory to <directory>, or the home directory if unspecified",
single_optional_name_param, single_optional_name_param,
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
@ -1979,9 +1979,9 @@ const CommandDesc change_working_directory_cmd = {
}; };
const CommandDesc set_session_name = { const CommandDesc set_session_name = {
"namesession", "rename-session",
nullptr, nullptr,
"namesession <name>: change remote session name", "rename-session <name>: change remote session name",
ParameterDesc{{}, ParameterDesc::Flags::None, 1, 1}, ParameterDesc{{}, ParameterDesc::Flags::None, 1, 1},
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},