Commit Graph

402 Commits (a06871a68971aa1eff8f54e8b3d751683f9d2c12)

Author SHA1 Message Date
ath3 70c62530ee
Support env flags in shebang (#1224) 3 years ago
Blaž Hrastnik 01f7a312d0 Address new lint on 1.57 3 years ago
Blaž Hrastnik 119dee2980 fix: Correctly detect empty transactions
Fixes #1221
3 years ago
George Rodrigues 3e15aead4a
Fix typo on docs (#1201) 3 years ago
Blaž Hrastnik 30171416cb Gutter functions 3 years ago
Gokul Soumya dc53e65b9e
Fix surround cursor position calculation (#1183)
Fixes #1077. This was caused by the assumption that a block
cursor is represented as zero width internally and simply
rendered to be a single width selection, where as in reality
a block cursor is an actual single width selection in form and
function.

Behavioural changes:

1. Surround selection no longer works when cursor is _on_ a
    surround character that has matching pairs (like `'`
    or `"`). This was the intended behaviour from the start
    but worked till now because of the cursor position
    calculation mismatch.
3 years ago
ath3 1d773bcefb
Implement black hole register (#1165) 3 years ago
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
3 years ago
Blaž Hrastnik 2b7c086653 fix: Expand tilde first, then deal with relative paths
Otherwise the ~ gets treated as a relative path.

Fixes #1107
3 years ago
ath3 90fd09f2cc
Fix selection remove doc comment (#1122) 3 years ago
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
3 years ago
Ivan Tham b7c3877e94
Add movement shortcut for history (#1088)
alt-u and alt-U
3 years ago
ath3 6fa76d9fe7
Add trim_selections command (#1092) 3 years ago
Blaž Hrastnik 1817b7f581 minor: Import Range too 3 years ago
ath3 35c974c9c4
Implement "Goto last modification" command (#1067) 3 years ago
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>
3 years ago
Omnikar a424ef4e20
Use default `languages.toml` if user's is invalid (#994) 3 years ago
Blaž Hrastnik e18198aeb2 Revert "fix(core): stop merging array toml config values (#1004)"
It breaks languages.toml merging

This reverts commit 4304b52ff8.
3 years ago
Blaž Hrastnik f804ed3192 Make shebangs optional, they don't make sense outside of scripts 3 years ago
Blaž Hrastnik 549cdee561 Refactor shebang detection to reuse the loaded buffer 3 years ago
ath3 77dbbc73f9
Detect filetype from shebang line (#1001) 3 years ago
Blaž Hrastnik 82ff5b0ab6 Specify capacity on toggle_line_comments 3 years ago
Daniel S Poulin 1e793c2bbf
Adds single and double quotes to matching pairs (#995)
This enables `mm` to work on quote characters as well as highlighting of
matching quote when on it.
3 years ago
Omnikar a252ecd8c8
Add WORD textobject (#991)
* Add WORD textobject

* Document WORD textobject
3 years ago
Carter Snook 4304b52ff8
fix(core): stop merging array toml config values (#1004) 3 years ago
Blaž Hrastnik e80708eba7 Make sure document diagnostics are sorted 3 years ago
Blaž Hrastnik 6431b26a6a Implement Selection::replace to replace a single range
Fixes #985

Co-authored-by: Daniel S Poulin <crimsonmage+github@gmail.com>
3 years ago
Ivan Tham 3eb829e233
Ensure coords in screen depends on char width (#885)
The issue affected files with lots of tabs at the start as well.

Fix #840
3 years ago
Kirawi ee889aaa85
Updated tree-sitter query scopes (#896)
* updated theme scopes

variable.property -> variable.field
property -> variable.field

* updated theme scopes

* update book and themes

updated book and themes to reflect scope changes

* wip

* update more queries

* update dark_plus.toml
3 years ago
cossonleo befecc8a9a select smaller range on some case 3 years ago
Omnikar 45fadf6151
Add hyperlinks to fix `cargo doc` warn (#931) 3 years ago
Gygaxis Vainhardt 0a38983ee3
Remove three transmutes from helix-core syntax.rs (#923) 3 years ago
Kirawi 92c2d5d3bf
Document more of helix-core (#904) 3 years ago
Blaž Hrastnik 3edca7854e completion: fully revert state before apply & insertText common prefix 3 years ago
Blaž Hrastnik bfb6cff5a9 fix: Compose where changes.compose(empty_other) 3 years ago
Blaž Hrastnik cee7ad781e Mark a few functions as `const` 3 years ago
Kirawi 0cb5e0b2ca
log syntax highlighting init errors (#895) 3 years ago
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
3 years ago
Michael Davis 1766bdb9d4
clean up combined-injections comment (#880) 3 years ago
Ivan Tham 4260b31ec0
Update mdbook style and fix unreadable table head (#806)
The styles are now pulled from upstream styles, some of the changes I
submitted it back to upstream.

Fix #796
3 years ago
Midnight Exigent eedcea7e6b
Allow `language.config` (in languages.toml) to be passed in as a toml object (#807)
* 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
3 years ago
Blaž Hrastnik 2e0803c8d9 Implement 'remove_primary_selection' as Alt-,
This allows removing search matches from the selection

Fixes #713
3 years ago
Blaž Hrastnik 64e8f0017c ... 3 years ago
Blaž Hrastnik d8b94ba85f Fix broken test 3 years ago
Blaž Hrastnik dd0b15e1f1 syntax: Properly handle injection-regex for language injections 3 years ago
Blaž Hrastnik 066367c0a4 fix: Need to reset set_byte_range in case cursor_ref is reused. 3 years ago
Blaž Hrastnik 4ac29434cb syntax: Add go & rust locals, improve tree-sitter error message 3 years ago
Blaž Hrastnik 585e3ce830 fix: tree-sitter-scopes would infinitely loop 3 years ago
Blaž Hrastnik 3cb95be452 Update tree-sitter to 0.20
0.20 includes querying improvements, we no longer have to convert
fragments to strings but can return an iterator of chunks instead.
3 years ago
Brian Shu fa4caf7e3d remove unsafe 3 years ago