Commit Graph

7935 Commits

Author SHA1 Message Date
codesoap
6e86766966 makefile.kak: remove reqex mismatch between highlight and indent 2019-07-30 10:00:04 +02:00
codesoap
4c3795faa2 makefile.kak: Refine regex for target
Multiple targets and the target separators ':', '::' and '!' are now
supported.
2019-07-30 09:55:25 +02:00
Frank LENORMAND
ff52bd7027 rc python: Highlight indented decorators with .
Make sure decorators are on their own line, and don't stop highlighting at
the first dot when they are imported, e.g.

```
import enum

@enum.unique
class A(enum.Enum):
    …
```

Ideally highlighting shouldn't stop at the first parenthesis either
(e.g. `@foo(['1'])`), but the current code somewhat highlights the contents
of the parens already, which is good enough in most cases.
2019-07-26 13:01:58 +03:00
Frank LENORMAND
da2f6c296a src: De-indent docstrings passed to command/option/mapping definitions
This commit implements formatting behaviour when the first character of a
docstring is a newline. In that case, the exact indentation level of the
next line will be removed from that line and all subsequent non-empty lines.

An error will be returned if a subsequent non-empty line does not have the
same indentation level.

The docstrings are always trimmed (surrounding whitespaces) whether the
first character is a newline or not, as was the case prior to this commit.

Example: the following declaration

```
define-command test -docstring %{
    test: do something

    Nothing really.
        More
            indented
                lines.
} nop
```

would be rendered as

```
test: do something

Nothing really.
    More
        indented
            lines.
```

Related to #2405
2019-07-25 12:28:04 +03:00
Maxime Coste
550feb1706 Merge remote-tracking branch 'andreyorst/rust-highlighting' 2019-07-25 17:48:04 +10:00
Maxime Coste
e840140b38 Add indent tests for brace after else indent 2019-07-25 17:27:08 +10:00
Maxime Coste
6e1e79ed19 Merge branch 'master' of http://github.com/cglogic/kakoune 2019-07-25 17:26:41 +10:00
Oleh Hushchenkov
8fc705d4cc Fix c-family indent on opening curly brace after if-else 2019-07-25 09:58:33 +03:00
Maxime Coste
65327da4cf Merge remote-tracking branch 'laelath/markdown-lazy-load' 2019-07-24 17:38:00 +10:00
Justin Frank
a15ff0ffc3 Move module aliases to after main module definition 2019-07-22 23:48:30 -07:00
Justin Frank
8941002ce0 Give hooks a group so they're cleaned up 2019-07-22 19:03:04 -07:00
Justin Frank
89b50daa66 Use module alias pattern for markdown dynamic loading 2019-07-22 19:01:40 -07:00
aecepoglu
8691c1557a
ocaml.kak fix '"' and char literals 2019-07-22 23:49:15 +03:00
Andrey Orst
677d1efb23 move regex highlighters to the top, add method, field and function hl 2019-07-22 22:32:26 +03:00
codesoap
090c0b4db1 Allow / in target when highlighting in makefile.kak 2019-07-22 17:32:25 +02:00
Andrey Orst
3c0a350079 require module the old way 2019-07-22 18:22:44 +03:00
Andrey Orst
a81eb158be extend Rust highlighting 2019-07-22 15:56:29 +03:00
Maxime Coste
e42c81c8eb Ensure current context switches away from buffer on delete-buffer
Fixes #3025
2019-07-22 20:26:39 +10:00
Maxime Coste
837416ea38 Merge remote-tracking branch 'MarSoft/nix-syntax' 2019-07-21 12:36:56 +10:00
Maxime Coste
d05ef24471 Merge remote-tracking branch 'gaeulbyul/css-comment' 2019-07-21 12:34:28 +10:00
Maxime Coste
39445f9acb save command history in execute-keys by default
This should make #3014 unnecessary
2019-07-21 12:29:52 +10:00
Maxime Coste
1a16590960 Slight code cleanup in prompt history handling 2019-07-21 12:20:47 +10:00
Maxime Coste
b83c09509e Merge branch 'master' of http://github.com/jo-he/kakoune 2019-07-21 12:15:48 +10:00
Maxime Coste
268af7f61c Merge remote-tracking branch 'lenormf/patch-1' 2019-07-21 12:14:57 +10:00
Maxime Coste
b18ca12882 More functional style for '*' code 2019-07-21 12:14:25 +10:00
Maxime Coste
c54e0ec873 Merge remote-tracking branch 'lenormf/fix-2994' 2019-07-21 12:10:22 +10:00
Maxime Coste
27fce78eac Merge remote-tracking branch 'codesoap/ledger' 2019-07-21 12:08:42 +10:00
Gaeulbyul
42ef151bec Gaeulbyul Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
2019-07-18 01:59:01 +09:00
Gaeulbyul
bd257ceb7d css.kak: Highlight comment inside declaration 2019-07-18 01:33:57 +09:00
codesoap
0bd57817b3 Configure comment_line for the ledger filetype 2019-07-12 14:02:06 +02:00
Maxime Coste
be3d0f8b33 Filter non-extra_word_chars completion candidates using Codepoints
Fixes #3010
2019-07-09 19:36:57 +10:00
Maxime Coste
c2e43ee42c Use -O0 for debug builds
-Og is not nice enough to work with in gdb, control jumps around
in too unpredictible ways due to inlining.
2019-07-09 19:27:55 +10:00
Joachim Henke
2cc92e8ff1 function keys need to be provided in upper case now 2019-07-07 18:44:14 +02:00
Joachim Henke
556d58a073 allow for mapping the Insert key 2019-07-07 18:38:46 +02:00
Maxime Coste
3a7d0b67fa Merge remote-tracking branch 'lenormf/fix-history-size' 2019-07-07 09:14:25 +10:00
Maxime Coste
9e62d2c345 Merge branch 'master' of http://github.com/jo-he/kakoune 2019-07-07 09:13:11 +10:00
Maxime Coste
c4836f8478 Merge remote-tracking branch 't6/patch-freebsd' 2019-07-07 09:10:53 +10:00
David Ross
27ed20582f Add complete extra_word_chars for lisp
See https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node27.html.
2019-07-06 12:25:46 -07:00
Joachim Henke
4c61f82fb2 fix a few typos 2019-07-06 17:37:30 +02:00
Joachim Henke
ab87d2b2cb Joachim Henke Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
2019-07-06 17:27:59 +02:00
Tobias Kortkamp
16bb55edee
Fix build on FreeBSD
file.cc:390:21: error: use of undeclared identifier 'rename'; did you mean 'devname'?
    if (replace and rename(temp_filename, zfilename) != 0)
                    ^~~~~~
                    devname
