kakoune
kakoune copied to clipboard
Proposal for indentation settings
Options
indent_style
Specifies the indentation style, whether to use tabs or spaces for indenting.
Possible values are tab
and space
.
Default is space
.
indent_size
Specifies the number of columns used for each indentation level and the width of soft tabs.
When indenting with tabs, the value of tab_width
(if specified) will be used.
Default is 4
.
tab_width
Specifies the number of columns used to represent a tab character.
This defaults to the value of indent_size
and doesn’t usually need to be specified.
Reference
What's wrong with the current system, where indentwidth=0
means "indents are 1 tab"?
Have you tried the editorconfig-load
command? That's generally the best way to set up these settings in kakoune.
An editor should not need to be hacked to support a basic feature. The lack of this feature makes collaboration difficult.
What's wrong with the current system, where
indentwidth=0
means "indents are 1 tab"?
This does not satisfy the feature as described:
Specifies the indentation style, whether to use tabs or spaces for indenting.
indentwidth=0
means "use tabs", any other number means "use spaces". Is that not specifying the indentation style?
Again, I redirect you to my comment about editorconfig-load. The most common way to set these settings is to include an editorconfig file in your project and have kakoune parse it.
https://github.com/mawww/kakoune/blob/f3cb2e434004a718d1225cb0d74c694e66a7248b/rc/detection/editorconfig.kak#L38-L40
@Screwtapello it seems tab stop will always be set to indent_size, so if I want to space, this is my editor config:
end_of_line=lf
charset=utf-8
indent_style=space
indent_size=2
tab_width=0
insert_final_newline=true
trim_trailing_whitespace=true
tab_stop will be 2, I still can not use tab to instead 2 spaces.
I just don't know how to configure my editor config to force the tab to space, I'm new to kak, try learning it.
I figured it out by using smarttab plugin:
with the following editorconfig:
end_of_line=lf
charset=utf-8
indent_style=space
indent_size=2
insert_final_newline=true
trim_trailing_whitespace=true
tab_width=2
and this in kakrc
:
hook global BufCreate .* %{
editorconfig-load
autoconfigtab
}
plug "andreyorst/smarttab.kak" defer smarttab %{
set-option global softtabstop 2
}
You also need to install editorconfig in your system.