Skip to content

add editor.initial-mode to control the initial mode of new documents#108

Open
lolbinarycat wants to merge 56 commits into
usagi-flow:mainfrom
lolbinarycat:patch-1
Open

add editor.initial-mode to control the initial mode of new documents#108
lolbinarycat wants to merge 56 commits into
usagi-flow:mainfrom
lolbinarycat:patch-1

Conversation

@lolbinarycat

Copy link
Copy Markdown

this should make the editor more usable by people (like me) who aren't frequent vim users.

initially proposed and rejected by mainline helix (helix-editor/helix#13593)

usagi-flow added 30 commits May 18, 2024 20:35
commit a750143
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Wed May 15 20:56:11 2024 +0200

    doc(evil): add a notice regarding the branch being rebased

commit 88e3b5f
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Wed May 15 20:56:11 2024 +0200

    doc(evil): add a screenshot

commit 1227eeb
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Wed May 15 20:56:11 2024 +0200

    doc(evil): fix links in README.md

commit 5ca6c2c
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Wed May 15 20:56:11 2024 +0200

    doc(evil): Update README.md
commit 13654f9
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sat May 18 00:03:44 2024 +0200

    feat(ci): pr test/build workflow

commit 80f3586
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sat May 18 00:03:44 2024 +0200

    fix(ci): x86_64 macos build

commit 26d458b
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Thu Apr 25 20:44:51 2024 +0200

    fix(ci): build and create a release when a release tag is pushed

commit b89d1e3
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Thu Apr 25 20:44:51 2024 +0200

    fix(ci): mac builds

commit 4fee940
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Thu Apr 25 20:44:51 2024 +0200

    feat(commands): ci
commit f107739
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Mon Jul 18 16:43:24 2022 +0200

    feat(tui): minimalistic vertical window separator
commit 3c50f91
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Fri Oct 21 22:52:20 2022 +0200

    feat(statusline): if color_modes is enabled, color the file type as well
commit 33162d4
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Thu May 16 23:28:26 2024 +0200

    feat(defaults): use `catppuccin_macchiato` as the default theme

commit b719768
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Thu May 16 23:28:26 2024 +0200

    fix(defaults): smart tab shouldn't be enabled by default
commit b4d065f
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Thu Apr 25 20:44:51 2024 +0200

    feat(commands): implement partial line-based selection

commit 62881a8
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sun Feb 11 15:44:20 2024 +0100

    feat(commands): introduce an `evil` configuration option

    Introduce an `evil` configuration option and respective defaults

commit 7217fad
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sun Feb 11 15:44:20 2024 +0100

    feat(commands): ensure the last character remains selected when pressing 'b' in select mode

commit 2852cf8
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Fri Mar 31 19:17:20 2023 +0200

    feat(commands): avoid selections in the normal/insert mode

commit c8f4b11
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Fri Mar 31 18:21:13 2023 +0200

    feat(command): don't crash when using an unsupported motion key

commit 06dee1c
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Fri Mar 31 17:58:38 2023 +0200

    feat(commands): avoid crash when using a count after the action key which includes 0

    - The 0-key would be incorrectly interpreted as a motion key.

commit 72e2cd6
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Fri Mar 31 14:35:41 2023 +0200

    feat(commands): better word movement

    - Do not move the anchor when performing a word-based movement in selection mode.

commit 51833cd
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sun Mar 26 17:01:12 2023 +0200

    feat(commands): implement "delete_immediate" (x)

commit e10ce6e
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sat Nov 19 15:00:53 2022 +0100

    feat(commands): adjust writing to the register following upstream API changes

commit de0c9c2
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sat Oct 22 14:01:11 2022 +0200

    feat(commands): evil-specific movement (no normal-mode selection)

commit 750b68d
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sat Oct 22 00:27:05 2022 +0200

    feat(commands): initial change (replace) implementation

commit 9925128
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Fri Oct 21 22:42:30 2022 +0200

    feat(commands): word-based selection

commit d37bd99
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Wed Oct 19 22:00:39 2022 +0200

    feat(commands): initial word-based selection

commit e6bc49e
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sun Oct 16 12:43:44 2022 +0200

    feat(commands): prepare for word-based motions

commit 548333f
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sat Oct 1 15:14:14 2022 +0200

    feat(commands): code adjustments following API changes

commit aeb0bf7
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Tue Aug 16 23:07:25 2022 +0200

    feat(commands): delete command, refactoring

commit f595eed
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sun Aug 14 14:39:36 2022 +0200

    feat(commands): better count handling in evil mode

commit b445a1c
Author: usagi-flow <2804556+usagi-flow@users.noreply.github.com>
Date:   Sat May 14 18:25:21 2022 +0200

    feat(commands): evil mode
commit cdc53f42e8e9eeb19f7411bd3d026d75188cd8f5
Author: Jesse Luehrs <doy@tozt.net>
Date:   Sun Sep 17 13:25:52 2023 -0400

    add a separate "helix:" modeline for setting helix-specific config

    for example, if the language name differs between vim and helix

commit 01554579e9ffdb2922b68bc55a42c36be76d3f4f
Author: Jesse Luehrs <doy@tozt.net>
Date:   Sun Sep 17 12:35:57 2023 -0400

    add basic modeline support

    currently only supports setting language, indent style, and line endings
When starting without a user configuration, the editor would load with `evil` set to `false`.
Fix this by not only adjusting the defaults, but by separating the defaults in respective `default_evil()` functions.
The editor is now evil by default.
…line` opt-in (usagi-flow#13)

* feat(defaults): statusline layout and colors

Adjust the default layout and enable mode/file-type colors by default

* refactor(defaults): treat the different smart-tab default as an evil-specific default

* feat(defaults): disable `insert_final_newline` by default

This is not a decision that the editor should take for the user. Make it opt-in instead.
* test(defaults): fix `keys_resolve_to_correct_defaults`

* test(defaults): fix `parsing_keymaps_config_file`
…ow#26)

* feat(evil): implement the long word motions (`W`, `B`, `E`)

* feat(evil): add support for word motions `e`, `W`, `B` and `E` when used with a command
usagi-flow and others added 26 commits June 15, 2024 10:32
* doc(evil): remove the mention of a different default theme

* refactor(evil): improve logging to avoid misconceptions

* doc(evil): we don't rebase that often anymore

* doc(evil): document the `editor.evil` option
* feat(commands): implement change line with `cc`

* refactor(commands): logging
* fix(treesitter-build): mingw doesn't support `-z`

* feat(ci): support windows builds

* feat(ci): support windows builds

* feat(ci): support windows builds (attempt building with cargo-xwin)

* feat(ci): support windows builds (attempt building with cargo-zigbuild)

* feat(ci): support windows builds (attempt building with cargo-zigbuild)

* feat(ci): support windows builds (attempt building with cargo-zigbuild)

* feat(ci): support windows builds (attempt building with cargo-zigbuild)

* feat(ci): support windows builds (attempt building with cross + clang)

* fix(ci): ensure relro is enabled for linux targets only

See also: https://www.redhat.com/en/blog/hardening-elf-binaries-using-relocation-read-only-relro

* fix(ci): ensure relro is enabled for linux targets only

* fix(ci): ensure relro is enabled for linux targets only

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)

* feat(ci): support windows builds (attempt building on the windows runner)
…mode behave exactly like Vim (usagi-flow#69)

* Simplify evil_move_word_impl, fixing bugs

The function `evil_move_word_impl` can be simplified, thereby fixing the
following two bugs in the process:

1. In select mode, the key sequence `wb` would result in a selection,
   instead of being a no-op as in Vim.

2. The functions `evil_next_word_end` and `evil_next_long_word_end`
   (mapped to 'e' and 'E') in normal mode would make the cursor land on
   the space after the word, instead of the last character of the word.

The only problem with this commit is that now the functions
`evil_next_word_start` and `evil_next_long_word_start` (mapped to `w`
and `W`) don't behave correctly anymore, making the cursor land
on the space before the next word. We'll fix it in the next commit.

* Fix `w` and `W`

1. Space before word: when the cursor is on the space before a word, and
   you hit `w`, Vim will move the cursor to this word, but evil-helix
   would skip the word and move to the _next_ word.

2. Punctuation: when the cursor is on the letter 'f' in "foo.bar qux",
   and you hit `w` twice, Vim will move the cursor to the letter 'b',
   but evil-helix would skip to the letter 'q'.

   This bug has the same underlying cause as the previous one, and the
   fix for both is to move the cursor one character to the left before
   doing the word move.

3. Regression: the previous commit, simplifying `evil_move_word_impl`,
   introduced a bug where `w` would make the cursor land on the space
   before the next word, instead of _on_ the next word. Fix it by moving
   the cursor one character to the right again after the word move.

4. Newlines: when the cursor is on the 'f' in "foo\nbar", and you hit
   `w`, Vim will move the cursor to the letter 'b' (so to the next
   line), but evil-helix would move the cursor onto the newline
   character. See the changes in `reached_target` for the fix.

Fixes usagi-flow#44
The configuration option `default-yank-register` was added to Helix in
helix-editor/helix#11430.

Evil helix issue: usagi-flow#53.
* add `same_line` movement commands (#768)

Commands added:
* `move_same_line_char_left`
* `move_same_line_char_right`
* `extend_same_line_char_left`
* `extend_same_line_char_right`
* `append_mode_same_line`

These new commands move cursors, while making them stay in the same
line. So if a cursor would wrap around into another line, instead it
won't move and stay at its current position.

* add `anchored` movement commands

Commands added:
* `move_anchored_line_up`
* `move_anchored_line_down`
* `move_anchored_visual_line_up`
* `move_anchored_visual_line_down`
* `extend_anchored_line_up`
* `extend_anchored_line_down`
* `extend_anchored_visual_line_up`
* `extend_anchored_visual_line_down`

These new commands move cursors vertically. A cursor will move depending
on its position:

* If it is on a newline character of a non-empty line, the cursor will
  stay on newlines (i.e. on a line's last character).

* If it is on a non-newline character of a non-empty line, the cursor
  will try to avoid newline characters. It will move normally, but if
  it would end up on a newline, instead it will be moved one position
  left of it (i.e. the line's second to last character).

* If it is on the newline character of an empty line (that contains
  nothing except the newline character), the cursor will continue to
  move like before: If it stayed on newline before, it will continue to
  do so. Otherwise it will try to avoid them (except on empty lines).

* feat(evil): make the new (vim-like) movement default

* feat(evil): ensure selections are collapsed when appending

---------

Co-authored-by: Pantos <pantos+github@akk.org>
* Squashed commit of the following:

commit b5bf68129b56dc0178a61b7e22151decf82a25da
Merge: d1517c6a 207829e
Author: SoraTenshi <dream@neoncity.dev>
Date:   Thu May 25 19:53:22 2023 +0200

    Merge branch 'master' into colored-indent-guides

commit d1517c6a4b9b09609df03d984f4e890ec1998c26
Author: SoraTenshi <dream@neoncity.dev>
Date:   Sun Feb 12 22:18:41 2023 +0100

    Update to new TextRenderer

    Docs

    fmt

commit 7f47756b6d3d9119e1e426d7df48221d9019265c
Author: Michael Davis <mcarsondavis@gmail.com>
Date:   Mon Jul 11 19:10:57 2022 -0500

    Parse rainbow style array in themes

    This change adds a field to the schema of themes which takes a
    list of styles.

        rainbow = ["red", "orange", "yellow", { modifiers = ["reversed"] }]
        [palette]
        red = "#ff0000"
        orange = "#ffa500"
        yellow = "#fff000"

    Normal style rules apply for each element in `rainbows`: you can
    use definitions from the palette and the full fg/bg/modifiers
    notation.

    Themes written with `rainbow` keys are not backwards compatible.
    Parsing errors will be generated for older versions of Helix
    attempting to use themes with `rainbow` keys.

    A default rainbow is provided with base16 colors.

    This change is made with rainbow pair characters (parens, brackets, etc.)
    in mind but it could also be used for other rainbow cosmetic elements
    like rainbow indent-guides.

* fix: avoid panic, properly set rainbow_length when loading theme

* feat: define a rainbow palette for the catppuccin themes
* Add scaffolding for visual line mode

Doesn't do anything yet.

* Implement visual line mode
* feat(evil): map } and { to ]p and [p without selection

* feat(evil): add } and { vim movements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants