Commit Graph

180 Commits (f9baced216df60122f2aae08d382931d77901ca9)

Author SHA1 Message Date
unrelentingtech 2c60798b00
feat(ui): add nbsp (non-breaking space) to rendered whitespace (#2322) 2 years ago
Matouš Dzivjak 52f5a4228a
feat(commands): better handling of buffer-close (#1397)
* feat(commands): better handling of buffer-close

Previously, when closing buffer, you would loose cursor position in other docs.
Also, all splits where the buffer was open would be closed.

This PR changes the behavior, if the view has also other buffer
previously viewed it switches back to the last one instead of the view
being closed. As a side effect, since the views are persisted,
 the cursor history is persisted as well.

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

* Adjust buffer close behavior

* Remove closed documents from jump history

* Fix after rebase
2 years ago
Omnikar e6b865ed0b allow whitespace to be rendered
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2 years ago
Thomas 5d5b6bab9b
Add rulers option (#2060)
* Add color_column option

* Rename to ruler

Co-authored-by: DeviousStoat <devious@stoat.com>
2 years ago
Dr. David A. Kunz b04c425c63
Make gutters configurable (#1967)
* config option line numbers none

* view tests

* added tests

* doc

* comment

* Make gutters configurable

* docu

* docu

* rm none docu

* order

* order

* precedence

* simpler

* rm todo

* fixed clippy

* order

* double quotes

* only allow diagnostics and line-numbers

* tests

* docu

* format

* rm short variant and more docu

* performance improvements

* typo

* rename
2 years ago
Roland Kovacs a0c6c45c1b
Fix panic when using set-language on a scratch (#1996)
Skip launching a language server if a document doesn't have a valid URL.
2 years ago
Roland Kovacs d962e06e91
Add runtime language configuration (#1794) (#1866)
* Add runtime language configuration (#1794)

* Add set-language typable command to change the language of current buffer.
* Add completer for available language options.

* Update set-language to refresh language server as well

* Add language id based config lookup on `syntax::Loader`.
* Add `Document::set_language3` to set programming language based on language
  id.
* Update `Editor::refresh_language_server` to try language detection only if
  language is not already set.

* Remove language detection from Editor::refresh_language_server

* Move document language detection to where the scratch buffer is saved.
* Rename Document::set_language3 to Document::set_language_by_language_id.

* Remove unnecessary clone in completers::language
2 years ago
Gokul Soumya 7b3a3d562c
Move top level lsp config to editor.lsp (#1868)
* Move top level lsp config to editor.lsp

This is mainly done to accomodate the new lsp.signature-help config
option that will be introduced in https://github.com/helix-editor/helix/pull/1755
which will have to be accessed by commands. The top level config
struct is split and moved to different places, making the relocation
necessary

* Revert rebase slipup
2 years ago
Joe bee05dd32a
Add refresh-config and open-config command (#1803)
* Add refresh-config and open-config command

* clippy

* Use dynamic dispatch for editor config

* Refactor Result::Ok to Ok

* Remove unused import

* cargo fmt

* Modify config error handling

* cargo xtask docgen

* impl display for ConfigLoadError

* cargo fmt

* Put keymaps behind dyn access, refactor config.load()

* Update command names

* Update helix-term/src/application.rs

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

* Switch to unbounded_channel

* Remove --edit-config command

* Update configuration docs

* Revert "Put keymaps behind dyn access", too hard

This reverts commit 06bad8cf492b9331d0a2d1e9242f3ad4e2c1cf79.

* Add refresh for keys

* Refactor default_keymaps, fix config default, add test

* swap -> store, remove unneeded clone

* cargo fmt

* Rename default_keymaps to default

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2 years ago
Gokul Soumya 2b0835b295
Refactor :set to parse by deserializing values (#1799)
* Refactor :set to parse by deserializing values

* Implement serialize for idle_timeout config
2 years ago
Mateusz S. Szczygieł 14e2ced440
Make repeat operator work with completion edits (#1640)
* 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>
2 years ago
Daniel S Poulin b13d44156c
Show infobox to hint textobjects with `mi` and `ma` (#1686)
* 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>
2 years ago
Skyler Hawthorne a494f47a5d
Configurable auto pairs (#1624)
* 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
2 years ago
Blaž Hrastnik d11b652139 Allow static strings in set_status/set_error so API is nicer 2 years ago
Blaž Hrastnik bd549d8a20 Merge remote-tracking branch 'origin/master' into debug 2 years ago
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
2 years ago
Gokul Soumya bf773db451 Show infobox with register contents 2 years ago
Ivan Tham 6c11708fb3
Fix incorrect last modified behavior (#1621)
Looks like it checked the wrong doc id when setting last modified doc.
2 years ago
Andrew Neth 333c2949c2
feat(helix-view): dynamic line numbers (#1522)
* feat(helix-view): dynamic line numbers

* docs: describe editor.line-number in more detail

* Make dynamic numbers the default behavior of `relative`
2 years ago
Blaž Hrastnik e2d2f19fd0
Merge pull request #1154 from sudormrfbin/cursor-shape-new
Change cursor shape on mode change
2 years ago
Blaž Hrastnik 4080341977 cargo fmt + clippy lint 2 years ago
Blaž Hrastnik 53d881f172 Store theme scopes on the loader, this way theme isn't passed around 2 years ago
Blaž Hrastnik 6728e44490 syntax: Split parsing and highlighting 2 years ago
Kevin Sjöberg 3a34036310
Use the correct language ID for JavaScript & TypeScript (#1466)
* Use correct language ID for JavaScript/TypeScript

* Add missing slash

* Only calculate fallback when needed
2 years ago
Gokul Soumya 449624965b Merge branch 'master' into cursor-shape-new 3 years ago
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
3 years ago
Gokul Soumya c0bbadcaaf Manually draw all block cursors 3 years ago
Gokul Soumya d4fb1d0633 Merge branch 'master' into cursor-shape-new 3 years ago
Gokul Soumya 016640f4fb Remove ui.cursor.primary and hashmap lookups 3 years ago
Blaž Hrastnik 730d3be201 Add ui.gutter to theme all gutters (i.e. set bg) 3 years ago
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`
3 years ago
Omnikar e91d357fae
Macros (#1234)
* 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
3 years ago
Ivan Tham e2b428cc2d
Add last modified file (gm) (#1093) 3 years ago
Blaž Hrastnik 8ffafb826f dap: Rewrite breakpoints so that there's a single set maintained 3 years ago
Blaž Hrastnik 9ed930b233 Merge remote-tracking branch 'origin/master' into debug 3 years ago
Gokul Soumya 058796c18e Change default cursors to block for all modes 3 years ago
Blaž Hrastnik 30171416cb Gutter functions 3 years ago
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)
3 years ago
Blaž Hrastnik 6e62c3de47 Simplify some code in editor.rs 3 years ago
Ivan Tham 67bf4250ca
Optimize space for DocumentId with NonZeroUsize (#1097)
Now Option<DocumentId> uses one byte rather than two
3 years ago
Gokul Soumya 7961355ba1 Change cursor shape on mode change
Fixes #323. Due to terminal limitations we can only
change the shape of the primary cursor.
3 years ago
Blaž Hrastnik 177b6fcdc9 cargo fmt 3 years ago
Blaž Hrastnik d1854d8e6a Merge remote-tracking branch 'origin/master' into debug 3 years ago
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
3 years ago
Cole Helbling 225e7904ec
helix-view/editor: use SCRATCH_BUFFER_NAME const (#1104) 3 years ago
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
3 years ago
Cole Helbling 87e61a0894
helix-term/commands: implement cquit (#1096)
This allows you to exit helix with an exit code, e.g. `:cq 2`.
3 years ago
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>
3 years ago
CossonLeo 29e6849413
Add LSP rename_symbol (space-r) (#1011)
improve apply_workspace_edit
3 years ago
Blaž Hrastnik 5938ab1bf1 dap: Fully extract template parameter prompts 3 years ago