Commit Graph

231 Commits

Author SHA1 Message Date
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
Maxime Coste
14fa89e642 Merge remote-tracking branch 'lenormf/fix-doc-ansi-sequences' 2017-02-13 20:27:38 +00:00
Maxime Coste
f7d794d047 Merge remote-tracking branch 'nicholastmosher/faces' 2017-02-13 20:25:41 +00:00
Maxime Coste
5b1229709d Fix make.kak handling of 'Entering directory' and absolute paths
Fixes #1212
2017-02-13 13:52:51 +00:00
Frank LENORMAND
0532251aaf Make sure no ANSI sequences are in the data returned by man
The Debian implementation of `man-db` does not strip ANSI sequences out
of the file, even though the documentation says it would do so. The
commit that originally closed this issue wasn't related to the problem
experienced, this one hopefully addresses it.

This commit also addresses an issue with the `-i` flag in BSD `sed`
which expects an argument (the GNU implementation doesn't).

Fixes #1098
2017-02-10 13:30:06 +03:00
Nick Mosher
e1927fa9c4 Adds faces module and function. Renames identifier face to variable. 2017-02-09 21:43:29 -05:00
Maxime Coste
033ded15ae Add proper heredoc highlighting support to sh.kak 2017-02-06 23:00:20 +00:00
Maxime Coste
99b7d83ca3 Highlight c-family include paths as identifiers 2017-02-03 13:35:45 +00:00
Maxime Coste
e2d24701fa Merge remote-tracking branch '4d47/php-comments' 2017-01-29 14:43:59 +00:00
Mathieu Gagnon
97d99358d1 Set commenting options for php
The defaults are working but using c-family style is more idiomatic,
it also enable support for `comment-selection`.
2017-01-29 06:23:11 -05:00
Maxime Coste
1048036d3c Merge remote-tracking branch 'alexherbo2/rc-comment' 2017-01-25 21:18:48 +00:00
Maxime Coste
d3ecc9f311 More tolerant recognition of underlined titles in asciidoc highlight 2017-01-25 00:24:41 +00:00
Alex Leferry 2
4f3c28aa37 fix quote convention 2017-01-15 15:12:57 +01:00
Alex Leferry 2
b66d58b703 remove optional value 2017-01-15 15:07:17 +01:00
Alex Leferry 2
d6cb1b8e53 fix typo 2017-01-15 15:05:01 +01:00
Alex Leferry 2
165227dac2 rename line and block comments options 2017-01-15 14:58:07 +01:00
Alex Leferry 2
98cc81ae07 rename :comment-selection to :comment-block 2017-01-15 14:48:12 +01:00
Alex Leferry 2
1f0ec535bd tweak :comment-line behaviour to comment selected lines 2017-01-15 14:43:45 +01:00
Alex Leferry 2
4ad4b2d41a rename commenting.kak to comment.kak 2017-01-15 14:25:32 +01:00
Maxime Coste
c0afbe8626 Remove MAN_KEEP_FORMATTING for doc.kak
Fixes #1098
2017-01-15 11:26:57 +00:00
Maxime Coste
5ad4499503 Fix naming conventions in bundled scripts
Do not use _ prefix for hidden commands, use - as a word separator
in command names.
2017-01-13 01:00:43 +00:00
Maxime Coste
91a56c11fe Various auto indent fixes regarding wrong use of x instead of <a-x> 2017-01-13 00:50:03 +00:00
Maxime Coste
5989903e7c Copy comments *before* copying indentation
Fixes #1118
2017-01-11 13:56:48 +00:00
Maxime Coste
4cfa4062bc Add '-' as completion extra word character for kakrc files 2017-01-10 13:48:04 +00:00
Maxime Coste
343df600cb Merge remote-tracking branch 'alexherbo2/command-names' 2017-01-10 13:44:11 +00:00
Maxime Coste
a8fb280b6d make.kak: highlight gcc/clang style location markers 2017-01-06 17:05:39 +00:00
Alex Leferry 2
671b50bb52 update command names 2017-01-04 13:04:27 +01:00
Alex Leferry 2
8f821f0fba update kakrc keywords 2017-01-04 00:30:50 +01:00
Maxime Coste
c3e1bab9d6 Fix comment autoinsert for c-family as well.
Fixes #1074
2017-01-02 12:05:49 +00:00
Maxime Coste
4901a02e50 Add indentation hooks to kak filetype support script 2017-01-02 04:33:42 +00:00
Maxime Coste
5ab60cde51 Rename python indentation command to be more consistent
We use `-` as word separator, and there is no need for leading
underscore.
2017-01-02 04:20:05 +00:00
Maxime Coste
d5231c713e Fix corner case in C indentation 2017-01-02 04:15:12 +00:00
Leira Hua
6cbc9e0a34 Fixes #995 Documentation rendering problem
BSD sed doesn't accept ascii number with '\x', used printf to generate
\x8 as @lenormf suggested.
2016-12-20 02:31:55 -08:00
Maxime Coste
1bdf26fd6e Merge remote-tracking branch 'casimir/remove-mimetype' 2016-12-14 13:30:59 +00:00
Maxime Coste
8e351e8285 Remove use of non-standard -l option in doc.kak
This will break BSD unfortunately, we should try to find a
portable fix for that.

Fixes #967
2016-12-14 01:02:53 +00:00
Maxime Coste
066d6d1120 Do not use find -printf in doc completion implementation 2016-12-14 00:59:19 +00:00