Commit graph

410 commits

Author SHA1 Message Date
Blaž Hrastnik
662ecf0cd4 Annotate Theme::highlight with #[inline] 2021-12-01 13:13:50 +09:00
Blaž Hrastnik
259678585c ui: Optimize tree-sitter style lookups
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.
2021-12-01 13:08:20 +09:00
Blaž Hrastnik
225e8ccf31 Extract gutters into helix-view 2021-11-29 11:00:28 +09:00
Blaž Hrastnik
30171416cb Gutter functions 2021-11-29 11:00:28 +09:00
RustyStriker
103b5125e4
Detect filetype on :write (#1141)
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)
2021-11-28 10:19:54 +09:00
Blaž Hrastnik
6e62c3de47 Simplify some code in editor.rs 2021-11-26 18:26:22 +09:00
Ivan Tham
67bf4250ca
Optimize space for DocumentId with NonZeroUsize (#1097)
Now Option<DocumentId> uses one byte rather than two
2021-11-25 11:07:23 +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
Blaž Hrastnik
27ceeb83bb Simplify view/doc macros 2021-11-18 14:13:42 +09:00
Cole Helbling
225e7904ec
helix-view/editor: use SCRATCH_BUFFER_NAME const (#1104) 2021-11-16 01:46:39 +09:00
Cole Helbling
c638b6b60e
helix-term/commands: implement buffer-close (bc, bclose) (#1035)
* 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
2021-11-16 00:30:45 +09:00
Cole Helbling
87e61a0894
helix-term/commands: implement cquit (#1096)
This allows you to exit helix with an exit code, e.g. `:cq 2`.
2021-11-15 13:06:12 +09:00
ath3
35c974c9c4
Implement "Goto last modification" command (#1067) 2021-11-15 00:11:53 +09:00
Cole Helbling
b824e091a9
helix-term/commands: move SCRATCH_BUFFER_NAME to helix-view/document (#1091)
This way, the name is accessible everywhere `Document` and related types
are.
2021-11-13 13:15:41 +09:00
Ivan Tham
9d591427be
Fix earlier/later missing changeset update (#1069)
Fix #1059
2021-11-11 22:32:44 +09:00
Jason Hansen
cf831b1a65
Allow piping from stdin into a buffer on startup (#996)
* Allow piping from stdin into a buffer on startup

* Refactor

* Don't allow piping into new buffer on macOS

* Update helix-term/src/application.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* Update helix-term/src/application.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* Fix

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-11-10 10:53:14 +09:00
CossonLeo
a69caff450
search_impl will only align cursor center when it isn't in view (#959) 2021-11-09 11:11:45 +09:00
Blaž Hrastnik
549cdee561 Refactor shebang detection to reuse the loaded buffer 2021-11-09 00:30:34 +09:00
ath3
77dbbc73f9
Detect filetype from shebang line (#1001) 2021-11-09 00:19:44 +09:00
CossonLeo
29e6849413
Add LSP rename_symbol (space-r) (#1011)
improve apply_workspace_edit
2021-11-09 00:17:54 +09:00
Omnikar
ed23057ff8
Launch with defaults upon invalid config/theme (#982)
* 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
2021-11-07 00:57:14 +09:00
Blaž Hrastnik
e80708eba7 Make sure document diagnostics are sorted 2021-11-06 18:58:58 +09:00
Omnikar
cfc8285867
Allow infoboxes to be disabled (#972)
* Allow infoboxes to be disabled

* Document `infoboxes` default value

* Rename `infoboxes` to `auto_info`

* Document `auto-info`

* Fix incomplete rename
2021-11-05 11:25:08 +09:00
Omnikar
51b4d35dce
Inform when reaching undo/redo bounds (#981)
* Inform when reaching undo/redo bounds

* `Already at oldest change` when undo fails
* `Already at newest change` when redo fails

* Add missing `the`
2021-11-05 10:20:06 +09:00
ath3
aa4d0b4646
Fix crash on changing from empty scratch buffer to itself (#975) 2021-11-04 17:57:04 +09:00
Blaž Hrastnik
e2560f427e Replace documents SlotMap with BTreeMap 2021-11-04 13:43:45 +09:00
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
2021-11-03 12:02:29 +09:00
Daniel Ebert
eb8745db09 Implement key ordering for info box 2021-11-03 11:56:55 +09:00
Omnikar
2f8ad7f890
If switching away from an empty scratch buffer, remove it (#935)
* If switching away from an empty scratch buffer, remove it

* Move `view.jumps.push` call into `else` clause

* Refactor
2021-10-31 09:42:49 +09:00
Kirawi
cec0cfdaec
Uncomment mapping LSP diagnostics through changes (#925) 2021-10-29 10:11:30 +09:00
Blaž Hrastnik
f3c7f20dbc Release v0.5.0 2021-10-28 16:41:34 +09:00
Blaž Hrastnik
c1e5831b21 set_path: Pass in the function directly 2021-10-28 10:51:19 +09:00
Blaž Hrastnik
3e69a4852e Simplify set_path 2021-10-28 10:50:17 +09:00
Omnikar
e2ed691537
Implement hx --tutor and :tutor to load tutor.txt (#898)
* 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>
2021-10-28 10:23:46 +09:00
Blaž Hrastnik
e36ad8b4ed minor: Further simplify take_with 2021-10-27 12:25:00 +09:00
Blaž Hrastnik
3edca7854e completion: fully revert state before apply & insertText common prefix 2021-10-25 11:09:09 +09:00
CossonLeo
2ed01f2d9c
find motion and textobj motion repeat (#891) 2021-10-24 22:47:10 +09:00
Blaž Hrastnik
c913bade0a fix: Indentation used different default on hx vs hx new_file.txt 2021-10-24 17:20:30 +09:00
Kirawi
0cb5e0b2ca
log syntax highlighting init errors (#895) 2021-10-23 21:52:18 +09:00
Oskar Nehlin
0f886af4b9
Add commands for moving between splits with a direction (#860)
* Add commands for moving between splits with a direction

* Update keymaps

* Change picker mapping

* Add test and clean up some comments
2021-10-23 20:06:40 +09:00
Blaž Hrastnik
182a59b552 Update to rust 1.56 + 2021 edition 2021-10-22 12:15:18 +09:00
Blaž Hrastnik
9688cb74a1 Update dependencies to bump crossterm to 0.22.1
Fixes #825
Fixes #690
2021-10-19 23:58:51 +09:00
CossonLeo
9ac0c95161
Improve completion trigger (#838)
* improve idle completion trigger

* add completion-trigger-len to book

* rename semantics_completion to language_server_completion and optimize idle completion trigger
2021-10-18 15:14:50 +09:00
Ivan Tham
89707a858f
Make auto-completion a config (#853) 2021-10-16 22:57:41 +09:00
Blaž Hrastnik
a930f99179 fix: Make sure to actually use idle_timeout config value for the timers 2021-10-10 22:39:47 +09:00
Blaž Hrastnik
633b981db2 Make idle-timeout configurable 2021-10-10 12:32:06 +09:00
Blaž Hrastnik
66f26e82ce Filter the initial completion 2021-10-05 22:27:35 +09:00
Blaž Hrastnik
f99bea404f idle timer wip 2021-10-05 22:27:10 +09:00
lurpahi
a958d34bfb
Add option for automatic insertion of closing-parens/brackets/etc (#779)
* Add auto-pair editor option

* Document auto-pair editor option

* Make cargo fmt happy

* Actually make cargo fmt happy

* Rename auto-pair option to auto-pairs

* Inline a few constants

Co-authored-by: miaomai <cunso@tutanota.com>
2021-09-24 10:28:44 +09:00
kraem
4a003782a5
enable smart case regex search by default (#761) 2021-09-20 13:45:07 +09:00