Commit Graph

146 Commits (c68ec92c5e1bd3a2bf402fb583de23693f59b722)

Author SHA1 Message Date
nibon7 43997f1936
Use `^` and `$` to match the beginning and end of a line when searching (#1790)
Fixes #1737

Signed-off-by: nibon7 <nibon7@163.com>
2022-03-12 16:05:50 +09:00
Michael Davis 4fc991fdec migrate grammar fetching/building code into helix-loader crate
This is a rather large refactor that moves most of the code for
loading, fetching, and building grammars into a new helix-loader
module. This works well with the [[grammars]] syntax for
languages.toml defined earlier: we only have to depend on the types
for GrammarConfiguration in helix-loader and can leave all the
[[language]] entries for helix-core.
2022-03-10 17:31:57 +09:00
Blaž Hrastnik 78fba8683b
Picker performance improvements 2022-03-03 16:52:41 +09:00
Philipp Mildenberger 49c5bc5934
Add jumplist support for the search (closes #1625) (#1718) 2022-03-01 20:57:57 +09:00
Daniel S Poulin bdbf423876
Minor cleanup of file picker file gathering logic (#1683)
* Refactor file picker filetype filter logic to remove panic, make clearer

An unwrap was unneccesarily present due to a prior contribution of mine
which was before I had any understanding of error handling in Rust. I've
also swapped a match for an if let, as was originally suggested in the
original pull request adding filetype filtering, but was merged before I
could address.

* Add some comments to the file picker code for clarity

* Switch to expect instead of ignoring type def error
2022-03-01 10:16:25 +09:00
Daniel S Poulin 700058f433
Always ignore the .git directory in file picker (#1604)
Some users (including myself) want to turn off filtering of files
prefixed with `.`, as they are often useful to edit. For example, `.env`
files, configuration for linters `.eslint.json` and the like.
2022-02-20 15:47:43 +09:00
Blaž Hrastnik c06155ace4 Extract a helper function for lsp::Location 2022-02-18 14:37:59 +09:00
Blaž Hrastnik 24f90ba8d8 Manually recalculate initial completion where it matters 2022-02-17 14:02:42 +09:00
Blaž Hrastnik af21e2a5b4 Pass through Editor instead of Context 2022-02-17 14:02:42 +09:00
Cole Helbling 6118486eb2 helix-term: implement buffer completer
In order to implement this completer, the completion function needs to
be able to access the compositor's context (to allow it to get the
list of buffers currently open in the context's editor).
2022-02-17 14:02:42 +09:00
Ludwig Stecher 4429993842
Add `PageUp`, `PageDown`, `Ctrl-u`, `Ctrl-d`, `Home`, `End` keyboard shortcuts to file picker (#1612)
* Add `PageUp`, `PageDown`, `Ctrl-u`, `Ctrl-d`, `Home`, `End` keyboard shortcuts to file picker

* Refactor file picker paging logic

* change key mapping

* Add overlay component

* Use closure instead of margin to calculate size

* Don't wrap file picker in `Overlay` automatically
2022-02-15 10:24:03 +09:00
Kirawi 23907a063c
use PathBuf::to_string_lossy() instead of to_str() (#1655) 2022-02-15 10:22:55 +09:00
Blaž Hrastnik bd549d8a20 Merge remote-tracking branch 'origin/master' into debug 2022-02-13 18:31:51 +09:00
Matouš Dzivjak fdb9a1677b
feat(editor): add config for search wrap_around (#1516)
* feat(editor): add config for search wrap_around

Fixes: https://github.com/helix-editor/helix/issues/1489

* Move search settings into separate config

* Disable linter
2022-02-10 11:04:40 +09:00
Blaž Hrastnik 094a0aa3f9 Render code actions as a menu, allow adding padding to popup 2022-01-31 16:04:58 +09:00
Blaž Hrastnik 3e4f81547c fix: Use std::path::MAIN_SEPARATOR to determine completion
Refs #1439
2022-01-06 11:03:54 +09:00
Blaž Hrastnik bed9aced5f Revert "Convert Windows style path separator in completers to Unix style (#1389)"
This reverts commit 49444f9c05.
2022-01-05 10:58:12 +09:00
ath3 49444f9c05
Convert Windows style path separator in completers to Unix style (#1389) 2021-12-30 00:30:20 +09:00
Tamo a306a1052a
Update settings at runtime (#798)
* feat: Update settings at runtime

fix the clippy warning

* update the documentation

* use to_value instead of to_vec+from_value

* drop the equal

* remove an useless comment

* apply suggestion
2021-12-26 10:04:33 +09:00
Omnikar 98ce2a301d Load alt default theme if true color is not supported
* Move `runtime/themes/base16_default_terminal.toml` to
  `base16_theme.toml` alongside `theme.toml`
* Use `terminfo` crate to detect whether the terminal supports true
  color and, if the user has no theme configured and their terminal does
  not support true color, load the alt default theme instead of the
  normal default.

Remove `terminfo` dependency, use `COLORTERM` env instead

Prevent user from switching to an unsupported theme

Add `true-color-override` option

If the terminal is wrongly detected to not support true color,
`true-color-override = true` will override the detection.

Rename `true-color-override` to `true-color`
2021-12-14 00:47:18 +09:00
Blaž Hrastnik 9ed930b233 Merge remote-tracking branch 'origin/master' into debug 2021-11-30 13:06:30 +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
Ivan Tham 97893cca64
Restore screen position when abort search (#1047) 2021-11-10 10:46: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
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
Daniel S Poulin 3b032e8e1f
First stab at ignoring compressed files from picker (#767) 2021-10-22 10:02:05 +09:00
Dmitry Sharshakov bf53aff27d Merge branch 'master' into debug 2021-09-25 23:14:59 +03: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
Blaž Hrastnik 72cf86e462 Regex prompts should have a history with a specifiable register 2021-09-08 16:34:04 +09:00
Dmitry Sharshakov 1befbd076c Add command for editing breakpoint condition 2021-09-04 22:57:58 +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
Stuart Hinson 6192f2fa25
Show hidden files in filename completer (#648)
also removes unnecessary clone
2021-08-27 00:30:47 +09:00
Kirawi b99db7c687
Move path util functions from helix-term to helix-core (#650) 2021-08-25 10:04:05 +09:00
Blaž Hrastnik cbd39d67a4 minor: Refactor commands.rs a bit more 2021-08-20 10:43:22 +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
Blaž Hrastnik a2ccfffda1 config: Rename [terminal] to [editor] and pass it into Editor 2021-08-08 14:10:01 +09: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
Ivan Tham 8985c58fd3 Add infobox 2021-07-04 18:01:59 +09: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
Blaž Hrastnik d94410a678 Sort the files in descending order 2021-06-28 13:08:38 +09:00
Blaž Hrastnik cad14c6b46 Address nightly clippy warnings 2021-06-27 13:27:47 +09:00
Wojciech Kępka eb6fb63e74
Sort files in file picker by access, modification and creation date (#336)
* Sort files in file picker by access date

* Fallback file time to modified then created then UNIX_EPOCH

* Use `sort_by_key`

* Refactor
2021-06-26 11:09:17 +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
Joe Neeman fd1ae35051 Make the prompt callback take a Context. 2021-06-23 10:03:11 +09: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
wojciechkepka b2804b14b1 Add a `Spinner` 2021-06-21 12:59:06 +09:00
wojciechkepka a2db161d5a Add theme completer 2021-06-20 00:07:13 +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
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
Kevin Sjöberg b20e4a108c Only enforce limit outside of .git 2021-06-09 10:06:31 +09:00
Kevin Sjöberg 08f50310bd Bump file picker limit 2021-06-08 09:51:50 +09:00
Blaž Hrastnik 51d1d43289 Double the UI picker file limit. 2021-05-18 17:53:58 +09:00
Blaž Hrastnik f0712479cb Define text color (mostly) in theme.toml. 2021-05-07 17:42:09 +09:00
Blaž Hrastnik ff84c8e394 Command mode: Per command completers. 2021-05-07 17:19:45 +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 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 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 e833d65b77 Teach file picker how to find the project root (.git). 2021-03-30 10:14:50 +09:00
Blaž Hrastnik 742b3a709f Store intra-files jumps (goto) on the jumplist. 2021-03-29 16:32:42 +09:00
Blaž Hrastnik 5c2d2fda21 Wire up opening in splits via pickers. 2021-03-29 15:21:48 +09:00
Blaž Hrastnik a24c3fff54 Filter the completion menu based on text entered. 2021-03-27 12:08:44 +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 bf95ee27aa Store Document on the Editor type, make View reference it. 2021-03-22 13:53:43 +09:00
Blaž Hrastnik 698e4ddea4 clippy: Factor out a Completion type. 2021-03-22 13:16:56 +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 c331721565 Finish hiding doc.state / State as an implementation detail. 2021-03-18 15:07:02 +09:00
Blaž Hrastnik 51c15da3c3 Hold a reference to executor on the Editor type. 2021-03-16 23:14:51 +09:00
Blaž Hrastnik 1d42b95915 ui: wip: Markdown doc renderer. 2021-03-05 16:07:46 +09:00
Blaž Hrastnik 4c6611f96b commands: Stop select_regex from breaking when no matches. 2021-03-03 17:55:56 +09:00
Blaž Hrastnik bd0f6c1dfc clippy lint 2021-03-02 18:29:15 +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 857bce0e30 ui: Rework command mode, implement file path completion. 2021-03-01 18:02:31 +09:00
Blaž Hrastnik 7162632eb7 lsp: Hover documentation draft. 2021-02-25 18:07:47 +09:00
Blaž Hrastnik 83d48f10ea search: Barebones implementation. 2021-02-12 18:10:05 +09:00
Blaž Hrastnik d4b85ce18d popup: wip work on completion popups 2021-02-09 15:40:47 +09:00
Blaž Hrastnik 448c1abba0 View tree implementation: render multiple split views.
Cursors are still a bit buggy and we should render in focus statusbar
differently than in the other pane.
2021-02-03 19:36:54 +09:00
Blaž Hrastnik 2bea5db7bd commands: Implement select_on_matches. 2021-01-22 17:13:14 +09:00
Blaž Hrastnik 05c7fb98df Refactoring: move language_servers into Editor, proper load for doc. 2021-01-21 16:55:46 +09:00
Blaž Hrastnik 47e282804d buffer picker: Mark current view with (*) 2020-12-21 17:58:54 +09:00
Blaž Hrastnik 3d3295bb75 ui: buffer picker on ctrl-b 2020-12-21 16:26:22 +09:00
Blaž Hrastnik 25aa45e76c picker: Factor out file picker, we want to reuse code for other pickers. 2020-12-18 19:19:50 +09:00
Blaž Hrastnik 7c75ec04e8 File picker mockup, reuses the line editor work done on Prompt. 2020-12-17 18:08:16 +09:00
Blaž Hrastnik 8f0b28aeb8 Make the select prompt interactive. 2020-12-15 19:29:56 +09:00
Blaž Hrastnik 7dc24a25ba Move ui modules under a ui:: namespace. 2020-12-13 13:44:51 +09:00