Commit Graph

130 Commits

Author SHA1 Message Date
Maxime Coste
047488a8da Fix recursive string parsing, correct handling of escapes 2014-06-26 18:59:41 +01:00
Maxime Coste
7235180614 Use main selection index as default when accessing only one register value
Fixes #117
2014-06-21 11:31:08 +01:00
Maxime Coste
9aa8c8a60a Add a %val{...} expand type
%val{name} gives access to values given in shell through $kak_<name>
2014-06-18 19:32:13 +01:00
Maxime Coste
d33554a1cc Add support for long names for registers
We can now access register / with the name slash, * with star,
and | with pipe

Fixes #23
2014-06-06 00:49:36 +01:00
Maxime Coste
2d5c730441 Replace CommandManager::register_command*s* with register_alias 2014-06-06 00:21:12 +01:00
Maxime Coste
8356e44ad5 Improve error reporting when parsing commands
*debug* will contain line and column informations along
with the responsible command name.
2014-05-07 20:39:59 +01:00
Maxime Coste
36620f8cc8 Wrap command completion containing spaces, semicolons or quotes in double quotes 2014-05-05 12:54:23 +01:00
Maxime Coste
5db3b51843 Add command aliases in command info
Fixes #101
2014-05-03 16:00:03 +01:00
Maxime Coste
65c818b859 Use StringView in CommandManager 2014-04-21 21:49:25 +01:00
Maxime Coste
20d20ae1dc formatting changes in command_manager.cc 2014-04-08 19:55:31 +01:00
Maxime Coste
3c40ac50af Add %rec{...} string that recursively expand %block inside
the result is then used as one token
2014-04-03 23:57:14 +01:00
Maxime Coste
8e0b5d67aa Fix segfault in get_until_delimiter 2014-03-05 20:57:12 +00:00
Maxime Coste
8ac19edf67 Add a docstring to commands 2014-03-02 01:08:11 +00:00
Maxime Coste
486d1269e0 Consistently name -foo things 'switches' 2014-03-02 01:08:11 +00:00
Maxime Coste
9451782648 Add command switches information, and automatically display it 2014-03-02 01:08:11 +00:00
Maxime Coste
7f9f887b4a All commands now take directly a parameter parser
The command parameters description are now stored in a ParameterDesc
structure.
2014-03-02 01:08:11 +00:00
Maxime Coste
aceee75ed9 Tolerate invalid %...{} when completing 2014-02-27 06:44:14 +00:00
Maxime Coste
37b4eacdc8 Rework command completion to allow partial token completion
Implement hook completion.

fixes #44
2014-01-27 19:51:58 +00:00
Maxime Coste
26e8c45282 CommandManager: support completion of chained commands
Command completion now work after a command separator (;)

