You are not logged in.
Since emacs has issues witgh C23 with auto indention falling apart and stuff like that i am temporarily using nano.
And it works pretty good so far and i like it, the only thing is that i can not get bracket matching to work. According to the manual, it is on by default and i have nothing to do to make it work. It doesn't work.
But i can set it by using
set brackets
and
set bracketmatching
i tried those two parameter to but... nothing, no effect. It just gets ignored. All other options like set linenumbers or set autoindent did work fine, just bracket matching doesn't.
Does anyone have any idea why? I tried different terminal emulators, but that is not the issue. Does anyone have working bracket matching in nano? (Again, it should be on by default, so just typing some () or {} should instantly confirm it)
Last edited by Vamp898 (2025-07-15 23:22:45)
Offline
Why not switch to a real editor like https://archlinux.org/packages/extra/x86_64/vim/ ?
Or, for a more shameless self-plug, https://aur.archlinux.org/packages/sqriptor-git (not terminal, but more human-friendly than vim)
Apparently nano handles this via a regular expression, https://unix.stackexchange.com/question … y-brackets and it would be https://man.archlinux.org/man/core/nano … .en#set~27
Offline
Why not switch to a real editor like https://archlinux.org/packages/extra/x86_64/vim/ ?
Or, for a more shameless self-plug, https://aur.archlinux.org/packages/sqriptor-git (not terminal, but more human-friendly than vim)Apparently nano handles this via a regular expression, https://unix.stackexchange.com/question … y-brackets and it would be https://man.archlinux.org/man/core/nano … .en#set~27
So it does work for you? I am trying to verify if it is an bug and it should be reported upstream.
According to the manpage (that you also linked)
The default value is "(<[{)>]}".
That does not work for me. Even explicitly setting this value does not work for me.
This is my .nanorc
$ cat .nanorc
set linenumbers
set autoindent
set matchbrackets "(<[{)>]}"
The first two options work fine, the third does nothing (but nano doesn't complain about it being wrong either).
But again, i should not have to set it to begin with as this is the default value anyway.
Offline
It works for me because I'm not using nano and never had any intentions to do so…
But tried and I don't get what you'd likely expect (highlight the match) but also the nanorc manpage doesn't seem to advertise this and the match is used for https://man.archlinux.org/man/core/nano … indbracket ?
Offline
In that case i might just be misinterpreting the feature. I thought set brackets and set matchbrackets are for highlighting but it seems they are there to find the matching bracket when using the key combo as it seems. I did not do actual work with nano yet, i just wanted to explore its capabilities and it does offer quite some features in its simple package, so i thought it can be used as an workaround until the bug in emacs is fixed. I am well aware that it is an very limited editor and i do not plan and/or want to use it in the long run.
In that case, it looks like this feature simply doesn't exist or it works different than i though it does and manually counting braces is not my thing, so i'll abort the experiment here.
I don't think vim is bad, not at all, i assume it would do everything i want but there is a learning curve i have no time for right now. I know how emacs works and i can use nano (everyone can who can read the bottom of the screen) and i can compensate the lack of tiling with screen which does work fine.
Learning a third editor means learning again how tiling in the editor works, how copy/paste of sections between these tiles work, how the builtin file browser works and so on, all that just to bridge the time until a bug in emacs is fixed (which an workaround exists for) is an rather extreme workaround^^ its like buying a new car because the one i own has flat tires.
Does VIM work with C23 indentation of enums afterall?
The bug in emacs is
typedef enum _Whatever { <-- this works fine
typedef enum _Whatever : uint8_t { <-- this does not (indentation falls apart)
I checked the documentation, there is no mention that this works. According to the source of vim/neovim: https://github.com/vim/vim/blob/master/src/cindent.c and https://github.com/neovim/neovim/blob/m … indent_c.c there seems to be no support implemented for C23 enums either. So in the end, i would hit the exact same bug as in emacs.
So i'll just life with the workaround for a few days until it is fixed in emacs and cancel my very short lifed nano experiment^^
But thanks for your input anyway!
Offline
Does VIM work with C23 indentation of enums afterall?
Yup, just tried. Not sure though whether this is because vim is smart or not trying to be too smart for its own good (ie. just indents because you opened a context and really doesn't care much about the stuff ahead of the brace)
Indention handling in general is quite frankly not great in qscite, so if this makes or breaks your day, don't bother w/ sqriptor anyway…
Offline
With autoindent or smartindent?
I just tested it with the following code
typedef enum _IgePlayerState : Uint8 {
IGE_PLAYER_STATE_BLOCK,
IGE_PLAYER_STATE_IDLE,
IGE_PLAYER_STATE_MOVING_RIGHT,
IGE_PLAYER_STATE_MOVING_LEFT,
IGE_PLAYER_STATE_MOVING_UP,
IGE_PLAYER_STATE_MOVING_DOWN
} IgePlayerState;And Smartindent in vim turns it into this
typedef enum _IgePlayerState : Uint8 {
IGE_PLAYER_STATE_BLOCK,
IGE_PLAYER_STATE_IDLE,
IGE_PLAYER_STATE_MOVING_RIGHT,
IGE_PLAYER_STATE_MOVING_LEFT,
IGE_PLAYER_STATE_MOVING_UP,
IGE_PLAYER_STATE_MOVING_DOWN
} IgePlayerState;But maybe i am doing something wrong as i just scratched together some vim commands from The Internet©®™ so take this with a grain of salt, the issue might be on my side
qscite and sqriptor are both GUI Editors written in Qt, i am not a big fan of GUI Text Editor and/or Qt (Which is partly because i am not a big fan of C++ to begin with). I am using LabWC because i like it simple and small (And in C
if possible)
Offline
if has("autocmd")
filetype plugin indent on
endif is the only thing I ever had indentation-related in my vimrc.
According to https://vim.fandom.com/wiki/Indenting_s … ndentation
'smartindent' and 'cindent' might interfere with file type based indentation, and should never be used in conjunction with it.
When it comes to C and C++, file type based indentations automatically sets 'cindent', and for that reason, there is no need to set 'cindent' manually for such files. In these cases, the 'cinwords', 'cinkeys' and 'cinoptions' options still apply.
Generally, 'smartindent' or 'cindent' should only be set manually if you're not satisfied with how file type based indentation works.
It "just works" and I don't get the mess of your second code block.
I've actually never spent much thought about it either.
Offline
lol im stupid
emacs has an guessing feature. I just gave him an C-File that looks exactly how i want, ran c-guess over it and it produced a finished C-Style i could just set as default and the issue is gone.
And with that, C23 support does work. Its not an fix for the issue at its core, but its an workaround that does exactly what i want. Well in that case, i don't care about the nano issue anymore, i marked it as solved.
Offline