Commit Graph

133 Commits

Author SHA1 Message Date
niten94
85e2b3bd86 status.lua: Display hash and branch of file
Return current commit hash and branch of repository where file in buffer
is located instead of current directory.
2025-03-02 09:40:27 +08:00
niten94
d992c606c5 status.lua: Move import lines to beginning of file 2025-02-15 23:17:33 +08:00
Andriamanitra
b9f1fc8da2 add missing linters to help linter 2025-02-07 23:56:25 +02:00
magneticminou
728526682e
plugin: linter: add ruff to documentation 2025-02-07 14:12:29 -03:00
magneticminou
c105c940fe
plugin: linter: change in ruff configuration
Use `--output-format concise` as suggested to get exact column of error

Co-authored-by: Mikko <Andriamanitra@users.noreply.github.com>
2025-02-06 19:28:47 -03:00
magneticminou
cdc9ab17f2
plugin: linter: add ruff to default configuration. 2025-02-06 17:05:04 -03:00
Jöran Karl
d1f54ea2a4 plugin: linter: Remove the forced C++14 standard to keep GCCs default 2024-12-31 13:27:38 +01:00
Jöran Karl
6b21fc5f92 plugin: linter: Invoke g++ for c++ instead of gcc 2024-12-31 13:27:38 +01:00
Jöran Karl
de84da068d plugin: linter: Move file type check into a dedicated function 2024-12-31 13:27:38 +01:00
Jöran Karl
771b84141f plugin: linter: Use new onBufferOptionChanged callback 2024-12-31 13:27:38 +01:00
Dmytro Maluka
6214abba9a Overhaul LastVisualX and GetVisualX() usage
Restore the original meaning of LastVisualX before commit 6d13710d93
("Implement moving cursor up/down within a wrapped line"): last visual x
location of the cursor in a logical line in the buffer, not in a visual
line on the screen (in other words, taking tabs and wide characters into
account, but not taking softwrap into account). And add a separate
LastWrappedVisualX field, similar to LastVisualX but taking softwrap
into account as well.

This allows tracking last x position at the same time for both cases
when we care about softwrap and when we don't care about it. This can be
useful, for example, for implementing cursor up/down movement actions
that always move by logical lines, not by visual lines, even if softwrap
is enabled (in addition to our default CursorUp and CursorDown actions
that move by visual lines).

Also this fixes a minor bug: in InsertTab(), when `tabstospaces` is
enabled and we insert a tab, the amount of inserted spaces depends on
the visual line wrapping (i.e. on the window width), which is probably
not a good idea.
2024-10-14 01:41:35 +02:00
Dmytro Maluka
85afb6eb87 Use StoreVisualX() all over the code
Since we already have the StoreVisualX() helper, use it all over the
place instead of setting LastVisualX directly.

This will allow us to add more logic to StoreVisualX() add let this
extra logic apply everywhere automatically.
2024-10-13 17:46:34 +02:00
Jöran Karl
f391b59be6 plugins/literate: Remove empty rules in regions 2024-09-09 18:32:30 +02:00
Jöran Karl
a678d42861 plugins/comment: Don't write to b.Settings directly
...and use `SetOptionNative()` instead.
2024-08-18 21:10:37 +02:00
Justin Su
b8772b69c2
Use // comments for .json (#3388)
Add comments to `.json` files using `//` instead of the default `#`.

Even though JSON does not support comments, JSON5 and JSONC exist, so `//` is a much more sane default. It also improves the experience of editing micro's own config files.
2024-07-30 22:58:07 +02:00
Dmytro Maluka
24406a5ae8 Comment plugin: doc: fix incorrect keybinding 2024-04-25 01:28:34 +02:00
Dmitry Maluka
c52ccad14b hltrailingws: adjust autoclose plugin implementation
Fix unwanted highlighting of whitespace in the new line when inserting
a newline after a bracket (when hltrailingws is on). To fix it, change
the order of operations: insert the new empty line after all other
things, to avoid moving the cursor between lines after that.
2024-03-14 03:10:33 +01:00
Zachary Yedidia
7dd88c2f23 Don't auto-detect commenttype if last_ft is empty
Also fixes commenttype for batch files.

