Commit Graph

231 Commits

Author SHA1 Message Date
Frank LENORMAND
ab1704ce10 rc doc: Hide errors on missing directories
Fixes #4273.
2021-09-16 11:46:18 +03:00
Tim Allen
dc07c649de Add standard DiagnosticError and DiagnosticWarning faces.
kak-lsp uses these faces to mark errors inside the buffer, instead of the Error
face which is much more jarring, and which does not have an associated warning
face. Since the :spell command marks errors inside the buffer, it's also updated
to use this new face.

Adding these faces to Kakoune makes it more likely that colorschemes will
automatically do the right thing when used with kak-lsp, and makes it possible
to use a subtle appearance (like curly underlines) for in-buffer errors while
keeping Kakoune errors bold and jarring as they should be.
2021-09-07 17:46:50 +10:00
Maxime Coste
e63ab10424 Merge remote-tracking branch 'gustavo-hms/master' 2021-08-17 08:43:25 +10:00
Johannes Altmanninger
89229bab39 Teach :comment-line about the fennel language
Fixes #4292
2021-08-09 22:45:57 +02:00
Maxime Coste
9cf79bfd1e Merge remote-tracking branch 'listentolist/pascal-filetype' 2021-07-20 22:40:06 +10:00
Tilman List
807be115b2 make pascal filetype compatible with bash
When using bash, the whitespaces before the delimiting identifier `EOF`
cause an error as well as a missing `\` before `$`.
2021-07-17 20:01:12 +02:00
Robin Stumm
507e16ff23 comment.kak: add cue 2021-07-16 17:55:10 +02:00
throwawayaccount12345-1
719b23c54f
Fix #3957
If the session wasn't valid anymore by the time the linter finishes,
writing to "$dir"/fifo would hang forever leaving temporary files in
/tmp/kak-lint.XXX and the process alive. This commit fixes that by
not writing to the fifo if the session was not valid.

throwawayaccount12345-1 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.
2021-07-09 22:18:25 -03:00
Maxime Coste
2b68b6737c Update spell.kak to use command/response fifo 2021-07-07 19:25:06 +10:00
Maxim Baz
0289131c24
spell.kak: ignore another undocumented control char 2021-07-01 21:52:59 +02:00
Răzvan C. Rădulescu
c24cbebe47 Fix purescript comments and keywords 2021-05-30 15:39:58 +03:00
Dan Rosén
6198ebe37d Fix jedi off-by-one and refactor jedi
The off-by-one was introduced by cd9b1e66 which changed `column-1` to `column`.

The refactoring solves some esoteric quoting errors: I think cases like
unbalanced braces in the bufname and client were not supported.
2021-05-04 20:57:13 +02:00
Markus F.X.J. Oberhumer
c4c093d764 doc: small UX improvements.
Place the cursor at the beginning of the file (and not at
the end of the first line) and improve error message in
case of failure.
2021-05-02 11:27:48 +02:00
dzamo
cd9b1e66f0
Update jedi.kak
I needed this patch accommodating minor Jedi API changes to get Jedi completion working.  I've got Jedi 0.18.0.
2021-04-27 17:42:29 +02:00
Markus F.X.J. Oberhumer
2b3e5bc972 rc doc: do not require arguments for ":doc" or ":help"
When no arguments are given simply run ":doc doc".
2021-04-26 00:13:01 +02:00
Gustavo Henrique Montesião de Sousa
2454cf3345 Add basic support for the Janet language 2021-04-23 14:49:24 -03:00
Calum
3e456ae34e use lisp comments for scheme 2021-02-22 01:21:04 +13:00
Maxime Coste
dea44e4964 Merge remote-tracking branch 'lenormf/fix-spell' 2021-02-11 20:40:50 +11:00
Maxime Coste
8738be1252 Merge branch 'master' of http://github.com/Kabouik/kakoune 2021-01-28 21:06:14 +11:00
Maxime Coste
b8f1df6458 Fix man for systems lacking the col command
At least Alpine linux with mandoc does not have the col command,
as it is easy to emulate with sed, fallback onto it when it does
not exist.
2021-01-26 09:28:24 +11:00
Mathieu Laparie
0a978865f4 Add comment symbols for r filetypes, remove rmd for now 2021-01-21 15:35:35 +01:00
Mathieu Laparie
b74dfa1e74 Add R and Rmd options for comment.kak 2021-01-21 15:12:41 +01:00
Frank LENORMAND
efb6fca068 rc spell: Remove :spell-replace default value
This commit removes the default prompt value from the `spell-replace`
command.

Currently, running the command after selecting a misspelled word
might not allow the editor to propose alternative spellings because
it completes upon whatever is inserted into the prompt. If the words
returned by `aspell` are too different from the currently misspelled
word, no candidates are shown.

For example, selecting “unanymously” and running `:spell-replace`
will not show any candidates under the current implementation (the
‘y’ probably trips the fuzzy-matcher).

The user develops a habit of clearing the prompt every time, because
that's the only way to make sure all suggestions from `aspell` are
visible, so the editor might as well not have any default value for
`:spell-replace`.
2021-01-19 16:38:23 +03:00
Maxime Coste
c8378eb7f2 Merge remote-tracking branch 'Ordoviz/pascal' 2021-01-03 11:28:11 +11:00
Lennard Hofmann
3eabeac3c9 Add Pascal/Delphi language support 2020-12-29 12:20:33 +01:00
Maxime Coste
a0f575a0f7 Merge remote-tracking branch 'tototest99/ml_v_comments' 2020-12-21 08:59:14 +11:00
antab
6523f57d72 feat(comment.kak): add OCaml and Coq cases 2020-12-18 08:08:56 +01:00
Frank LENORMAND
deff6b2fa9
rc doc: Hide private commands 2020-12-17 16:43:48 +03:00
David Arnold
38efe8b421
Fix protobuf commenter 2020-12-13 20:15:02 -05:00
Maxime Coste
ce97c0dd17 Merge remote-tracking branch 'lenormf/fix-temporary-dir-template' 2020-12-05 10:53:57 +11:00
Frank LENORMAND
a548caaebe rc: Consistently use a dot as template separator
Other scripts uses a dot `.` to separate the seed from the rest of
the template, making that standard across the codebase allows running
cleanup commands like `rm -rf /tmp/kak-*.*`.
2020-11-30 14:24:06 +03:00
Frank LENORMAND
fe5f357446 rc lint: Avoid stray processes and temporary directory
This commit is an attempt at mitigating stray processes and temporary
directories, which pile up in the process tree and `$TMPDIR` over time.

To reproduce the issue, run the `lint` command in rapid successions,
or simply run `:lint; lint; lint;` in the prompt (two consecutive
calls are enough to trigger the bug).

The first call creates a `\*lint-ouput*` buffer, bound to a named
pipe that will be populated later on in an asychronous shell
process. It's that same process that runs the linter afterward, and as
soon as it has been spawned, the following call to `:lint` is executed.

Each call to `:lint` overrides the path to the named pipe that was
assigned to `\*lint-output*` by the previous one, resulting in several
asynchronous processes (that write diagnostics to the pipe) hanging
forever — the pipe is never read, and so the process idles.

The command that removes the temporary directory follows the one that
writes to the named pipe, it's never called in the above scenario,
which additionally results in `kak-lint.XXXXXXXX` directories being
left behind in `$TMPDIR`.

(Also) Fixes #3681.
2020-11-30 13:51:34 +03:00
Maxime Coste
d495369e75 Merge remote-tracking branch 'ManDay/master' into master 2020-11-11 07:25:54 +11:00
Patsakula Nikita
ff8d4d6567
[-] spell.kak: undocumented aspell buggy-behavior avoided. 2020-11-06 15:41:12 +03:00
Maxime Coste
42301f32ca doc.kak: Render links and other elements with a single ranges highlighter 2020-11-02 08:51:44 +11:00
Cedric Sodhi
221fc38bd9 Disabled backtick escaping
Fixes issue #2377 by removing the ability to escape backticks in backticks in compliance with asciidoc's behaviour. Adjusted hooks.asciidoc, keys.asciidoc, and command-parsing.asciidoc to match accordingly.
2020-10-27 12:36:33 +01:00
Maxime Coste
90043e7df0 Replace write -atomic with write -method <method>
`-atomic` becomes `-method replace` and `-method overwrite` is now
supported explicitely instead of only available through the
writemethod option.

Fixes #3827
2020-10-27 20:20:18 +11:00
voroskoi
dd6a275c3e
gopls.kak: use nop for removing temp dir
Co-authored-by: Frank LENORMAND <1379068+lenormf@users.noreply.github.com>
2020-10-17 09:47:07 +02:00
VÖRÖSKŐI András
cbbab07aab gopls: Fix format/imports error reporting
Remove unnecessary single quotes and whitespaces in %file{}
Do not delete error file before sending to debug buffer
Fix gopls definition error handling and empty sting check
Silence shellcheck warnings
2020-10-16 22:40:58 +02:00
Maxime Coste
9401a9fd25 Merge remote-tracking branch 'Screwtapello/extensible-docs' into master 2020-10-01 22:16:23 +10:00
Maxime Coste
88f6b65f35 Merge remote-tracking branch 'lboklin/master' into master 2020-09-30 21:29:38 +10:00
Tim Allen
93e5a3b51f spell.kak: Replace "kak -f" with "sed" for efficiency. 2020-09-22 01:29:03 +10:00
Tim Allen
f75f484b84 spell.kak: Present spelling suggestions with :prompt
Previously, spelling suggestions were presented with the :menu command,
requiring the user to cycle through wild and fanciful alternatives to get to the
one they wanted. Now, we present suggestions with the :prompt command, which
allows the user to type to filter down the list, and also to customise the
replacement after they've chose it (perhaps to fix capitalisation or add
apostrophe-S).

We also use the mispelled word as the initial content of the prompt. That
filters out the wildest alternatives by default, and allows the user to edit the
original word instead of forcing them to choose from among the suggestions. To
get the full list of suggestions, it's easy enough to just backspace until the
word you want appears in the list.
2020-09-21 21:07:35 +10:00
VÖRÖSKŐI András
9fe1a2a9a4 gopls: fixes based on krobelus@ review 2020-09-16 21:58:22 +02:00
VÖRÖSKŐI András
2b18b1d088 rc/go-tools.kak: remove
Working functions replaced by gopls
Use kak-lsp if you need in place documentation and autocompletion
2020-09-15 01:02:19 +02:00
VÖRÖSKŐI András
568020d67b rc gopls.kak: initial import
Add support for the following gopls commands:
 - format
 - imports
 - definition
 - references

Thanks krobelus@ and lenormf@ for their review and suggestions.
2020-09-15 01:01:35 +02:00
Maxime Coste
c98d6c3062 Merge remote-tracking branch 'krobelus/initialize-shell-vars' into master 2020-09-06 10:52:07 +10:00
Maxime Coste
f84c550d30
Apply suggestions from code review
Co-authored-by: Screwtapello <thristian@gmail.com>
Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
2020-09-06 10:56:37 +10:00
Tim Allen
a25cc215e8 Reference content goes in docstrings, explanations go in prose docs.
Also, make sure docstrings reference the prose docs, so people who stumble over
an interesting-looking command or option can find out more about it.
2020-09-04 19:20:50 +10:00
Tim Allen
66cc39cb14 Update plugin docs to not duplicate docstring information. 2020-09-03 17:18:19 +10:00
Tim Allen
9934788155 Add more user-oriented documentation for the documentation system. 2020-09-03 16:49:18 +10:00
Tim Allen
e3298c6320 Address code-review comments
- some wording changes in included documentation
- find supports multiple starting paths, we don't need to launch it 3 times
- Change the regex that trims the file extension to only trim the last extension

Some additional things I noticed:

- find should use -L to see through symlinks like the autoload processing does.
- find should check the user's autoload directory first, so users can override
  Kakoune's built-in documentation.
2020-09-03 15:21:54 +10:00
Tim Allen
d628cb50cf rc: Add some documentation for existing plugins.. 2020-09-03 01:55:36 +10:00
Tim Allen
4296305171 doc.kak: Also search through plugins (stdlib and per-user) for docs.
This makes the somewhat-dubious assumption that every plugin will have uniquely-
named documentation files, instead of automatically putting every plugin's docs
into a namespace. However, plugins already have to deal with flat namespaces for
commands, options, filetypes, etc. so one more shouldn't hurt.

Fixes #2466.
2020-09-03 01:19:20 +10:00
Frank LENORMAND
0cd706254a rc clang grep: Make docstrings more readable 2020-09-02 11:57:34 +03:00
Johannes Altmanninger
407c72d90a Clear unwanted environment variable
This adds two things I forgot in
9a7d8df4 (Avoid accidentally using environment variables in sh scopes)

Mea culpa, the problem was that I was skipping matches with "filetype"
because that's usually just a hook parameter as in "WinSetOption filetype=.."

	rg --pcre2 '\b(?!filetype=)\w+=' rc/

So I missed these two cases where a shell variable is actually called "filetype".

The one in git.kak was not a problem because show_git_cmd_output is only
ever called with sane inputs.  However, file.kak does use the filetype
environment variable for many mime types, for example:

	filetype=somefiletype\''; echo -debug injection; nop '\' kak /dev/null

Will run the echo since /dev/null has mime type "inode/chardevice"
2020-09-02 06:54:19 +02:00
Ludvig Böklin
0e84cdb016 Mercury-lang filetype support 2020-08-31 16:36:43 +02:00
Johannes Altmanninger
9a7d8df447 Avoid accidentally using environment variables in sh scopes
On the instances with altfile this was already the case, but this makes it more obvious.

Closes #3673
2020-08-24 19:01:05 +02:00
Vladimir Bauer
649e252f75 bring *grep* buffer to front in context of toolsclient 2020-08-14 00:52:22 +05:00
Thayne McCombs
881c7b9f15 Add comment highlighting and options for asciidoc.
Fixes #3068.
2020-07-04 00:28:51 -06:00
Maxime Coste
f5127f8b22 Merge remote-tracking branch 'lenormf/key-percent' 2020-06-25 20:58:26 +10:00
Maxime Coste
42af5e1f9e Merge remote-tracking branch 'lenormf/fix-3432' 2020-06-25 20:57:35 +10:00
Cem Aksoylar
28be53fb39 Make lint.kak utilize toolsclient 2020-06-10 22:39:11 -07:00
Frank LENORMAND
61366fd1ef rc man: Handle early window resize
If the window gets resized before the `man` command is called, the
hook will error out and display an error.

Fix #3432
2020-06-03 15:47:46 +03:00
Frank LENORMAND
24c5169400 src: Introduce a <percent> named key
Similarly to the <semicolon> key, make it easier to write
`:execute-keys` commands by replacing <percent> with `%`.

Highlighters can keep escaping the sign when regular expressions are
not quoted, but built-in scripts that use `%` as an editing primitive
have been modified to use the named key, for clarity.
2020-06-03 15:42:38 +03:00
Maxime Coste
0b56c777c0 Merge remote-tracking branch 'lenormf/fix-spell-next' 2020-05-30 09:22:06 +10:00
Maxime Coste
0315b2e3f5 Merge remote-tracking branch 'greenfork/add-default-comments-for-zig' 2020-05-30 09:12:51 +10:00
Maxime Coste
d90f8d4324 Merge remote-tracking branch 'lenormf/remove-lint-enable' 2020-05-30 09:05:53 +10:00
Frank LENORMAND
b4f2c3fe91 rc lint: Remove the concept of "enabling" linting
This commit renames `lint-enable` into `lint-show-diagnostics`,
makes it hidden, and calls it automatically after diagnostics have
been recovered by `:lint-cleaned-selections`.

The `lint-disable` command becomes `lint-hide-diagnostics`.

The concept of "enabling" diagnostics was inherited from the Clang
support script, but in that case it's not clear why calling `:lint`
should do the work but not render it (similarly to `:spell`).

The `lint-show` command was also renamed into a more descriptive
`lint-show-current-line`.
2020-05-29 14:39:39 +03:00
Maxime Coste
08e0b663f7 Fix unintended interpretation of ranges length syntax
Ranges specified with a +<length> were inconsistent, with +0 meaning
an empty range, while +1 meant a two character long range (first character
+ the following one). Change that to mean a single character.

Fixes #3479
2020-05-29 12:25:57 +10:00
Dmitry Matveyev
ccfd5ea5c6 Add default comments for Zig language 2020-05-19 22:05:10 +03:00
Frank LENORMAND
05db1e8697 rc spell: Make :spell-next wrap around the buffer 2020-05-15 18:37:03 +03:00
Frank LENORMAND
4eac927a01 rc spell: Rewrite :spell-next in Awk 2020-05-15 12:59:30 +03:00
Frank LENORMAND
e9e15e6a44 rc spell: Simplify selection-descriptions parsing
Remove everything after the first pipe sign. Pop the timestamp.
2020-05-15 12:21:02 +03:00
Frank LENORMAND
7db9062122 rc spell: Don't use expr to format-check
The regular pattern based on `printf`/`grep` is cleaner and less
error prone.
2020-05-15 12:19:29 +03:00
Frank LENORMAND
9bc6bddcac
rc spell: Fix off-by-one highlighting glitch 2020-05-07 10:40:25 +00:00
Frank LENORMAND
c6906be475 rc man: Make the use of $MANPATH portable 2020-05-02 11:59:06 +10:00
Maxime Coste
83cdaee002 Merge remote-tracking branch 'JJK96/spell' 2020-04-30 19:23:27 +10:00
Jan-Jaap Korpershoek
063a702bf4 Add error handling
Rewrite line by line to make escaping easier
2020-04-27 12:28:29 +02:00
Jan-Jaap Korpershoek
246735520f Add spell-add command 2020-04-27 11:57:14 +02:00
Maxime Coste
6dc17cb3b3 Complete man pages from MANPATH as well 2020-04-21 13:21:35 +10:00
Maxime Coste
54e0396c84 Merge remote-tracking branch 'codesoap/awkcomment' 2020-04-09 07:50:11 +10:00
Frank LENORMAND
7d987c013e rc lint: Check the lintcmd option is set in :lint-buffer
Calling `:lint-buffer` when `lintcmd` is empty results in a temporary
directory being created, but never removed when the underlying linting
code errors out.
2020-03-27 10:20:40 +03:00
codesoap
94cdd3f9e3 rc spell: Avoid C-style comments in awk 2020-03-22 08:13:30 +01:00
Maxime Coste
329f291ae0 Merge remote-tracking branch 'Anfid/hunk-seek-wrap' 2020-03-15 12:35:50 +11:00
Mikhail Pogretskiy
8c7bb10e56 rc git: Make git next/prev-hunk behavior consistent with search command 2020-03-11 13:56:28 +07:00
Frank LENORMAND
e83ad2a2a4 rc spell: Re-implement message processing in Awk
Plain shell takes too long on large files.

Fixes #3399
2020-03-09 14:22:34 +03:00
Maxime Coste
f682d8c01f Merge remote-tracking branch 'chambln/git' 2020-03-03 07:55:12 +11:00
Jason Felice
1ed8b84762 Fix unnecessary refreshes
Incrementally setting the lint variables triggers multiple refreshes,
including the text jumping as the guttter column is removed and re-
added.  This causes the info message to disappear when linting is done
on NormalIdle.
2020-02-28 21:44:10 -05:00
Gregory Chamberlain
13d042cf8f rc git: Fix highlighting of ‘:git log --graph’
Looks like hyphens and periods are sometimes printed as part of
git-log(1)’s graphing feature; for example, in this repository:

    git log --graph 55e7f857
2020-02-27 05:11:11 +00:00
Maxime Coste
ce93a7b032 Fix doc paragraph rewrapping 2020-02-18 19:25:12 +11:00
Tim Allen
9277121695 rc lint: Change flag symbols for lint errors and warnings.
As suggested in code review.
2020-02-14 17:27:36 +11:00
Tim Allen
59e273c316 rc lint: Teach lint-{next,previous}-message to wrap around the buffer.
This matches the behaviour of make-{next,previous}-error.
2020-02-13 20:27:28 +11:00
Tim Allen
48bd7387bb rc lint: When parsing lint messages, use "remove shortest prefix" pattern.
There might legitimately be "|" characters in the message, so
we want to stop at the first one, the one that delimits the message location
from the message text.
2020-02-13 20:27:24 +11:00
Tim Allen
cad0572ca5 rc lint: Re-add missing kakquote functions. 2020-02-13 20:27:19 +11:00
Tim Allen
c1e9f46301 rc lint: Don't start a comment with "shellcheck".
That confuses shellcheck into expecting a warning pragma.
2020-02-13 20:27:12 +11:00
Tim Allen
09f067d585 rc lint: More code-review comments.
Don't ask Kakoune to quote values we know can never contain shell-sensitive
characters, and flatten the kakquote() function to a single line for ease
of copy/pasting.
2020-02-09 14:01:35 +11:00
Tim Allen
673d081823 rc lint: Address code-review comments. 2020-02-09 13:23:58 +11:00
Tim Allen
51fcea7ce0 rc lint: Add a lint-selections command to lint part of a buffer.
Fixes #2302, #3336.

Addresses parts of #3155.

Changes include:

- New `lint-selections` command that only lints the current selections,
  and allows a custom lint command.
- New `lint-buffer` command that always lints the whole buffer with
  the linter specified in the lintcmd option.
- `lint` alias for `lint-buffer`, for backwards compatibility.
- Errors and warnings are now shown in the Error and Information faces,
  not hard-coded red and yellow.
- Error and warning flags now use "!" and "?" symbols respectively,
  instead of a unicode block, so they can still be distinguished
  in a monochrome colour-scheme or by colour-blind users.
- An error flag on a given line always takes precedence over a warning.
- All messages for the same line are collected into a multi-line message.
- We no longer escape tildes in messages, since that change was added
  in commit ae339dc (2016) when we started using `%~~` to quote messages.
  We stopped using `%~~` in commit 1a2eecd (2018).
- Anything the linter writes to stderr is logged to the *debug* buffer,
  not lost.
- If the linter writes to stderr, an error is shown to the user instead
  of the usual error/warning count.
- The `lint_errors` hidden option is replaced by `lint_messages`,
  because it contains warnings as well as errors.
- `lint-next-error` renamed to `lint-next-message`,
  and `lint-previous-error` renamed to `lint-previous-message`
  for the same reason.
    - New `lint-next-error` and `lint-previous-error` aliases,
      for backwards compatibility.
- `lint-next-message` and `lint-previous-message` show the message
  they jump to.
- Where `lint_errors` was a range-specs option, `lint_messages` is a
  line-specs option to keep things simpler. This means lint-next-message
  and lint-previous-message no longer jump to a specific column.
2020-02-07 19:22:47 +11:00
Maxime Coste
bb28477c48 Merge remote-tracking branch 'chambln/master' 2020-02-05 20:54:49 +11:00