Commit Graph

1088 Commits (c312f0baff1bee98396d06d73fc241d2034d36e5)

Author SHA1 Message Date
Bob 42fde95223
Accept count for goto_window (#1033)
* accept count for goto_window

also fix view is not fullfilled issue

* fix fulfilled mispell

* Update helix-term/src/commands.rs

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

* Update helix-term/src/commands.rs

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

* fix merge issue

* revert line computation logic

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-11-29 10:58:21 +09:00
Bob 4f9390a435
gf as goto_file (#1102)
* goto_file

* support goto_file under current cursor

* add C-w f/F

* sync space w with window mode

* Update helix-term/src/commands.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-11-29 10:53:29 +09:00
RustyStriker 103b5125e4
Detect filetype on :write (#1141)
fixes #1136

* removed a log::info

* removed temp.rs

* cargo clippy no longer complains

* new get_lang_server function

* get_lang_server is now launch_language_server

* launch_lang_server will now close the previous one

* better code readability

* remove resfresh_ls(and a wrong comment)
2021-11-28 10:19:54 +09:00
Thanabodee Charoenpiriyakij e8f800a141
Do not crash when run goto command without line number (#1160)
* Do not crash when run goto command without line number

Report an error when running goto command without entering a
line number.

Fixes #1159

* Use is_empty() instead check len zero
2021-11-25 11:02:51 +09:00
ath3 72f606ee19
Implement no-yank delete/change (#1099) 2021-11-24 16:46:40 +09:00
Martin Junghanns 57c14d4a93
Add `:<line>` and `:goto <line>` commands (#1128)
* Add typable `goto` command

* Support `:<line-number>` on prompt

* Rename function according to convention

* Directly call into goto_line_number function
2021-11-24 15:26:55 +09:00
Bob 21143e8d22
Align selections via & (#1101)
* align lines

* remove log statement

* use selections to align

* fix a clippy issue

* only accept 1,2,3 as user count

* Update helix-term/src/commands.rs

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

* return if user count is not correct

* add doc

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-11-23 23:08:05 +09:00
Blaž Hrastnik 0eadeab8c7 dap: Remove the prompt line parameter, use insert_str instead 2021-11-22 11:14:10 +09:00
Blaž Hrastnik d1854d8e6a Merge remote-tracking branch 'origin/master' into debug 2021-11-21 20:06:45 +09:00
Dan Nases Sha 6a4d9693ba
File picker config (#988)
* squashed WIP commits

* hide_gitignore working with config

* pass reference to new config parameter of file_picker()

* update config option name to match name on walk builder

* add comments to config and documentation of option to book

* add git_ignore option to WalkBuilder within prompt in commands.rs

* WIP: add FilePickerConfig struct

* WIP: cleanup

* WIP: add more options including max_depth

* WIP: changed defaults to match ignore crate defaults

* WIP: change WalkBuilder in global_search() to use config options

* WIP: removed follow_links, changed max_depth to follow config setting

* WIP: update book with file-picker inline table notation

* update documentation for file-picker config in book

* adjusted to [editor.file-picker] in book configuration.md

* adjust comments in editor.rs to be doc comments, cleanup

* adjust comments

* adjust book
2021-11-20 23:23:36 +09:00
Martin Junghanns a3a3b0b517
Jump to end char of surrounding pair from any cursor pos (#1121)
* Jump to end char of surrounding pair from any cursor pos

* Separate bracket matching into exact and fuzzy search

* Add constants for bracket chars

* Abort early if char under cursor is not a bracket

* Simplify bracket char validation

* Refactor node search and unify find methods

* Remove bracket constants
2021-11-20 23:17:25 +09:00
Blaž Hrastnik 2b7c086653 fix: Expand tilde first, then deal with relative paths
Otherwise the ~ gets treated as a relative path.

Fixes #1107
2021-11-19 12:09:17 +09:00
WindSoilder 5959356a24
Implement indent-aware delete (#1120)
* delete character backward can make undent behavior

* improve to handle mixed indentation
2021-11-19 00:19:40 +09:00
Ivan Tham bd56dde6e2
Ensure cursor in view after pipe (#1123)
Fix #1024
2021-11-18 18:46:27 +09:00
Blaž Hrastnik fa4c59df46 Simplify compositor.find 2021-11-18 11:09:04 +09:00
Blaž Hrastnik dd98727bad fix: editor.close now takes only a single parameter 2021-11-16 00:37:30 +09:00
Jason Hansen 6cb35d28a8
Add command to inc/dec number under cursor (#1027)
* Add command to inc/dec number under cursor

With the cursor over a number in normal mode, Ctrl + A will increment the
number and Ctrl + X will decrement the number. It works with binary, octal,
decimal, and hexidecimal numbers. Here are some examples.

0b01110100
0o1734
-24234
0x1F245

If the number isn't over a number it will try to find a number after the
cursor on the same line.

* Move several functions to helix-core

* Change to work based on word under selection

* It no longer finds the next number if the cursor isn't already over
  a number.
* It only matches numbers that are part of words with other characters
  like "foo123bar".
* It now works with multiple selections.

* Add some unit tests

* Fix for clippy

* Simplify some things

* Keep previous selection after incrementing

* Use short word instead of long word

This change requires us to manually handle minus sign.

* Don't pad decimal numbers if no leading zeros

* Handle numbers with `_` separators

* Refactor and add tests

* Move most of the code into core
* Add tests for the incremented output

* Use correct range

* Formatting

* Rename increment functions

* Make docs more specific

* This is easier to read

* This is clearer

* Type can be inferred
2021-11-16 00:32:58 +09:00
Bob 46d9ae2b62
Readline style insert mode (#1039)
* readline style insert mode

* update keymap.md

* don't save change history in insert mode

* Revert "don't save change history in insert mode"

This reverts commit cb47f946d7.

* don't affect register and history in insert mode

* add insert_register

* don't call exit_select_mode in insert mode

* avoid set_selection

* avoid duplicated current!
2021-11-16 00:31:20 +09:00
Cole Helbling c638b6b60e
helix-term/commands: implement buffer-close (bc, bclose) (#1035)
* helix-view/view: impl method to remove document from jumps

* helix-view/editor: impl close_document

* helix-view/editor: remove close_buffer argument from `close`

According to archseer, this was never implemented or used properly. Now
that we have a proper "buffer close" function, we can get rid of this.

* helix-term/commands: implement buffer-close (bc, bclose)

This behaves the same as Kakoune's `delete-buffer` / `db` command:

* With 3 files opened by the user with `:o ab`, `:o cd`, and `:o ef`:
  * `buffer-close` once closes `ef` and switches to `cd`
  * `buffer-close` again closes `cd` and switches to `ab`
  * `buffer-close` again closes `ab` and switches to a scratch buffer
* With 3 files opened from the command line with `hx -- ab cd ef`:
  * `buffer-close` once closes `ab` and switches to `cd`
  * `buffer-close` again closes `cd` and switches to `ef`
  * `buffer-close` again closes `ef` and switches to a scratch buffer
* With 1 file opened (`ab`):
  * `buffer-close` once closes `ab` and switches to a scratch buffer
  * `buffer-close` again closes the scratch buffer and switches to a new
    scratch buffer

* helix-term/commands: implement buffer-close! (bclose!, bc!)

Namely, if you have a document open in multiple splits, all the splits
will  be closed at the same time, leaving only splits without that
document focused (or a scratch buffer if they were all focused on that
buffer).

* helix-view/tree: reset focus if Tree is empty
2021-11-16 00:30:45 +09:00
Cole Helbling 87e61a0894
helix-term/commands: implement cquit (#1096)
This allows you to exit helix with an exit code, e.g. `:cq 2`.
2021-11-15 13:06:12 +09:00
Blaž Hrastnik f5e070e808 minor: Remove leftover log line 2021-11-15 10:33:14 +09:00
Blaž Hrastnik e128a8702e Implement MarkedString rendering
Solves typescript and python documentation rendering
2021-11-15 10:30:05 +09:00
Ivan Tham b7c3877e94
Add movement shortcut for history (#1088)
alt-u and alt-U
2021-11-15 00:16:47 +09:00
ath3 6fa76d9fe7
Add trim_selections command (#1092) 2021-11-15 00:16:20 +09:00
Ebbe Steenhoudt edc976b6bb
Added workspace_symbol_picker (#1041)
* Added workspace_symbol_picker

* Moved truncation of the symbol pickers to the end.

* Fixed typo
2021-11-15 00:12:56 +09:00
ath3 35c974c9c4
Implement "Goto last modification" command (#1067) 2021-11-15 00:11:53 +09:00
Cole Helbling b824e091a9
helix-term/commands: move SCRATCH_BUFFER_NAME to helix-view/document (#1091)
This way, the name is accessible everywhere `Document` and related types
are.
2021-11-13 13:15:41 +09:00
Omnikar 6d4409c00f
Make prompts consistent (#1080) 2021-11-13 01:34:49 +09:00
Omnikar bf95a9ed04
Add `remove_selections` command (#1065)
* Add `remove_selections` command

* Document `remove_selections`

* Update helix-term/src/keymap.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-11-12 09:34:08 +09:00
Ivan Tham 9d591427be
Fix earlier/later missing changeset update (#1069)
Fix #1059
2021-11-11 22:32:44 +09:00
Cole Helbling bf70cfd050
helix-term/command: make scratch buffer name consistent (#1071) 2021-11-11 12:22:15 +09:00
Omnikar ebc14d9d20
Add `m` textobject for pair under cursor (#961) 2021-11-11 11:33:31 +09:00
Bob 4d22454386
add wonly -- window only (#1057)
* add wonly

* Update book/src/keymap.md

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* add `wonly` to space w mode too

* remove the TODO

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-11-11 11:32:23 +09:00
CossonLeo 68224232af
buffer picker add is_modifier flag (#1020) 2021-11-10 10:52:39 +09:00
CossonLeo a69caff450
search_impl will only align cursor center when it isn't in view (#959) 2021-11-09 11:11:45 +09:00
CossonLeo 29e6849413
Add LSP rename_symbol (space-r) (#1011)
improve apply_workspace_edit
2021-11-09 00:17:54 +09:00
Omnikar a252ecd8c8
Add WORD textobject (#991)
* Add WORD textobject

* Document WORD textobject
2021-11-08 09:54:39 +09:00
Blaž Hrastnik 09f5796537 dap: Simplify get_breakpoint_at_current_line 2021-11-07 22:03:55 +09:00
Blaž Hrastnik 3b8d5102ac Make picker take the whole context, not just editor 2021-11-07 18:03:04 +09:00
Blaž Hrastnik f2b709a3c3 Merge branch 'master' into debug 2021-11-07 00:28:19 +09:00
Blaž Hrastnik 2c1313c064 Specify vector capacity on surround_add 2021-11-06 23:52:49 +09:00
Blaž Hrastnik 1a1685acf7 Simplify current!(..).1 into doc!() 2021-11-06 23:52:26 +09:00
Blaž Hrastnik 0f4cd73000 Simplify goto_*_diagnostic commands 2021-11-06 18:58:58 +09:00
Blaž Hrastnik f659e1178a minor: view!(..).doc is slightly more efficient than current!(..).1.id() 2021-11-06 17:54:04 +09:00
Blaž Hrastnik b81a554424 Retain range direction on search
Co-authored-by: CossonLeo <20379044+cossonleo@users.noreply.github.com>
2021-11-06 17:41:30 +09:00
Blaž Hrastnik 6431b26a6a Implement Selection::replace to replace a single range
Fixes #985

Co-authored-by: Daniel S Poulin <crimsonmage+github@gmail.com>
2021-11-06 17:37:45 +09:00
Gygaxis Vainhardt 911b9b3276
Add reverse search functionality (#958)
* Add reverse search functionality

* Change keybindings for extend to be in select mode, incorporate Movement and Direction enums

* Fix accidental revert of #948 in rebase

* Add reverse search to docs, clean up mismatched whitespace

* Reverse search optimization

* More optimization via github feedback
2021-11-06 17:33:30 +09:00
Omnikar 51b4d35dce
Inform when reaching undo/redo bounds (#981)
* Inform when reaching undo/redo bounds

* `Already at oldest change` when undo fails
* `Already at newest change` when redo fails

* Add missing `the`
2021-11-05 10:20:06 +09:00
Blaž Hrastnik 7b65a6d687 Rewrite goto_buffer 2021-11-04 14:03:03 +09:00
ath3 78c68fae91 Implement "Goto next buffer / Goto previous buffer" commands 2021-11-04 14:03:03 +09:00
Blaž Hrastnik e2560f427e Replace documents SlotMap with BTreeMap 2021-11-04 13:43:45 +09:00
CossonLeo 39584cbccd
Add c-s to pick word under doc cursor to prompt line & search completion (#831)
* Add prompt shourtcut to book
Add completions to search
Add c-s to pick word under doc cursor to prompt line

* limit 20 last items of search completion, update book

* Update book/src/keymap.md

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

* limit search completions 200

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-11-04 12:26:01 +09:00
CossonLeo 1720b98760
only remove primary index when search next without extend (#948) 2021-11-02 13:32:57 +09:00
Ivan Tham bc6a34d97e
Make match work with extend and multi cursors (#920) 2021-10-29 10:08:53 +09:00
Ivan Tham 21d535565b
Support extend for multiple goto (#909)
gg, ge, [n]gg
2021-10-29 10:07:07 +09:00
cossonleo f1d339919f add expand_selection to last_motion 2021-10-29 10:04:12 +09:00
Omnikar e2ed691537
Implement `hx --tutor` and `:tutor` to load `tutor.txt` (#898)
* Implement `hx --tutor` and `:tutor` to load `tutor.txt`

* Document `hx --tutor` and `:tutor`

* Change `Document::set_path` to take an `Option`

* `Document::set_path` accepts an `Option<&Path>` instead of `&Path`.
* Remove `Editor::open_tutor` and make tutor-open functionality use
  `Editor::open` and `Document::set_path`.

* Use `PathBuf::join`

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

* Add comments explaining unsetting tutor path

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-10-28 10:23:46 +09:00
Omnikar a7d87c79ce
Fix `:quit!` description and tense of other commands (#902) 2021-10-25 09:25:47 +09:00
CossonLeo 2ed01f2d9c
find motion and textobj motion repeat (#891) 2021-10-24 22:47:10 +09:00
CossonLeo 971ba8929f
Filter completion items from language server by starts_with word under cursor (#883)
* filter items by starts_with pre nth char of cursor

* add config for filter completion items by starts_with

* filter items by starts_with pre nth char of cursor

* add config for filter completion items by starts_with

* remove completion items pre filter configuratio
2021-10-24 16:55:29 +09:00
Oskar Nehlin 0f886af4b9
Add commands for moving between splits with a direction (#860)
* Add commands for moving between splits with a direction

* Update keymaps

* Change picker mapping

* Add test and clean up some comments
2021-10-23 20:06:40 +09:00
Gokul Soumya 4ee92cad19
Add treesitter textobjects (#728)
* Add treesitter textobject queries

Only for Go, Python and Rust for now.

* Add tree-sitter textobjects

Only has functions and class objects as of now.

* Fix tests

* Add docs for tree-sitter textobjects

* Add guide for creating new textobject queries

* Add parameter textobject

Only parameter.inside is implemented now, parameter.around
will probably require custom predicates akin to nvim' `make-range`
since we want to select a trailing comma too (a comma will be
an anonymous node and matching against them doesn't work similar
to named nodes)

* Simplify TextObject cell init
2021-10-23 11:41:19 +09:00
radical3dd b1ebd7a07e
Replace current selection with all yanked values. (#882) 2021-10-21 09:44:53 +09:00
CossonLeo 9ac0c95161
Improve completion trigger (#838)
* improve idle completion trigger

* add completion-trigger-len to book

* rename semantics_completion to language_server_completion and optimize idle completion trigger
2021-10-18 15:14:50 +09:00
Blaž Hrastnik 0a6b60085a Merge branch 'master' into debug 2021-10-17 13:51:56 +09:00
Blaž Hrastnik f8f63c5508
Merge pull request #821 from helix-editor/idle-timer
Idle timer / Autocompletion
2021-10-10 22:11:01 +09:00
Blaž Hrastnik 633b981db2 Make idle-timeout configurable 2021-10-10 12:32:06 +09:00
Dmitry Sharshakov bc0084d071
fix command descriptions 2021-10-09 16:06:32 +03:00
Dmitry Sharshakov 48cb81eff1
Merge branch 'master' into debug 2021-10-09 16:03:46 +03:00
Ethan Frei 9f27be429d
relative paths showing active file in global search (#803) 2021-10-08 11:08:10 +09:00
Blaž Hrastnik 66f26e82ce Filter the initial completion 2021-10-05 22:27:35 +09:00
Blaž Hrastnik 40abec80e1 Experiment with autocompletion on idle 2021-10-05 22:27:33 +09:00
Irevoire c4ae17dfd4
fix clippy warnings (#804) 2021-10-03 12:40:33 +09:00
Irevoire 7e958e1834
Add a bunch of aliases (#797)
* add a bunch of aliases

* apply code review from archseer
2021-10-03 11:41:41 +09:00
Dylan Richardson 4a92a79da4
global search: show file names as relative paths (#802)
This commit fixes #786
2021-10-03 08:41:52 +09:00
Dmitry Sharshakov 0e51e5fbaf
editor: support setExceptionBreakpoints 2021-09-26 10:24:58 +03:00
Dmitry Sharshakov bf53aff27d Merge branch 'master' into debug 2021-09-25 23:14:59 +03:00
Matt W df55eaae69
Add tilde expansion for file opening (#782)
* change to helix_core's tilde expansion,
    from helix-core::path::expand_tilde
2021-09-24 11:21:04 +09:00
Blaž Hrastnik 2e0803c8d9 Implement 'remove_primary_selection' as Alt-,
This allows removing search matches from the selection

Fixes #713
2021-09-24 10:30:28 +09:00
Blaž Hrastnik 9ea9e779b2 experiment: Move keep_primary_selection to , 2021-09-24 10:30:17 +09:00
lurpahi a958d34bfb
Add option for automatic insertion of closing-parens/brackets/etc (#779)
* Add auto-pair editor option

* Document auto-pair editor option

* Make cargo fmt happy

* Actually make cargo fmt happy

* Rename auto-pair option to auto-pairs

* Inline a few constants

Co-authored-by: miaomai <cunso@tutanota.com>
2021-09-24 10:28:44 +09:00
Leoi Hung Kin 432bec10ed
allow smart case in global search (#781) 2021-09-24 10:27:16 +09:00
Leoi Hung Kin 9456d5c1a2
Initial implementation of global search (#651)
* initial implementation of global search

* use tokio::sync::mpsc::unbounded_channel instead of Arc, Mutex, Waker poll_fn

* use tokio_stream::wrappers::UnboundedReceiverStream to collect all search matches

* regex_prompt: unified callback; refactor

* global search doc
2021-09-22 01:03:12 +09:00
kraem 4a003782a5
enable smart case regex search by default (#761) 2021-09-20 13:45:07 +09:00
Leoi Hung Kin 1d04e5938d
search_next_impl: don't panic on invalid regex (#740) 2021-09-17 17:22:17 +09:00
Blaž Hrastnik 3ff5b001ac fix: Don't allow closing the last split if there's unsaved changes
Fixes #674
2021-09-17 14:43:06 +09:00
Blaž Hrastnik b02d872938 fix: Refactor apply_workspace_edit to remove assert
Fixes #698
2021-09-17 14:43:06 +09:00
Omnikar 3e12b00993
Add `no_op` command (#743)
* Add `no_op` command

* Document `no_op` in `remapping.md`
2021-09-13 17:48:12 +09:00
Kangwook Lee (이강욱) 05c2a72ccb
goto line start/end commands extend when in select mode (#739) 2021-09-11 18:31:40 +09:00
Kirawi 987d8e6dd6
Convert clipboard line ending to document line ending when pasting (#716)
* convert a paste's line-ending to the current doc's line-ending

* move paste regex into paste_impl
2021-09-11 00:12:26 +09:00
Blaž Hrastnik 3426285a63 fix: Don't automatically search_next on *
Refs #713
2021-09-08 16:34:04 +09:00
Blaž Hrastnik 72cf86e462 Regex prompts should have a history with a specifiable register 2021-09-08 16:34:04 +09:00
Kangwook Lee (이강욱) 7a9db95182
Add command to extend to line start or end (#717) 2021-09-07 23:22:39 +09:00
Dmitry Sharshakov 8a609047c3 Mouse command for editing logpoint 2021-09-05 08:50:03 +03:00
Dmitry Sharshakov 7bdead5b4b Drop old commands
TODO: edit logpoints with a keybinding and mouse
2021-09-05 08:20:21 +03:00
Gokul Soumya 95cd2c645b Refactor switch_case commands 2021-09-05 12:41:19 +09:00
Gokul Soumya 33ce8779fd Refactor {move,extend}_word_* commands 2021-09-05 12:41:19 +09:00
Gokul Soumya ea2b4c687d Refactor {move,extend}_char_* commands 2021-09-05 12:41:19 +09:00
Dmitry Sharshakov 1befbd076c Add command for editing breakpoint condition 2021-09-04 22:57:58 +03:00
Dmitry Sharshakov e36fc57fff refactor breakpoint edit 2021-09-04 22:18:42 +03:00
Kangwook Lee (이강욱) 07fe4a6a40
Add commands that extends to long words (#706) 2021-09-04 19:00:32 +05:30
Blaž Hrastnik c63ad60c31 dap: Allow switching between stack frames 2021-09-03 17:25:11 +09:00
Blaž Hrastnik b997d2cdeb dap: Allow setting breakpoints before starting the adapter 2021-09-03 13:26:30 +09:00
Blaž Hrastnik 289303a30d dap: small TODO 2021-09-03 11:48:55 +09:00
Blaž Hrastnik 4c410eef87 Merge remote-tracking branch 'origin/master' into debug 2021-09-03 11:03:34 +09:00
Wojciech Kępka 7e1123680f
Expand `~` in `change-current-directory` command (#692) 2021-09-02 11:03:42 +09:00
oberblastmeister 825bceeab6
add_newline unimpaired mapping (#653)
* added some keymaps

* remove

* remove wrong mappings

* remove

* wrong import

* use enum

* correct line ending

* added to book

* column
2021-09-02 00:55:16 +09:00
Blaž Hrastnik ce7ad2beb5 Reimplement keep-pipe, it needs to manipulate selections, not text 2021-09-01 11:09:50 +09:00
Blaž Hrastnik dc609cafb5 Extract the shell command into a separate function 2021-09-01 10:46:35 +09:00
Dmitry Sharshakov 5b20f6020a Merge remote-tracking branch 'origin/master' into debug
Contains type fix on helix-term/src/ui/editor.rs:752:13
2021-08-31 21:29:11 +03:00
Blaž Hrastnik a3bd80a6fa ui: prompt: Avoid allocating a prompt name if it's a static string 2021-08-31 18:29:24 +09:00
Blaž Hrastnik 9b96bb5ac8 Refactor a bit further 2021-08-31 18:24:24 +09:00
Blaž Hrastnik 4a76ea8f88 shell: Move changes outside so we can properly handle errors 2021-08-31 18:19:18 +09:00
Omnikar e772808a5b
Shell commands (#547)
* Implement shell interaction commands

* Use slice instead of iterator for shell invocation

* Default to `sh` instead of `$SHELL` for shell commands

* Enforce trailing comma in `commands` macro

* Use `|` register for shell commands

* Move shell config to `editor` and use in command

* Update shell command prompts

* Remove clone of shell config

* Change shell function names to match prompts

* Log stderr contents upon external command error

* Remove `unwrap` calls on potential common errors

`shell` will no longer panic if:
  * The user-configured shell cannot be found
  * The shell command does not output UTF-8

* Remove redundant `pipe` parameter

* Rename `ShellBehavior::None` to `Ignore`

* Display error when shell command is used and `shell = []`

* Document shell commands in `keymap.md`
2021-08-31 18:13:16 +09:00
Blaž Hrastnik 2c7b75475f dap: refactor frame handling 2021-08-30 11:07:59 +09:00
Blaž Hrastnik 986828e75c dap: Remap keys, match current thread behavior from dap-mode, switch-thread 2021-08-29 23:32:46 +09:00
Blaž Hrastnik d6ccc150c7 Extract dap commands into a separate file 2021-08-29 22:43:08 +09:00
Blaž Hrastnik ee2ba744a2 Rename dap_in/_out to dap_step_in/_out 2021-08-29 22:37:21 +09:00
Dmitry Sharshakov b42631942b
Defaults in completions, better schema 2021-08-29 14:51:47 +03:00
Dmitry Sharshakov 94901b8677
Customized completion for template parameters 2021-08-28 19:11:19 +03:00
Dmitry Sharshakov e315394631
Merge remote-tracking branch 'origin/master' into debug 2021-08-28 14:59:26 +03:00
Dmitry Sharshakov 8df6739759
New way of starting debug sessions 2021-08-28 14:23:54 +03:00
Dmitry Sharshakov 890b51b568
Paginated variables 2021-08-28 10:13:19 +03:00
Ivan Tham 4bafda3995
Change vsp to vs (#647)
Follow up on #639 to match vim behavior
2021-08-27 00:20:37 +09:00
Dmitry Sharshakov 3b87fce0ce
Print errors occurred in debug commands 2021-08-25 21:01:15 +03:00
Dmitry Sharshakov c7759a5aa0
Merge remote-tracking branch 'origin/master' into debug 2021-08-25 19:22:01 +03:00
Dmitry Sharshakov 4ee66b8766
Support remote debug adapter 2021-08-25 19:14:47 +03:00
Dmitry Sharshakov 326293cb57
only show variables' names and types 2021-08-25 08:33:46 +03:00
Kirawi b99db7c687
Move path util functions from helix-term to helix-core (#650) 2021-08-25 10:04:05 +09:00
Dmitry Sharshakov 8cc6d68160
Autocomplete files for debug command 2021-08-24 20:38:49 +03:00
Dmitry Sharshakov 235a84d989
Remove shortcut for starting debug 2021-08-24 20:32:38 +03:00
Dmitry Sharshakov 299da5a35b
Support attach request 2021-08-24 20:27:54 +03:00
Dmitry Sharshakov b001008a69
Support templates in debug configurations 2021-08-24 20:04:14 +03:00
Dmitry Sharshakov 31212e133d
Rename functions 2021-08-24 16:48:38 +03:00
Dmitry Sharshakov 1041a5bb07
Support launching configs by name 2021-08-24 12:21:00 +03:00
Dmitry Sharshakov c463142e5e
Create new debugger config format 2021-08-24 11:56:18 +03:00
Dmitry Sharshakov 34c6094604
refactor 2021-08-24 11:32:44 +03:00
Dmitry Sharshakov fdad7d67aa
Check capabilities for breakpoint config 2021-08-24 10:48:47 +03:00
Dmitry Sharshakov 5d3c69d565
Support logpoints
Tested with Node (Delve and LLDB do not support logpoints)
2021-08-24 08:47:20 +03:00
Blaž Hrastnik a5c3c6c6a9 ui: Highlight line ranges in the preview 2021-08-24 13:25:39 +09:00
Blaž Hrastnik 1d45f50781 fix: Don't internally use relative paths in the buffer picker
Fixes #619
2021-08-24 09:56:09 +09:00
devins2518 e1c9f13263
Add :vsplit and :hsplit commands (#639)
* add vsplit and hsplit commands

* handle splits more elegantly
2021-08-24 09:37:44 +09:00
Dmitry Sharshakov b6b99b2487
config: minor fixes 2021-08-23 17:26:12 +03:00
Dmitry Sharshakov 839d210573
Enable stdio transport via config 2021-08-23 17:18:03 +03:00
Dmitry Sharshakov f55a012fb7
editor: add debug session config 2021-08-23 16:56:41 +03:00
Dmitry Sharshakov c5b210df59
Add debug-adapter field to languages.toml 2021-08-23 16:48:06 +03:00
Dmitry Sharshakov 53ee57f84a
clippy 2021-08-22 15:16:59 +03:00
Dmitry Sharshakov f247858055
Support conditional breakpoints 2021-08-22 15:06:27 +03:00
Dmitry Sharshakov 3197c2536e
Add eval command 2021-08-22 14:44:16 +03:00
Dmitry Sharshakov 838f69929d
Simplify variables display 2021-08-22 12:49:18 +03:00
Dmitry Sharshakov 060a422c7e
fix crash when pausing 2021-08-22 12:26:36 +03:00
Dmitry Sharshakov 132198323c
editor: go to pos where stack pointer is located 2021-08-22 11:56:22 +03:00
Dmitry Sharshakov d93cd2a261
editor: support stepIn, stepOut, next and pause commands 2021-08-22 11:16:11 +03:00
Blaž Hrastnik 607b92b2e3 fix: Place the cursor on the start of the selected symbol
Fixes #626
2021-08-22 15:00:07 +09:00
Dmitry Sharshakov 89ad54a2e5
Add variable type to output 2021-08-22 08:31:01 +03:00
Dmitry Sharshakov cc66475592
Add commands for variable introspection 2021-08-22 08:25:38 +03:00
Dmitry Sharshakov 95ba4ff5bd
Hide stack pointer when continued 2021-08-21 21:00:18 +03:00
Dmitry Sharshakov f3e47bfee4
Disable continuing when running 2021-08-21 20:55:45 +03:00
Dmitry Sharshakov 66c035fa99
Continue command 2021-08-21 20:42:13 +03:00
Dmitry Sharshakov 6709b4242f
Drop and terminate debugger 2021-08-21 20:38:03 +03:00
Dmitry Sharshakov 26dee49dc9
Add command to detach debugger 2021-08-21 20:33:56 +03:00
Dmitry Sharshakov a938f5a87a
refactor: handle DAP events in editor main loop 2021-08-21 17:21:35 +03:00
Dmitry Sharshakov 5f5b383979
Fix clippy warnings 2021-08-21 14:35:53 +03:00
Dmitry Sharshakov 6458edecfd
Add stack pointer display when stopped 2021-08-21 14:15:29 +03:00
Dmitry Sharshakov 738e8a4dd3
Unify init and launch commands 2021-08-20 19:11:37 +03:00
Dmitry Sharshakov 9e22842d51
move debug command to keybinding 2021-08-20 19:06:52 +03:00
Dmitry Sharshakov e2c74d26e0
Add command to run debug target 2021-08-20 18:18:35 +03:00
Dmitry Sharshakov c4970c617e
make CI green 2021-08-20 16:48:59 +03:00
Blaž Hrastnik a54b09e3fe dap: Split out launch from init 2021-08-20 14:06:55 +09:00
Blaž Hrastnik 94a1951d40 Work towards a breakpoint UI 2021-08-20 13:51:38 +09:00
Blaž Hrastnik 86102a651f wip 2021-08-20 13:48:33 +09:00
Blaž Hrastnik d39baa3b4e Start integrating into the editor's event loop 2021-08-20 13:48:32 +09:00
Blaž Hrastnik d4c17b633c minor: Extract doc.text().slice(..) into a var 2021-08-20 13:42:47 +09:00
Blaž Hrastnik 38e932bd4c minor: Nicer errors, std::io::Error provides a Display impl 2021-08-20 13:42:17 +09:00
Blaž Hrastnik a76ec9a64e Make scrolling extend in extend mode 2021-08-20 13:42:01 +09:00
Blaž Hrastnik 07fea61d03 Use the correct search register 2021-08-20 11:14:57 +09:00
Blaž Hrastnik f60b549fb7 cargo fmt 2021-08-20 11:02:28 +09:00
Blaž Hrastnik cbd39d67a4 minor: Refactor commands.rs a bit more 2021-08-20 10:43:22 +09:00
Blaž Hrastnik 557fd86e71 Extract view.inner_area(), simplify render_focused_view_elements 2021-08-19 15:59:03 +09:00
Blaž Hrastnik 9776553ad0 Refactor view.first_line/first_col into view.offset (Position) 2021-08-19 12:52:07 +09:00
Blaž Hrastnik 115754c5ee Simplify write/write_all commands, we no longer need to excessively block 2021-08-19 11:37:42 +09:00
Yerlan 18c0509593
Exit select mode after toggle_comment. Fixes #597 (#598)
Consistent with yanking, exit select mode after toggling comment. Fixes #597
2021-08-17 09:52:52 +09:00
Blaž Hrastnik fd1eaafff5 Add :tree-sitter-scopes, useful when developing indents.toml 2021-08-13 13:15:53 +09:00
Gokul Soumya d84f8b5fde
Show file preview in split pane in fuzzy finder (#534)
* Add preview pane for fuzzy finder

* Fix picker preview lag by caching

* Add picker preview for document symbols

* Cache picker preview per document instead of view

* Use line instead of range for preview doc

* Add picker preview for buffer picker

* Fix render bug and refactor picker

* Refactor picker preview rendering

* Split picker and preview and compose

The current selected item is cloned on every event, which is
undesirable

* Refactor out clones in previewed picker

* Retrieve doc from editor if possible in filepicker

* Disable syntax highlight for picker preview

Files already loaded in memory have syntax highlighting enabled

* Ignore directory symlinks in file picker

* Cleanup unnecessary pubs and derives

* Remove unnecessary highlight from file picker

* Reorganize buffer rendering

* Use normal picker for code actions

* Remove unnecessary generics and trait impls

* Remove prepare_for_render and make render mutable

* Skip picker preview if screen small, less padding
2021-08-12 16:00:42 +09:00
Dmitry Sharshakov 7d51805e94
Support primary clipboard (#548)
* clipboard-none: add in-memory fallback buffer

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* view: add Wayland primary clipboard

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Format

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: copy to primary selection after mouse move stops

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: don't update primary selection if it is a single character

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: discard result of setting primary selection

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: add commands for interaction with primary clipboard

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* editor: implement primary selection copy/paste using commands

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* clipboard: support xsel for primary selection

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* clipboard: support xclip for primary selection

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: multiple cursor support for middle click paste

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* rename primary selection to primary clipboard in scope of PR

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: make middle click paste optional

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Format

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Update helix-term/src/ui/editor.rs

* fix formatting

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* config: correct defaults if terminal prop is not set

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* refactor: merge clipboard and primary selection implementations

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Tidy up code

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* view: remove names for different clipboard/selection providers

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* Update helix-view/src/clipboard.rs

Co-authored-by: Gokul Soumya <gokulps15@gmail.com>

* helix-view: tidy macros

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: refactor paste-replace commands

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: use new config for middle-click-paste

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* clipboard: remove memory fallback for command and windows providers

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* clipboard-win: fix build

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* clipboard: return empty string when primary clipboard is missing

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* clipboard: fix errors in Windows build

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
2021-08-12 11:53:48 +09:00
Blaž Hrastnik d03982ee43 cargo fmt 2021-08-12 10:18:37 +09:00
Blaž Hrastnik 6d52424303 fix: Adjust scroll offset/padding calculation to prevent wobble
Fixes #324
2021-08-11 13:53:38 +09:00
Nathan Vegdahl dde2be9395
Fix surround_replace replacing the wrong character on the right. (#571)
Fixes #569.
2021-08-11 09:17:59 +09:00
Dmitry Sharshakov 27b551d345
helix-term: handle scrolling when mouse is enabled (#554)
* helix-term: handle scrolling when mouse is enabled

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: configure scrolling speed

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: use new config for scrolling

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* config: defaults for edtior config

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* config: add scroll-lines property

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: scroll hovered view

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: support inverted scrolling

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: remove duplicating code

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: do not focus view while scrolled

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* helix-term: refactor mouse events and scrolling

Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>

* simplify

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-08-10 14:35:20 +09:00
Omnikar 21e5662125
Make `exit_select_mode` check current mode (#568)
Change `exit_select_mode` to check that the current mode is select mode
before switching to normal mode
2021-08-10 10:57:07 +09:00
Blaž Hrastnik a2ccfffda1 config: Rename [terminal] to [editor] and pass it into Editor 2021-08-08 14:10:01 +09:00
Blaž Hrastnik f0eb6ed96a Resolve a couple TODOs 2021-08-08 14:08:54 +09:00
Blaž Hrastnik 02cba2a7f4 Implement alt-( and alt-) to rotate selection contents 2021-08-08 13:26:13 +09:00
Blaž Hrastnik 66a90130a5 Implement selection rotation with `(` and `)` 2021-08-06 11:22:01 +09:00
Ivan Tham 10c77cdc03 Exit extend after yank
Yank should proceed with normal mode.
2021-08-05 17:25:23 +09:00
Blaž Hrastnik 0793841ac3 Refactor copy selection vertically 2021-08-05 17:04:26 +09:00
Cor f160008add Vertical Selection 2021-08-05 17:04:26 +09:00
Nathan Vegdahl 8c3a5b14de Add `goto_last_line` command, and bind it to `ge`.
Resolves #529.
2021-08-04 09:47:22 +09:00
Ivan Tham 821565e4ef Add ctrl-z to suspend 2021-08-03 09:32:21 +09:00
Blaž Hrastnik adb5d842ba Use nicer filepaths instead of URIs in goto picker 2021-08-03 09:30:51 +09:00
Nathan Vegdahl f88d4c1e20 Move indent-style code into `helix_core::indent`. 2021-07-30 12:22:59 +09:00
Nathan Vegdahl e6e0d31be0 Fix incorrect behavior of `find_char` command and friends.
The non-extending variants of the commands weren't selecting from the range head.

Fixes #527.
2021-07-30 09:39:18 +08:00
Nathan Vegdahl 3fda350494 Fixes for new clippy lints in Rust 1.54. 2021-07-29 22:47:18 +02:00
Blaž Hrastnik 05d20e196f
Merge pull request #376 from cessen/great_line_ending_and_cursor_range_cleanup
The Great Line Ending & Cursor Range Cleanup
2021-07-29 18:43:20 +09:00
Nathan Vegdahl e4d41d06e3 Fix typo in comment. 2021-07-28 19:20:23 -07:00
Gokul Soumya 8a2fa692f2 Refactor case where key event is solely a character 2021-07-29 08:39:58 +08:00
Nathan Vegdahl 285aba2de5 Fix bug with `/` searching after non-ascii characters.
Forgot to convert from char indices to byte indices before passing
to the regex engine.
2021-07-28 16:03:34 -07:00
Nathan Vegdahl cd7302ffd3 Enforce cursor/selection invariants in one place.
Rather than per-command like before.
2021-07-28 15:57:00 -07:00
Nathan Vegdahl a873e719d5 Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-28 14:11:08 -07:00
Gokul Soumya b90450b9e8 Fix goto line number
Regression from #454. Go to line 10 with `10gg` or `10G`.
2021-07-28 21:33:18 +08: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 01247acf0c Start searches at the right side of the block cursor. 2021-07-26 08:50:26 -07:00
Nathan Vegdahl 0883b4fae0 Collect some common patterns into methods on `Range`. 2021-07-26 08:40:30 -07:00
Blaž Hrastnik 63e54e30a7 Implement in-memory prompt history
Implementation is similar to kakoune: we store the entries into
a register.
2021-07-26 11:19:33 +09:00
Gokul Soumya e07e42dcfb fix(term): undo-ing code actions 2021-07-25 19:49:05 +09:00
gbaranski 8da58fe44a fix(term): use existing implementation of edits_to_transaction 2021-07-25 19:49:05 +09:00
Nathan Vegdahl f96b8b769b Switch to a cleaner range-head moving abstraction.
Also fix a bunch of bugs related to it.
2021-07-24 07:44:11 -07:00
Grzegorz Baranski 48e344a2a8
feat: code actions - document edits (#478)
* wip: Code actions

* fix(term): use current macro instead Context::context

* feat(lsp): set code_action capabilities

* feat(term): set SPC-a to code_action

* feat(term): wip on applying code actions

* deps: `cargo update`

* feat(term): applying code actions edits

* fix(term): cleanup of apply_edit

* fix(term): applying edits as a whole thing instead one by one

* refactor(term): move apply_edits below

* fix(term): improve unimplemented messages for further investigation

* fix(term): change code action command comment

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

* fix(term): add matching `}`

* fix(term): cleanup, todo!() on workspace edit

* fix(term): remove unrelated workspace_symbol_picker

* fix(term): apply cargo-clippy suggestions

* fix(term): replace todo!'s with editor.set_error

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-07-24 10:26:43 +09:00
Nathan Vegdahl 20723495d3 Fixed find_till_char and find_char commands.
They worked correctly when extending, but not for normal cursor
movement.
2021-07-23 18:03:40 -07:00
Nathan Vegdahl 8f43dc4039 Fix surround replace command replacing the wrong position on the right. 2021-07-23 17:52:45 -07:00
Nathan Vegdahl 43594049dd Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-23 17:23:16 -07:00
Nathan Vegdahl 427ae6ac6c Put selection in separate variable in commands code. 2021-07-23 17:06:14 -07:00
Nathan Vegdahl ad814b8c2e Fix append mode, and make insertion always happen at head of range. 2021-07-23 14:27:12 -07:00
Nathan Vegdahl 5841954f58 Calculate the line that the range head is on correctly. 2021-07-22 11:17:03 -07:00
Nathan Vegdahl 673338bdb6 Use `Range::line_range()` in some more places I missed. 2021-07-22 10:50:12 -07:00
Ivan Tham eba0bbda2e Resume last picker
Inspired by space ' in doom emacs.
2021-07-22 11:22:27 +09:00
Nathan Vegdahl 7d07704e6f Fix append mode not editing correctly.
This is currently a bit of a hack, and still doesn't behave quite how we
probably want.  Left a TODO.
2021-07-21 09:56:21 -07:00
Nathan Vegdahl 063aa9452d Fix yank not working with internally zero-width ranges. 2021-07-21 09:32:48 -07:00
Nathan Vegdahl c848ed7abc Fixes for misc bugs with view movement. 2021-07-20 18:15:34 -07:00
Nathan Vegdahl 1194fc842a Use new `Range::line_range()` method in more places, as appropriate. 2021-07-20 12:40:58 -07:00
Nathan Vegdahl 1c6b5581f0 Fix various bugs related to goto-end-of-line command.
This also fixes a bug with `Selection::normalize()`, that could
result in an out-of-bounds primary index.
2021-07-20 11:58:56 -07:00
Nathan Vegdahl e8a3980e46 Fix line-wise `p` pasting before the current line instead of after. 2021-07-20 10:56:27 -07:00
Nathan Vegdahl 1792dc6f93 Make search work a little nicer when there are already selections.
Specifically, if you have text like "aaaaaaaaa" and you search
for "a", the new behavior will actually progress through all of the
"a"s, whereas the previous behavior would be stuck on a single one.
2021-07-19 18:29:26 -07:00
Nathan Vegdahl 13b0784009 Fix extend line behavior. 2021-07-19 17:44:18 -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
Nathan Vegdahl e462f32723 Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-18 22:02:12 -07:00
Nathan Vegdahl 6c038bb015 Update word selection/navigation to work with gap indexing.
Also tweaked some of the existing behavior that seemed inconsistent
and/or buggy.  It's mostly identical, just a few corner cases are
different.
2021-07-18 21:59:31 -07:00
Cor Peters cd65a48635
Made toggle_comments language dependent (#463)
* Made toggle_comments language dependent

* Fixed Test Cases

* Added clippy suggestion

* Small Fixes

* Clippy Suggestion

Co-authored-by: Cor <prive@corpeters.nl>
2021-07-19 01:33:38 +09:00
Nathan Vegdahl c2fd55e168 Update extend_line command to work with gap indexing. 2021-07-17 11:28:20 -07:00
Nathan Vegdahl 954314a7c9 Update change-case commands to work with gap indexing. 2021-07-17 11:03:39 -07:00
Nathan Vegdahl a77274e8bb Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-17 10:49:03 -07:00
Cor Peters 722cfedb38
Added change_case command (#441)
* Added change_case command

* Added switch_to_uppercase and switch_to_lowercase

Renamed change_case to switch_case.

* Updated the Keymap section of the Book

* Use flat_map instead of map + flatten

* Fix switch_to_uppercase using to_lowercase

* Switched 'Alt-`' to uppercase and '`' to lowercase

Co-authored-by: Cor <prive@corpeters.nl>
2021-07-17 01:12:59 +09:00
Blaž Hrastnik 4a5cb0e04b Restore C-w shortcut 2021-07-11 16:42:23 +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 3e4cd8f8e6 Add infobox for view 2021-07-11 11:12:04 +09:00
Nathan Vegdahl b4c59b444c Update surround commands to work with gap indexing. 2021-07-08 16:47:20 -07:00
Ivan Tham 1c71fced0e Add more modes to infobox 2021-07-08 09:37:18 +09:00
Nathan Vegdahl 85d5b399de Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-05 20:27:49 -07:00
Blaž Hrastnik a4e28c6927 Implement `X` as extend selection to line bounds 2021-07-05 10:12:34 +09:00
Blaž Hrastnik ebccc96cd4 Factor out goto t/m/b into a single function again 2021-07-04 18:07:58 +09:00
Blaž Hrastnik 6ce303977c Revert back to 'gm'
top / middle / bottom mnemonic.
2021-07-04 18:02:42 +09:00
Ivan Tham bbbbfa9bcf Goto mode use infobox
In the meantime, change gm to gc.
Remove extra space in mode title.
2021-07-04 18:01:59 +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 64f83dfcbd Support infobox doc gen on stable release 2021-07-04 18:01:59 +09:00
Ivan Tham 61e925cbed Add infobox doc generation and improve ergonomics 2021-07-04 18:01:59 +09:00
Ivan Tham 6710855eac Fix rendering issues for infobox 2021-07-04 18:01:59 +09:00
Ivan Tham 4c190ec9d9 Suggestions for infobox changes
Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu>
2021-07-04 18:01:59 +09:00
Ivan Tham 8985c58fd3 Add infobox 2021-07-04 18:01:59 +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
Nathan Vegdahl 28d2d68804 Make horizontal selection movement work properly. 2021-07-02 09:51:29 -07: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 2224a1527e Merge branch 'master' into great_line_ending_and_cursor_range_cleanup 2021-07-01 19:37:28 -07:00
Nathan Vegdahl 0b2d51cf5a Fix unused `Result` warnings in helix-term. 2021-07-01 19:06:52 -07:00
Nathan Vegdahl efa3389b6a Fix unused variable, parameter, and `mut` warnings in helix-term. 2021-07-01 19:06:52 -07:00
Nathan Vegdahl 702a0491db Remove #[allow(unused)] from helix-term, and fix unused imports.
Lots of other warning still left.  Will address in subsequent commits.
2021-07-01 19:06:52 -07:00
Nathan Vegdahl e725957704 Ensure a minimum selection width on commands that need it. 2021-07-01 14:22:28 -07:00
Nathan Vegdahl 7c7be6d583 Make `Selection`'s normalize and transform methods self-consuming only. 2021-07-01 14:22:28 -07:00
Nathan Vegdahl 0ae522f3df Clean up `Selection` to not use so many allocations. 2021-07-01 14:22:28 -07:00
Blaž Hrastnik 2a92dd8d4d If completion arrives after we already stopped editing, ignore it 2021-06-30 17:49:42 +09:00
Joe Neeman b39e452d77 Make set_unmodified an enum. 2021-06-30 17:08:50 +09:00
Joe Neeman 2902a10a3e Make Document's format API a little nicer. 2021-06-30 17:08:50 +09:00
Joe Neeman ffa2f2590b Satisfy clippy. 2021-06-30 17:08:50 +09:00
Joe Neeman d64d75e724 Add some async job infrastructure. 2021-06-30 17:08:50 +09:00
Joe Neeman c9be480bf8 Make formatting happen asynchronously. 2021-06-30 17:08:50 +09:00
PabloMansanet de8745aea7 Incorporate long word commands into keymap 2021-06-30 00:56:19 +09:00
Blaž Hrastnik 6214d707f3 fix: Don't panic on Enter on an empty document.
Refs #386
2021-06-28 17:52:57 +09:00
Blaž Hrastnik 503ca112ae fix: jumping to location did not convert the URI correctly
thus breaking Windows
2021-06-25 13:20:15 +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
Ivan Tham c2b937481f Fix goto line end
Should not goto newline.
2021-06-24 18:34:23 -07:00
Ivan Tham 10548bf0e3 Fix previous broken refactor key into helix-view
Need to be used for autoinfo

Revert "Revert "Refactor key into helix-view""

This reverts commit 10f9f72232.
2021-06-25 00:39:03 +09:00
Kirawi 15ae2e7ef1 Update helix-term/src/commands.rs
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-06-24 22:38:38 +09:00
Kirawi 7ae21b98ce Update helix-term/src/commands.rs
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-06-24 22:38:38 +09:00
Shafkath Shuhan 629df6124d Blocking :wq 2021-06-24 22:38:38 +09:00
Nathan Vegdahl 8935e7a879 Fix open-new-line command for CRLF, as well as other bugs.
Fixes #363.

I set out to fix issue #363, but after fixing it discovered some
other things were wrong with the command while testing.  In
summary:
- #363 was because it was still assuming a line ending width
  of 1 char in its indexing calculations, even when actually
  inserting CRLF.
- Aside from #363, it actually needed to set `line_end_index`
  to zero for *all* calculations that use it when line == 0,
  but it was only doing so for a single calculation.
2021-06-24 18:25:56 +09:00
Blaž Hrastnik 0f55e67576 fix: ok, needs to be the end of the previous line 2021-06-24 01:35:36 +09:00
Blaž Hrastnik 7366fe81e0 open: Use the correct function
Still not correct but at least it doesn't append at EOF
2021-06-24 01:06:17 +09:00
Blaž Hrastnik 4ad7b61c69 fix: Better fix that also fixes crashes on `o` 2021-06-24 00:58:14 +09:00
Blaž Hrastnik 655c1aeb73 fix: panic on O at the start of the file (fixes #354) 2021-06-24 00:50:52 +09:00
Shafkath Shuhan fd98e743e8 Handle non-UTF8 files 2021-06-23 15:40:27 +09:00
Nathan Vegdahl 848cc1b438 Fix extend_line() behavior.
It would always extend to the next line if the cursor was at the
end of the current line, even if the current line wasn't fully
selected yet.
2021-06-23 12:43:09 +09:00
Nathan Vegdahl 38bf9c2576 Missed some items in the CRLF PR. 2021-06-23 12:43:09 +09:00
Blaž Hrastnik 7511110d82 Fix build on master 2021-06-23 10:15:57 +09:00
Joe Neeman fd1ae35051 Make the prompt callback take a Context. 2021-06-23 10:03:11 +09:00
Lionel Flandrin 16883e7543 Implement show_current_directory command 2021-06-22 19:20:51 -04:00
Lionel Flandrin b56174d738 Implement change_current_directory command 2021-06-22 19:20:51 -04:00
Blaž Hrastnik 20f33ead67 minor: Remove old TODOs 2021-06-22 23:26:34 +09:00
Gokul Soumya e0fd08d6df Rename surround to match_mode 2021-06-22 14:27:51 +09:00
Gokul Soumya 753ed4cbc5 Add documentation for surround 2021-06-22 14:27:51 +09:00
Gokul Soumya b00e9fc227 Handle line endings correctly in surround 2021-06-22 14:27:51 +09:00
Gokul Soumya b79b5e66f2 Move match_bracket to mm 2021-06-22 14:27:51 +09:00
Gokul Soumya 13648d28b9 Add surround keybinds 2021-06-22 14:27:51 +09:00
Blaž Hrastnik a70de6e980
Merge pull request #224 from helix-editor/line_ending_detection
Line ending detection
2021-06-22 11:09:19 +09:00
Nathan Vegdahl a18d50b777 Add command to set the document's default line ending. 2021-06-21 12:36:01 -07:00
Nathan Vegdahl 7c4fa18764 Fix clippy warnings. 2021-06-21 12:02:44 -07:00
Nathan Vegdahl d33355650f Convert remaining commands to use the document's line ending setting. 2021-06-21 11:59:03 -07:00
Nathan Vegdahl e436c30ed7 Make split_selection_on_newline command handle all line endings. 2021-06-21 11:22:07 -07:00
Nathan Vegdahl 23d6188535 Update `replace` command to use document line ending setting. 2021-06-21 11:08:05 -07: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 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.
2021-06-21 09:52:21 -07:00
wojciechkepka cc357d5096 Add progress spinners to status line 2021-06-21 12:59:06 +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
Blaž Hrastnik eaf259f8aa Fix build.. 2021-06-20 23:40:48 +09:00
Blaž Hrastnik f41688d960 Merge `x` and `X` 2021-06-20 23:37:11 +09:00
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
2021-06-20 23:25:53 +09: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
Jan Hrastnik 8634e04a31 added the line_end helper function 2021-06-20 02:22:10 +02:00
Jan Hrastnik 701eb0dd68 changed some hardcoded newlines, removed a else if in line_ending.rs 2021-06-20 01:24:36 +02:00
wojciechkepka 42e13bd542 Add `:theme <name>` command 2021-06-20 00:07:13 +09:00
Blaž Hrastnik 10f9f72232 Revert "Refactor key into helix-view"
Did not use defaults when custom keymap was used

This reverts commit ca806d4f85.
2021-06-19 23:59:19 +09:00
Jan Hrastnik 1e80fbb602 fix merge issue 2021-06-19 14:58:49 +02: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
Ivan Tham ca806d4f85 Refactor key into helix-view
Now also make use of Deserialize for Config.
2021-06-19 16:37:15 +09:00
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
2021-06-18 21:30:58 +09:00
wojciechkepka a6d39585d8 Add `work_done_token` as parameter to lsp methods 2021-06-18 17:42:38 +09: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
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
Jan Hrastnik 8bccd6df30 applied changes from pr review 2021-06-17 13:49:50 +02:00
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
2021-06-17 20:08:05 +09:00
Gokul Soumya 47d2e3aefa Let o, O take counts for multiple cursors 2021-06-17 18:54:07 +09:00
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
2021-06-17 18:54:07 +09:00
Jan Hrastnik 9c3eadb2e4 fixed some problems from rebasing 2021-06-16 17:22:55 +02:00
Jan Hrastnik 7cf0fa05a4 doc.line_ending() now returns &'static str 2021-06-16 17:13:44 +02:00
Jan Hrastnik a4f5a0134e trying out line ending helper functions in commands.rs 2021-06-16 17:13:41 +02: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
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.
2021-06-15 02:33:12 -04:00
Ivan Tham 05ed3e8fb8 Remove unused variables 2021-06-15 00:17:04 -04:00
Nathan Vegdahl 7c2fb92c91 Report indent style when calling indent-style with no arguments.
Also print an error message when the argument is malformed.
2021-06-14 20:33:42 -07:00
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.
2021-06-14 18:32:23 -07:00
Nathan Vegdahl 358ea6a37c Implement command to change the indent-style setting of a document. 2021-06-14 18:32:23 -07:00
Blaž Hrastnik e819121f6e fix: wq/wqa functions need to wait for save to finish before closing 2021-06-15 01:02:32 +09:00
Andreas Liljeqvist 5d23667a26 fix offset by one problem in replace_with_yanked 2021-06-14 09:58:40 +09:00
Wojciech Kępka df217f71c1 Fix `wq` 2021-06-13 20:48:18 +09:00
Wojciech Kępka b9100fbd44 Fix clippy 2021-06-13 20:48:18 +09:00
Wojciech Kępka 52d3c29244 Deduplicate code 2021-06-13 20:48:18 +09:00
Wojciech Kępka 17c9a8499e Add `qa` and `qa!` 2021-06-13 20:48:18 +09:00
Wojciech Kępka 62e6232a32 Update write_all 2021-06-13 20:48:18 +09:00
Wojciech Kępka d8b5d1181f Add `Copy` derive to `PromptEvent` 2021-06-13 20:48:18 +09:00
Wojciech Kępka b500a2a138 commands: Add more write commands 2021-06-13 20:48:18 +09:00
Ivan Tham 9640ed1425 Add clarification to last buffer 2021-06-13 09:58:50 +09:00
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
2021-06-12 21:45:21 +09: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 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
2021-06-12 16:04:30 +09:00
Blaž Hrastnik 278361a086 Only auto-format for certain languages
Fixes #53
Fixes #207
2021-06-12 10:20:37 +09: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 0c2b99327a commands: Handle `t<ENTER>` as till newline 2021-06-11 18:34:46 +09:00
Robin van Dijk c0d32707d0 move to first nonwhitespace on shift-i
This matches the behaviour in vim and kak
2021-06-10 22:02:38 +09:00
Ivan Tham 6b3c9d8ed3 Fix jump behavior, goto_implementation now jump
Better jump behavior since we override the first jump if it's on the
first document. At the same time, ctrl-i is now working with gd jumps.
2021-06-10 11:08:18 +08:00
Zheming Li ae51065213 Support go to line 1 2021-06-08 17:27:21 +09:00
Wojciech Kępka 4e3a343602 Make `r<ENTER>` work 2021-06-08 17:23:38 +09:00
Wojciech Kępka 81e02e1ba4 Remove unwanted `as_str` 2021-06-08 17:23:38 +09:00
Wojciech Kępka c349ceb61f Don't replace newlines 2021-06-08 17:23:38 +09:00
Wojciech Kępka 2e4a338944 Add bounds checks to replace 2021-06-08 17:23:38 +09:00
Wojciech Kępka 9c83a98469 commands: Replace all characters in selection 2021-06-08 17:23:38 +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
Kirawi b873fb9897
Fix Unicode (#135)
* init

* wip

* wip

* fix unicode break

* fix unicode break

* Update helix-core/src/transaction.rs

Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu>

* clippy

* fix

* add changes

* added test

* wip

* wip

* wip

* wip

* fix

* fix view

* fix #88

Co-authored-by: Benoît Cortier <benoit.cortier@fried-world.eu>
2021-06-08 13:20:15 +09:00
Wojciech Kępka c65b4dea09 commands: Add replace with yanked as `R` 2021-06-08 09:50:14 +09:00
Blaž Hrastnik 0201ef9205 ui: completion: Use the correct type_name
Fixes #166
2021-06-08 01:38:57 +09:00
Blaž Hrastnik 9821beb5c4 Make gh/gl extend selection in select mode 2021-06-07 23:32:44 +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
Blaž Hrastnik 8d6fad4cac lsp: Provide workspace root on client.initialize() 2021-06-07 21:32:01 +09:00
Blaž Hrastnik 4f561e93b8 View mode: Use saturating_sub when calculating first_col 2021-06-07 09:29:21 +09:00
Blaž Hrastnik 01b1bd15a1 commands: use chars().count() over .len() on strings 2021-06-07 09:26:49 +09:00
Wojciech Kępka 16b1cfa3be Add diagnostics keybindings 2021-06-07 09:11:52 +09:00
Ivan Tham 2066e866c7 Add spc w w for window mode 2021-06-07 09:08:08 +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
Ivan Tham 8c2fa12ffc Add window mode
Fix #93
2021-06-06 10:12:35 +09:00
ahkrr 444cd0b068 fix: make find_prev_char and till_prev_char work
Bevore this PR `commands::find_prev_char` and `commands::till_prev_char` were triggerable through keys 
but `seach::find_nth_next()` was hardcoded in `_find_char`. 
The passed `fn` was nerver used. With this PR the passed `fn` is used.
The change in search.rs resolves an off by one error in the behivor of `find_nth_prev`
2021-06-06 00:01:16 +09:00
Kirawi c17dcb8633
Fixing Multiple Panics (#121)
* init

* wip

* wip
2021-06-05 12:49:19 +09:00
Antoni Stevenet a1f4b8f92b
Add home-end keymaps, (as kakoune/vim do) (#83)
* add home-end keymaps

* implement extend methods for extend_line_start, extend_line_end

* add home-end mappings to keymaps.md

* add ^-$ extend mappings for extend mode

* pass cargo linter
2021-06-05 09:25:46 +09:00
notoria adcfcf9044 Replace ^/$ with gh/gl 2021-06-04 17:26:16 +09:00
Blaž Hrastnik 4f0e3aa948 Implement gt/gm/gb, remap goto tYpe to gy 2021-06-04 15:47:29 +09:00
Blaž Hrastnik bd4552cd2b scroll: Fix the clamping 2021-06-04 11:36:28 +09:00
Blaž Hrastnik 8afd4e1bc2 Exit select mode on delete_selection 2021-06-04 11:03:40 +09:00
Kevin Sjöberg fdb5bfafae Limit goto count
Giving a goto count greater than the number of lines in the buffer
would cause Helix to panic.
2021-06-04 01:35:52 +09:00
Jakub Bartodziej 09a7db637e Avoid theoretical underflow. 2021-06-03 23:23:23 +09:00
Jakub Bartodziej 31ed4db153 Clean up leftover log. 2021-06-03 23:23:23 +09:00
Jakub Bartodziej 3c5dfb0633 Improve on the fix for deleting from the end of the buffer. 2021-06-03 23:23:23 +09:00
Jakub Bartodziej 6cbc0aea92 Disable deleting from an empty buffer which can cause a crash. 2021-06-03 23:23:23 +09:00
Blaž Hrastnik cbb3ebafdc Support ctrl-f and ctrl-b to page up/down, fixes #41 2021-06-02 13:20:36 +09:00
Daichi Takamiya 4d12c7c3cf Fix empty command cause panic 2021-06-02 10:55:32 +09:00
Blaž Hrastnik ce25aa951e Allow setting a filepath on :write 2021-06-01 17:26:03 +09:00
Blaž Hrastnik d8e16554bf Don't crash if no filename specified on open 2021-06-01 11:59:59 +09:00
Blaž Hrastnik 2c48d65b15 Format document on save 2021-05-30 00:00:15 +09:00
Blaž Hrastnik 094203c74e Update deps, introduce the new tree-sitter lifetimes 2021-05-28 00:00:51 +09:00
Blaž Hrastnik f1dc25a774 Support count for indent too 2021-05-19 00:37:01 +09:00
Blaž Hrastnik 4f335fabc8 Fix unindent to work with tabs, take a count 2021-05-19 00:35:33 +09:00
Blaž Hrastnik 9c24f1ec0e Drop selection_lines completely, change move_line_start binding 2021-05-18 18:28:32 +09:00
Blaž Hrastnik f99a683991 Fix crash if appending at end of line on the last line of the file 2021-05-18 18:17:14 +09:00
Blaž Hrastnik 5a245b83a0 Append :fmt as a separate history state 2021-05-18 17:53:00 +09:00
Blaž Hrastnik 54de768915 Fix crash if typing | (regex or) into the prompt.
Zero-width matches at the start of the file make no sense to us.
2021-05-16 18:58:43 +09:00
Blaž Hrastnik 5e6b46e7c5 Use array::IntoIter. 2021-05-15 10:52:07 +09:00
Blaž Hrastnik 354b822d21 Fix crash on xa<Enter> if we were on the last line. 2021-05-15 10:50:36 +09:00
Blaž Hrastnik fae2127a11 Drop cx.view_id, it was used before we had cx.current. 2021-05-15 10:50:36 +09:00
Blaž Hrastnik 0e5b421646 When calculating a new selection, we need to take newly inserted text into account. 2021-05-15 10:50:36 +09:00
Blaž Hrastnik 4a9d1163e0 Hacky way to specify indent scopes per language via toml configs.
Can't do it via a scm query nicely because it returns an iterator over
all the matches, whereas we want to traverse the tree ourselves.

Can't extract the pattern data from a parsed query either.

Oh well, toml files for now.
2021-05-14 19:21:46 +09:00
Blaž Hrastnik e4ff75b4d4 Add :fmt (formats the whole file). 2021-05-12 17:24:55 +09:00
Blaž Hrastnik 1255bcb8a3 Simplify the compositor callback. 2021-05-09 18:02:31 +09:00
Blaž Hrastnik ed827e993f Fix jumplist jumps, keep the selection on vsplit. 2021-05-08 18:25:19 +09:00
Blaž Hrastnik caf4349925 Remove some of the panics, just log instead. 2021-05-08 18:17:13 +09:00
Blaž Hrastnik d24844b73d ui: Render command mode doc text if available. 2021-05-08 17:33:06 +09:00
Blaž Hrastnik d4d5e88ade Show a message if no definition was found. 2021-05-08 15:39:42 +09:00
Blaž Hrastnik 1be8b2005d Extract a method for view alignment. 2021-05-08 15:36:27 +09:00
Blaž Hrastnik adaf861881 vsplit can now split scratch buffers. 2021-05-08 15:29:15 +09:00
Blaž Hrastnik ff84c8e394 Command mode: Per command completers. 2021-05-07 17:19:45 +09:00
Blaž Hrastnik 87e7a0de3f Save space by having the command hashmap use const static refs. 2021-05-07 17:13:26 +09:00
Blaž Hrastnik 9604a0c294 Improve command mode handling. 2021-05-07 17:08:07 +09:00
Blaž Hrastnik 243456a583 Disallow quitting on last view if unsaved changes present. 2021-05-07 15:15:15 +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 7c915dc065 Add the :new command, don't crash if saving without filename. 2021-05-07 14:19:58 +09:00
Blaž Hrastnik f8844c6811 Implement pair expansion when pressing new line between bracket pairs.
From:
{|}

To:
{
    |
}
2021-05-06 23:02:32 +09:00
Blaž Hrastnik ba97005495 Work around the rest of the blocking issues. 2021-05-06 17:15:49 +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 0e5308bce1 Need to allow this lint, the Hook signature requires Option<>. 2021-05-05 16:25:17 +09:00
Blaž Hrastnik ab4decfd6d Make post hooks trigger even when a different handler processes input.
The default handler is now simply a fallback.
2021-05-03 17:56:02 +09:00
Blaž Hrastnik 594575ba3f Center forward and backward jumps too. 2021-04-24 11:46:46 +09:00
Blaž Hrastnik c64240b6ef Implement most of the view mode (z). 2021-04-14 17:15:11 +09:00
Blaž Hrastnik 3e5f24a9d5 lsp: support both utf-8 and utf-16 offsets.
Still need to implement the clangd encoding negotiation, but it's
a start. Should also manually override to utf8 for pyls.
2021-04-14 15:39:31 +09:00
Blaž Hrastnik 811f952a41 Center search results. 2021-04-14 15:39:31 +09:00
Blaž Hrastnik 180521fefe Adjust scroll() to match kakoune: only scroll the view if cursor in bounds. 2021-04-14 14:27:47 +09:00
Blaž Hrastnik 2a1f10d1b5 Center the new position on screen after doing a goto jump. 2021-04-13 16:56:03 +09:00
Blaž Hrastnik 95dd55ba94 Fix overlap calculation. 2021-04-10 12:02:23 +09:00
Blaž Hrastnik 392c4a9c02 Keep primary selection as space+space. 2021-04-10 00:21:54 +09:00
Blaž Hrastnik 73f4abbb37 N as extend with search (for now, N should be search_prev). 2021-04-10 00:21:13 +09:00
Blaž Hrastnik 865429643b <space>w for save, <space>c for close current split. 2021-04-09 18:57:46 +09:00
Blaž Hrastnik 9ca2909c80 Loop around the end on regex searches. 2021-04-08 22:34:06 +09:00
Blaž Hrastnik 8b33ba2284 Correct the naming issue with vsplit and hsplit being swapped. 2021-04-08 15:52:04 +09:00
Blaž Hrastnik 58c5fec592 minor: This comment was resolved. 2021-04-08 14:25:04 +09:00
Blaž Hrastnik 12961d657f Implement P as paste_before. 2021-04-07 17:03:29 +09:00
Blaž Hrastnik 82ff996662 Yank selection when deleting. 2021-04-07 15:40:15 +09:00
Blaž Hrastnik 463f58dfda Fix clamping scroll in certain cases.
.clamp(min, max) requires that min < max. In some cases
first + scrolloff > last - scrolloff and we would panic.
2021-04-07 13:38:50 +09:00
Blaž Hrastnik 0e9ecccfc1 clippy: Drop or-patterns for now because they're not on stable rust yet 2021-04-06 19:51:15 +09:00
Blaž Hrastnik 95d0bba81a ui: Improve completion state handling. 2021-04-05 18:23:37 +09:00
Blaž Hrastnik 59a0fc7b59 w, b, e: Match kakoune's behavior in selecting by default.
I initially preferred only moving the cursor, but selecting the whole
word is a lot nicer for things like wd (instead of vwd).
2021-04-05 16:35:04 +09:00
Blaž Hrastnik ab1d11088f Import some lsp utilities. 2021-04-01 11:43:34 +09:00
Blaž Hrastnik 77cab5a715 Merge open_above and open_below definitions. 2021-04-01 11:36:59 +09:00
Blaž Hrastnik cc058ad78f Simplify some code. 2021-04-01 11:04:25 +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 7dfd7f51a0 Implement space-v as view same file in split. 2021-03-31 18:00:53 +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 dfc17becd5 Move pickers under my leader key mode (space). 2021-03-30 18:38:26 +09:00
Blaž Hrastnik e166da2ab0 fix: A (append to line) was inserting before last char. 2021-03-30 18:31:56 +09:00
Blaž Hrastnik 1b5316ea74 Track document modified state. 2021-03-30 18:23:12 +09:00
Blaž Hrastnik 88bb7a1f38 Repeat insert command (.). 2021-03-30 18:19:27 +09:00
Blaž Hrastnik e833d65b77 Teach file picker how to find the project root (.git). 2021-03-30 10:14:50 +09:00
Blaž Hrastnik 8098e9bdcd Allow setting a status message. 2021-03-29 16:47:02 +09:00
Blaž Hrastnik 742b3a709f Store intra-files jumps (goto) on the jumplist. 2021-03-29 16:32:42 +09:00
Blaž Hrastnik 0083a6c325 commands: Simplify _goto. 2021-03-29 15:44:03 +09:00
Blaž Hrastnik ea407ccdba Implement <n>g as goto line n. 2021-03-29 15:29:03 +09:00
Blaž Hrastnik 5c2d2fda21 Wire up opening in splits via pickers. 2021-03-29 15:21:48 +09:00
Blaž Hrastnik aefafc25cd Replace Mode::Goto with just using on_next_key. 2021-03-29 15:04:29 +09:00
Blaž Hrastnik a24c3fff54 Filter the completion menu based on text entered. 2021-03-27 12:08:44 +09:00
Blaž Hrastnik 2a3910c1d9 wip: Async async. Delay response handling with a callback. 2021-03-26 17:12:45 +09:00
Blaž Hrastnik ad3325db8e minor: Remove a few unwraps. 2021-03-26 11:03:14 +09:00
Blaž Hrastnik 9a36d2c2a8 wip: Hooks & trigger characters for completion/signature_help. 2021-03-24 18:17:00 +09:00
Blaž Hrastnik 8657c57cf2 Trivial jumplist implementation. 2021-03-24 18:01:26 +09:00
Blaž Hrastnik 915fd9ebaf Restore buffer_picker. 2021-03-24 16:26:53 +09:00
Blaž Hrastnik 8a0ab447ec editor.open can now either replace the current view or open in a split. 2021-03-24 14:28:26 +09:00
Blaž Hrastnik 8328fe926d Drop refcell use, make view simply ref doc.id. 2021-03-23 18:14:35 +09:00
Blaž Hrastnik d0530fb839 Fix a scrolling crash where it would jump past the end of the buffer. 2021-03-22 18:06:52 +09:00
Blaž Hrastnik 73c92a0bc1 Implement m / match_brackets (using tree sitter). 2021-03-22 17:58:49 +09:00
Blaž Hrastnik df306fe031 Implement open_above (O). 2021-03-22 13:53:43 +09:00
Blaž Hrastnik 42d07b0621 Implement replace command (r<key>). 2021-03-22 13:53:43 +09:00
Blaž Hrastnik bf95ee27aa Store Document on the Editor type, make View reference it. 2021-03-22 13:53:43 +09:00
Blaž Hrastnik 5e6716c89c Add tab_width and indent_unit config. 2021-03-22 13:53:36 +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 a32806b490 Improve completion: src/<tab> will now correctly complete to src/main.rs 2021-03-21 14:13:49 +09:00
Blaž Hrastnik f29f01858d Implement iter() and len() directly on Selection. 2021-03-19 11:14:13 +09:00
Blaž Hrastnik e9bd9e72c3 Pos conversions always operate on whole documents. 2021-03-18 15:23:42 +09:00
Blaž Hrastnik 175d38c88c toggle_comments needs to append to history. 2021-03-18 15:20:28 +09:00
Blaž Hrastnik c331721565 Finish hiding doc.state / State as an implementation detail. 2021-03-18 15:07:02 +09:00
Blaž Hrastnik 8ba1e15d29 Expose doc.syntax() via accessor. 2021-03-18 14:53:29 +09:00
Blaž Hrastnik e261f3c50d Expose doc.language_server as an accessor. 2021-03-18 14:40:22 +09:00
Blaž Hrastnik 59e6024186 Remove State from a few more signatures. 2021-03-18 14:17:32 +09:00
Blaž Hrastnik dbcc099f48 Move things out of state.rs. 2021-03-18 14:07:53 +09:00
Blaž Hrastnik 0f6624491b Fix completion panicking if text changed before insert completed. 2021-03-18 14:07:53 +09:00
Blaž Hrastnik 8eaf9a432d Make Transaction::change only rely on the rope. 2021-03-18 13:39:56 +09:00
Blaž Hrastnik 51c15da3c3 Hold a reference to executor on the Editor type. 2021-03-16 23:14:51 +09:00
Blaž Hrastnik e3ec5e31ec Fix goto code before merging. 2021-03-16 23:05:43 +09:00
Jan Hrastnik eadad13efa preparing for gd merge 2021-03-16 23:03:29 +09:00
Jan Hrastnik 4e461bea2f editor.open now checks if view already exists 2021-03-16 23:03:29 +09:00
Jan Hrastnik 0828d1fdea picker wip 2021-03-16 23:03:29 +09:00
Blaž Hrastnik cf71625d4e term: Simplify goto code, address lints. 2021-03-16 23:03:27 +09:00
Jan Hrastnik 3869d7713e added goto functions in helix-term 2021-03-16 23:03:10 +09:00
Jan Hrastnik b738ae1bc7 more goto lsp functions 2021-03-16 23:03:10 +09:00
Jan Hrastnik 294791dffd added picker for gd, but yet to test it. also need to load appropriate file when definition isnt in same file 2021-03-16 23:03:10 +09:00
Jan Hrastnik 0322c28e6b gd now works for singular definition 2021-03-16 23:03:10 +09:00
Blaž Hrastnik 18ec8adc7f Simplify code a bit. 2021-03-16 23:03:10 +09:00
Jan Hrastnik 8a68a04340 gotodefiniton now runs but doesnt return anything 2021-03-16 23:03:10 +09:00
Jan Hrastnik d3ddc8dea6 wip 2021-03-16 23:03:10 +09:00
Blaž Hrastnik 54a7e893b7 lsp: Wire up didClose notification on editor.close. 2021-03-16 16:27:12 +09:00
Blaž Hrastnik eca2a73ad0 lsp: Pass through language_id on didOpenTextDocument. 2021-03-16 16:13:41 +09:00
Blaž Hrastnik 143cfe13e0 minor: TODO comment cleanup 2021-03-16 15:41:42 +09:00
Blaž Hrastnik eea339545c Add command for keeping only the primary selection. 2021-03-15 17:13:36 +09:00
Blaž Hrastnik dd91090a1a Implement keep_selections (filter selections on regex). 2021-03-15 17:09:18 +09:00
Blaž Hrastnik 1cf887dea9 Cleanup: use doc.selection() instead of doc.state.selection(). 2021-03-14 17:14:34 +09:00
Blaž Hrastnik 4acf301022 Implement the f/t/F/T find/till family of commands. 2021-03-11 16:15:27 +09:00
Blaž Hrastnik 62c991230f find-till (f) prototype, on_next_key mode implementation. 2021-03-11 10:44:38 +09:00
Blaž Hrastnik 5ea610c41d ui: Move terminal into compositor, redo required_size hints. 2021-03-08 17:00:32 +09:00
Blaž Hrastnik 05aa0d6991 minor: dead code 2021-03-05 17:55:06 +09:00
Blaž Hrastnik 1d42b95915 ui: wip: Markdown doc renderer. 2021-03-05 16:07:46 +09:00
Blaž Hrastnik a5c4314940 commands: Improve scroll functions.
Followed kakoune's implementation, it's no longer janky and can scroll
all the way in either direction.
2021-03-04 16:15:34 +09:00
Blaž Hrastnik 565fb94afe commands: Correct another case that always used primary(). 2021-03-04 14:12:19 +09:00
Blaž Hrastnik 7e4830215e commands: w/b/e need to apply to all selections. 2021-03-04 14:09:39 +09:00
Blaž Hrastnik 4c6611f96b commands: Stop select_regex from breaking when no matches. 2021-03-03 17:55:56 +09:00
Blaž Hrastnik 0b85c16be9 ui: Share popup code with menu.
Menu is now just wrapped in a popup.
2021-03-02 18:24:24 +09:00
Blaž Hrastnik 11c4e0b053 ui: Calculate popup rendering and sizing. 2021-03-02 17:58:15 +09:00
Blaž Hrastnik 8f4ff4c646 editor: We still want to be able to calculate cursor pos. 2021-03-02 15:44:09 +09:00
Blaž Hrastnik 32f9a2d1d6 add missing fn 2021-03-01 18:19:08 +09:00
Blaž Hrastnik 857bce0e30 ui: Rework command mode, implement file path completion. 2021-03-01 18:02:31 +09:00
Blaž Hrastnik 2088c45075 commands: Implement X as extend line. 2021-03-01 14:41:02 +09:00
Blaž Hrastnik ec4dd0a176 Add a selection mode again. 2021-03-01 14:31:34 +09:00
Blaž Hrastnik 00808afe3c ui: Make editor more resilient about being shrunk too small. 2021-03-01 14:23:10 +09:00
Blaž Hrastnik 2c9b02039b commands: Implement join_selections. 2021-02-26 17:21:59 +09:00
Blaž Hrastnik 1ae7c43391 commands: = as range formatting (via lsp) 2021-02-26 15:52:43 +09:00
Blaž Hrastnik 7162632eb7 lsp: Hover documentation draft. 2021-02-25 18:07:47 +09:00
Blaž Hrastnik 8289bd1cb0 minor, fix clippy lint 2021-02-25 16:52:32 +09:00
Blaž Hrastnik 01907b3497 commands: Implement count for a few more commands. 2021-02-25 16:49:30 +09:00
Blaž Hrastnik 5fa1ba6b1c commands: refactor open_below to support count. 2021-02-25 16:47:37 +09:00
Blaž Hrastnik 87a6d4e736 minor: Simplify some code. 2021-02-24 16:07:39 +09:00
Blaž Hrastnik def949e509 open_below: drop redundant collect/into_iter. 2021-02-22 17:02:32 +09:00
Blaž Hrastnik 6cfb1acb9d commands: Implement expand_selection. 2021-02-22 17:02:32 +09:00
Blaž Hrastnik 33c67f1388 commands: add * as selection search. 2021-02-22 15:14:02 +09:00
Blaž Hrastnik 5096bdad33 completion: Use the language server bound to the document. 2021-02-22 11:42:47 +09:00
Blaž Hrastnik 9132c6a591 Make some Document fields read-only. 2021-02-21 19:47:21 +09:00
Blaž Hrastnik 7da6bd6a71 commands: Simplify some code, only calling cx.doc() once. 2021-02-21 19:04:31 +09:00
Blaž Hrastnik 7877647cf0 Allow closing individual views. 2021-02-19 17:46:43 +09:00
Blaž Hrastnik 1e1dae1c11 Remove unused method. 2021-02-19 16:49:10 +09:00
Blaž Hrastnik 8c82f8f140 indent: use_list indentation, fix indentation bug on open_below
use std::{
  time::Duration // <- pressing `o` here would use }'s indent instead of prev line
}
2021-02-19 14:55:53 +09:00