Commit Graph

266 Commits

Author SHA1 Message Date
Maxime Coste
e93c31ff0d doc.kak: stricter parsing of formatted text
Format markers such as *, _ or ` must be followed/preceeded by a non
whitespace character to be considered formatting marker.
2018-02-22 22:22:13 +11:00
Maxime Coste
026cf8af3a doc.kak: fix handling of lines begining with * or -
Those were considered as any other lines for paragraph joining,
threat them as a new paragraph start, to correctly handle asciidoc
lists.
2018-02-22 22:09:00 +11:00
Maxime Coste
9755f7f8f2 make.kak: Fix echoing of error message when jumping
The use of `%{...%reg{...}}` was not being expanded correctly, as
the enclosing %{...} prevents the internal %expand{...} from being
considered.

The introduction of an additional command allows us to bypass
quoting hell as the expansion of %reg{5} could contain arbitrary
text.
2018-02-19 21:43:43 +11:00
Maxime Coste
f8861734cf rc/: Replace simple uses of sed with tr 2018-02-18 15:00:30 +11:00
Maxime Coste
43f50c0852 Convert bundled scripts to ModeChange hook 2018-01-21 10:35:05 +11:00
Dan Rosén
a612432c8d Highlight python operators 2018-01-07 23:36:41 +01:00
Dan Rosén
40aaf63338 Highlight python doctests in docstrings 2018-01-07 23:36:41 +01:00
Maxime Coste
4740dbf9fa doc.kak: Fix anchor name completion 2017-12-29 09:37:04 +11:00
Maxime Coste
7072e65a28 Merge remote-tracking branch 'danr/typescript-comment' 2017-12-07 10:46:26 +08:00
Dan Rosén
fbe312e0d0 Add typescript to comment.kak 2017-12-06 20:50:05 +01:00
Maxime Coste
1b44056fce man.kak: Better support for renaming a man buffer
Fixes #1718
2017-12-06 14:49:38 +08:00
Maxime Coste
a9f1a23f35 man.kak: use shell-candidates instead of shell-completions 2017-12-06 14:10:10 +08:00
Maxime Coste
363a0c3a0d man.kak: Fix behaviour when called with no params with Posix shells
Seems dash nevers falls back for ${@-$blah}, it does not considers $@
to be empty. Use ${1-$blah} instead as we never have more than one
parameter.
2017-12-06 13:23:39 +08:00
Maxime Coste
35d2b2b4bc c-family.kak: Use regex custom text object to simplify some indent 2017-12-03 17:48:04 +08:00
Maxime Coste
1a38849086 c-family.kak: indent after parenthesis at end of line 2017-12-03 17:47:44 +08:00
Maxime Coste
74b0c98769 Merge remote-tracking branch 'occivink/comment' 2017-11-24 16:29:30 +08:00
Olivier Perret
ee117b9499 set registers directly instead of expanding options in exec 2017-11-23 10:30:10 +01:00
Frank LENORMAND
58ccf6b295 rc python: Highlight built-in exceptions 2017-11-18 11:56:47 +03:00
Maxime Coste
77b0ee1e19 Merge remote-tracking branch 'lenormf/extend-python-highlighters' 2017-11-14 18:08:27 +08:00
Frank LENORMAND
105d7a1276 rc python: Extend highlighted keywords and numbers 2017-11-14 12:50:20 +03:00
Maxime Coste
2ab9f65b36 c-family.kak: Use <a-S> in various auto indent hooks 2017-11-14 13:32:46 +08:00
Maxime Coste
9c964e97f0 c-family.kak: Highlight character literals later
That way it overrides integer literal highlighters in the case where
they conflict.
2017-11-14 11:45:30 +08:00
fsub
ee695ecf95 c-familiy.kak: improve highlighting of C++ literals 2017-11-12 18:16:20 +01:00
Maxime Coste
add7f7e76b Revert "c-family.kak: Remove invalid 'compl' keyword from C++ highlight"
This reverts commit f8dee65d6e.

compl is actually the alternate keyword for `~`.
2017-11-11 09:54:32 +08:00
Maxime Coste
f8dee65d6e c-family.kak: Remove invalid 'compl' keyword from C++ highlight 2017-11-09 10:43:46 +08:00
Maxime Coste
5791632a98 c-family.kak: use space separated words list 2017-11-09 10:25:03 +08:00
Maxime Coste
a131edb9b3 Merge remote-tracking branch 'fsub/c-family' 2017-11-09 10:09:58 +08:00
Maxime Coste
8aa35c0724 doc.kak: Use a github compatible anchor generation
Convert session names to lowercase and replace spaces with minus
to generate anchor names.
2017-11-08 20:15:46 +08:00
Maxime Coste
b8fdcff7b0 doc.kak: anchor/section completion support 2017-11-08 17:20:37 +08:00
Maxime Coste
b63f16e7a2 doc.kak: Support anchors and internal links
Underline links, support jumping to a specific anchor either in
the current page or another one, use those new features in some
pages.
2017-11-08 16:32:49 +08:00
Maxime Coste
d6b5240bdf doc.kak: Remove unused lines 2017-11-06 20:53:50 +08:00
Maxime Coste
73182de20c doc.kak: Support jumping on links using <ret> 2017-11-06 20:52:24 +08:00
Maxime Coste
19cda837ff doc.kak: Simplify completion script 2017-11-06 20:47:12 +08:00
fsub
db15f7adc5 c-family.kak: Add missing C++ keywords, attributes, and types 2017-11-05 10:11:59 +01:00
fsub
1ad83745c2 c-family.kak: Sort keywords, attributes, values, and decorators 2017-11-05 10:11:59 +01:00
Olivier Perret
16f42fe3a6 refactor comment.kak
* move most of the kakoune implementation outside of the shell scope
  to avoid unnecessary escaping
* let kakoune do the option expansions to avoid injection of special
  characters
* split block commenting options into two and do the < to <lt>
  conversion directly
* show error messages directly in the buffer rather than in *debug*

Fixes #1600 and #875
2017-11-03 13:20:02 +01:00
Olivier Perret
00d8716c79 commenting: move rust to the C-style group 2017-11-03 13:13:42 +01:00
Maxime Coste
9b216e0e79 Merge remote-tracking branch 'lenormf/fix-rc-aliases' 2017-11-03 19:32:30 +08:00
Frank LENORMAND
9127ed0d55 src rc: Rename exec/eval into execute-keys/evaluate-commands 2017-11-03 11:09:45 +03:00
Frank LENORMAND
c9b280b712 rc: Don't use command aliases to highlight keywords properly 2017-11-03 10:34:41 +03:00
Kylie McClain
79f725a558 sh: support mksh 2017-11-02 23:23:54 -04:00
Maxime Coste
b3daf6b746 doc.kak: Support rendering _italic_ text as well 2017-11-02 17:42:16 +08:00
Maxime Coste
4fabba3d12 doc.kak: Render documentation internally instead of relying on man
doc.kak now behaves as a basic asciidoc renderer. Asciidoc is unfortunately
still a dependency to generate the manpage of the `kak` command.
2017-11-02 10:03:24 +08:00
Maxime Coste
90865b65cd asciidoc.kak: Highlight ^=+ syntax sections 2017-11-02 09:52:18 +08:00
Maxime Coste
424b2389cb kakrc.kak: Fix highlighting of key words at start of buffer 2017-11-02 01:28:37 +08:00
Maxime Coste
c8257a58a5 kakrc.kak: set '-' as an additional word char 2017-10-28 13:43:04 +08:00
Maxime Coste
d7671f0cdf kakrc.kak: Fix static word definition 2017-10-28 13:43:04 +08:00
Maxime Coste
d49555fc75 Move highlighters into Scopes
That means we can now have highlighters active at global, buffer, and
window scope. The add-highlighter and remove-highlighter syntax changed
to take the parent path (scope/group/...) as a mandatory argument,
superseeding the previous -group switch.
2017-10-28 13:43:04 +08:00
Maxime Coste
d09924d24b asciidoc.kak: use a more tolerant block regex for
Get rid of the nasty backreference we were relying on.
2017-10-25 10:29:27 +08:00
Maxime Coste
0fa59e5fd2 rc/: Tweak some regexes to be compatible with our impl limitations
The upcoming custom implementation does not support arbitrary lookarounds,
and other advanced regex features. Simplify the regexes to avoid those.
2017-10-25 10:27:39 +08:00
Maxime Coste
bf6e5daa08 Use stricter regex syntax
boost regex tolerates non-escaped special characters, and escaped
non-special characters. Standardize on stricter syntax, where
special characters must be escaped, and non-special characters must
not.
2017-10-25 10:27:39 +08:00
Maxime Coste
80d661e6a7 rc/: More consistent uses of regex syntax
Always use \A \z for subject start/end, always \b for word boundaries
2017-10-25 10:27:25 +08:00
Maxime Coste
214f321951 Merge remote-tracking branch 'danr/Fix-introduced-mistake-in-kakrc-highlighting' 2017-10-23 16:33:26 +08:00
Maxime Coste
6d65d8e778 kakrc.kak: refactor grammar handling 2017-10-23 10:56:45 +08:00
Dan Rosén
577d84217a Fix introduced mistake in kakrc highlighting 2017-10-22 01:23:12 +02:00
Maxime Coste
6740e3cc0c Add some more keywords to kakrc highlighting 2017-10-21 18:48:35 +08:00
Dan Rosén
5b0f070300 Improve kakrc highlighter 2017-10-21 10:08:50 +02:00
Frank LENORMAND
1cfee17a16 rc man/doc: Don't show groff warnings
Sometimes the implementation of `man` will display errors, e.g.

```
<standard input>:4808: warning [p 54, 13.2i]: can't break line
```

Those errors are harmless but are still reported on the debug buffer,
so we hide them by redirecting the standard error stream to /dev/null.
2017-09-30 08:23:10 +03:00
Frank LENORMAND
1e3c343773 rc doc: Use POSIX flag -name instead of -iname 2017-09-30 08:15:14 +03:00
Frank LENORMAND
18e64c5c7d rc doc: Implement the -i flag of sed in a POSIX manner 2017-09-29 22:16:31 +03:00
Frank LENORMAND
f26854694e rc doc: Remove window hooks automatically assigned
When using the `man` filetype to make use of the text highlighters
of the `man.kak` script, the documentation pages inherit from the
window resizing hooks that won't work on `doc` buffers.

Fixes #1591
2017-09-29 22:12:09 +03:00
Maxime Coste
902724e558 c-family: auto close unions with a semicolon as well 2017-09-18 09:41:26 +09:00
Maxime Coste
420c6aca23 Change documentation directory towards $kak_runtime/doc 2017-08-03 15:00:02 +07:00
Maxime Coste
4dac61c864 Fix grep-next/prev-match not jumping correctly to first/last match
When used just after grepping, grep-next-match ended up jumping to
the second match, as `0g` is the same as `g`.

The fix itself is pretty ugly, a better one might be to distinguish
the `0` count from no count given, so that `0g` could fail with
"no such line" or similar.
2017-07-29 03:02:11 +07:00
Maxime Coste
6ab98f8bf8 Fix grep-jump on eol 2017-07-29 03:02:11 +07:00
Maxime Coste
9c4448ac41 Remove echo -color support, superseeded by echo -markup
`echo -color Error "blah"` is the same as `echo -markup '{Error}blah'`
Fixes #1512
2017-07-19 17:18:52 +02:00
Frank LENORMAND
21847a5f85 rc man: Avoid undefined behavior on expr
Looking up the man page for `index` was failing on systems using
GNU/coreutils. The `:man` command matched whatever page it was given with
the `expr` utility. This tool behaves as expected when it follows strictly
the POSIX standard but the GNU implementation introduces additional commands
(including `index`), about which the standard states:

```
The use of string arguments length, substr, index, or match produces unspecified results.
```

As a result, parsing the man page number is now implemented with pure
shell expansions, to avoid triggering an undefined behavior when the topic
searched is one of the keywords above.
2017-07-17 21:24:41 +03:00
Frank LENORMAND
74babc36b1 rc formatter: Don't force selection restoration
The `|` primitive now correctly restores selections, we don't need to
forcibly restore the main one after formatting anymore.
2017-07-14 11:21:48 +03:00
Frank LENORMAND
50b635ce2d rc c-family: Add a hook to the insert group 2017-06-29 13:29:48 +03:00
Delapouite
a932b6b21e Add error message when using format command with no formatcmd specified 2017-06-26 22:10:04 +02:00
Maxime Coste
f41d78083a Use the extra_word_chars option in word based normal commands
the completion_extra_word_chars is now gone, superseeded by
extra_word_chars that gets used both for completion and for normal mode.

Fixes #1304
2017-06-26 15:28:41 +01:00
Frank LENORMAND
6376aa6206 rc formatter: Make sure the formatter returned successfully
The previous implementation used to replace the contents of the buffer with
whatever the `formatcmd` was returning, regardless of the exit code of the
command, which led to the buffer being wiped out on error.

This commit does the formatting in a temporary file, and only replaces the
current buffer with the contents of the -formatted- temporary file if the
`formatcmd` returned successfully.

Fixes #1357
2017-06-23 15:12:23 +03:00
Alex Leferry 2
585778057f Update command names 2017-06-16 13:53:03 +02:00
Frank LENORMAND
cb9a2e562b rc: Fix calls to mktemp
The GNU and BSD implementations differ on several points, this commit
hopefully finds a middle ground.
2017-06-16 11:51:46 +03:00
Maxime Coste
e73cd78288 Fix corner case in C family indenting 2017-06-13 10:19:38 +01:00
Frank LENORMAND
813d09a101 rc: Fix calls to mktemp
Allow `mktemp` to make use of the `TMPDIR` environment variable when
calling it with a template.

Don't use the deprecated `-t` flag.
2017-06-09 14:30:54 +03:00
Maxime Coste
81118552c8 Fix missing hook removal command in c-family.kak 2017-06-07 12:44:00 +01:00
Frank LENORMAND
8794687f36 Revert "doc: Fix the documentation of the alt_dirs option"
This reverts commit ef88b28392.
2017-06-04 11:24:10 +03:00
Frank LENORMAND
ef88b28392 doc: Fix the documentation of the alt_dirs option 2017-06-03 21:49:10 +03:00
Maxime Coste
d8a90ad5d3 Merge remote-tracking branch 'danr/Remove-ad-hoc-rules-in-kakrc-highlighter' 2017-06-03 15:16:49 +01:00
Maxime Coste
f3f6ac9e8a Merge remote-tracking branch 'danr/Improve-kakrc-highlighter-with-more-static-words' 2017-06-03 15:16:14 +01:00
Maxime Coste
9d71be769b Rename _grep_current_line option to grep_current_line 2017-06-03 14:04:06 +01:00
Maxime Coste
d8cc50ed79 man.kak: Rename _manpage option to manpage 2017-05-27 07:40:47 +01:00
Maxime Coste
ad154e7bb7 Highlight non numeric man sections as well in man.kak 2017-05-27 07:34:35 +01:00
Maxime Coste
0b592c5641 Slight style tweak in doc.kak 2017-05-27 06:14:01 +01:00
Maxime Coste
ca38e10314 Make shell variable expansion in "strings" highlighted the same way as in code 2017-05-25 19:54:08 +01:00
Maxime Coste
a84d7cf06b Add break and continue to the list of sh keywords 2017-05-25 19:54:08 +01:00
Maxime Coste
3e4e4f6210 Add support for raw C++ strings in c-family highlighting 2017-05-25 06:51:39 +01:00
Maxime Coste
a0e63fbe93 Fix man.kak when man pages filenames just end up with the manual section 2017-05-23 13:59:31 +01:00
Maxime Coste
2f9b77b748 Smarter align to opening parenthesis/brace supporting multiline 2017-05-21 22:31:05 +01:00
Maxime Coste
c6508ee101 Merge remote-tracking branch 'lenormf/doc-public-options' 2017-05-21 07:09:37 +01:00
Maxime Coste
e43e44f9cc Commit correct version of c-family indent change 2017-05-21 07:08:20 +01:00
Maxime Coste
cab0adaa53 Support aligning to opening { as well as ( in c-family indent 2017-05-20 11:08:13 +01:00
Maxime Coste
55d1d1020d Merge remote-tracking branch 'lenormf/rc-misc-fixes' 2017-05-19 21:53:02 +01:00
Frank LENORMAND
d59bafa2c1 rc: Simplify and optimize the alt command 2017-05-16 18:20:19 +03:00
Frank LENORMAND
b9cdccd53a rc: Document non-hidden options with -docstring 2017-05-16 14:35:43 +03:00
Dan Rosén
4f7f7edea0 Add some missing languages to comment.kak 2017-05-16 09:21:30 +02:00
Dan Rosén
5f97117ab4 Remove ad-hoc rules in kakrc highlighter
These are less useful with more static words, and they are
woefully incomplete: no support -docstring for map, set
uses the variable face, but there is no corresponding
highlighter for decl or %opt{..}.
2017-05-15 21:58:57 +02:00
Dan Rosén
1e4958353a Improve kakrc highlighter with more static words 2017-05-15 21:58:57 +02:00
Maxime Coste
edc2a88643 Rename BufNew and BufOpen hooks to BufNewFile and BufOpenFile
Fixes #1225
2017-02-19 13:08:06 +00:00