Commit Graph

308 Commits

Author SHA1 Message Date
Maxime Coste
ef8a11b3db Make x just select the full lines
`x` is often criticized as hard to predict due to its slightly complex
behaviour of selecting next line if the current one is fully selected.

Change `x` to use the previous `<a-x>` behaviour, and change `<a-x>` to
trim to fully selected lines as `<a-X>` did.

Adapt existing indentation script to the new behaviour
2022-07-05 08:43:40 +10:00
nonumeros
3eeebd676a git-show-branch added to show graph with branches and commits 2022-06-27 16:51:28 -04:00
Jon Eskin
1898528421 Add hare comments and indentation 2022-06-09 04:31:18 -04:00
Maxime Coste
7f245e92fb Merge branch 'doc_doc' of http://github.com/Pound-Hash/kakoune 2022-05-09 20:04:53 +10:00
Pound_Hash
ac5ebe70ae Wrapped the lines at the 80th column 2022-05-06 10:33:12 -07:00
Johannes Altmanninger
52a7c58670 rc autorestore: fix regression due to ! breaking change
Commit 85b78dda (src: Select the data inserted by `!` and `<a-!>`,
merged on 2021-03-06) broke autorestore by making it delete the
restored content.  I've been using it for 6 months but never noticed
since I didn't use autorestore

Reproducer:

	HOME=$PWD kak -s foo README.asciidoc -e 'exec iUNSAVED-CONTENT'
	# In another terminal:
	ps aux | awk '/kak -s foo/ {print $2; exit}' | xargs kill -HUP
	HOME=$PWD kak -s foo README.asciidoc

Delete the trailing newline instead of the restored content.

While at it, remove some <space> commands from execute-keys, to make
it work on the breaking-cleanups branch which swaps <space> and ",".

Closes #4335
2022-04-28 19:32:24 +02:00
Andrew Vos
0f966e656b
Disable external diff tools when diffing buffer
There is a bug that causes `:git show-diff` to fail when using an external diff, for example difftastic.

This change ensures that we don't use an external diff tool when diffing the current buffer.
2022-04-12 16:26:38 +01:00
Pound_Hash
0ba945d585 Fixed English mechanics: grammar, punctuation, wording 2022-04-11 15:41:46 -07:00
Johannes Altmanninger
a0477b1016 rc format: restore in-client error when formatcmd fails
Commit 5b1f9255 (rc: Use the standard `fail` command to report errors,
2019-11-14) replaced uses of "echo -markup {Error}" with "fail".
This made format-buffer do

	echo "eval -client $kak_client %{ fail }" | kak -p $kak_session

Unfortunately "fail" fails in the client spawned by "kak -p" and not
in $kak_client where the user would see the message. Correct this.

While at it, clarify the error message, so users immediately know
that the number is the exit code.

Fixes #3254
2022-04-09 15:36:02 +02:00
Maxime Coste
eae8ea8a54 Merge remote-tracking branch 'krobelus/ini-hash-comments' 2022-03-21 21:04:55 +11:00
Maxime Coste
7061001728 Add a complete-command command to configure command completion
This makes it possible to change command completion in hooks and
paves the way to more flexibility in how custom commands can be
completed
2022-03-06 10:13:14 +11:00
Johannes Altmanninger
3a856ef57b rc conf: treat ini files as conf if they contain a #-comment
*.ini files traditionally use ; but for example the "foot" terminal's
foot.ini uses #. Add a hack to treat ini files as "conf" filetype
if they contain a #-comment (very slim chance of false positives).
This requires to explicitly set comment_line to the default #,
because we set the "ini" filetype earlier.
2022-02-19 17:31:55 +01:00
Maxime Coste
6c8b7c954f Merge remote-tracking branch 'Qeole/pr/git-blame-flags' 2022-01-29 10:17:02 +11:00
Qeole
5650bf33fa rc git: Batch flags when passing commit info for "git blame"
The wrapper for "git blame" creates flags for each line of the buffer.
It parses the output from git and would send a flag (or a series of
flags) each time the commit to blame for a line differs from the
previous one. For files that were touched by a large number of commits,
this results in a high number of kakoune processes being launched, and
may take some time. This is visible in the session through the flags for
the different commits appearing on the lines one by one, possibly during
several seconds.

To speed up the process, batch flags before passing them to the kak
session. One solution could be to send all flags at once, but this might
delay the appearance of commit info for too long if "git blame" really
takes a long time. The alternative solution retained for this commit
consists in grouping as many flags as we can during one second
(roughly), to pass them to kakoune, and then to move on to the next
flags. This way, a new batch of commit information flags appears every
second or so in the client, until all information is added. This should
be much faster than lauching a kakoune process for each commit
reported by "git blame": tests have shown that blaming a large file in
the Linux repository goes 4.5 times faster when batching flags.

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
2022-01-27 23:15:32 +00:00
Johannes Altmanninger
bf239ba77a rc diff: introduce diff-jump, replacing git-diff-goto-source
git-diff-goto-source is specific to diffs produced by Git.  This patch
generalizes the logic and moves it to a new diff-jump in diff.kak.