/usr/include/stdlib.h:277:7: note: 'devname' declared here
char    *devname(__dev_t, __mode_t);
         ^
file.cc:390:28: error: cannot initialize a parameter of type '__dev_t' (aka 'unsigned long') with an lvalue of type 'char [1024]'
    if (replace and rename(temp_filename, zfilename) != 0)
                           ^~~~~~~~~~~~~
/usr/include/stdlib.h:277:22: note: passing argument to parameter here
char    *devname(__dev_t, __mode_t);
                        ^
2 errors generated.

---

highlighters.cc:1110:13: error: use of undeclared identifier 'snprintf'; did you mean 'vswprintf'?
            snprintf(buffer, 16, format, std::abs(line_to_format));
            ^~~~~~~~
            vswprintf
/usr/include/wchar.h:139:5: note: 'vswprintf' declared here
int     vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
highlighters.cc:1110:22: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [16]'
            snprintf(buffer, 16, format, std::abs(line_to_format));
                     ^~~~~~
/usr/include/wchar.h:139:35: note: passing argument to parameter here
int     vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                      ^
2 errors generated.

---

json_ui.cc:60:13: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
            sprintf(buf, "\\u%04x", *next);
            ^~~~~~~
            swprintf
/usr/include/wchar.h:133:5: note: 'swprintf' declared here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
json_ui.cc:60:21: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [7]'
            sprintf(buf, "\\u%04x", *next);
                    ^~~
