Commit Graph

83 Commits (b239f0f45ffd0993cffc2a676651a0770b705fb5)

Author SHA1 Message Date
Blaž Hrastnik a2ccfffda1 config: Rename [terminal] to [editor] and pass it into Editor 2021-08-08 14:10:01 +09:00
Nathan Vegdahl f62ec6e51e Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-26 11:19:10 -07:00
Gokul Soumya 88d6f65239
Allow multi key remappings in config file (#454)
* Use tree like structure to store keymaps

* Allow multi key keymaps in config file

* Allow multi key keymaps in insert mode

* Make keymap state self contained

* Add keymap! macro for ergonomic declaration

* Add descriptions for editor commands

* Allow keymap! to take multiple keys

* Restore infobox display

* Fix keymap merging and add infobox titles

* Fix and add tests for keymaps

* Clean up comments and apply suggestions

* Allow trailing commas in keymap!

* Remove mode suffixes from keymaps

* Preserve order of keys when showing infobox

* Make command descriptions smaller

* Strip infobox title prefix from items

* Strip infobox title prefix from items
2021-07-27 01:07:13 +09:00
Nathan Vegdahl 0883b4fae0 Collect some common patterns into methods on `Range`. 2021-07-26 08:40:30 -07:00
Nathan Vegdahl b0311f4fc2 Fixed primary cursor position calculation to use 1-width semantics.
This had a bunch of knock-on effects that were buggy, such as bracket
match highlighting.
2021-07-19 09:25:10 -07:00
Cor 9fcbbfa467 Changed startup behaviour to only open a single view when multiple files are specified on the commandline.
Changed the behaviour; the first argument on the commandline is the file on display
2021-07-18 00:29:05 +09:00
Blaž Hrastnik d530d6e39d Further simplify error handling in :commands 2021-07-11 16:36:36 +09:00
Lionel Flandrin 9c02a1b070 Make command implementation return a Result<()>
The error message is displayed with cx.editor.set_error.
2021-07-11 16:36:20 +09:00
Ivan Tham 5977b07e19 Reduce calculation and improve pattern in infobox
- switch to use static OnceCell to calculate Info once
- pass Vec<(&[KeyEvent], &str)> rather than Vec<(Vec<KeyEvent>, &str)>
- expr -> tt to allow using | as separator, make it more like match
2021-07-04 18:01:59 +09:00
Ivan Tham 8985c58fd3 Add infobox 2021-07-04 18:01:59 +09:00
Joe Neeman c9be480bf8 Make formatting happen asynchronously. 2021-06-30 17:08:50 +09:00
Keith Simmons 4418e17547
reverse the dependency between helix-tui and helix-view (#366)
* reverse the dependency between helix-tui and helix-view by moving a fiew types to view

* fix tests

* clippy and format fixes

Co-authored-by: Keith Simmons <keithsim@microsoft.com>
2021-06-25 12:58:15 +09:00
Shafkath Shuhan fd98e743e8 Handle non-UTF8 files 2021-06-23 15:40:27 +09: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
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
2021-06-20 23:25:53 +09:00
wojciechkepka 6825e19509 Only reconfiure highlights when setting theme 2021-06-20 00:07:13 +09:00
wojciechkepka ce97a2f05f Add ability to change theme on editor 2021-06-20 00:07:13 +09:00
wojciechkepka c5a2fd5da3 Add `close_language_servers` method on `Editor` 2021-06-19 13:02:56 +09:00
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.
2021-06-18 09:38:10 +09:00
Ivan Tham 124514aa70 Add cursor kind to separate hidden cursor from pos
Now IME cursor position should be correct since we can still set cursor
position without drawing the cursor.
2021-06-15 23:46:21 +08:00
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.
2021-06-15 23:01:56 +08:00
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
2021-06-12 21:21:06 +09:00
Wojciech Kępka 098806ce2a
lsp: Display LSP progress messages (#216) 2021-06-11 12:42:16 +09:00
Ivan Tham 7cc13fefe9 Derive debug without feature
Note that this also removed those `finish_non_exhaustive()`.
2021-06-10 22:00:08 +09:00
notoria 1a3a924634 Implement Debug for data structure as a feature 2021-06-10 22:00:08 +09:00
Zheming Li ae51065213 Support go to line 1 2021-06-08 17:27:21 +09:00
Egor Karavaev 960bc9f134 Don't panic on LSP not starting 2021-06-08 10:02:41 +09:00
Benoît CORTIER 68affa3c59 Implement register selection
User can select register to yank into with the " command.
A new state is added to `Editor` and `commands::Context` structs.
This state is managed by leveraging a new struct `RegisterSelection`.
2021-06-07 21:52:09 +09:00
Wojciech Kępka 14f511da93 Create document if it doesn't exist on save 2021-06-06 17:28:09 +08:00
Blaž Hrastnik 06d8d3f55f Try to detect language when document file path is set
Fixes #91
2021-06-04 11:03:40 +09:00
Blaž Hrastnik c0332bd935 Fix split sizes getting out of sync with the terminal size, refs #69 2021-06-03 10:28:49 +09:00
Blaž Hrastnik 2100f5a2c0 Address clippy lint. 2021-05-17 23:01:45 +09:00
Blaž Hrastnik 8f6f329057 If switching to a previously open buffer in the same view, keep it's old offset 2021-05-17 16:36:13 +09:00
Blaž Hrastnik c0a8b81487 Only send the document close event if we're closing the underlying buffer 2021-05-07 14:52:47 +09:00
Blaž Hrastnik c20813690f View::new is infallible, so is editor.switch/new_file. 2021-05-07 14:45:49 +09:00
Blaž Hrastnik f2c79e245b Allow switching views back to scratch buffers. 2021-05-07 14:36:37 +09:00
Blaž Hrastnik 418ee17b86 Canonicalize the path on open to avoid duplicates. 2021-05-07 14:30:23 +09:00
Blaž Hrastnik 7c915dc065 Add the :new command, don't crash if saving without filename. 2021-05-07 14:19:58 +09:00
Blaž Hrastnik fd4fd12fa3 clippy lint 2021-05-06 17:20:00 +09:00
Blaž Hrastnik d00414f81a Start moving more LSP calls into callbacks/futures without capturing self 2021-05-06 15:08:59 +09:00
Blaž Hrastnik 355ad3cb82 Tokio migration. 2021-05-06 13:56:34 +09:00
Blaž Hrastnik bc4e54c0c4 Load config files from ~/.config/helix, fallback to defaults. 2021-04-07 23:56:20 +09:00
Blaž Hrastnik 91462af546 Allow starting hx without a file. A new blank file will be created. 2021-04-06 19:02:22 +09:00
Blaž Hrastnik 0dbd5b61ef Simplify code by providin cx.current() = (view, doc). 2021-04-01 11:01:26 +09:00
Blaž Hrastnik ceea5eacd8 clippy lint 2021-03-31 23:42:16 +09:00
Blaž Hrastnik 6c4093c946 Weave through view_id references so that views into one file have independent selects. 2021-03-31 17:17:01 +09:00
Blaž Hrastnik c1f2a14453 view: document.rs cleanup 2021-03-29 15:22:43 +09:00
Blaž Hrastnik a65395d94b Load theme from toml file. 2021-03-25 16:42:14 +09:00
Blaž Hrastnik 8657c57cf2 Trivial jumplist implementation. 2021-03-24 18:01:26 +09:00