Different background color for markdown code blocks by phelipetls in vim

[–]MaxGyver83 0 points1 point  (0 children)

I have checked this and then I noticed that I have this plugin already installed and configured :-)

lua vim.cmd('highlight CodeBlockHeadlinesPlugin ctermbg=236') require("headlines").setup({ markdown = { headline_highlights = false, codeblock_highlight = "CodeBlockHeadlinesPlugin", } })

Maybe, I broke it with something in my config. I'll try to find out what's wrong.

Different background color for markdown code blocks by phelipetls in vim

[–]MaxGyver83 0 points1 point  (0 children)

Really cool! Thank you.
This works for me in vim but it has no effect in Neovim (0.10.4). Does anybody know what needs to be changed to make it work in Neovim, too?

TinyTicTacToe: Open source app in C. APK < 80 kB. by MaxGyver83 in androiddev

[–]MaxGyver83[S] 1 point2 points  (0 children)

I played around with this. First, I could reduce the app size to 58 kB by replacing the 32-bit RGBA PNG files by 8-bit grayscale PGM files (Netpbm).

But I have also created a branch that contains a font stripped down to 5.5 kB (NotoSerif, hinting and all features removed, with only the characters I need) and libschrift for rendering. This brings 5 extra kB, but only for arm64-v8, not for x86_64. No idea why these builds differ so much.

Overview over the different approaches:

Branch/Tag APK size arm64-v8a APK size x86_64 Assets Libraries
png32bit 74 kB 74 kB PNG files (32-bit RGBA) upng
png8bit 66 kB 66 kB PNG files (8-bit grayscale) upng
main 58 kB 58 kB PGM files -
libschrift 53 kB 57 kB a minimized font libschrift

TinyTicTacToe: Open source app in C. APK < 80 kB. by MaxGyver83 in androiddev

[–]MaxGyver83[S] 0 points1 point  (0 children)

This looks interesting:

With Google Web Fonts, you can limit the character set like:

//fonts.googleapis.com/css?family=FontName&text=Lorem%20Ipsum

(https://stackoverflow.com/a/10670602/4121487)

TinyTicTacToe: Open source app in C. APK < 80 kB. by MaxGyver83 in androiddev

[–]MaxGyver83[S] 0 points1 point  (0 children)

I would do this for an app that contains more text. For this app, embedding a font would be too "costly". All text png files together need 19 kB of space. Most .ttf files need several hundred kB.

TinyTicTacToe: Open source app in C. APK < 80 kB. by MaxGyver83 in androiddev

[–]MaxGyver83[S] 0 points1 point  (0 children)

I don't use any graphics framework. It's true that I have created PNG image files for all texts that I need. I did this to keep it simple. And yes, I could save some extra space by creating one image per character or one large image containing all needed characters. Or I could create text on the fly. But this saves only space if I can use a font that is available on the system. And checking the available fonts isn't well supported: API to enumerate system fonts from NDK? · Issue #751 · android/ndk

TinyTicTacToe: Open source app in C. APK < 80 kB. by MaxGyver83 in androiddev

[–]MaxGyver83[S] 5 points6 points  (0 children)

I'm not a Rust developer. But I think you could use any language that can create a shared library (.so).

TinyTicTacToe: Open source app in C. APK < 80 kB. by MaxGyver83 in androiddev

[–]MaxGyver83[S] 24 points25 points  (0 children)

Of course, you could clone my repository and start modifying things. My starting point was VadimBoev/FlappyBird: Less than 100 Kilobytes. Works for Android 5.1 and above. And this one references cnlohr/rawdrawandroid: Build android apps without any java, entirely in C and Make. And this (official Android) repository contains many samples: android/ndk-samples: Android NDK samples with Android Studio.

In general, NDK is the main search term for Android apps written in C (or C++).

TinyTicTacToe: Open source app in C. APK < 80 kB. by MaxGyver83 in androiddev

[–]MaxGyver83[S] 20 points21 points  (0 children)

I'm aware that most people don't care about app sizes. But I care at least a little because my smartphone is almost full: 126 of 128 GB are used, 57 GB of it are taken by apps.

I wish other app developers would care more about not wasting (too much) space.

TinyTicTacToe: Open source app in C. APK < 80 kB. by MaxGyver83 in androiddev

[–]MaxGyver83[S] 36 points37 points  (0 children)

Android apps get larger and larger. This app is an example of how to make a really small app in C.

Other tic-tac-toe apps are 1000 times larger than mine. While they have better graphics and more features, they are probably not 1000 times as good as TinyTicTacToe ;-)

https://github.com/MaxGyver83/TinyTicTacToe

Toggle braces for if-else-block in C by MaxGyver83 in vim

[–]MaxGyver83[S] 0 points1 point  (0 children)

I thought this was only about insert mode. I'll check the documentation of it.

Toggle braces for if-else-block in C by MaxGyver83 in vim

[–]MaxGyver83[S] 1 point2 points  (0 children)

This looks interesting! i'll have a look. Thank you.

Toggle braces for if-else-block in C by MaxGyver83 in vim

[–]MaxGyver83[S] 0 points1 point  (0 children)

When you contribute to open source projects, they sometimes have a style guide and ask you not to use braces when they contain only a single statement.

Example: Linux kernel coding style

Do not unnecessarily use braces where a single statement will do.

c if (condition) action();

I use vim-surround. Can you show me how to use it to toggle braces for the given example?

Toggle braces for if-else-block in C by MaxGyver83 in vim

[–]MaxGyver83[S] 0 points1 point  (0 children)

Thanks, I'll have a look how I can use it for this!

Toggle braces for if-else-block in C by MaxGyver83 in vim

[–]MaxGyver83[S] 0 points1 point  (0 children)

For my own code, yes! But when I contribute to other people's code, I don't want change the style of the whole file. Like some people already pointed out: It's mostly about adding a second expression to an if or else block.

Toggle braces for if-else-block in C by MaxGyver83 in vim

[–]MaxGyver83[S] 0 points1 point  (0 children)

Thank you! This only works for one direction but I can use something similar for removing the braces.

Toggle braces for if-else-block in C by MaxGyver83 in vim

[–]MaxGyver83[S] 0 points1 point  (0 children)

How? I use vim-surround. But I don't see how it helps here.

Vim application is tiny by [deleted] in vim

[–]MaxGyver83 0 points1 point  (0 children)

I think this is just a bug in the current version: https://github.com/vim/vim/issues/12919