/usr/include/wchar.h:133:34: note: passing argument to parameter here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                     ^
json_ui.cc:74:9: error: use of undeclared identifier 'sprintf'
        sprintf(buffer, R"("#%02x%02x%02x")", color.r, color.g, color.b);
        ^
3 errors generated.

---

regex_impl.cc:1039:9: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
        sprintf(buf, " %03d     ", count++);
        ^~~~~~~
        swprintf
/usr/include/wchar.h:133:5: note: 'swprintf' declared here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
regex_impl.cc:1039:17: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [20]'
        sprintf(buf, " %03d     ", count++);
                ^~~
/usr/include/wchar.h:133:34: note: passing argument to parameter here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                     ^
regex_impl.cc:1197:17: error: use of undeclared identifier 'puts'
    { if (dump) puts(dump_regex(*this).c_str()); }
                ^
regex_impl.cc:1208:18: note: in instantiation of member function 'Kakoune::(anonymous namespace)::TestVM<Kakoune::RegexMode::Forward>::TestVM' requested here
        TestVM<> vm{R"(a*b)"};
                 ^
regex_impl.cc:1197:17: error: use of undeclared identifier 'puts'
    { if (dump) puts(dump_regex(*this).c_str()); }
                ^
regex_impl.cc:1283:56: note: in instantiation of member function 'Kakoune::(anonymous namespace)::TestVM<5>::TestVM' requested here
        TestVM<RegexMode::Forward | RegexMode::Search> vm{R"(f.*a(.*o))"};
                                                       ^
regex_impl.cc:1197:17: error: use of undeclared identifier 'puts'
    { if (dump) puts(dump_regex(*this).c_str()); }
                ^
regex_impl.cc:1423:57: note: in instantiation of member function 'Kakoune::(anonymous namespace)::TestVM<6>::TestVM' requested here
        TestVM<RegexMode::Backward | RegexMode::Search> vm{R"(fo{1,})"};
                                                        ^
5 errors generated.

---

remote.cc:829:9: error: use of undeclared identifier 'rename'; did you mean 'devname'?
    if (rename(old_socket_file.c_str(), new_socket_file.c_str()) != 0)
        ^~~~~~
        devname
/usr/include/stdlib.h:277:7: note: 'devname' declared here
char    *devname(__dev_t, __mode_t);
         ^
remote.cc:829:16: error: cannot initialize a parameter of type '__dev_t' (aka 'unsigned long') with an rvalue of type 'const char *'
    if (rename(old_socket_file.c_str(), new_socket_file.c_str()) != 0)
               ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:277:22: note: passing argument to parameter here
char    *devname(__dev_t, __mode_t);
                        ^
2 errors generated.

---

string_utils.cc:126:20: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
    res.m_length = sprintf(res.m_data, "%i", val);
                   ^~~~~~~
                   swprintf
/usr/include/wchar.h:133:5: note: 'swprintf' declared here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
        ^
string_utils.cc:126:28: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [15]'
    res.m_length = sprintf(res.m_data, "%i", val);
                           ^~~~~~~~~~
/usr/include/wchar.h:133:34: note: passing argument to parameter here
int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
                                     ^
string_utils.cc:133:20: error: use of undeclared identifier 'sprintf'; did you mean 'swprintf'?
    res.m_length = sprintf(res.m_data, "%u", val);
                   ^~~~~~~
                   swprintf
[...]
2019-07-06 08:53:47 +02:00
David Ross
e65740873d Treat '-' as an word character in lisp
'-' is part of identifiers in most or all lisps.

Strategy for implementing this copied from https://github.com/mawww/kakoune/blob/master/rc/filetype/scss.kak#L20.
2019-07-05 06:44:45 -07:00
David Ross
a9a6397363 David Ross Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
2019-07-05 06:44:45 -07:00
Frank LENORMAND
78129150c9 src: Cap the maximum size of history registers
History registers (for prompt commands, pipe primitive commands etc) are
populated interactively by the users, and currently have no size limit.

This commits silently drops the oldest entries in the storage space to
allow at most 100 entries, to prevent long-running editing sessions from
hogging memory for data most likely never used.
2019-07-02 16:36:12 +03:00
codesoap
2d15c13c1e ledger.kak: Automatically indent postings in transactions 2019-07-02 09:49:52 +02:00
codesoap
710ebabcb8 Add ledger filetype 2019-07-01 20:49:55 +02:00
Frank LENORMAND
b040bf8b81 src: Use all selections to generate a pattern upon hitting *
This commit makes the `*` and <a-*> primitives compose a search pattern
comprised of all the current selections, as opposed to only the main one.

All selections are OR'd into the default search register, which makes it
convenient to search for several identifiers already selected.

To retain the old behaviour, the following mappings can be used:

```
map global normal * ': exec -draft -save-regs "" %{<space>*}<ret>'
map global normal <a-*> ': exec -draft -save-regs "" %{<space><a-*>}<ret>'
```

Fixes #2994
2019-07-01 19:53:08 +03:00
Frank LENORMAND
a735c06714
rc git: Fix the indentation of misaligned commands 2019-07-01 12:56:51 +00:00
Maxime Coste
2ff9fd8d92 Kakoune v2019.07.01 2019-07-01 22:07:29 +10:00
Maxime Coste
9363f98f5b Fix indent/sh/deindent-after-esac test case 2019-07-01 22:04:04 +10:00