* add tree-sitter-regex
* adapt regex highlights from upstream
* inject regex into elixir sigil_r/2 and sigil_R/2
* generate lang-support docs
* capture interesting nodes in character-ranges
* make $.character_class captures more consistent
* fix fallthrough behavior for character classes
* capture pattern characters as 'string'
* use latest tree-sitter-regex
* set elixir regex injections as combined
* add link to upstream queries
* inject regex in rust into 'Regex::new' raw string literals
* 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
Indentation of single line statements doesn't work, i.e.
for (;;)<hit enter>
leads to
for(;;)
<cursor here>
Only blocks with curly braces are indented.
* Add injection regex for more languages
To support embedding them in other languages like markdown.
* Add llvm-mir highlighting
LLVM Machine IR is dumped as yaml files that can embed LLVM IR and
Machine IR.
To support this, add a llvm-mir-yaml language that uses the yaml
parser, but uses different injections to highlight IR and MIR.
* Update submodule with fixed multiline comments
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Add a tree-sitter grammar and highlights for TableGen files.
TableGen and its grammar are described here:
https://llvm.org/docs/TableGen/index.html
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* add submodule on tree-sitter-rebase, add to languages
* add basic highlights query
* inject bash in execute statements
* update tree-sitter-rebase
* tree-sitter-rebase->tree-sitter-git-rebase
* get injection working with tree-sitter-git-commit
* set scope under source.gitrebase
* unset include-children on commit message injections
* Revert "unset include-children on commit message injections"
This reverts commit 2ecee155ea8e229651920b291062c2ee84b47944.
* fix generated language docs
* use rebase_command scopes from tree-sitter-git-commit
* add submodule on tree-sitter-git-diff
* add git-diff highlights
* inject git-diff into git-commit
* update tree-sitter-git-commit with fix for bad diff case
* add git-diff to language support docs
* include-children in diff injections
This ensures that children nodes of $.message are included in the
injection, such as $.user or issue/pr numbers. Without this change,
diffs containing '#' or '@' characters can trip up the injection and
be parsed separately.
See https://github.com/helix-editor/helix/pull/1373#issuecomment-1001215629
* set diff language's scope as source.diff
* Improve llvm highlighting and queries
The llvm tree-sitter parser was updated to support scopes and more
accurate highlighting.
* Group highlight expressions better
* 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(lsp): configurable diagnostic severity
Allow severity of diagnostic messages to be configured.
E.g. allow turning of Hint level diagnostics.
Fixes: https://github.com/helix-editor/helix/issues/1007
* Use language_config() method
* Add documentation for diagnostic_severity
* Use unreachable for unknown severity level
* fix: documentation for diagnostic_severity config
* allow language.config (in languages.toml) to be passed in as a toml object
* Change config field for languages from json string to toml object
* remove indents on languages.toml config
* fix: remove patch version from serde_json import in helix-core
* Use same tree-sitter-zig as upstream/master
* fix(completion_popup): Fixes#1256
* Update helix-term/src/ui/completion.rs
* feat(languages): Add support for `Dockerfile`s
* docs(cargo-xtask-docgen):
* improvement(langs-dockerfile): Add `injection-regex` to `languages.toml` for
`Dockerfile`
* improvement(langs-dockerfile): Add injections.scm
* Update .gitmodules
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
- Rename markup.underline.link to markup.link.url
- Add markup.link.label
- Add markup.quote
(The constructor theme scope was missing from the
docs, so unrelated to this commit).
* 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
* 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>
* 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>
* 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
* 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
* 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 cb47f946d7fb62ceda68e7d1692a3914d0be7762.
* 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!
* Add arrow keys to view mode
* Drop C-up and C-down
* Update docs for #987
* Format correctly
* Drop other keymaps
* Correct keymap.md
* Add arrow keys to view mode
Drop C-up and C-down
Update docs for #987
Format correctly
Drop other keymaps
Correct keymap.md
Rebase
Co-authored-by: Rust & Python <nexinov@localhost.gud-o15>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Allow keys to be mapped to sequences of commands
* Handle `Sequence` at the start of `Keymap::get`
* Use `"[Multiple commands]"` as command sequence doc
* Add command sequence example to `remapping.md`
* 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>
* feat(book/src/languages.md)
Add a section in the book about language-specific settings and the languages.toml file.
* Update book/src/languages.md
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
* feat(book/src/guides/adding_languages.md)
Add book section on adding a new language to the compile-time/root languages.toml file.
* Update book/src/guides/adding_languages.md
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Update book/src/guides/adding_languages.md
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* refactor(revise book/src/languages.md)
Change the book page on language settings to match suggestions by archseer and mention both toml files.
Co-authored-by: Gokul Soumya <gokulps15@gmail.com>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* 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
* 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>
* 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>
* 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
* Add `A-,` to `keymap.md`, and remove out-of-place commas
* Update book/src/keymap.md
Co-authored-by: Ivan Tham <pickfire@riseup.net>
* Add slashes in place of previous commas in `keymap.md`
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
* 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
* 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`
* 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>
* 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
* Enable using color palettes in theme files.
* Add an example theme defined using a gruvbox color palette.
* Fix clippy error.
* Small style improvement.
* Add documentation for the features to themes.md.
* Update runtime/themes/gruvbox.toml
Fix the value of purple0.
Co-authored-by: DrZingo <DrZingo@users.noreply.github.com>
Co-authored-by: DrZingo <DrZingo@users.noreply.github.com>
* 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
Adds `ui.linenr.selected` which controls highlight of linu numbes which
have cursors on.
- Fallback to linenr if linenr.selected is missing
- Update docs and themes
- Add TODOs for themes with temporary linenr.selected
* 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
* 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
These changes provide a new feature flag "embed_runtime" that when
enabled and built in release mode will embed the runtime folder into the
resulting binary.