Commit Graph

40 Commits

Author SHA1 Message Date
Chris Webb
86979841b7 Improve c-family highlighting of preprocessor directives
The current handling of preprocessor directives in filetype/c-family.kak
leads to a wall of solid colour for more complicated #if or #define
directives, although #include is already nicely highlighted.

Instead of highlighting an entire directive with the meta face, highlight
just the #define, #if or #elif keyword as meta, treating the rest of the
directive as normal c-family expressions. This significantly improves
the readability of complex macro definitions.

For directives other than #define, #if and #elif, we treat the rest of
the directive as an opaque string in normal face rather than trying to
highlight it, covering cases like #error, #pragma, etc. where the rest
of the line is an error message string or other non-expression content.

This does the right thing for #ifdef and #ifndef too, as we don't highlight
identifiers in c-family text so their arguments should be normal face
anyway.
2023-12-10 13:50:29 +00:00
Maxime Coste
b020922e6f Fix some corner cases in c-family indentation 2023-10-25 12:51:16 +11:00
Maxime Coste
18d4c40f08 Fix c-family closing brace indent behaviour on some corner cases 2023-06-15 17:42:19 +10:00
Maxime Coste
2d8456db10 Move user mappings to <space> and keep/remove selection to , 2022-07-05 08:43:40 +10:00
Maxime Coste
266d1c37d0 Select pasted text on paste
This is more consistent with the recently changed ! and <a-!>
behaviour
2022-07-05 08:43:40 +10:00
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
Cormac Stephenson
6a630ae3e6 c-family: highlight 0X style int literals 2022-05-05 13:41:35 +01:00
Cormac Stephenson
ed9d99c7b3 c-family: fix whitespace trimming in comments 2022-02-10 00:49:46 +00:00
Olivier Perret
0bcbcef7dc c-family.kak: properly quote shell variable
This will fail with filenames with spaces otherwise
2021-04-30 11:53:18 +02:00
Maxime Coste
732ee04c84 Merge branch 'better_headerguards' of http://github.com/fennewald/kakoune 2021-04-18 17:04:40 +10:00
Maxime Coste
5696ed02e4 Fix invalid insertion of ; after } closing some functions
Function taking a parameter with a struct tag on the last line
before the opening { were wrongly treated as structs. Add some
additional regex logic to try to catch those cases.

Fixes #4136
2021-04-08 20:14:02 +10:00
Carson Riker
b98ec3836b Stripped directory prefix from c-family autogenerated header guards 2021-03-31 17:33:04 -04:00
Maxime Coste
212242cc60 Slight cleanup of the c-family highlighters
* Extract raw strings to the C++ specific section
* Merge different documetnation comment formats in single regions
2021-03-31 21:24:45 +11:00
Olivier Perret
7e736289ce c-family: allow specifying absolute alt directory paths
alt-dirs which start with a / are considered to be absolute
2020-11-05 16:56:41 +01:00
Maxime Coste
55fbdb3606 Merge remote-tracking branch 'johnisom/deindent-closing-braces' 2020-07-30 21:14:37 +10:00
John Isom
9c957167fa Update deindentation in c-family.kak 2020-07-29 15:14:35 -06:00
Johannes Altmanninger
6ca51882a1 c-family.kak: fix /**/ being interpreted as javadoc start 2020-07-28 20:32:56 +02:00
John Isom
a7567d82c9 Update c-family brace deindenting to handle bad indentation edge case 2020-07-27 12:04:07 -06:00
John Isom
565e3bef1d Update comment wording for deindentation 2020-07-26 20:46:47 -06:00
John Isom
4b35a701c4 Fix indentation rule for c-family.kak 2020-07-26 18:56:53 -06:00
Maxime Coste
08d6268ae7 Merge remote-tracking branch 'lenormf/documentation-face' 2020-02-16 10:46:35 +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
Frank LENORMAND
0c4c744362 rc: Highlight embedded documentation
This commit adds a `documentation` face to the builtin themes, used
to highlight common documentation syntaxes:

	/**
	 * JavaDoc
	 */

	/*!
	 * QtDoc
	 */

	/// Inline documentation

	## Inline documentation

The face is only an alias to the `comment` one for now.

Closes #1944
2020-01-29 20:03:21 +01:00
Maxime Coste
44047a69c5 Fix c-family include highlighting 2019-11-05 17:35:44 +11:00
Frank LENORMAND
21614cb06e src: Create a <semicolon> named key
This commit allows using the <semicolon> expansion in commands, instead
of `\;`.

It makes commands look more elegant, and prevents new-comers from
falling into the trap of using <a-;> without escaping the semicolon.
2019-10-22 11:02:06 +02:00
Maxime Coste
e4fb70ebec Replace ModeChange hooks by ModePush and ModePop
Remove deprecated InsertBegin, InsertEnd, NormalBegin, NormalEnd
hooks.

Closes #2545
2019-10-16 20:45:53 +11:00
Olivier Perret
fac05f3ea0 [rc] Use 'fail' when the alternative file cannot be found
This makes it possible to implement a fallback strategy using 'try .. catch',
for cases where the alternative file is not stored in a subdirectory
2019-10-08 18:06:54 +02: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
89b50daa66 Use module alias pattern for markdown dynamic loading 2019-07-22 19:01:40 -07:00
Maxime Coste
4b7b5d077c Make quoting opt-in by using $kak_quoted_... 2019-06-23 12:04:21 +10:00
Justin Frank
48abc3cbf3 Changed '🦀' to '§' for complex module quoting 2019-04-13 12:57:57 -07:00
Justin Frank
80ac46e09d Fixed many of the filetype support modules to not use BufSetOption to load 2019-04-09 20:54:19 -07:00
Justin Frank
1fab727f2b Modified a bunch of language support files to use modules 2019-04-08 17:02:44 -07:00
Maxime Coste
a32da9d3ee Fix spurious error from c-family-indent-on-closing-curly-brace 2019-04-01 22:20:43 +11:00
Grant Moyer
d8e4c6801f Fix autoindent issues with paren in literal 2019-03-31 00:07:12 -04:00
Grant Moyer
61840c8b11 Preserve tabs during autoindent and alignment with '(' for c-family languages
Also add test for tab preservation during c-family autoindentation, and correct alignment of '}' with opening of block in cases of wrap between '(' and ')' in c-family languages
2019-03-28 13:08:02 -04:00
Alex Leferry 2
c0dccdd90d Add categories in rc/
Closes #2783
2019-03-21 01:06:16 +01:00