The main differences are:
- diff-jump handles plain file diffs (i.e. without the -r option). These
  have no "diff" line. This means that it needs to parse +++/--- instead.
- diff-jump can go to the old file, not just the new one.
- diff-jump allows to override the base directory and the number of
  directory components to strip.

git-diff-goto-source was implemented with several nested try/catch
blocks.  Implementing the extra features would have added more
nesting, redundancy or hidden options. To avoid that, I ported the
parsing logic to Perl (which git.kak already depends on). Maybe
it's possible to do the same in awk.

Potential concerns:
- We could move diff-jump to a new rc/tools/diff.kak but then it's not
  obvious where the "diff" module belongs to.
- Should diff "diff-jump -1" be spelled "diff-jump -p1"?

In future, the diff parser could be reused to implement a vimdiff-style
feature: given a diff and the "old" line number, we can compute the
corresponding "new" line number. Perhaps diff-jump should get a -client
argument.
2022-01-25 14:15:01 +01:00
Johannes Altmanninger
b84abd57de rc diff: make it a module
We want to move git-diff-goto-source from rc/tools/git.kak
to rc/filetype/diff.kak (or should we could create
rc/tools/diff.kak?). Either way, create the diff module so we can
formalize this dependency.

Currently this module only provides highlighters, so require it
wherever we reference them.

Keep the diff-select-{file,hunk} commands outside the module because
people might already use them in git buffers.
2022-01-25 14:11:06 +01:00
Sidharth Kshatriya
2825ca5f73 When viewing :git diff or :git show within kakoune, this commit
adds the ability to press <ret> within a hunk and navigate to the original
source code. This can be useful because one often needs to go back and forth
between the diff and the full source code.

- You can press <ret> anywhere _within_ a hunk i.e. lines that start with
  ` `, `+`, `-`. You will be taken to the exact line in the source that corresponds
  to where you pressed <ret> in the hunk. It actually does not make sense
  to press <ret> on a `-` line because that does not exist anymore but
  in that case you are taken to a nearby line in the hope this is still useful.

- You can also press <ret> on a range line (lines that
  look like @@ ... @@). If you press <ret> on anywhere on a range line e.g.

  ```
  @@ -120,3 +123,4 @@ fn some_function {
  ```
  The code will try to navigate to the section heading "fn some_function {"
  Note that the section heading is _not_ necessarily located at the
  range line (in the above example the range line is 123).

- You can press <ret> on a +++ line also and you will be taken the first
   line of the file

Caveats:
- Navigation to the original source file will be accurate only if any edits to
  the original source file have been saved to disk, because otherwise
  they will not be detected by the `:git diff` or `:git show` commands
- This feature should work well for most typical uses e.g. `:git diff`, `:git diff HEAD^`
  `:git diff <some-sha1>`. In fact this feature should work in all scenarios when
  the *current files* on disk are being compared _with_ some arbitrary git revision/staging.
  It will be less useful in other scenarios when two arbitrary revisions are being
  compared to each other or when you are trying to compare staging to some revision.
  For example when you invoke `:git diff --staged` you are trying to compare staging
  with HEAD but are navigating to what is currently on disk (which may be different
  from staging).

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
2021-11-22 23:33:09 +05:30
Maxime Coste
960e7c7e6a Merge branch 'master' of http://github.com/throwawayaccount12345-1/kakoune 2021-11-07 15:39:25 +11:00
throwawayaccount12345-1
3e580b185c
rc/tools/make.kak: quote "${kak_opt_makecmd}"
As per man page eval(1p):
> The eval utility shall construct a command by concatenating arguments together,
> separating each with a `<space>` character.  The constructed command shall be
> read and executed by the shell.

When not quoting `$kak_opt_makecmd` in the eval, the variable is split by
newlines and spaces and then joined by spaces to form the command. If there
were newlines in `$kak_opt_makecmd`, the command would be malformed.


To reproduce:
```kak
set-option global makecmd "
echo foo
echo bar"
make a b c
```

Expected output in the `*make*` buffer:
```
foo
bar a b c
```

Actual output:
```
foo echo bar a b c
```

This patch fixes this.
2021-11-05 13:43:18 -03:00
Frank LENORMAND
6abcb891ea rc man: Gracefully fail link search 2021-11-04 07:31:43 +03:00
Frank LENORMAND
b7452f2c7e rc man: Keep user mode alias in the prompt history
The `m` user mode key is a prompt helper, it's helpful to keep it in
the history by default.
2021-11-04 07:28:06 +03:00
Frank LENORMAND
4cee8917ab rc man: Let mode commands fail
Commands in the `man` user mode shouldn't fail silently.
2021-11-04 07:20:10 +03:00
Frank LENORMAND
924ca6b43a rc man: Drop helper command
The mappings declaration code is not necessarily more readable and
the resulting command is shorter by a single flag.
2021-11-04 07:17:54 +03:00
Frank LENORMAND
28559bc1e7 rc man: Rename mode to man
The suffix seems redundant when entering the mode with the
`enter-user-mode` command.

