-
Notifications
You must be signed in to change notification settings - Fork 715
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
EditorConfig does not expandtab #3073
Comments
@andreyorst any chance you would add support for this in https://github.com/andreyorst/smarttab.kak ? |
I don't know. But then it may conflict with user hooks, like |
I am currently using smarttab (great plugin!) to get the behaviour I want, but shouldn't editors that support |
Hello, I think this issue is incorrect, editorconfig support is doing the right thing here:
What you are asking for is for I can understand that confusion, as users are used to |
I guess I should include |
@mawww From https://editorconfig.org:
My understanding is that soft vs hard tabs denotes what is inserted when the |
@benburk To me, Most editor use the That said, I think it would make sense fo smarttab.kak to work well with editorconfig, so that you get the behaviour you expect. I merely object to the idea that its editorconfig.kak responsibility to do so. |
Thanks for your perspective @mawww. It sounds like you have given it quite a bit of thought.
To me, I think the majority of new users would expect the behaviour I describe, since that is how most other programs implement it, and it is a reasonable interpretation of the Additionally, indenting with spaces is extremely popular and having to download a plugin to achieve the functionality they are familiar with could be frustrating to new users. I think it would be great to have as a default setting. I may be wrong though and am open to having my mind changed. |
In most editors, sure. The description of the Kakoune repo is "mawww's experiment for a better code editor", and part of that experiment is seeing how far it can get with super-minimalist internals and a lot of scripting on top. For example, one example of that minimalism is "in insert mode, keys are inserted into the buffer, but in normal mode they operate on the selection". This is a bit fuzzy, since pressing Esc in insert mode does not insert a 0x1B byte into the buffer, but it's true for regular typable characters like A and } and Space and Tab. Those are all characters one might reasonably expect to find in a source-code file, and in insert mode, they all insert themselves as-is. That said, brutal minimalism is uncomfortable for actual humans, and Kakoune ships with a a bunch of scripts to make things more comfortable. For example, many of Kakoune's file-type-support scripts, as well as adding syntax highlighting, teach Enter to copy the indent from the previous line as well as inserting a new one. There's definitely drawbacks to that strategy (not every file-type supports it, and some of them are inconsistent), but there's also advantages (file-formats or users with unusual requirements can be special without having to modify Kakoune's core). If Kakoune were all about making the most polished, easy-to-use editor, then sure, making a magic Tab key would absolutely be the right move. But instead, Kakoune is trying to balance comfort against simplicity and minimalism. One thing that has changed since these conventions were established is that Kakoune now has a module system so scripts can depend on one another. I wonder if it would be reasonable to ship some |
Regardless of the design philosophy of Kakoune, it purports to implement the
In addition to those reasons, I believe it is inconvenient and perhaps uninviting requiring new users to resort to plugins for such a basic feature used by ~half of programmers when they should be focusing on learning the editing model. I think Kakoune has done a great job setting itself up as a minimalist editor but I'm not convinced this is where to draw the line. |
@mawww Just wondering if this affects your view at all. If not I can close the issue. |
Hello, I agree that from the wording at editorconfig.org, interpreting Editorconfig hence used a wording that made sense to 99% of text editor users, but that does not mean Kakoune has to embrace it blindly. I think it makes sense to have an interpretation of editorconfig that matches both its general intent, and Kakoune design principles, in the case of |
Though I realise this is a separate issue, which I've made here: #3136. |
Here's how I configured indentation:
(full version also configures smarttab's It's honestly silly that the scripts shipped out of the box don't include all of smarttab and parts of something like this. Making the tab key "magic" should be done in a couple lines of config, not a whole screen of config. |
Hi! I think it would help to have a page linked at https://github.com/mawww/kakoune/blob/master/README.asciidoc dedicated to the behavior of the tab key and how it can be tweaked. I've been trying Kakoune for a few weeks and tabs were biting me few times with a language in which indentation changes scope. The code looked right to me, but to the compiler it meant something I didn't expect, giving me hard to debug errors (because tabs were mixed with spaces). |
Like this https://github.com/mawww/kakoune/wiki/Indentation-and-Tabulation? |
@andreyorst yes, like that for example. There's no link to that page in the main documentation page I linked. But then, that page about Indentation-and-Tabulation does not mention interesting facts that are in this thread, for example, that every key pressed in insert mode is inserted into the document, which may be different from other editors, and why is it so. It is also very brief, with no explanations or reasoning. For example "Indentation and Tab handling — Through a mapping" - what is that for? and what is the purpose of "Indentation and Tab handling — Through hooks" ? It seems like what I'm looking for is at the bottom: |
@mawww, it was mentioned several times in this thread, and I've also thought about the fact that there are some languages1 which directly expect spaces to be used for indenation, either because of language parser implementation, or because language standard strongly suggests it. Isn't this good enough reason to include smarttab.kak to the core and handle Tab and > keys through it for better programming experience? This issue has popped up several times, and majority of users expect this thing to be builtin. (Again, it is presented in 99% of editors). Smarttab.kak has barely changed since I've wrote it, and had served me well, as well as other users. I'm fine with it being a plugin, but I still think that this is a first-class feature of any code editor. I know that one of the reasons not to ship it is this, but I think we have better ways to teach users write hooks. 1: Such languages would be all Lisps, Python, Rust. |
That doesn't have any instructions on how to set it up with editorconfig. Also, is it really that common to have have softtabs for indentation, but want to insert literal tab characters in the file? I don't really understand the argument that you shouldn't use to indent, because you can use <alt-;> instead. (and same with vs <alt-;>) |
New user here. Came here to figure out what I was doing wrong because I'd set up editorconfig and it configured the size of a tab but not the behavior of the tab key. Turns out I'm not doing anything wrong and these defaults are deeply surprising. I'm curious who benefits by having the behavior of the tab key be inserting literal tabs regardless of editorconfig? Seems like something anyone working on a spaces-only codebase would immediately be hung up on. |
In theory, everybody benefits from a simpler, more flexible editor core, as I wrote above: #3073 (comment) If a project has If there were one simple, obvious implementation that would make everybody happy, Kakoune would probably do that. In practice, people have different ideas of how things should work, and different levels of willingness to deal with behaviour that isn't quite what they expected. As a general rule, if there's more than one sensible way to do something, Kakoune will not pick one, or try to build a system that provides every option. Instead, Kakoune will do nothing, but will give you the tools to build whatever you want. |
Perhaps what I'm suggesting, at least, isn't that Kakoune change it's core behavior, but that the implementation of the editorconfig do the expected thing with At any rate, I've started using smarttab.kak and it works "fine", I only wanted to add a +1 to the idea that with built-in editorconfig support, I felt like I must be doing something wrong with tab continuing to insert the literal tab character. Perhaps this is just something new users will have to grapple with, and that's OK. |
Steps
.editorconfig
:kakrc
:Outcome
Pressing
Tab
inserts\t
Expected
Pressing
Tab
inserts 4 spacesThe text was updated successfully, but these errors were encountered: