aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
Commit message (Collapse)AuthorAge
* goto_window_* extends selection (#3985)greg-enbala2022-10-03
| | | | | * goto_window_* extends selection * Don't push to the jumplist
* Extend textobject selections in select modeMichael Davis2022-10-03
|
* Use Range::with_direction consistentlyMichael Davis2022-10-03
|
* Use requested direction for new textobject selection rangeMichael Davis2022-10-03
| | | | | | | | | | | | | | | | | | This changes the behavior of operations like `]f`/`[f` to set the direction of the new range to the direction of the action. The original behavior was to always use the head of the next function. This is inconsistent with the behavior of goto_next_paragraph and makes it impossible to create extend variants of the textobject motions. This causes a behavior change when there are nested functions. The behavior in the parent commit is that repeated uses of `]f` will select every function in the file even if nested. With this commit, functions are skipped. It's notable that it's possible to emulate the original behavior by using the `ensure_selections_forward` (A-:) command between invocations of `]f`.
* Cycled to end/beginning + no more matches msgs (#3176)A-Walrus2022-10-03
| | | | | | | | | * Show status msg when next/prev cycles around * Add msg when there is no wraparound * Cleanup code * Change msg to "Wrapped around document"
* Add pseudo_pending for t/T/f/F (#4062)Matt Freitas-Stavola2022-10-02
|
* Ensure cursor in view after format (#4047)zensayyy2022-10-01
| | | Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Split helix_core::find_root and helix_loader::find_local_config_dirs (#3929)Riccardo Binetti2022-09-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Split helix_core::find_root and helix_loader::find_local_config_dirs The documentation of find_root described the following priority for detecting a project root: - Top-most folder containing a root marker in current git repository - Git repository root if no marker detected - Top-most folder containing a root marker if not git repository detected - Current working directory as fallback The commit contained in https://github.com/helix-editor/helix/pull/1249 extracted and changed the implementation of find_root in find_root_impl, actually reversing its result order (since that is the order that made sense for the local configuration merge, from innermost to outermost ancestors). Since the two uses of find_root_impl have different requirements (and it's not a matter of reversing the order of results since, e.g., the top repository dir should be used by find_root only if there's not marker in other dirs), this PR splits the two implementations in two different specialized functions. In doing so, find_root_impl is removed and the implementation is moved back in find_root, moving it closer to the documented behaviour thus making it easier to verify it's actually correct * helix-core: remove Option from find_root return type It always returns some result, so Option is not needed
* Deduplicate regexes in search_selection command (#3941)A-Walrus2022-09-22
|
* fix: View needs to retain the original scroll offset on splitBlaž Hrastnik2022-09-05
|
* Fix off-by-one in extend_line_above (#3689)Michael Davis2022-09-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | `extend_line_above` (and `extend_line` when facing backwards) skip a line when the current range does not fully cover a line. Before this change: foo b#[|a]#r baz With `extend_line_above` or `extend_line` selected the line above. #[|foo bar]# baz Which is inconsistent with `extend_line_below`. This commit changes the behavior to select the current line when it is not already selected. foo #[|bar]# baz Then further calls of `extend_line_above` extend the selection up line-wise.
* Make mode editor-wide rather than per-documentBlaž Hrastnik2022-09-01
|
* fix: prevents storing last prompt if is top of stack (#3609)Saber Haj Rabiee2022-09-01
|
* Refactor goto_ts_object_impl as a motion (#3264)Michael Davis2022-08-31
| | | | | | | | | This refactor changes the overall structure of the goto_ts_object_impl command without removing any functionality from its behavior. The refactored motion: * acts on all selections instead of reducing to one selection * may be repeated with the `repeat_last_motion` (A-.) command * informs the user when the syntax-tree is not accessible in the current buffer
* jumplist: Add documents to view history (#3593)Michael Davis2022-08-31
| | | | | | | | | | | | | | This change adds documents to the view's document history Vec. (This is used by `ga` for example to access the last buffer.) Previously, a sequence like so would have confusing behavior: 1. Open file A: any document with an active language server 2. Find some definition that lives in another file - file B - with `gd` 3. Jump back in the jumplist with `C-o` to file A 4. Use `ga` intending to switch back to file B The behavior prior to this change was that `ga` would switch to file A: you could not use `ga` to switch to file B.
* Fix process spawning error handling (#3349)PiergiorgioZagaria2022-08-30
| | | | | * Fix process spawning error handling * Log stderr in any case
* let extend-line respect range direction (#3046)Bob2022-08-29
| | | | | | | | | | | | | * let extend-line respect range direction * fix extend above logic * keep `x` existing binding * Update book/src/keymap.md Co-authored-by: Ivan Tham <pickfire@riseup.net> Co-authored-by: Ivan Tham <pickfire@riseup.net>
* Add bracketed paste (#3233)Charlie Groves2022-08-29
|
* Editor: remove duplication for view focus/swap commandsBlaž Hrastnik2022-08-23
|
* style: fixes `unused_parens` warnings on nightly builds (#3471)Saber Haj Rabiee2022-08-18
|
* Adjust `m` textobject description and minor code clarification (#3343)Daniel S Poulin2022-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update description of `m` textobject to its actual functionality Sometime recently the functionality of `m` was changed to match the nearest pair to the cursor, rather than the former functionality of matching the pair only if the cursor was on one of the brace characters directly. * Rename surround methods to reflect that they work on pairs The current naming suggests that they may work generally on any textobject, whereas their implementation really focuses on pairs. * Change description of m textobject to match actual functionality The current implementation of `m` no longer merely looks at the pair character the cursor is on, but actually will search for the pair (defined in helix-core/src/surround.rs) that encloses the cursor, and not the entire selection. * Accept suggested wording change Co-authored-by: Michael Davis <mcarsondavis@gmail.com> * Prefix pair surround for consistency Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* Fix conditional setting of stdin handle on Windows (#3379)Kyle L. Davis2022-08-12
| | | | | | | | | * Revert 3121353c6ab2fbc5fced28f075c7fc45b53b661e * Switch to conditional compilation * Run formatter * Switch from conditional compilation to compile-time bool
* Add custom event type replacing crossterm's Event (#3169)Gokul Soumya2022-08-09
| | | | | | | | | | Ported over from 61365dfbf3 in the `gui` branch. This will allow adding our own events, most notably an idle timer event (useful for adding debounced input in [dynamic pickers][1] used by interactive global search and workspace symbols). [1]: https://github.com/helix-editor/helix/pull/3110 Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Avoid setting stdin handle when not necessary (#3248)Dario Oddenino2022-08-05
| | | | | | | | | | | | | | * Avoid setting stdin handle when not necessary Avoid setting the stdin handle in `shell_impl` when the input argument is None. This permits to run commands with no stdin with :sh * refactoring to avoid code duplication * making clippy happy * Process variable name fix
* Avoid copying fragments (#3136)Matthias Deiml2022-08-04
| | | | | | | * Avoid copying fragments * Add slice / slices method * Better documentation for fragment and slice methods
* Change default formatter for any language (#2942)PiergiorgioZagaria2022-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change default formatter for any language * Fix clippy error * Close stdin for Stdio formatters * Better indentation and pattern matching * Return Result<Option<...>> for fn format instead of Option * Remove unwrap for stdin * Handle FormatterErrors instead of Result<Option<...>> * Use Transaction instead of LspFormatting * Use Transaction directly in Document::format * Perform stdin type formatting asynchronously * Rename formatter.type values to kebab-case * Debug format for displaying io::ErrorKind (msrv fix) * Solve conflict? * Use only stdio type formatters * Remove FormatterType enum * Remove old comment * Check if the formatter exited correctly * Add formatter configuration to the book * Avoid allocations when writing to stdin and formatting errors * Remove unused import Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
* Fix align_selection behaviour with tabs (#3276)A-Walrus2022-07-31
|
* Use OR of all selections in search_selection command (#3138)MilanVasko2022-07-27
| | | Closes #2312
* Shorten embedded command descriptions (#3070)Gokul Soumya2022-07-26
| | | | | | | | | * Shorten embedded command descriptions - Compact descriptions in command palette and infobox * Shorten typed command descriptions * Fix typo in decrement command description
* Auto pair-removal (#2940)Houkime2022-07-22
| | | | | | | | | | | | | | | * auto pair-removal Fixes https://github.com/helix-editor/helix/issues/1673 * autopairs removal: use doc autopairs * autopairs-removal: limit to one-char selections * use single_grapheme() to check if range is one char * fix errouneous deletes of " and other symmetric autopairs when at buffer start Co-authored-by: Houkime <>
* keep jump/file history when using :split (#3031)Robin2022-07-22
| | | | | | | * keep jump/file history when using :split * move history cloning into the switch function Co-authored-by: Robin <robinvandijk@klippa.com>
* jumplist picker (#3033)Bob2022-07-22
| | | | | | | | | | | | | * jumplist picker * remove jumps slicing Co-authored-by: Benoît Cortier <bcortier@proton.me> * remove unnecessary deref format! parameter Co-authored-by: Benoît Cortier <bcortier@proton.me> Co-authored-by: Benoît Cortier <bcortier@proton.me>
* Add lsp signature help (#1755)Gokul Soumya2022-07-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add lsp signature help * Do not move signature help popup on multiple triggers * Highlight current parameter in signature help * Auto close signature help * Position signature help above to not block completion * Update signature help on backspace/insert mode delete * Add lsp.auto-signature-help config option * Add serde default annotation for LspConfig * Show LSP inactive message only if signature help is invoked manually * Do not assume valid signature help response from LSP Malformed LSP responses are common, and these should not crash the editor. * Check signature help capability before sending request * Reuse Open enum for PositionBias in popup * Close signature popup and exit insert mode on escape * Add config to control signature help docs display * Use new Margin api in signature help * Invoke signature help on changing to insert mode
* respect count for selecting next/previous match (#3056)Bob2022-07-13
|
* respect count for repeating motion (#3057)Bob2022-07-13
|
* fix: error that caused usize to overflow (#3024)Slug2022-07-10
| | | | | * fix: error that caused usize to overflow * update: changed check_sub to saturating_sub
* Fix backwards selection duplication widening bug (#2945)A-Walrus2022-07-04
| | | | | | | | | | | | | * Fix backwards selection duplication widening bug * Add integration tests * Make tests line-ending agnostic Make tests line-ending agnostic Use indoc to fix tests Fix line-ending on test input
* Reuse menu::Item trait in picker (#2814)Gokul Soumya2022-07-02
| | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor menu::Item to accomodate external state Will be useful for storing editor state when reused by pickers. * Add some type aliases for readability * Reuse menu::Item trait in picker This opens the way for merging the menu and picker code in the future, since a picker is essentially a menu + prompt. More excitingly, this change will also allow aligning items in the picker, which would be useful (for example) in the command palette for aligning the descriptions to the left and the keybinds to the right in two separate columns. The item formatting of each picker has been kept as is, even though there is room for improvement now that we can format the data into columns, since that is better tackled in a separate PR. * Rename menu::Item::EditorData to Data * Call and inline filter_text() in sort_text() completion * Rename diagnostic picker's Item::Data
* Fix backwards character deletion on other whitespaces (#2855)Sora2022-07-01
| | | | | | | | | | | * delete_backwards_char accepts any type of whitespace * Fix inconsistency, where unicode whitespaces are treated as normal whitespaces * Changed back to direct whitespace match * Only accept explicit whitespace / tabs Co-authored-by: s0LA1337 <dreamer@neoncity.dev>
* Add workspace and document diagnostics picker (#2013)Falco Hirschenberger2022-06-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add workspace and document diagnostics picker fixes #1891 * Fix some of @archseer's annotations * Add From<&Spans> impl for String * More descriptive parameter names. * Adding From<Cow<str>> impls for Span and Spans * Add new keymap entries to docs * Avoid some clones * Fix api change * Update helix-term/src/application.rs Co-authored-by: Bjorn Ove Hay Andersen <bjrnove@gmail.com> * Fix a clippy hint * Sort diagnostics first by URL and then by severity. * Sort diagnostics first by URL and then by severity. * Ignore missing lsp severity entries * Add truncated filepath * Typo * Strip cwd from paths and use url-path without schema * Make tests a doctest * Better variable names Co-authored-by: Falco Hirschenberger <falco.hirschenberger@itwm.fraunhofer.de> Co-authored-by: Bjorn Ove Hay Andersen <bjrnove@gmail.com>
* Fix recursive macro crash and empty macro lockout (#2902)PabloMansanet2022-06-28
|
* feat: highlight / select symbol under cursor using LSP ↵lazytanuki2022-06-27
| | | | | | | | | textDocument/documentHighlight (#2738) * feat: highlight symbol under cursor using LSP textDocument/documentHighlight * fix: please clippy * fix: shorter description and code style
* Redetect indent and line endings after language server replaces documents ↵farwyler2022-06-24
| | | | | | | | | | | (#2778) * redetect indent and line endings after language server replaces document * removes nested if * always redetect indent and line endings after format This reverts commit 764d14f55894dc7213e48022dfa0f91829b8ef59.
* Remove a couple more unwrapsBlaž Hrastnik2022-06-21
|
* Merge pull request #2359 from dead10ck/test-harnessBlaž Hrastnik2022-06-21
|\ | | | | Integration testing harness
| * Merge branch 'master' into test-harnessBlaž Hrastnik2022-06-21
| |\
| * | use test terminal backend for integration testsSkyler Hawthorne2022-06-19
| | |
| * | Add more context; Editor::open doesn't need to own pathSkyler Hawthorne2022-06-19
| | |
| * | Fix initial selection of Document in new viewSkyler Hawthorne2022-06-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a new View of a Document is created, a default cursor of 0, 0 is created, and it does not get normalized to a single width cursor until at least one movement of the cursor happens. This appears to have no practical negative effect that I could find, but it makes tests difficult to work with, since the initial selection is not what you expect it to be. This changes the initial selection of a new View to be the width of the first grapheme in the text.
* | | add history suggest to global search (#2717)Termina942022-06-21
| | | | | | | | | Co-authored-by: Dean Revell <revell@gmail.com>