Closes #3970
2021-11-04 07:15:43 +03:00
Evan Lloyd New-Schmidt
6b6577d8b9 Disable comment_line for ocaml/coq
OCaml does not have line comments, and as far as I can tell neither
does Coq. Setting it to '' (like markdown and html do) throws an error
that can be handled or displayed instead of inserting the default '#'.
2021-10-04 13:19:00 -04:00
Maxime Coste
fb734cb61b Merge remote-tracking branch 'lenormf/fix-4273' 2021-09-26 11:09:34 +10:00
Frank LENORMAND
1815a352f6 rc doc: Don't spawn processes unecessarily 2021-09-16 11:47:44 +03:00
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
Maxime Coste
9cc22f2596 Merge remote-tracking branch 'lenormf/fix-3330' 2020-02-05 20:42:33 +11:00
Maxime Coste
a3749d6c20 Merge remote-tracking branch 'lenormf/patch-3' 2020-02-05 20:41:40 +11:00
Maxime Coste
7d4ae422d2 Merge remote-tracking branch 'lenormf/docstring-pretty' 2020-02-05 20:40:10 +11:00
Frank LENORMAND
275abb227e rc: Make docstrings more readable
This cosmetics commit makes use of the auto-deindentation syntax,
available to docstrings.
2020-02-03 20:53:28 +01:00
Gregory Chamberlain
548c6b0b7e rc git: Use git-log filetype for ‘:git show’
The git-log filetype is more appropriate for ‘git show’ output
because it highlights both diffs and commit data.
2020-02-02 00:26:46 +00:00
Frank LENORMAND
90ba4d0903 rc spell: Handle errors returned on the first line
The first line returned by `aspell` isn't always an identification
string, it can also be an error.

This commit prevents the first line from being ignored in any case,
and allows errors to be reported consistently.

Related to #3330
2020-02-01 16:04:58 +01:00
Gregory Chamberlain
f4e8585981 rc git: Expand highlighting of git status
Adds support for highlighting git-status(1) output in short format
(--short) and with branch name (--branch), including file renames and
commits ahead/behind information.
2020-01-29 17:19:23 +00:00
Gregory Chamberlain
eb1b629829 rc git: Improve git-log highlighters
Adds support for highlighting git-log(1) output with the ‘--graph’
and ‘--pretty=oneline’ options.
2020-01-29 12:48:08 +00:00
Frank LENORMAND
5ea2f26efa
rc ctags: Escape backslash in {\} faces
Using `{\}` in an Awk script results in the following error being printed:

```
awk: cmd. line:18: warning: escape sequence `\}' treated as plain `}'
```
2020-01-28 10:05:10 +00:00
Alex Leferry 2
2f05aebfff Use POSIX -E of sed for extended regular expressions 2020-01-21 14:45:33 +01:00
Maxime Coste
f2159750d2 Slight code cleanup in grep.kak 2019-12-31 12:50:19 +11:00
Maxime Coste
90ec9434b7 Fix clang completion output parsing 2019-12-15 10:32:14 +11:00
Maxime Coste
ee2985739b Merge remote-tracking branch 'lenormf/window-range' 2019-12-04 21:16:11 +11:00
Maxime Coste
b19dae13fc Merge remote-tracking branch 'lenormf/fix-clang-autocomplete' 2019-11-28 20:34:17 +11:00
Maxime Coste
2904d13420 Add a {\} marker to disable markup processing 2019-11-28 20:23:52 +11:00
Frank LENORMAND
657eeb02d2 rc clang: Factorize multiple calls to gsub 2019-11-22 09:43:39 +01:00
Frank LENORMAND
3161a6255c rc clang: Handle nested tags in completion
Some completion candidates have e.g. `{#…#}` tags in their
name/description. They can be nested, which the cleanup regex doesn't
take into account.
2019-11-22 09:30:30 +01:00
Maxime Coste
82e5346904 Add a -atomic switch to write and change clang.kak to take advantage 2019-11-21 23:38:32 +11:00
Maxime Coste
2804479b27 Merge remote-tracking branch 'JJK96/comment' 2019-11-18 20:01:37 +11:00
Maxime Coste
d220ac049e Merge remote-tracking branch 'Anfid/hunk-next-prev' 2019-11-17 10:38:52 +11:00
Frank LENORMAND
5b1f9255a1 rc: Use the standard fail command to report errors
Merely using `echo` with markup doesn't log errors in the debug
buffers, and is also less readable.
2019-11-14 08:32:55 +01:00
Mikhail Pogretskiy
e159acaa19 Add git next-hunk and prev-hunk commands
Fixes #2423
2019-11-13 22:55:03 +07:00
Jan-Jaap Korpershoek
d655af04cd Change markdown block comment 2019-11-12 13:21:54 +01:00