diff --git a/README.asciidoc b/README.asciidoc index 9c94cc89..94ea4538 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -205,12 +205,17 @@ sudo zypper install kakoune [TIP] .Ubuntu ==== -Building on Ubuntu 16.04 and 18.04. -Make sure you have .local/bin in your path to make the kak binary available from your shell. +Kakoune can be found in the Ubuntu repositories. + +---------------------------- +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 -make +CXX=g++-10 make PREFIX=$HOME/.local make install ---------------------------------------------------------------- ==== diff --git a/rc/filetype/cmake.kak b/rc/filetype/cmake.kak index cb5c65db..86fda25d 100644 --- a/rc/filetype/cmake.kak +++ b/rc/filetype/cmake.kak @@ -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/argument/args default-region regex '\$\{\w+\}' 0:variable +add-highlighter shared/cmake/argument/comment region '#' '$' fill comment add-highlighter shared/cmake/argument/quoted region '"' '(? + 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 + +} diff --git a/rc/filetype/fennel.kak b/rc/filetype/fennel.kak index e6d604fe..91368cc5 100644 --- a/rc/filetype/fennel.kak +++ b/rc/filetype/fennel.kak @@ -39,7 +39,7 @@ evaluate-commands %sh{ # Grammar 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 - 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 \\$\\.\\.\\.' builtins="_G _VERSION arg assert bit32 collectgarbage coroutine debug dofile error getfenv getmetatable io ipairs length load diff --git a/rc/filetype/ini.kak b/rc/filetype/ini.kak index 1e922fdd..75762f6a 100644 --- a/rc/filetype/ini.kak +++ b/rc/filetype/ini.kak @@ -1,4 +1,4 @@ -hook global BufCreate .+\.(repo|ini|cfg|properties|desktop) %{ +hook global BufCreate .+\.ini %{ set-option buffer filetype ini } diff --git a/rc/tools/comment.kak b/rc/tools/comment.kak index 8d3ee798..1094fbba 100644 --- a/rc/tools/comment.kak +++ b/rc/tools/comment.kak @@ -45,6 +45,10 @@ hook global BufSetOption filetype=coffee %{ set-option buffer comment_block_end '###' } +hook global BufSetOption filetype=conf %{ + set-option buffer comment_line '#' +} + hook global BufSetOption filetype=css %{ set-option buffer comment_line '' set-option buffer comment_block_begin '/*' diff --git a/src/command_manager.cc b/src/command_manager.cc index 0f3cb749..b8784093 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -132,7 +132,7 @@ ParseResult parse_quoted(ParseState& state, Delimiter delimiter) if (c == delimiter) { auto next = state.pos; - if (read(next, end) != delimiter) + if (next == end || read(next, end) != delimiter) { if (str.empty()) return {String{String::NoCopy{}, {beg, cur}}, true}; @@ -815,15 +815,20 @@ UnitTest test_command_parsing{[] { auto check_quoted = [](StringView str, bool terminated, StringView content) { - ParseState state{str, str.begin()}; - const Codepoint delimiter = *state.pos++; - auto quoted = parse_quoted(state, delimiter); - kak_assert(quoted.terminated == terminated); - kak_assert(quoted.content == content); + auto check_quoted_impl = [&](auto type_hint) { + ParseState state{str, str.begin()}; + const decltype(type_hint) delimiter = *state.pos++; + auto quoted = parse_quoted(state, delimiter); + kak_assert(quoted.terminated == terminated); + kak_assert(quoted.content == content); + }; + check_quoted_impl(Codepoint{}); + check_quoted_impl(char{}); }; check_quoted("'abc'", true, "abc"); check_quoted("'abc''def", false, "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) {