-
Notifications
You must be signed in to change notification settings - Fork 280
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
How to make o/O use 4 spaces or a tab, it does 2 spaces. #1937
Comments
Setting |
Hi, I'm having a similar issue with Go, where pressing Here's what I mean: Peek.2024-10-20.15-55.mp4I think this is indeed an issue with evil-mode, since when I turn it off and press Enter the cursor is placed at Here's the behavior with evil-mode disabled: Peek.2024-10-20.16-01.mp4I've tried every combination of settings mentioned here, including: (define-key global-map (kbd "RET") 'newline-and-indent) ...and other Some guidance here would be deeply appreciated, as I'm not sure what combination of settings or packages is at fault here. I just want Go to have one tab worth of indentation, and for I'm using the same versions as @leimath. FWIW this started happening relatively recently. I can't pinpoint after which upgrade it broke, though. 😞 UPDATE: Managed to hack around this somewhat with: (defun own/newline-and-indent ()
(interactive)
(evil-append-line 1)
(newline-and-indent)
(evil-backward-char 1))
(general-define-key
:states '(normal)
"o" 'own/newline-and-indent)
(general-define-key
:states '(insert)
[return] 'own/newline-and-indent) It's far from perfect, but it removes most of the annoyance. UPDATE2: Nope, this breaks other things, like the behavior when the cursor is between braces... 🤦 Help? 🙏 |
I managed to fix this for me at least partially (for C++ but). I removed the entire The ONLY thing I have for indentation is: (setq c-basic-offset 4)
(setq c-guess-guessed-basic-offset 4)
(setq c-ts-mode-indent-offset 4)
(setq c++-ts-mode-indent-offset 4)
(setq c++-ts-mode-basic-offet 4)
(setq c-ts-mode-indent-offset 4) I frantically added all the variables here as I am not sure which is responsible for setting it. The main issue is that in treesitter mode the indent has to be set with |
Issue type
Environment
Emacs version:
GNU Emacs 29.4 (build 3, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw3d scroll \ bars) of 2024-10-07
Operating System: WSL2 + Ubuntu-24.04
Evil version:
Evil version 1.15.0
Evil installation type: Elpaca
Graphical/Terminal: terminal-emulator (wsltty)
Tested in a
make emacs
session (see CONTRIBUTING.md):Reproduction steps
Open a C++ file.
Go to a line.
Press o.
Expected behavior
I want it so that it either inserts a tab (size: 4) in the next line or 4 spaces.
Actual behavior
Inserts 2 spaces.
Further notes
Noob tries to do stuff with tabs. Why is this so difficult.
I am using evil-collection and evil. I have no clue what to do. Read manuals but cannot wrap my head around which option to set/unset.
The text was updated successfully, but these errors were encountered: