-
Notifications
You must be signed in to change notification settings - Fork 174
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
[feature request] expand tabs option based on path #1222
Comments
or may be even autodetect.. |
default editor's charset by path is also appreciated |
Please implement if possible. Still hurts. |
See branch edit-live-expandtab |
Great! Will look within a half of an hour. Maybe it is possible to detect indentation style for the first time opened files also? |
Looks working! |
With this simple addition I've got just that I wanted :)
|
Extra fine! Very useful features! But it required clear simple info about current mode. In top status line in Editor some info will be useful:
For example may be it write as: |
May be useful also add in Editor switch to show spaces, tabs and new lines as special symbols (may be more gray than standard text color). For example: each space as |
There is already option Show white space in F9/Options/Editor settings |
Ooops! Fine! Please add keyboard shortcut to on/off show white space in Editor on-fly. May be by F3 or F9, which now free. |
Whitespaces toggling added on Ctrl+F5. This however not saved per file, should it be? IMHO not, but can reconsider.. |
Merged to master, regarding autodetection - may be will do it as an extra option, i just afraid that it will be too much unpredictable |
Let user decide: it may be enabled as fourth "expand tabs" option: "expand new tabs if no tabs present in file". |
There are several examples of tab detection, may be it worth looking at them to select best logic: |
Its still heuristics, no matter how its done. Also, i think if implementing this then need also check 'sibling' files in same in case new file being created or in case algorithm assumed unreliable decision. |
Sounds good |
When you press F5 in tab mode, all tabs in the file are replaced with spaces. I do not think it's a good idea. It would be better to switch to tab mode 2, rather than tab mode 1, so that the switch only affects newly entered characters, not existing ones. |
may be its better to save tabs state only if it was modified explicitly (by F5)? and keep default if it wasnt? |
agree |
Thank you. Very useful features, which usually need in moment to verify real formatting (now in far2l show contrast bright white-spaces with colors equal to text not comfort during regular editing). I think it not need to save individually per file. For me toggle white-space more often action then change tab spaces and may be if it possible switch toggling to 1-key (may be from Clrt+F5 to F3), but here I not sure. |
first i suspect that other still free keys can be used by plugins or by some future useful functionality so i don't like reserving all F-s right now, second all that whitespaces/tabs-to-space convertions are similar and so looks better to be on same F with different mods... |
I agree. Thank you for efforts & fine far2l. May be change F5 to toggle white-space and Ctrl+F5 to toggle space/tab mode? What opinion @unxed about what action more often change tabs or show white-space? |
No opinion. Should use new features for a while before making conclusions. Also, my UX is specific: I use tabs auto detection patch, so do not need to switch tab mode manually often. With all it's simplicity, for all source code files I've tested it with it gave me no failed detections. It uses the last line of the file what starts with a tab character or two spaces to determine the type of indentation. There is sometimes mixed formatting at the beginning of source code files due to different headers and comments, using end of file for auto detection works better because the end of any source code file usually looks something like this:
|
As for determining the tab mode for new files, I could not come up with a sufficiently reliable algorithm. What if it's the first file in the folder? What to do with files with different extensions, like .c and .h? Probably the only reliable solution would be to use per-folder configuration files
If no such file is found in the current folder, far2l should look in parent folders through directory tree up to the root folder. If still no such file found, auto detection should be used, and for the new files global editor setting should be used. Both features, per-folder configuration and tab mode detection should be implemented as optional, being enabled in global configuration like:
With both whose checkboxes disabled far2l should behave just like it behaves now. Also auto detection may be improved by asking user explicitly during opening file: |
maybe this? |
Looks good! |
Wow, libeditorconfig is even available in Ubuntu/Fedora/brew repos!
|
format doesnt look as something much more than usual ini file with few simple extensions so better to avoid extra dependency |
It turns out that several projects I work with already use this format. It's great if far2l starts supporting it out of the box! |
Because now active working with the editor may be also implemented in it quick switching F8 between not only OEM<->ANSI, but also UTF8<->OEM<->ANSI (it will closed #1179). May be even realize for user customization codepages for F8. |
i thought there can be no conflicting rules, now i see that it can and must be ordered, so need some corrections.. Regarding ** - its also not yet supported |
Also I have some problems with my .editorconfig files for far2l, checked on vanilla editorconfig tool, need some fixes. Please apply #1530. |
Still problems :) See calc/.editorconfig, then try to edit calc/src/shared/sgml/tools.cpp.
|
After some experiments I found that far2l treats sections names with relative paths as if we are in folder of file edited, even if applied section is from file located in one of parent folders. |
There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors |
Thanks! In the meantime, I made some attempt to get rid of the mixed indentation in the sources, take a look: #1532 (build error fixed!). By the way, how about running sources (excluding ones that are often upstream-synced) through astyle utility for consistent indentation style and code beautifulness? I experimented with it, works great. And for the cmake there is cmake-format that does the same job. UPD: Verified all far2l's .editorconfig files, now everything seem to work fine, great! |
I suddenly found that Alt+Shift+F9 in editor opens 'local' editor configuration. However it doesnt work for some reason per se, but works if press Win+Shift+F9.
|
Same for Viewer BTW |
Not working for me :( |
In tty-xi Shift-Alt-F9 works fine. Cool thing! Still, tab mode hot keys were very useful during mixed indentation removal that I did in last few days. |
I have language switcher at Alt+Shift, may be this prevents Alt+Shift+F9. So i will reassign it to F9, as Alt+Shift+F9 not obvious and as found - not working sometimes.. |
btw, what is preferred way of indenting multi line
but with tabs indentation it becomes less beautiful:
Or maybe such alignments are not welcomed at all when indenting is done via tabs? |
Btw, github announces .editorconfig support, but diffs are still viewed with 8-space-tabs. What am I doing wrong? |
strange thing. both files should share the same .editorconfig settings |
May be it takes .editorconfig from 'old' revision? |
putty's sources use spaces. far2l uses tabs. Continuously switching between modes produces mixed files, which is mess. It would be great to have an option to configure "expand tabs" editor option differently for different paths.
The text was updated successfully, but these errors were encountered: