Skip to content

alexbostock/detect-indent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

detect-indent

A simple program to guess the indentation style used in a given file (assumed to be source code). This is language agnostic; it will not parse the file.

Output is an integer number of spaces, or 0 to indicate indentation with tabs. In case of failure or uncertainty, it will output either 4 or 2, as a reasonable guess.

To compile:

gcc -o ~/bin/detect-indent detect-indent.c

To use indent detection when a file is opened in Kakoune, add this to ~/.config/kak/kakrc:

hook global BufOpenFile .* %{
	set-option buffer indentwidth %sh{ detect-indent "$kak_hook_param" }
}

About

Guess the indent size of a given file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages