Commit graph

998 commits

Author SHA1 Message Date
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
2021-12-26 10:04:33 +09:00
Matouš Dzivjak
4b0b1a5657
feat(ui): file encoding in statusline (#1355)
* 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.
2021-12-26 00:10:46 +09:00
Gabriel Berto
5d7b5db8ab
Resolve completion item (#1315)
Co-authored-by: Gabriel Berto <gabriel.berto@pottencial.com.br>
2021-12-25 19:00:57 +09:00
Matouš Dzivjak
0e7d757869
feat(lsp): configurable diagnostic severity (#1325)
* 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
2021-12-25 14:32:43 +09:00
BB
60f3225c7f
Truncate the start of file paths in the StatusLine (#1351)
* Truncate the start of file paths in the StatusLine

* cargo fmt

Co-authored-by: Bódi Balázs <97936@4ig.hu>
2021-12-25 14:24:29 +09:00
Matouš Dzivjak
75a8b789d2
LSP code action commands (#1304)
* feat(lsp): codeAction commands

* Don't block on command call

* Fix lifetime of command execution

* Fix lint issues
2021-12-21 18:21:45 +09:00
WindSoilder
600ce70cf6
Improve dedent behavior (#1232)
* 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
2021-12-21 18:17:55 +09:00
Ivan Tham
f174d27d0d
Change text for gg to explain <n>gg (#1287) 2021-12-18 20:28:17 +05:30
Kirawi
02fc52f6d5
Apply recent nightly suggestions (#1286)
array iterators are now implicit
2021-12-18 14:57:49 +09:00
Omnikar
6da2174e14
Allow paste commands to take a count (#1261)
* Allow paste commands to take a count

* Call `.repeat` within iterator methods

* Implement counts for paste-replace
2021-12-14 17:49:29 +09:00
Midnight Exigent
e188926138
Fix panic when scrolling through completion popup (#1260)
* fix(completion_popup): Fixes #1256

* Update helix-term/src/ui/completion.rs

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-12-14 10:14:23 +09:00
Skyler Hawthorne
94535fa013
Add auto pairs for same-char pairs (#1219)
* Add auto pairs for same-char pairs

* Add unit tests for all existing functionality
* Add auto pairs for same-char pairs (quotes, etc). Account for
  apostrophe in prose by requiring both sides of the cursor to be
  non-pair chars or whitespace. This also incidentally will work for
  avoiding a double single quote in lifetime annotations, at least until
  <> is added
* Slight factor of moving the cursor transform of the selection to
  inside the hooks. This will enable doing auto pairing with selections,
  and fixing the bug where auto pairs destroy the selection.

Fixes #1014
2021-12-14 00:58:58 +09:00
Blaž Hrastnik
730d3be201 Add ui.gutter to theme all gutters (i.e. set bg) 2021-12-14 00:52:15 +09:00
Omnikar
cce34feb4e Assume true color support on Windows 2021-12-14 00:48:45 +09:00
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`
2021-12-14 00:47:18 +09:00
Blaž Hrastnik
b25d453f64 minor: Shorten goto file(s) descriptions 2021-12-13 14:36:53 +09:00
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
2021-12-12 21:16:48 +09:00
ath3
3156577fbf
Open files with spaces in filename, allow opening multiple files (#1231) 2021-12-12 21:13:33 +09:00
Blaž Hrastnik
3307f44ce2 ui: popup: Don't allow scrolling past the end of content 2021-12-10 19:23:58 +09:00
Omnikar
b66d3d3d9d
Add save_selection command (#1247) 2021-12-10 11:46:24 +09:00
Kirawi
29c053e84e
Only use a single documentation popup (#1241) 2021-12-08 16:11:18 +09:00
Gokul Soumya
71292f9f11 docs: Auto generate command list 2021-12-08 10:23:50 +09:00
WindSoilder
93e276cd9d
Make kill_to_line_end behave like emacs (#1235) 2021-12-07 01:44:04 +09:00
Blaž Hrastnik
cab09093dd fix: Normalize backtab into shift-tab
Fixes #1150
2021-12-06 12:25:19 +09:00
Jason Rodney Hansen
461cd20563 Small change 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
31ed91dc2e Don't increment for overlapping changes 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
c74cd48f38 Cleanup 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
37e484ee38 Add support for time and more date formats 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
c9641fcced Add Increment trait 2021-12-05 16:22:58 +08:00
Jason Rodney Hansen
c1f6167e37 Add support for dates for increment/decrement 2021-12-05 16:22:58 +08:00
ath3
11a2f9ac31
Assert in release mode too on duplicate keys (#1228) 2021-12-05 13:04:10 +09:00
Oskar Nehlin
a06871a689
feat: Make it possible to keybind TypableCommands (#1169)
* Make TypableCommands mappable

* Fix pr comments

* Update PartialEq implementation
2021-12-04 20:17:18 +05:30
Blaž Hrastnik
371c84f70b cargo fmt 2021-12-03 12:51:55 +09:00
Blaž Hrastnik
34f46e7502 Bump rust to 1.57, fix new lint failures 2021-12-03 12:48:07 +09:00
Ivan Tham
e2b428cc2d
Add last modified file (gm) (#1093) 2021-12-02 13:46:57 +09:00
Bob
418b833d2b
fix goto_window index crash (#1207) 2021-12-02 13:42:34 +09:00
Blaž Hrastnik
c955eaa6cd Revert "Improve dedent behavior, make kill_to_line_end behave like emacs (#1173)"
1. pressing o on a line with no indentation will open a new line as
   expected, but esc will then delete the line altogether

2. the kill_line behavior happens after insert mode changes are already
   commited to history, and the change isn't commited. pressing u after
   this will break highlighting & undo history

This reverts commit c08d2fae58.
2021-12-01 13:40:54 +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
7bbf4c5b06 ui: Only calculate span styling when it's actually in bounds 2021-12-01 12:57:57 +09:00
Blaž Hrastnik
d562e13e1f minor: Use anchor::ensure in some cases 2021-12-01 12:57:22 +09:00
WindSoilder
c08d2fae58
Improve dedent behavior, make kill_to_line_end behave like emacs (#1173)
* restore indent when press esc right after open a new line

* add comment for restore_indent

* fix, and make kill to line end behaves like emacs

* update comment

* fix comment

* adjust cancel restore_indent situation

* check esc logic in mode transaction

* improve comment

* add more check for dedent

* update comment

* use matches to check for last_cmd

* no need to introduct CommandFun type
2021-11-30 16:40:38 +09:00
Blaž Hrastnik
225e8ccf31 Extract gutters into helix-view 2021-11-29 11:00:28 +09:00
Blaž Hrastnik
27c1a84f05 Reuse a text buffer for each gutter line 2021-11-29 11:00:28 +09:00
Blaž Hrastnik
ba45db84d4 Tie the GutterFn lifetime to the doc so we can avoid cloning data 2021-11-29 11:00:28 +09:00
Blaž Hrastnik
c71c9f69e2 TODO 2021-11-29 11:00:28 +09:00
Blaž Hrastnik
30171416cb Gutter functions 2021-11-29 11:00:28 +09:00
Bob
42fde95223
Accept count for goto_window (#1033)
* accept count for goto_window

also fix view is not fullfilled issue

* fix fulfilled mispell

* Update helix-term/src/commands.rs

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* Update helix-term/src/commands.rs

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* fix merge issue

* revert line computation logic

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-11-29 10:58:21 +09:00
Bob
4f9390a435
gf as goto_file (#1102)
* 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>
2021-11-29 10:53:29 +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