-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smart tab (aka tabout) #4443
Smart tab (aka tabout) #4443
Conversation
04ef07a
to
73f4299
Compare
13875aa
to
163e4dc
Compare
5eddb01
to
7d144f2
Compare
1c11a25
to
30c15da
Compare
829015b
to
2d90e8e
Compare
50146c9
to
c46bc36
Compare
03af146
to
e8ef964
Compare
Implement `smart_tab`, which optionally makes the tab key run the `move_parent_node_start` command when the cursor has non- whitespace to its left.
Ok I think I got all the comments 🙂 |
For reference:
BTW. I might have missed it, but it might be worthwhile documenting the more elaborated setup somewhere in the docs. And also having to customize 5 bindings to set it up feels kind of ... Vimish. I wish there was something like |
@dpc I have:
No need for any extra select mode bindings as it selects already. I am not sure about your |
How does it work in selection mode? (I haven't tried, but I'm curious what exactly is responsible for it working, more than the effect) I have this feature enabled and configured since it was a PR, so I might have missed something, but when I google and look through the docs I only find https://docs.helix-editor.com/master/configuration.html#editorsmart-tab-section that doesn't explain (or advertise) this feature much at all, and doesn't seem to enable any extra binding that made a big difference when I was first trying it out. |
Not really sure what this has to do with @dpc 's question. These bindings aren't for smart tab, and the bindings they're asking about aren't in the default key map. @dpc the reason this isn't in the default key map is because it needs a terminal with support for the Kitty keyboard protocol to work, and we don't want to require that in the default bindings. But smart tab is enabled by default, so you don't need that part. |
We've also been disinclined to make configuration "kits" like this because they require special case logic and have confusing semantics with respect to overrides. |
I'm confused - seems to me like all I'm binding is Anyhow, would it make sense to expand https://docs.helix-editor.com/master/configuration.html#editorsmart-tab-section with recommended settings or something? Hmmm... are even the settings i have recommended? :D . I just copied them from some previous comment in the past and it worked great. |
Yeah, in standard terminals, Shift + Tab does not work. Also, tab is ambiguous with Ctrl-i, which is the binding for going forward in the jump history, so binding to tab in normal mode overwrites that binding.
Sure, we'd appreciate a PR 🙂 |
This adds new commands that will traverse up to the parent tree-sitter node and move to either the beginning or the end. It also adds an optional feature I've called "smart tab" which will run the latter command when tab is pressed, unless the cursor is preceded only by whitespace, in which case it will insert a tab as normal. With the default bindings,
S-tab
can be pressed to explicitly only insert a tab. This can be used to emulate a tabout behavior.Some things I'm unsure about in the approach:
C-i
, this would clearly be a controversial choice in the default bindings.This change is based on top of
#4425and#6156