diff --git a/README.asciidoc b/README.asciidoc index 5a839039..b07c336a 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -473,9 +473,12 @@ When entering a command, parameters are separated by whitespace (shell like), if you want to give parameters with spaces, you should quote them. Kakoune support three string syntax: + + * +\'strings\'+: uninterpreted strings, you can use \' to escape the separator, + every other char is itself. - * +"strings" and \'strings\'+: classic strings, use \' or \" to escape the - separator. + * +"strings"+: expended strings, % strings (see %sh, %opt or %reg) contained + are expended. Use \% to escape a % inside them, and \\ to escape a slash. * +%\{strings\}+: these strings are very useful when entering commands diff --git a/rc/clang.kak b/rc/clang.kak index 927b2026..b2c9c220 100644 --- a/rc/clang.kak +++ b/rc/clang.kak @@ -55,7 +55,7 @@ def clang-complete %{ } def clang-enable-autocomplete %{ - set window completers %rec{option=clang_completions:%opt{completers}} + set window completers "option=clang_completions:%opt{completers}" hook window -group clang-autocomplete InsertIdle .* %{ try %{ exec -draft (\.|->|::).\' echo 'completing...' diff --git a/rc/cpp.kak b/rc/cpp.kak index 72c2c890..be6c807c 100644 --- a/rc/cpp.kak +++ b/rc/cpp.kak @@ -51,7 +51,7 @@ addhl -group /cpp/comment fill comment addhl -group /cpp/disabled fill rgb:666666 addhl -group /cpp/macro fill meta -addhl -group /cpp/code regex "\<(this|true|false|NULL|nullptr|)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'" 0:value +addhl -group /cpp/code regex %{\<(this|true|false|NULL|nullptr|)\>|\<-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value addhl -group /cpp/code regex "\<(void|int|char|unsigned|float|bool|size_t)\>" 0:type addhl -group /cpp/code regex "\<(while|for|if|else|do|switch|case|default|goto|break|continue|return|using|try|catch|throw|new|delete|and|or|not|operator|explicit|(?:reinterpret|const|static|dynamic)_cast)\>" 0:keyword addhl -group /cpp/code regex "\<(const|constexpr|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|template|typedef|virtual|friend|extern|typename|override|final)\>" 0:attribute diff --git a/rc/ctags.kak b/rc/ctags.kak index 7cd8b9c7..8741659d 100644 --- a/rc/ctags.kak +++ b/rc/ctags.kak @@ -46,8 +46,8 @@ def funcinfo %{ } def ctags-enable-autoinfo %{ - hook window -group ctags-autoinfo NormalIdle .* funcinfo - hook window -group ctags-autoinfo InsertIdle .* funcinfo + hook window -group ctags-autoinfo NormalKey .* funcinfo + hook window -group ctags-autoinfo InsertKey .* funcinfo } def ctags-disable-autoinfo %{ rmhooks window ctags-autoinfo } diff --git a/rc/grep.kak b/rc/grep.kak index 502b8bdf..575ef461 100644 --- a/rc/grep.kak +++ b/rc/grep.kak @@ -41,7 +41,7 @@ def jump %{ def next -docstring 'Jump to next grep match' %{ eval -try-client %opt{jumpclient} %{ buffer '*grep*' - exec %rec{%opt{_grep_current_line}ggl/^[^:]+:\d+:} + exec "%opt{_grep_current_line}ggl/^[^:]+:\d+:" jump } } @@ -49,7 +49,7 @@ def next -docstring 'Jump to next grep match' %{ def prev -docstring 'Jump to previous grep match' %{ eval -try-client %opt{jumpclient} %{ buffer '*grep*' - exec %rec{%opt{_grep_current_line}g^[^:]+:\d+:} + exec "%opt{_grep_current_line}g^[^:]+:\d+:" jump } } diff --git a/rc/jedi.kak b/rc/jedi.kak index b6644db8..584022db 100644 --- a/rc/jedi.kak +++ b/rc/jedi.kak @@ -34,7 +34,7 @@ def jedi-complete %{ } def jedi-enable-autocomplete %{ - set window completers %rec{option=jedi_completions:%opt{completers}} + set window completers "option=jedi_completions:%opt{completers}" hook window -group jedi-autocomplete InsertIdle .* %{ try %{ exec -draft \..\' echo 'completing...' diff --git a/rc/make.kak b/rc/make.kak index d66f89b6..55191ce0 100644 --- a/rc/make.kak +++ b/rc/make.kak @@ -33,12 +33,12 @@ def errjump -docstring 'Jump to error location' %{ exec gll "Entering directory" exec s "Entering directory '([^']+)'.*\n([^:]+):(\d+):(?:(\d+):)?([^\n]+)\'" l set buffer _make_current_error_line %val{cursor_line} - eval -try-client %opt{jumpclient} %rec{edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -color Information '%reg{5}'} + eval -try-client %opt{jumpclient} "edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -color Information '%reg{5}'" try %{ focus %opt{jumpclient} } } catch %{ exec ghgl s "([^:]+):(\d+):(?:(\d+):)?([^\n]+)\'" l set buffer _make_current_error_line %val{cursor_line} - eval -try-client %opt{jumpclient} %rec{edit -existing %reg{1} %reg{2} %reg{3}; echo -color Information '%reg{4}'} + eval -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -color Information '%reg{4}'" try %{ focus %opt{jumpclient} } } } @@ -46,7 +46,7 @@ def errjump -docstring 'Jump to error location' %{ def errnext -docstring 'Jump to next error' %{ eval -try-client %opt{jumpclient} %{ buffer '*make*' - exec %rec{%opt{_make_current_error_line}ggl/[0-9]+: (?:fatal )?error:} + exec "%opt{_make_current_error_line}ggl/[0-9]+: (?:fatal )?error:" errjump } } @@ -54,7 +54,7 @@ def errnext -docstring 'Jump to next error' %{ def errprev -docstring 'Jump to previous error' %{ eval -try-client %opt{jumpclient} %{ buffer '*make*' - exec %rec{%opt{_make_current_error_line}ggh[0-9]+: (?:fatal )?error:} + exec "%opt{_make_current_error_line}ggh[0-9]+: (?:fatal )?error:" errjump } } diff --git a/src/command_manager.cc b/src/command_manager.cc index a771ddeb..aa966161 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -139,8 +139,6 @@ Token::Type token_type(StringView type_name) return Token::Type::OptionExpand; else if (type_name == "val") return Token::Type::ValExpand; - else if (type_name == "rec") - return Token::Type::RawEval; else if (throw_on_invalid) throw unknown_expand{type_name}; else @@ -239,8 +237,9 @@ TokenList parse(StringView line) if (throw_on_unterminated and pos == length) throw unterminated_string(String{delimiter}, String{delimiter}); - result.emplace_back(Token::Type::Raw, token_start, - pos, std::move(token)); + result.emplace_back(delimiter == '"' ? Token::Type::RawEval + : Token::Type::Raw, + token_start, pos, std::move(token)); } else if (line[pos] == '%') result.push_back(