Merge branch 'mawww:master' into master

This commit is contained in:
in0ni 2022-04-03 11:59:17 -04:00 committed by GitHub
commit fbf1d98e58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 11 deletions

View File

@ -205,12 +205,17 @@ sudo zypper install kakoune
[TIP] [TIP]
.Ubuntu .Ubuntu
==== ====
Building on Ubuntu 16.04 and 18.04. Kakoune can be found in the Ubuntu repositories.
Make sure you have .local/bin in your path to make the kak binary available from your shell.
----------------------------
sudo apt install kakoune
----------------------------
If you want to compile from source on 20.04 or earlier, you must force the build to use GCC 10, which is not the default. Also, make sure you have .local/bin in your path so that kak is available after the installation.
---------------------------------------------------------------- ----------------------------------------------------------------
git clone https://github.com/mawww/kakoune.git && cd kakoune/src git clone https://github.com/mawww/kakoune.git && cd kakoune/src
make CXX=g++-10 make
PREFIX=$HOME/.local make install PREFIX=$HOME/.local make install
---------------------------------------------------------------- ----------------------------------------------------------------
==== ====

View File

@ -25,6 +25,7 @@ add-highlighter shared/cmake/argument region -recurse '\(' '\w+\h*\(\K' '(?=\))'
add-highlighter shared/cmake/code/ regex '\w+\h*(?=\()' 0:meta add-highlighter shared/cmake/code/ regex '\w+\h*(?=\()' 0:meta
add-highlighter shared/cmake/argument/args default-region regex '\$\{\w+\}' 0:variable add-highlighter shared/cmake/argument/args default-region regex '\$\{\w+\}' 0:variable
add-highlighter shared/cmake/argument/comment region '#' '$' fill comment
add-highlighter shared/cmake/argument/quoted region '"' '(?<!\\)(\\\\)*"' group add-highlighter shared/cmake/argument/quoted region '"' '(?<!\\)(\\\\)*"' group
add-highlighter shared/cmake/argument/raw-quoted region -match-capture '\[(=*)\[' '\](=*)\]' ref cmake/argument/quoted add-highlighter shared/cmake/argument/raw-quoted region -match-capture '\[(=*)\[' '\](=*)\]' ref cmake/argument/quoted

30
rc/filetype/conf.kak Normal file
View File

@ -0,0 +1,30 @@
hook global BufCreate .+\.(repo|cfg|properties|desktop) %{
set-option buffer filetype conf
}
hook global WinCreate .+\.ini %{
try %{
execute-keys /^\h*#<ret>
set-option buffer filetype conf
}
}
hook global WinSetOption filetype=conf %{
require-module conf
}
hook -group conf-highlight global WinSetOption filetype=conf %{
add-highlighter window/conf ref conf
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/conf }
}
provide-module conf %{
add-highlighter shared/conf regions
add-highlighter shared/conf/code default-region group
add-highlighter shared/conf/comment region '(^|\h)\K#' $ fill comment
add-highlighter shared/conf/code/ regex "(?S)^\h*(\[.+?\])\h*$" 1:title
add-highlighter shared/conf/code/ regex "^\h*([^\[][^=\n]*)=([^\n]*)" 1:variable 2:value
}

View File

@ -39,7 +39,7 @@ evaluate-commands %sh{
# Grammar # Grammar
keywords="require-macros eval-compiler doc lua hashfn macro macros import-macros pick-args pick-values macroexpand macrodebug keywords="require-macros eval-compiler doc lua hashfn macro macros import-macros pick-args pick-values macroexpand macrodebug
do values if when each for fn lambda λ partial while set global var local let tset set-forcibly! doto match or and do values if when each for fn lambda λ partial while set global var local let tset set-forcibly! doto match or and
not not= collect icollect rshift lshift bor band bnot bxor with-open" not not= collect icollect accumulate rshift lshift bor band bnot bxor with-open"
re_keywords='\\$ \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 \\$\\.\\.\\.' re_keywords='\\$ \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 \\$\\.\\.\\.'
builtins="_G _VERSION arg assert bit32 collectgarbage coroutine debug builtins="_G _VERSION arg assert bit32 collectgarbage coroutine debug
dofile error getfenv getmetatable io ipairs length load dofile error getfenv getmetatable io ipairs length load

View File

@ -1,4 +1,4 @@
hook global BufCreate .+\.(repo|ini|cfg|properties|desktop) %{ hook global BufCreate .+\.ini %{
set-option buffer filetype ini set-option buffer filetype ini
} }

View File

@ -45,6 +45,10 @@ hook global BufSetOption filetype=coffee %{
set-option buffer comment_block_end '###' set-option buffer comment_block_end '###'
} }
hook global BufSetOption filetype=conf %{
set-option buffer comment_line '#'
}
hook global BufSetOption filetype=css %{ hook global BufSetOption filetype=css %{
set-option buffer comment_line '' set-option buffer comment_line ''
set-option buffer comment_block_begin '/*' set-option buffer comment_block_begin '/*'

View File

@ -132,7 +132,7 @@ ParseResult parse_quoted(ParseState& state, Delimiter delimiter)
if (c == delimiter) if (c == delimiter)
{ {
auto next = state.pos; auto next = state.pos;
if (read(next, end) != delimiter) if (next == end || read(next, end) != delimiter)
{ {
if (str.empty()) if (str.empty())
return {String{String::NoCopy{}, {beg, cur}}, true}; return {String{String::NoCopy{}, {beg, cur}}, true};
@ -815,15 +815,20 @@ UnitTest test_command_parsing{[]
{ {
auto check_quoted = [](StringView str, bool terminated, StringView content) auto check_quoted = [](StringView str, bool terminated, StringView content)
{ {
auto check_quoted_impl = [&](auto type_hint) {
ParseState state{str, str.begin()}; ParseState state{str, str.begin()};
const Codepoint delimiter = *state.pos++; const decltype(type_hint) delimiter = *state.pos++;
auto quoted = parse_quoted(state, delimiter); auto quoted = parse_quoted(state, delimiter);
kak_assert(quoted.terminated == terminated); kak_assert(quoted.terminated == terminated);
kak_assert(quoted.content == content); kak_assert(quoted.content == content);
}; };
check_quoted_impl(Codepoint{});
check_quoted_impl(char{});
};
check_quoted("'abc'", true, "abc"); check_quoted("'abc'", true, "abc");
check_quoted("'abc''def", false, "abc'def"); check_quoted("'abc''def", false, "abc'def");
check_quoted("'abc''def'''", true, "abc'def'"); check_quoted("'abc''def'''", true, "abc'def'");
check_quoted(StringView("'abc''def'", 5), true, "abc");
auto check_balanced = [](StringView str, bool terminated, StringView content) auto check_balanced = [](StringView str, bool terminated, StringView content)
{ {