fixes #19
2014-01-03 20:07:40 +00:00
Maxime Coste
a34b943749 Support completing %opt{...} and %sh{...} in command manager 2013-12-30 14:22:18 +00:00
Maxime Coste
56c3d9d137 Few cleanups in the command line parsing code 2013-12-29 18:37:48 +00:00
Maxime Coste
fd17ea00dd CommandManager: use aliases for commands rather than duplicating data
Completion now only proposes full command names
2013-12-24 02:06:22 +00:00
Maxime Coste
7f4d906774 move is_horizontal_blank to unicode.hh 2013-11-17 23:06:40 +00:00
Maxime Coste
04ae48c346 indent cleanup, correct erroneous 3 spaces indent 2013-11-14 00:12:15 +00:00
Maxime Coste
0244112af4 Add support for hidden commands, that will not show on completion 2013-11-12 19:38:19 +00:00
Maxime Coste
3e1bb777ce Add automatic completion display in prompt mode
Controlled by the autoshowcompl option
Completers now take a CompletionFlag parameter, used to specify
we want fast completion (tag completion can be slow, we do not
want to run it if not explicitely wanted by the user).
2013-11-04 21:59:28 +00:00
Maxime Coste
5ae43acf94 Add prefix_match function and use it instead of adhoc code 2013-09-23 21:16:25 +02:00
Maxime Coste
af8e8d27d4 Minor code cleanups 2013-07-28 16:40:02 +02:00
Maxime Coste
eedd37c09a memoryview: always pass by value 2013-07-26 01:50:36 +02:00
Maxime Coste
b1f31d2e12 change string parsing behaviour in command manager
* single and doubly quoted strings correctly remove the \ when their
delimiter is quoted ('\'' is interpreted as ', not \')

* %{} strings do not support quoting when using matching pairs, so
  %{\} is interpreted as \, however when using same ending character
  as delimiter quoting still works: %~\~~ is interpreted as ~.
2013-06-27 19:07:26 +01:00
Maxime Coste
6d125e6c36 do not use std::{to_string,stoi} as they cause problems with cygwin 2013-06-19 19:29:05 +01:00
Maxime Coste
26f0fd4cc6 Use more std::* for string handling 2013-05-13 18:43:38 +02:00
Maxime Coste
385241d2c0 remove String::replace, use boost::regex_replace directly 2013-04-12 19:16:55 +02:00
Maxime Coste
270e950cf1 sort includes directives 2013-04-09 20:05:40 +02:00
Maxime Coste
5adee4a6a7 rename assert to kak_assert to avoid collisions 2013-04-09 20:04:11 +02:00
Maxime Coste
a19a788b94 CommandManager: fix some crashes 2013-03-19 18:58:21 +01:00
Maxime Coste
fac222a427 Strongly typed options support
* non builtins options require declaration using the decl command

* At the moment, only int and string options are supported, however
the goal of this change is to provide a consistent way to support
more complex options, namely lists and booleans
2013-03-05 18:49:26 +01:00
Maxime Coste
4b649d386c various code style fixes 2013-01-04 18:39:13 +01:00
Maxime Coste
b090465e80 Command line parsing: support empty strings 2012-12-15 17:47:50 +01:00
Maxime Coste
73c446e379 code style cleanup in CommandManager 2012-11-22 14:28:14 +01:00
Maxime Coste
3b5530ac09 rename (hook|option)_manager to (hook|option)s.
And Global(Hook|Option)Manager to Global(Hook|Option)s
2012-11-22 13:50:29 +01:00
Maxime Coste
9d04c773c1 CommandManager: diagnose unterminated strings 2012-11-21 13:56:52 +01:00
Maxime Coste
0ce6bd9bf5 use ByteCount instead of CharCount when we are really counting bytes
(that is most of the time when we are not concerned with displaying)
2012-10-11 00:41:48 +02:00
Maxime Coste
c7272e427d get rid of Character 2012-10-08 19:33:53 +02:00
Maxime Coste
ae76b7dddc Add support for shell script parameters
Now %sh{ ... } can access positional parameters through
standard shell construct, allowing simple handling of variable
parameters.

def command accepts -shell-params flag to use this facility.
2012-09-09 17:10:53 +02:00
Maxime Coste
d530a2d864 Support # comments in commands 2012-09-04 00:04:49 +02:00
Maxime Coste
2825bc3d7b Fix escaped whitespace handling in command manager 2012-08-29 21:50:48 +02:00
Maxime Coste
e4fd839dda use a strongly typed int CharCount for character counts 2012-08-23 23:56:35 +02:00
Maxime Coste
346108ec62 CommandManager::parse: fix invalid memory read 2012-08-15 17:34:01 +02:00
Maxime Coste
0a976cd309 CommandManager: support %reg{<reg>} and %opt{<option>} syntax 2012-08-11 12:13:48 +02:00
Maxime Coste
a38a9c3bf2 Commands take a mutable context, main_context is gone ! 2012-08-06 22:02:11 +02:00
Maxime Coste
a712dd5bbe Completions functions take a Context parameter 2012-08-06 21:37:43 +02:00
Maxime Coste
39797f87dc command_manager: cleanup command execution, lazy exec shell commands 2012-08-06 19:29:51 +02:00
Maxime Coste
407782a742 command_manager.cc: use anonymous namespace 2012-08-02 06:41:55 +02:00
Maxime Coste
2071db3558 Tokens are CommandManager implementation details
CommandParameters go back to memoryview<String>
2012-08-01 14:27:34 +02:00
Maxime Coste
36070dd429 CommandManager: rework command parser
a new type of strings is supported inspired by the ruby strings.
%<delimiter>content<delimiter>, if opening delimiter is one of
([{<, then closing delimiter is the matching )]}> and balanced
delimiters in the string needs not to be escaped, else the closing
delimiter is the same as the opening one.

shell expansion is available through %sh<delimiter>command<delimiter>
syntax.

Command flags have been removed, as these strings provide proper nesting
support, so now, you can for example do:

def command %{ echo %sh{ ls } }
2012-07-31 14:22:57 +02:00
Maxime Coste
b65f8cc887 CommandParameters is a list of Tokens instead of Strings
CommandManager string parsing is less ad-hoc.
2012-07-31 00:06:50 +02:00
Maxime Coste
589aad5f9c sort command names completion candidates 2012-06-02 15:49:56 +00:00
Maxime Coste
f972428823 The def command do not override commands by default, use -allow-override 2012-06-02 15:49:35 +00:00
Maxime Coste
96c440fcaa CommandManager::execute can take an optional EnvVarMap argument which is used for shell evaluation 2012-05-29 05:42:26 +00:00
Maxime Coste
8fedbbf07b ShellManager::eval now takes an additional env_var map 2012-05-29 05:19:27 +00:00
Maxime Coste
0c596a9d64 Add a ShellManager which handles executing shell commands
ShellManager provides shell commands with environement variable
to retrieve some internal values in the shell parameters.
2012-05-03 07:25:13 +00:00
Maxime Coste
9337938403 replace std::string references with String 2012-04-14 01:17:09 +00:00
Maxime Coste
f2fd2b125a support read error in shell_eval 2012-03-08 21:15:37 +00:00
Maxime Coste
454258a495 fix shell_eval when no buffer in context 2012-03-04 19:42:31 +00:00
Maxime Coste
91f2292ec5 Support shell expansion in place of command name in command manager 2012-02-15 14:19:57 +00:00
Maxime Coste
2c8a6ca56a Support shell commands expansion in CommandManager 2012-02-13 21:38:07 +00:00
Maxime Coste
0483e951ad use memoryview instead of std::vector where applicable 2012-02-03 19:14:35 +00:00
Maxime Coste
f259af9326 CommandManager: add flags support and IgnoreSemiColons flag
commands are now registred with flags, and the IgnoreSemiColons
flag permit to specify a command which needs all the parameters
on the line, bypassing the command sequence operator ';'.

the hook command is tagged as such.
2012-01-15 03:02:08 +00:00
Maxime Coste
4a5758ebb3 CommandManager: support ';' as a command separator 2012-01-15 01:37:35 +00:00
Maxime Coste
95db828e17 CommandManager: use directly first command parameter as the command name 2012-01-14 14:02:54 +00:00
Maxime Coste
e36153f035 CommandManager: fix complete and style tweak 2011-11-26 19:05:49 +00:00
Maxime Coste
957446dee4 Add a Context parameter to commands 2011-11-26 18:32:57 +00:00
Maxime Coste
417802cbdf CommandManager: argument splitting supports "multi word"
works with " and '
2011-11-26 17:20:02 +00:00
Maxime Coste
712577b88e CommandManager: fix completion of empty tokens 2011-10-19 18:50:28 +00:00
Maxime Coste
63191f1900 CommandManager: support per command configurable completion 2011-09-16 09:18:51 +00:00
Maxime Coste
b59ad6a174 Completion: dedicated completion header and basic filename completion 2011-09-14 15:41:56 +00:00
Maxime Coste
eecc5a184e CommandManager: basic command name completion support 2011-09-13 21:16:48 +00:00
Maxime Coste
3caf962110 exception: refactoring 2011-09-09 18:40:59 +00:00
Maxime Coste
03f1520b43 Refactor commands handling and parsing in a CommandManager class 2011-09-07 18:16:56 +00:00