Commit Graph

279 Commits (23d618853553afbac78c8d2a4ad048195f3484b8)

Author SHA1 Message Date
Nathan Vegdahl 23d6188535 Update `replace` command to use document line ending setting. 3 years ago
Nathan Vegdahl 07e28802f6 Add function to get the line ending of a str slice.
This is needed in some places.
3 years ago
Nathan Vegdahl 714002048c Don't need getters/setters for line_ending property.
It's plain-old-data.  If we want to do fancier things later, it's
easy to switch back.
3 years ago
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.
3 years ago
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.
3 years ago
Blaž Hrastnik eaf259f8aa Fix build.. 3 years ago
Blaž Hrastnik f41688d960 Merge `x` and `X` 3 years ago
Benoît CORTIER f50261c944 Add mappable commands for system clipboard
System clipboard integration exists now in two favors: typable and
mappable.

Default mappings are:
- SPC p: paste clipboard after
- SPC P: paste clipboard before
- SPC y: join and yank selection to clipboard
- SPC Y: yank main selection to clipboard
- SPC R: replace selections by clipboard contents
3 years ago
Benoît CORTIER a2b8cfca34 Add system clipboard yank and paste commands
This commit adds six new commands to interact with system clipboard:
- clipboard-yank
- clipboard-yank-join
- clipboard-paste-after
- clipboard-paste-before
- clipboard-paste-replace
- show-clipboard-provider

System clipboard provider is detected by checking a few environment
variables and executables. Currently only built-in detection is
supported.

`clipboard-yank` will only yank the "main" selection, which is currently the first
one. This will need to be revisited later.

Closes https://github.com/helix-editor/helix/issues/76
3 years ago
Jan Hrastnik 8634e04a31 added the line_end helper function 3 years ago
Jan Hrastnik 701eb0dd68 changed some hardcoded newlines, removed a else if in line_ending.rs 3 years ago
wojciechkepka 42e13bd542 Add `:theme <name>` command 3 years ago
Blaž Hrastnik 10f9f72232 Revert "Refactor key into helix-view"
Did not use defaults when custom keymap was used

This reverts commit ca806d4f85.
3 years ago
Jan Hrastnik 1e80fbb602 fix merge issue 3 years ago
Jan Hrastnik cdd9347457 Merge remote-tracking branch 'origin/master' into line_ending_detection 3 years ago
Jan Hrastnik 97323dc2f9 ran cargo fmt 3 years ago
Jan Hrastnik ecb884db98 added get_line_ending from pr comment 3 years ago
Ivan Tham ca806d4f85 Refactor key into helix-view
Now also make use of Deserialize for Config.
3 years ago
Gokul Soumya b1cb98283d Fix indent regression issue with o, O
Indents were no longer respected with `o` and `O`. Using counts resulted
in multiple cursors in the same line instead of cursors on each line.

Introduced by 47d2e3ae
3 years ago
wojciechkepka a6d39585d8 Add `work_done_token` as parameter to lsp methods 3 years ago
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`
3 years ago
Benoît CORTIER 8664d70e73 Replace `Editor::current` by a macro
This is necessary to workaround ownership issues across function calls.
The issue notably arised when implementing the registers into `Editor`
and I was getting annoyed again when implementing copy/pasting into
system clipboard.
The problem is addressed by using macro calls instead of function calls.
There is no notable side effect.
3 years ago
Jan Hrastnik 8bccd6df30 applied changes from pr review 3 years ago
PabloMansanet f7e00cf720
Configurable keys 2 (Mapping keys to commands) (#268)
* Add convenience/clarity wrapper for Range initialization

* Add keycode parse and display methods

* Add remapping functions and tests

* Implement key remapping

* Add remapping book entry

* Use raw string literal for toml

* Add command constants

* Make command functions private

* Map directly to commands

* Match key parsing/displaying to Kakoune

* Formatting pass

* Update documentation

* Formatting

* Fix example in the book

* Refactor into single config file

* Formatting

* Refactor configuration and add keymap newtype wrappers

* Address first batch of PR comments

* Replace FromStr with custom deserialize
3 years ago
Gokul Soumya 47d2e3aefa Let o, O take counts for multiple cursors 3 years ago
Gokul Soumya 20d6b202d5 Fix cursor position bugs related to o and O
- `O` at the beginning of file didn't move cursor
- `o` and `O` messed up cursor position with multiple cursors

Fixes #127
3 years ago
Jan Hrastnik 9c3eadb2e4 fixed some problems from rebasing 3 years ago
Jan Hrastnik 7cf0fa05a4 doc.line_ending() now returns &'static str 3 years ago
Jan Hrastnik a4f5a0134e trying out line ending helper functions in commands.rs 3 years ago
Benoît CORTIER 6bdf609caa Remove RwLock for registers
Registers are stored inside `Editor` and accessed without `RwLock`.
To work around ownership, I added a sister method to `Editor::current`:
`Editor::current_with_context`. I tried to modify `Editor::current`
directly but it's used at a lot of places so I reverted into this for
now at least.
3 years ago
Benoît CORTIER 6fb2d2679d Use `_impl` suffix instead of `_` prefix
Helpers / internal implementations where using the `_` prefix.
However, this prefix also suppress unused warnings.
I suggest we use the `_impl` suffix instead.
3 years ago
Ivan Tham 05ed3e8fb8 Remove unused variables 3 years ago
Nathan Vegdahl 7c2fb92c91 Report indent style when calling indent-style with no arguments.
Also print an error message when the argument is malformed.
3 years ago
Nathan Vegdahl d415a666fe Address PR comments.
* Clean up "indent-style" command argument parsing.
* Adjust command's name to match the style of other commands.
* Add a "0" alias to the command, for tabs indent style.
3 years ago
Nathan Vegdahl 358ea6a37c Implement command to change the indent-style setting of a document. 3 years ago
Blaž Hrastnik e819121f6e fix: wq/wqa functions need to wait for save to finish before closing 3 years ago
Andreas Liljeqvist 5d23667a26 fix offset by one problem in replace_with_yanked 3 years ago
Wojciech Kępka df217f71c1 Fix `wq` 3 years ago
Wojciech Kępka b9100fbd44 Fix clippy 3 years ago
Wojciech Kępka 52d3c29244 Deduplicate code 3 years ago
Wojciech Kępka 17c9a8499e Add `qa` and `qa!` 3 years ago
Wojciech Kępka 62e6232a32 Update write_all 3 years ago
Wojciech Kępka d8b5d1181f Add `Copy` derive to `PromptEvent` 3 years ago
Wojciech Kępka b500a2a138 commands: Add more write commands 3 years ago
Ivan Tham 9640ed1425 Add clarification to last buffer 3 years ago
Robin 9baf1ecc90
add symbol picker (#230)
* add symbol picker

use the lsp document_symbol request

* fix errors from merging in master

* add docs for symbol picker
3 years ago
Robin 44cc0d8eb0
add alternate file (#223)
* add alternate file

inspired by vim ctrl-6/kak ga commands. the alternate file is kept per view

* apply feedback from #223

* rename to last_accessed

* add ga doc

* add fail message for ga
3 years ago
Wojciech Kępka c754df12b3
lsp: Check bounds when converting lsp positions (#204)
* lsp: Make position conversion funcs return `Option`

* Add tests

* Fixes

* Revert pos_to_lsp_pos to panic
3 years ago
Blaž Hrastnik 278361a086 Only auto-format for certain languages
Fixes #53
Fixes #207
3 years ago
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>
3 years ago