* add basic completion replay
* use transaction as the last completion
* completion replay only on trigger position
* cache changes in CompletionAction
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Show infobox to hint textobjects with `mi` and `ma`
* Add note to infobox than any pair of characters will work too
The wording could probably be a little more clear, but I wanted to
keep it short but still accurate.
* Don't allocate a vec for the static help text
* Fix bug where `mi<esc>` would swallow next input and persist infobox
* Better help text for arbitrary pair matching in textobject selection
* Add way to add fake pending key data below status, use with `mi`/`ma`
This is a bit hacky as it makes use of global state which will end
up managed in multiple places, but has precedent in the way autoinfo
works. There should probably be a bigger refactor to handle this
kind of state better.
* Return early on anything other than `mi` and `ma` for autoinfo
* Remove "ascii" from help text with `mi` and `ma`
* Update helix-term/src/ui/editor.rs
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* impl auto pairs config
Implements configuration for which pairs of tokens get auto completed.
In order to help with this, the logic for when *not* to auto complete
has been generalized from a specific hardcoded list of characters to
simply testing if the next/prev char is alphanumeric.
It is possible to configure a global list of pairs as well as at the
language level. The language config will take precedence over the
global config.
* rename AutoPair -> Pair
* clean up insert_char command
* remove Rc
* remove some explicit cloning with another impl
* fix lint
* review comments
* global auto-pairs = false takes precedence over language settings
* make clippy happy
* print out editor config on startup
* move auto pairs accessor into Document
* rearrange auto pair doc comment
* use pattern in Froms
* feat(commands): shrink_selection
Add `shrink_selection` command that can be used to shrink
previously expanded selection.
To make `shrink_selection` work it was necessary to add
selection history to the Document since we want to shrink
the selection towards the syntax tree node that was initially
selected.
Selection history is cleared any time the user changes
selection other way than by `expand_selection`. This ensures
that we don't get some funky edge cases when user calls
`shrink_selection`.
Related: https://github.com/helix-editor/helix/discussions/1328
* Refactor shrink_selection, move history to view
* Remove useless comment
* Add default key mapping for extend&shrink selection
* Rework contains_selection method
* Shrink selection without expand selects first child
* 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
* feat(ui): file encoding in statusline
Display file encoding in statusline if the encoding
isn't UTF-8.
* Re-export encoding_rs from core
From there it can be imported by other mods
that rely on it.
* tmp add code for dedent
* finish normal_mode with dedent behavior
* use function pointer
* rebase from origin
* check dedent condition inside normal_mode implementation
* using if let...
* fix check
* using char_is_whitespace instead of ch.is_whitespace
* fix clippy
* abstract restore_indent function
* 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`
* Macros WIP
`helix_term::compositor::Callback` changed to take a `&mut Context` as
a parameter for use by `play_macro`
* Default to `@` register for macros
* Import `KeyEvent`
* Special-case shift-tab -> backtab in `KeyEvent` conversion
* Move key recording to the compositor
* Add comment
* Add persistent display of macro recording status
When macro recording is active, the pending keys display will be shifted
3 characters left, and the register being recorded to will be displayed
between brackets — e.g., `[@]` — right of the pending keys display.
* Fix/add documentation
Tree sitter returns an index referring to the position of the scope in
the scopes array. We can use that same index to avoid a hashmap lookup
and instead store the styles in an array.
This currently stores the styles in both a map and an array because the
UI still uses hashmap lookups, but it's a reasonable tradeoff.
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)
* 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
* 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
* Launch with defaults upon invalid config/theme
* Startup message if there is a problematic config
* Statusline error if trying to switch to an invalid theme
* Use serde `deny_unknown_fields` for config
* 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>
* improve idle completion trigger
* add completion-trigger-len to book
* rename semantics_completion to language_server_completion and optimize idle completion trigger
* add docs
* clean up
* remove
* more
* Update helix-view/src/macros.rs
Co-authored-by: Ivan Tham <pickfire@riseup.net>
Co-authored-by: Ivan Tham <pickfire@riseup.net>
* 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`