Fixes #2752
2023-02-15 21:57:12 -08:00
Rein F
eb6daab169
Make the commenttype option useful (#2735) 2023-02-05 18:30:12 -08:00
Dmitry Maluka
f1801f1958
Comment plugin: improve commenting multi-line selection (#2668)
When commenting a block of multiple lines, the comment symbol is added
right before the first non-whitespace character in each line, e.g.:

void somefunc(int a)
{
    // if (a) {
        // a += 2;
        // printf("a = %d\n", a);
    // } else {
        // printf("none");
    // }
}

which isn't quite nice.

Change it to add the comment at the same position on each line, which is
the position of the leftmost non-whitespace in the entire block, e.g.:

void somefunc(int a)
{
    // if (a) {
    //     a += 2;
    //     printf("a = %d\n", a);
    // } else {
    //     printf("none");
    // }
}

Ref #2282
2023-01-11 21:54:59 -08:00
Matthias Thym
dd8e341de2
Fix linter help formatting (#2280) 2021-11-17 12:59:16 -08:00
Zachary Yedidia
bb609467dd Update comment filetype when commenting 2021-08-20 14:42:38 -04:00
Zachary Yedidia
403a9eb11d Add rust clippy linter and go vet linter 2021-08-18 01:08:54 -04:00
Ali Kefia
ae0c28a03d
Fix name collision on linter name (swiftc) (#2158) 2021-07-18 18:30:52 -04:00
Ali Kefia
1a5518ebbb
Shellcheck as a new shell linter + runtime.go out of git control (#2157)
* shellcheck as a new shell linter + runtime.go out of git control

* keep runtime.go and keep both shfmt and shellcheck since we can remove from custom conf
2021-07-16 15:01:50 -04:00
vandervoortj
9ceb69921a
Add nix language syntax (#2024)
* Create nix.yaml

Add nix language syntax

* Add nix-linter
2021-06-15 17:56:31 -04:00
Jeff Zhao
ee9c78dc86
Improve linter performance (#2083)
Only compute args if we are actually going to use it
2021-06-01 19:34:10 -04:00
Zachary Yedidia
2fbeb40bf0 Update hlint format 2020-12-20 16:53:18 -05:00
Ryan Westlund
1343955b05
Add comment support for OCaml (#1776) 2020-07-15 14:13:44 -04:00
Zachary Yedidia
781a2dd826 Add flake8 linter, postinit and preinit
Closes #1768
2020-07-13 13:28:26 -04:00
Zachary Yedidia
a52dbb2142 Fix swift linting problem 2020-07-09 18:08:14 -04:00
Zachary Yedidia
41a27cc58a Update linter to include eslint
Ref #1766
2020-07-09 18:04:40 -04:00
Zachary Yedidia
3d387732c4 Update linter documentation
Ref #1766
2020-07-09 17:58:42 -04:00
Zachary Yedidia
621e4e9e4d Slight performance improvement 2020-07-05 15:54:00 -04:00
Zachary Yedidia
806525c3da Improve comment plugin
When commenting a selection, the plugin won't just toggle each
line individually but will only uncomment the block if it is all
comments.

The comment plugin also now takes into account any number of spaces
between the comment character and the text. For example '//comment' will
be uncommented properly, as well as '//      comment'.

Fixes #1758
2020-07-05 15:48:49 -04:00
Zachary Yedidia
5f62f550f3 Add more functions to customize status bar
Adds `status.lines`, `status.vcol`, `status.bytes`, `status.size`,
and exposes some functions from go-humanize to plugins.

Ref #1727
2020-06-24 17:19:42 -04:00
Zachary Yedidia
891b117a33 Bind Ctrl-/ (CtrlUnderscore) in comment plugin 2020-06-18 17:18:34 -04:00
Hugo Locurcio
5bfc892a74
Add support for dozens more languages to the comment plugin (#1729) 2020-06-16 00:49:07 -04:00
Ryan Westlund
1793b6268b
Add comment support for Haskell (#1728) 2020-06-15 16:11:51 -04:00
Ján Priner
b2261fc225
Add latex support in comment plugin (#1725) 2020-06-12 12:58:51 -04:00
Zachary Yedidia
9a22d93ea2 Expose CharacterCount to plugins 2020-05-20 18:04:00 -04:00
jsyedidia
299af4a3db
Update hlint to 3.0 syntax (#1659) 2020-05-16 13:06:55 -04:00
jsyedidia
a76bf02f5f
Add Haskell linter hlint to linter plugin (#1610) 2020-04-05 14:05:01 -04:00
allanderek
ee157f6503
Add elm as a default comment type in the comment plugin. (#1586) 2020-03-24 10:56:50 -04:00
Zachary Yedidia
943ea15fa3 Fix linter c++ entry
Fixes #1578
2020-03-14 15:40:05 -04:00
Zachary Yedidia
b91242124c Go lint the current directory of file
Closes #1520
2020-02-18 21:40:14 -05:00
Zachary Yedidia
12c286f9b1 Introduce IndentLine action
Closes #1476
2020-02-12 13:30:24 -05:00
Zachary Yedidia
8224037080 Don't block when redraw channel becomes full
Fixes #1497
2020-02-11 20:03:32 -05:00
Zachary Yedidia
bdf9e6d3a4 Merge branch 'diff-gutter' of https://github.com/p-e-w/micro 2020-02-10 00:28:43 -05:00
Zachary Yedidia
8a907956d1 Use actual lua functions for callbacks instead of strings 2020-02-08 15:49:41 -05:00