Bug 109338 - Detect indentation method in opened file
Summary: Detect indentation method in opened file
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist with 180 votes (vote)
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-19 18:43 UTC by Full Decent
Modified: 2022-01-20 18:53 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.91


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Full Decent 2005-07-19 18:43:50 UTC
Version:            (using KDE KDE 3.4.1)
Installed from:    Gentoo Packages

When opening a file in Kate, it should be possible to guess settings for "Use spaces instead of tabs to indent" and "Number of spaces" and set them on a per-file basis. Now if I open someone else's file I can continue with their indentation method.
Comment 1 Anders Lund 2005-07-19 20:12:36 UTC
On Tuesday 19 July 2005 18:43, Full Decent wrote:
> When opening a file in Kate, it should be possible to guess settings for
> "Use spaces instead of tabs to indent" and "Number of spaces" and set them
> on a per-file basis. Now if I open someone else's file I can continue with
> their indentation method.


Like other editors, katepart provides to specify settings in the file. Read 
about it in the documentation.

As for content based analysis, code would eb wellcome :)
Comment 2 Dominik Haumann 2010-11-29 16:35:45 UTC
Here is a python script that automatically detects the specified tab-width and indent-width: http://www.freehackers.org/Indent_Finder

This could be translated to javascript and then even be executed by KatePart itself.
Comment 3 Dominik Haumann 2011-07-14 20:36:58 UTC
*** Bug 194014 has been marked as a duplicate of this bug. ***
Comment 4 Jean-Philippe Fleury 2011-10-03 17:44:23 UTC
In a discussion on kwrite-devel, someone wrote:

> I know of the following scripts for Vim that does auto-detection of
> indent settings, perhaps you could look at them to come up with some
> initial ideas:
> 
> https://github.com/ciaranm/detectindent
> https://github.com/vim-scripts/yaifa.vim

See http://lists.kde.org/?l=kwrite-devel&m=130885768709179
Comment 5 Florian Eßer 2013-11-06 08:52:49 UTC
Has there been any activity on this during the last two years?
I often use KDevelop to edit files in multiple projects with different indetation style (Tabs/Spaces) and it's quite annoying having to manually switch every time.
Comment 6 mel 2013-12-30 09:44:54 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Christoph Cullmann 2014-09-14 10:43:06 UTC
> Has there been any activity on this during the last two years?
Hi, not really, sorry.
Any patch is very welcome, thought it must work in a way that doesn't interfere with the settings given by the user for that file.
Comment 8 Christoph Cullmann 2019-05-19 15:05:52 UTC
Dear user, this wish list item is now closed, as it wasn't touched in the last year and no contributor stepped up to implement it.

The Kate/KTextEditor team is small and we can just try to keep up with fixing bugs.

Therefore wishes that show no activity for a years or more will be closed from now on to keep at least a bit overview about 'current' wishs of the users.
If you want your feature to be implemented, please step up to provide some patch for it.

If you think it is really needed, you can reopen your request, but keep in mind,
if no new good arguments are made and no people get attracted to help out to implement it,
it will expire in a year again.

We have a nice website https://kate-editor.org that provides all the information needed to contribute, please make use of it.

Patches can be handed in via https://phabricator.kde.org/differential/

Greetings
Christoph Cullmann
Comment 9 Nate Graham 2019-05-20 16:15:00 UTC
I think this would be useful. *Very* useful.
Comment 10 Waqar Ahmed 2022-01-15 17:08:16 UTC
Implemented in KF 5.90 https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/253
Comment 11 Nate Graham 2022-01-20 18:53:45 UTC
Woohoo!