Commit Graph

128 Commits (3a63e85b6ab204bf0e55d56db63ea02263175424)

Author SHA1 Message Date
Blaž Hrastnik 0fdb626c2c Remove embed_runtime feature
It's no longer practical to maintain. Closes #451
2021-07-30 16:27:22 +09:00
Gokul Soumya c68fe1f2a3
Add object selection (textobjects) (#385)
* Add textobjects for word

* Add textobjects for surround characters

* Apply clippy lints

* Remove ThisWordPrevBound in favor of PrevWordEnd

It's the same as PrevWordEnd except for taking the current char
into account, so use a "flag" to capture that usecase

* Add tests for PrevWordEnd movement

* Remove ThisWord* movements

They did not preserve anchor positions and were only used
for textobject boundary search anyway so replace them with
simple position finding functions

* Rewrite tests of word textobject

* Add tests for surround textobject

* Add textobject docs

* Refactor textobject word position functions

* Apply clippy lints on textobject

* Fix overflow error with textobjects
2021-07-03 10:07:49 +09:00
Kirawi c5b2973739
`:reload` (#374)
* reloading functionality

* fn with_newline_eof()

* fmt

* wip

* wip

* wip

* wip

* moved to core, added simd feature for encoding_rs

* wip

* rm

* .gitignore

* wip

* local wip

* wip

* wip

* no features

* wip

* nit

* remove simd

* doc

* clippy

* clippy

* address comments

* add indentation & line ending change
2021-07-02 23:54:50 +09:00
Nathan Vegdahl b571f28641 Remove #[allow(unused)] from helix-core, and fix unused imports.
Still a bunch more warnings to fix in core, but it's a start.
2021-07-01 19:06:52 -07:00
Shafkath Shuhan fd98e743e8 Handle non-UTF8 files 2021-06-23 15:40:27 +09:00
Gokul Soumya 13648d28b9 Add surround keybinds 2021-06-22 14:27:51 +09:00
Nathan Vegdahl 07e28802f6 Add function to get the line ending of a str slice.
This is needed in some places.
2021-06-21 10:29:29 -07:00
Nathan Vegdahl e686c3e462 Merge branch 'master' of github.com:helix-editor/helix into line_ending_detection
Rebasing was making me manually fix conflicts on every commit, so
merging instead.
2021-06-20 16:09:14 -07:00
Nathan Vegdahl 4efd6713c5 Work on moving code over to LineEnding instead of assuming '\n'.
Also some general cleanup and some minor fixes along the way.
2021-06-20 15:33:02 -07:00
Nathan Vegdahl 5d22e3c4e5 Misc fixes and clean up of line ending detect code. 2021-06-20 00:40:41 -07:00
Blaž Hrastnik e9a3245aae Re-export unicode crates from helix_core 2021-06-20 16:38:58 +09:00
Jan Hrastnik 8634e04a31 added the line_end helper function 2021-06-20 02:22:10 +02:00
wojciechkepka ce97a2f05f Add ability to change theme on editor 2021-06-20 00:07:13 +09:00
Jan Hrastnik cdd9347457 Merge remote-tracking branch 'origin/master' into line_ending_detection 2021-06-19 14:51:53 +02:00
Jan Hrastnik 97323dc2f9 ran cargo fmt 2021-06-19 14:05:11 +02:00
Jan Hrastnik ecb884db98 added get_line_ending from pr comment 2021-06-19 14:03:14 +02:00
Wojciech Kępka 41b07486ad
Fix expansion of `~` (#284)
* Fix expansion of `~`, dont use directory relative to cwd.

* Add `expand_tilde`

* Bring back `canonicalize_path`, use `expand_tilde` to `normalize`

* Make `:open ~` completion work

* Fix clippy

* Fold home dir into tilde in Document `realitve_path`
2021-06-18 15:19:34 +09:00
Jan Hrastnik a4f5a0134e trying out line ending helper functions in commands.rs 2021-06-16 17:13:41 +02:00
Jan Hrastnik a9a718c3ca added some tests and a line_ending helper function in document.rs 2021-06-16 17:11:16 +02:00
Jan Hrastnik 9c419fe05c added more changes from pr review for line_ending_detection 2021-06-16 17:08:46 +02:00
Jan Hrastnik 5eb6918392 resolved conflict in rebase 2021-06-16 17:05:14 +02:00
Jan Hrastnik 17f69a03e0 ran cargo clippy and cargo fmt 2021-06-16 17:00:30 +02:00
Jan Hrastnik 3756c21bae rebase on branch line_ending_detection 2021-06-16 17:00:21 +02:00
Nathan Vegdahl 0a5580aa21 Address PR comments.
- Move char functions into their own module under helix_core.
- Use matches!() macro where appropriate.
- Use a static lifetime on indent_unit() now that we can.
2021-06-14 18:32:23 -07:00
Ivan Tham 1bda454149 Add ctrl-w for prompt 2021-06-15 01:06:53 +09:00
Wojciech Kępka 4b6aff8c66 Use `runtime` dir when defaulting to executable location 2021-06-12 17:26:41 +08:00
Wojciech Kępka 4a40e935de Make `runtime_dir` private 2021-06-12 17:26:41 +08:00
Wojciech Kępka 716067ba05 Add more ways to detect runtime directory 2021-06-12 17:26:41 +08:00
Jakub Bartodziej 69fe46a122
Add :earlier and :later commands that can be used to navigate the full edit history. (#194)
* Disable deleting from an empty buffer which can cause a crash.

* Improve on the fix for deleting from the end of the buffer.

* Clean up leftover log.

* Avoid theoretical underflow.

* Implement :before which accepts a time interval and moves the editor to
the closest history state to the commit of the current time minus that
interval. Current time is now by default, or the commit time if :before
has just been used.

* Add :earlier an :later commands that can move through
the edit history and retrieve changes hidded by undoing
and commiting new changes. The commands accept a number
of steps or a time period relative to the currrent change.

* Fix clippy lint error.

* Remove the dependency on parse_duration, add a custom parser instead.

* Fix clippy errors.

* Make helix_core::history a public module.

* Use the helper for getting the current document and view.

* Handled some PR comments.

* Fix the logic in :later n.

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* Add an alias for :earlier.

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* Add an alias for later.

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* Run cargo fmt.

* Add some tests for earlier and later.

* Add more tests and restore the fix for later that diappeared somehow.

* Use ? instead of a match on an option.

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* Rename to UndoKind.

* Remove the leftover match.

* Handle a bunch of review comments.

* More systemd.time compliant time units and additional description for the new commands.

* A more concise rewrite of the time span parser using ideas from PR discussion.

* Replace a match with map_err().

Co-authored-by: Ivan Tham <pickfire@riseup.net>

Co-authored-by: Jakub Bartodziej <jqb@google.com>
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-06-11 22:06:13 +09:00
PabloMansanet 86af55c379
Movement fixes, refactor and unit test suite (#217)
* Add convenience/clarity wrapper for Range initialization

* Test horizontal moves

* Add column jumping tests

* Add failing movement conditions for multi-word moves

* Refactor skip_over_next

* Add complex forward movement unit tests

* Add strict whitespace checks and edge case tests

* Restore formatting

* Remove unused function

* Add empty test case for deletion and fix nth_prev_word_boundary

* Add tests for backward motion

* Refactor word movement

* Address review comments and finish refactoring backwards move

* Finish unit test suite

* Fmt pass

* Fix lint erors

* Clean up diff restoring bad 'cargo fmt' actions

* Simplify movement closures (thanks Pickfire)

* Fmt pass

* Replace index-based movement with iterator based movement, ensuring that each move incurs a single call to the RopeSlice API

* Break down tuple function

* Extract common logic to all movement functions

* Split iterator helpers away into their own module

* WIP reducing clones

* Operate on spans

* WIP simplifying iterators

* Simplify motion helpers

* Fix iterator

* Fix all unit tests

* Refactor and simplify

* Simplify fold
2021-06-11 21:57:07 +09:00
Wojciech Kępka c978d811d9 Cleanup find_first_non_whitespace_char funcs 2021-06-08 17:22:37 +09:00
Wojciech Kępka 48df05b16d commands: Add goto first non-whitespace char of line 2021-06-08 17:22:37 +09:00
Blaž Hrastnik 8d6fad4cac lsp: Provide workspace root on client.initialize() 2021-06-07 21:32:01 +09:00
Ivan Tham 40744ce835 Add ctrl-w in insert mode
It seemed to panic when I pressed too many times, but that is from
lsp side.
2021-06-06 21:30:18 +09:00
Brian Dawn 62d181de78 Provide a feature flag to be able to embed the runtime folder.
These changes provide a new feature flag "embed_runtime" that when
enabled and built in release mode will embed the runtime folder into the
resulting binary.
2021-06-06 10:49:17 +09:00
Ivan Tham d664d1dec0 Default log file to cache 2021-06-03 10:15:17 +08:00
Blaž Hrastnik 6460501a44 Update architecture.md 2021-05-30 17:52:46 +09:00
Blaž Hrastnik 1f2d87cb95 Make the config dir locator work on Windows. 2021-05-10 16:21:55 +09:00
Blaž Hrastnik 0f77f543e5 Determine runtime dir based on executable location or env override. 2021-05-10 01:02:53 +09:00
Blaž Hrastnik bc4e54c0c4 Load config files from ~/.config/helix, fallback to defaults. 2021-04-07 23:56:20 +09:00
Blaž Hrastnik cc058ad78f Simplify some code. 2021-04-01 11:04:25 +09:00
Blaž Hrastnik 73c92a0bc1 Implement m / match_brackets (using tree sitter). 2021-03-22 17:58:49 +09:00
Blaž Hrastnik cbcacb1063 Merge some imports. 2021-03-22 12:40:07 +09:00
Blaž Hrastnik 71999cce43 Implement auto-pairs behavior for open and close. 2021-03-22 12:22:33 +09:00
Blaž Hrastnik dbcc099f48 Move things out of state.rs. 2021-03-18 14:07:53 +09:00
Blaž Hrastnik 9dcfe25e4a Use diagnostic.severity to distinguish between error colors. 2021-03-11 16:31:49 +09:00
Blaž Hrastnik 62c991230f find-till (f) prototype, on_next_key mode implementation. 2021-03-11 10:44:38 +09:00
Blaž Hrastnik 6cfb1acb9d commands: Implement expand_selection. 2021-02-22 17:02:32 +09:00
Blaž Hrastnik 4ab5631d65 more lints 2021-02-18 18:45:41 +09:00
Blaž Hrastnik d0791e0f98 core: Implement comment toggling module. 2021-02-18 18:35:39 +09:00
Blaž Hrastnik c9dd1c930e treewide: &RopeSlice -> RopeSlice. It's Copy so no reason to pass by ref 2021-02-18 18:34:22 +09:00
Blaž Hrastnik cc6bdf8f66 Text change generation, RPC call handling. 2020-12-03 13:10:35 +09:00
Blaž Hrastnik f9bfba4d96 Reroute LSP notification events into the main app event loop. 2020-12-03 13:10:32 +09:00
Blaž Hrastnik d64f4beede Share tab width definitions. 2020-10-14 13:35:54 +09:00
Blaž Hrastnik 00e661f600 Indent draft, linewise paste 2020-10-13 23:13:56 +09:00
Blaž Hrastnik 1dba0f2b1c Simple yank/paste registers. 2020-10-13 23:13:56 +09:00
Blaž Hrastnik fd311fb8ad Undo tree draft.
We keep a tree of transactions. This allows for persistent undo by
simply serializing the changesets.
2020-10-13 23:13:56 +09:00
Blaž Hrastnik 36e7e2133f Split selection on regex, fix InputEdit generation. 2020-09-29 01:01:27 +09:00
Blaž Hrastnik 3020077da8 Extend selection commands. 2020-09-29 01:00:35 +09:00
Blaž Hrastnik eb639eb2e4 More robust syntax detection/grammar loading. 2020-09-22 18:27:37 +09:00
Blaž Hrastnik 935cfeae57 Split parts of helix-term into helix-view.
It still largely depends on term for some types but I plan to change
that later.
2020-09-21 18:24:16 +09:00
Blaž Hrastnik 48330ddb5f Command needs access to view information for certain changes. 2020-09-19 23:16:00 +09:00
Blaž Hrastnik 088f8a82af Incremental parsing: rough draft. 2020-09-17 16:32:40 +09:00
Blaž Hrastnik 9546164dc8 cargo fmt & clippy lint 2020-09-12 19:38:30 +09:00
Blaž Hrastnik a106be94f1 Refactor a little bit. 2020-09-12 17:44:57 +09:00
Blaž Hrastnik b17a77b8b8 cleanup: Import tree-sitter-highlight so we can cache trees. 2020-09-11 14:14:44 +09:00
Blaž Hrastnik b647c7a773 tree-sitter based syntax highlighting draft 2020-09-10 18:19:59 +09:00
Blaž Hrastnik 8b3e152126 cleanup: Make Buffer just a part of State. 2020-09-07 11:28:52 +09:00
Jan Hrastnik 6ba082697d added cursor rendering 2020-06-24 20:59:35 +02:00
Blaž Hrastnik e98cdebf1e Add a command module. 2020-06-08 00:15:39 +09:00
Blaž Hrastnik 10d53f3ef0 Add primitives for converting between char offset indices and coords. 2020-06-05 14:04:30 +09:00
Blaž Hrastnik 387fb57c94 Allow unused code for the time being. 2020-06-02 10:59:02 +09:00
Blaž Hrastnik 613d06dfb0 wip: importing to github 2020-06-01 17:42:28 +09:00
Blaž Hrastnik 1984410ac9 Selection mapping over changesets. 2020-05-28 14:59:50 +09:00
Blaž Hrastnik b5c38812e9 address clippy warnings 2020-05-28 14:45:44 +09:00
Blaž Hrastnik 23109f1512 OT: changeset: Implement compose and apply. 2020-05-26 18:11:11 +09:00
Blaž Hrastnik 44ff4d3c1f Implement a new core based on CodeMirror. 2020-05-25 13:02:21 +09:00
Blaž Hrastnik 240e5f4e3d Initial import. 2020-05-20 18:14:51 +09:00