Closed wilhelmy closed 4 years ago
=
doesn't implement its own indentation logic. It calls indent-region
if the selected region is larger than a line and indent-according-to-mode
otherwise. The other code in the function either tabifies or untabifies the indented region depending on the value of evil-indent-convert-tabs
. There does seem to be a few minor issues with that part of the code, but it mostly works.
When I create a cc-mode
file, more specifically a C file, containing the code
typedef struct {
char *name;
void *fun;
char const * doc;
ptrdiff_t minarity;
ptrdiff_t maxarity;
} ezmq_fun_t;
And run gg=G
I get the expected results with indent-tabs-mode
set to t
, c-basic-offset
set to 8, and evil-indent-convert-tabs
set to t
. It doesn't appear that evil-indent-convert-tabs
matters for cc-mode
since I also get tabs when it is set to nil
.
Like @dzop I'm unable to reproduce this. Please let us know if you can find some better repro steps.
This is still an issue and does not only apply to motion
, but also visual
.
#import "AViewController.h"
@implementation AViewController {
IosServiceProvider *serviceProvider_;
}
- (instancetype)initWithServiceProvider:(IosServiceProvider *)serviceProvider {
if (self = [super init]) {
serviceProvider_ = serviceProvider;
}
}
@end
I have editorconfig set up, so when I indent by hitting tab, it will indent using 4 spaces as specified by editorconfig. If I on the other hand select a region and run evil-indent
it will be indented with 2 spaces. I think it's hard-coded somewhere as all the relevant variables are set correctly AFAIK.
Issue type
Environment
Emacs version: 26.2 Operating System: openSuSE Tumbleweed Evil version: 1.2.14 Evil installation type: spacemacs default Graphical/Terminal: X11 Tested in a
make emacs
session (see CONTRIBUTING.md): NoReproduction steps
cc-mode
withindent-tabs-mode
set tot
andc-basic-offset
set to8
=G
Expected behavior
Code is indented using tab-stops
Actual behavior
Code is indented with 2 spaces instead of tab-stops.
Further notes
From a quick look at the function definition, apparently
==
is special-cased to(indent-according-to-mode)
which does the right thing, while=
otherwise implements its own indentation logic.