Commit Graph

677 Commits (93ec42d06e6c7b8c157fd17a1ed40dda3ee91bf3)

Author SHA1 Message Date
Omnikar 2d4bc0aec7 Change how macros separate keypresses
* Keypresses are no longer separated by spaces
* Single-character keypresses are serialized as-is
* Multi-character keypresses are delimited by `<>`
3 years ago
Ivan Tham ee3eb4057a Update macro display as [q] in message 3 years ago
Ivan Tham b9cb3930e2 Mark macros as experimental in docs
Given that currently macro does not integrate well with registers and
the internal representation of macros is expected to be changed.
3 years ago
Ivan Tham 9a32617b30 Rename play macro to replay macro
Macro needs to be defined first before playing so replay is more accurate.
Also, replay have the same length as record which makes it looks nice.
3 years ago
Ivan Tham 5326a05117 Improve macro error handling 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
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
3 years ago
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
3 years ago
Ivan Tham f174d27d0d
Change text for gg to explain <n>gg (#1287) 3 years ago
Kirawi 02fc52f6d5
Apply recent nightly suggestions (#1286)
array iterators are now implicit
3 years ago
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
3 years ago
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
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
Blaž Hrastnik b25d453f64 minor: Shorten goto file(s) descriptions 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
ath3 3156577fbf
Open files with spaces in filename, allow opening multiple files (#1231) 3 years ago
Omnikar b66d3d3d9d
Add `save_selection` command (#1247) 3 years ago
Kirawi 29c053e84e
Only use a single documentation popup (#1241) 3 years ago
Gokul Soumya 71292f9f11 docs: Auto generate command list 3 years ago
WindSoilder 93e276cd9d
Make kill_to_line_end behave like emacs (#1235) 3 years ago
Jason Rodney Hansen 461cd20563 Small change 3 years ago
Jason Rodney Hansen 31ed91dc2e Don't increment for overlapping changes 3 years ago
Jason Rodney Hansen c74cd48f38 Cleanup 3 years ago
Jason Rodney Hansen 37e484ee38 Add support for time and more date formats 3 years ago
Jason Rodney Hansen c9641fcced Add `Increment` trait 3 years ago
Jason Rodney Hansen c1f6167e37 Add support for dates for increment/decrement 3 years ago
Oskar Nehlin a06871a689
feat: Make it possible to keybind `TypableCommands` (#1169)
* Make TypableCommands mappable

* Fix pr comments

* Update PartialEq implementation
3 years ago
Blaž Hrastnik 43fbb6d965 Make dap_start non-blocking 3 years ago
Blaž Hrastnik 371c84f70b cargo fmt 3 years ago
Blaž Hrastnik 34f46e7502 Bump rust to 1.57, fix new lint failures 3 years ago
Ivan Tham e2b428cc2d
Add last modified file (gm) (#1093) 3 years ago
Bob 418b833d2b
fix goto_window index crash (#1207) 3 years ago
Blaž Hrastnik 54f8e5c9c3 dap: Fix an off-by-one and move the function over to commands/dap 3 years ago
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.
3 years ago
Blaž Hrastnik d562e13e1f minor: Use anchor::ensure in some cases 3 years ago
Blaž Hrastnik b4fd3148e3 These TODOs have been resolved 3 years ago
Blaž Hrastnik 8ffafb826f dap: Rewrite breakpoints so that there's a single set maintained 3 years ago
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
3 years ago
Blaž Hrastnik 9ed930b233 Merge remote-tracking branch 'origin/master' into debug 3 years ago
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>
3 years ago
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>
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
Thanabodee Charoenpiriyakij e8f800a141
Do not crash when run goto command without line number (#1160)
* Do not crash when run goto command without line number

Report an error when running goto command without entering a
line number.

Fixes #1159

* Use is_empty() instead check len zero
3 years ago
ath3 72f606ee19
Implement no-yank delete/change (#1099) 3 years ago
Martin Junghanns 57c14d4a93
Add `:<line>` and `:goto <line>` commands (#1128)
* Add typable `goto` command

* Support `:<line-number>` on prompt

* Rename function according to convention

* Directly call into goto_line_number function
3 years ago
Bob 21143e8d22
Align selections via & (#1101)
* 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>
3 years ago
Blaž Hrastnik 0eadeab8c7 dap: Remove the prompt line parameter, use insert_str instead 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
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
WindSoilder 5959356a24
Implement indent-aware delete (#1120)
* delete character backward can make undent behavior

* improve to handle mixed indentation
3 years ago
Ivan Tham bd56dde6e2
Ensure cursor in view after pipe (#1123)
Fix #1024
3 years ago
Blaž Hrastnik fa4c59df46 Simplify compositor.find 3 years ago
Blaž Hrastnik dd98727bad fix: editor.close now takes only a single parameter 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
Bob 46d9ae2b62
Readline style insert mode (#1039)
* 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!
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
Blaž Hrastnik f5e070e808 minor: Remove leftover log line 3 years ago
Blaž Hrastnik e128a8702e Implement MarkedString rendering
Solves typescript and python documentation rendering
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
Ebbe Steenhoudt edc976b6bb
Added workspace_symbol_picker (#1041)
* Added workspace_symbol_picker

* Moved truncation of the symbol pickers to the end.

* Fixed typo
3 years ago
ath3 35c974c9c4
Implement "Goto last modification" command (#1067) 3 years ago
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.
3 years ago
Omnikar 6d4409c00f
Make prompts consistent (#1080) 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
Ivan Tham 9d591427be
Fix earlier/later missing changeset update (#1069)
Fix #1059
3 years ago
Cole Helbling bf70cfd050
helix-term/command: make scratch buffer name consistent (#1071) 3 years ago
Omnikar ebc14d9d20
Add `m` textobject for pair under cursor (#961) 3 years ago
Bob 4d22454386
add wonly -- window only (#1057)
* 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>
3 years ago
CossonLeo 68224232af
buffer picker add is_modifier flag (#1020) 3 years ago
CossonLeo a69caff450
search_impl will only align cursor center when it isn't in view (#959) 3 years ago
CossonLeo 29e6849413
Add LSP rename_symbol (space-r) (#1011)
improve apply_workspace_edit
3 years ago
Omnikar a252ecd8c8
Add WORD textobject (#991)
* Add WORD textobject

* Document WORD textobject
3 years ago
Blaž Hrastnik 09f5796537 dap: Simplify get_breakpoint_at_current_line 3 years ago
Blaž Hrastnik 3b8d5102ac Make picker take the whole context, not just editor 3 years ago
Blaž Hrastnik f2b709a3c3 Merge branch 'master' into debug 3 years ago
Blaž Hrastnik 2c1313c064 Specify vector capacity on surround_add 3 years ago
Blaž Hrastnik 1a1685acf7 Simplify current!(..).1 into doc!() 3 years ago
Blaž Hrastnik 0f4cd73000 Simplify goto_*_diagnostic commands 3 years ago
Blaž Hrastnik f659e1178a minor: view!(..).doc is slightly more efficient than current!(..).1.id() 3 years ago
Blaž Hrastnik b81a554424 Retain range direction on search
Co-authored-by: CossonLeo <20379044+cossonleo@users.noreply.github.com>
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
Gygaxis Vainhardt 911b9b3276
Add reverse search functionality (#958)
* 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
3 years ago
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`
3 years ago
Blaž Hrastnik 7b65a6d687 Rewrite goto_buffer 3 years ago
ath3 78c68fae91 Implement "Goto next buffer / Goto previous buffer" commands 3 years ago
Blaž Hrastnik e2560f427e Replace documents SlotMap with BTreeMap 3 years ago
CossonLeo 39584cbccd
Add c-s to pick word under doc cursor to prompt line & search completion (#831)
* 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>
3 years ago
CossonLeo 1720b98760
only remove primary index when search next without extend (#948) 3 years ago
Ivan Tham bc6a34d97e
Make match work with extend and multi cursors (#920) 3 years ago
Ivan Tham 21d535565b
Support extend for multiple goto (#909)
gg, ge, [n]gg
3 years ago
cossonleo f1d339919f add expand_selection to last_motion 3 years ago
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>
3 years ago
Omnikar a7d87c79ce
Fix `:quit!` description and tense of other commands (#902) 3 years ago
CossonLeo 2ed01f2d9c
find motion and textobj motion repeat (#891) 3 years ago
CossonLeo 971ba8929f
Filter completion items from language server by starts_with word under cursor (#883)
* filter items by starts_with pre nth char of cursor

* add config for filter completion items by starts_with

* filter items by starts_with pre nth char of cursor

* add config for filter completion items by starts_with

* remove completion items pre filter configuratio
3 years ago
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
3 years ago