Indentation in code block

The improved code block is awesome!

However, I noticed that the editor still won’t indent automatically after I hit return for a new line. The cursor will appear in the head of the line. The screenshot looks like this:

image

This condition also appeared in the production version. I am looking forward to transferring my notes from Quiver to Bear :smiley:

4 Likes

For languages that use brackets, I would also like if while in a code block the second bracket gets added for you. If I type { and hit enter, it should skip a line and add the second bracket for me. This should work if I type { and hit space, then it would add a space and the second closing bracket.

2 Likes

For languages that use brackets, I would also like if while in a code block the second bracket gets added for you.

While I get that some people like that, it is something I always want to turn off if I can. I’ll type my own brackets, thanks, particularly in code.

I just want the option. Type your own brackets. I’d rather have a code block be smart enough to complete it for me.

Absolutely! With you as long as it’s optional : )

Aren’t auto-bracket closing and similar features a code editor or IDE feature.

I never thought that someone would actually write code in Bear.

A suggestion to the devs would be to map ⌘⌥A to select just the text of the current block, which would make it easy to quickly select all the lines of code to copy and paste it to your code editor/IDE of choice to make use of advanced completion features.

Notion actually has a button at the top right of their code blocks to copy code to clipboard. It’s a really great feature. Would love that in Bear’s code blocks too.

1 Like

I’m a CS student, so I store a lot of code snippets in bear. Since I spend a lot of time in IDEs, I expect the automatic ) and ].

It would also be great if (like an IDE), highlighting a passage and typing ( wrapped the passage in (brackets) instead of deleting the text, same with wrapping in ` backticks `

I like your suggestion of copying the entire code block, maybe include a button in the top right for that purpose?

Hello everyone!

Thank you for all the pointers, please keep in mind that Bear is not an IDE and it’s not meant to write code into it and many features like auto-bracket are not planned at the current state.

BUT we want to make the code block as good as possible, so copy/paste and basic editing facilities will arrive at some point :slight_smile:

1 Like

The thing I care about the most though is horizontally scrolling code blocks. Wrapped code blocks are ugly and make them awkward to read. I can always paste code into a code block or select the text and cmd + c. I can also manually enter my own brackets. But, I cannot make the code block scroll. That’s the feature I’d love to see the most when it comes to code blocks.

3 Likes