vosjedev

joined 1 year ago
5
submitted 7 months ago* (last edited 6 months ago) by [email protected] to c/[email protected]
 

Hi!

I am trying to set up arduino autocompletion and syntax highlighting. I followed some of the instuctions in an issue on the github adding that to my own common sense, and it mostly overlaps now. But the syntaxhighlighting is still not there, and neither is autocompletion.

My ~/.config/helix tree looks like this now:

.
├── config.toml
├── languages.toml
├── runtime
│  └── queries
│     ├── arduino
│     │  ├── folds.scm
│     │  ├── highlights.scm
│     │  ├── indents.scm
│     │  ├── injections.scm
│     │  └── locals.scm
│     └── cpp
│        ├── folds.scm
│        ├── highlights.scm
│        ├── indents.scm
│        ├── injections.scm
│        └── locals.scm
└── themes
   └── molokai-edit.toml

and the relevant content (I removed some markdown stuff for this post) of languages.toml:

[language-server.arduino]
command = "./arduino-language-server" 
args=["-clangd","/usr/local/bin/clangd","-cli","/usr/local/bin/arduino-cli","-cli-config","~/.arduino15/arduino-cli.yaml","-fqbn","arduino:avr:uno"]

[[grammar]]
name = "cpp"
source = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "a90f170f92d5d70e7c2d4183c146e61ba5f3a457" }

[[grammar]]
name = "arduino"
source = { git = "https://github.com/ObserverOfTime/tree-sitter-arduino", rev = "db929fc6822b9b9e1211678d508f187894ce0345"}

# [...] < here was some config for markdown

[[language]]
name = "arduino"
scope="source.arduino"
file-types=[ "ino" ]
language-servers=[ "arduino" ]
injection-regex = "arduino"
comment-token = "//"
roots=["sketch.yaml"]

I also installed the packages arduino-language-server (with dep clangd) and arduino-cli from the arch repos.

I just remembered: I am using the helix-ext AUR package (which means I am still on 23.10.2), to be able to use the file tree on the left. here is the repo. Could that be the issue?

I have no idea anymore what I am doing wrong, could anyone tell me? If you need more information to help, just ask for it.

addition (14-4-24):
As I switched to nvim (lack of features in helix), I am not interested in setting this up anymore. Thanks!

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

So I changed some other things to improve detection. I will update the post. But nice idea adding a hint! I personaly did that in a hint command also specifying other shortcuts and aliases about my zsh config.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

No, but I can make one.

edit:
Here it is.
There are also system config files of regolith (the i3-based de I am using). If you need those configs, just ask me, or look them up.
Here are the filelistings of those (the system configs):

% ls /usr/share/regolith/common/config.d /usr/share/regolith/i3/config.d
/usr/share/regolith/common/config.d:
15_base_launchers  30_navigation  40_i3-swap-focus  40_next-workspace  40_workspace-config  50_resize-mode  82_rofication-ilia  84_ftue  88_network-manager

/usr/share/regolith/i3/config.d:
20_ilia  35_gaps  40_default-style  55_session_keybindings  60_config_keybindings  70_bar  80_compositor  86_unclutter
 

How do I remove the dots in my i3bar?
I made a screenshot of the dots here:
dots.png (sorry for linking to my own site, lemmy complains about image being to big for no reason)

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

Yea, so I updated the post with my current solution. Also, I moved away from ubuntu touch, because of lomiri not supporting X apps like libreoffice. Therefore I do not recommend ubuntu touch... But I am going to try postmarketos+kde plasma mobile. I will update if that works better.

[–] [email protected] 0 points 1 year ago (2 children)

I almost live in my terminal...

But can you run lomiri on X? Mir is like wayland, where the shell and the wm are bound to the display server, and they work on that specific display server right? If it would be possible to run lomiri on X, I an trying that immediatly!

[–] [email protected] 1 points 1 year ago (4 children)

Ah. Ubuntu touch has the driver included, you just need to activate it. It is still the buggy driver, but it is a driver.

I am liking the experience a lot, for me it works fine, exept for the screen being rotated. I would suggest getting one.

I will have to say bluetooth also does not work yet, and kde (the default with danctnix) does not work really wel with a touchscreen.

 

I recently got a pinetab2, and I booted it into ubuntu-touch, running lomiri. But the screen orientation is the wrong way (portrait). I am not interested in autorotate, so how would I force the screen orientation of a mir-based desktop to landscape? If you need more info to help me, just ask for it.

edit:
Yesterday while writing this I didn't have much time, so I forgot to mention the accual problem...
The problem I'm having is that the autorotation sensor always reports portait mode, even when in landscape. It does report a change. I know this because it switches to desktop mode when I rotate with the keyboard plugged in.
edit while writing previous edit:
Now it does not even go to desktop mode anymore... So I guess it is now stuck even more.

My solution was either disabling the rotation sensor's driver to make lomiri default to the set rotation in /etc/ubuntu-touch-session.d/flo.conf, or fixing the driver so it reports orientation correctly.

edit 2: I currently solved this by editing /etc/deviceinfo/devices/pinetab2.yaml and removing all supported rotations except InvertedLandscape. This means it can't autorotate at all, but I wasn't interested in autorotate in the first place. If someone knows how to fix the driver and make autorotate work correctly, please let me know.

[–] [email protected] 1 points 1 year ago (4 children)

Thanks for your reply! This made me think: could I bind enter to newline and alt-enter to accept, which then made me think if it was possible to have enter to accept and alt-enter to newline on first line only, after that in reverse. That made me think of the script I added to the post.

But serious, without this I would have never thought of doing what I did.

[–] [email protected] 1 points 1 year ago (6 children)

I updated my post to be clearer.

[–] [email protected] 0 points 1 year ago

because it is a python shell, not a posix shell. and, my python broke, and I don't know how to solve that (but I am not lokking for help with that :)

[–] [email protected] 0 points 1 year ago

ah, I updated the post to be clearer :).

 

Some time ago I found xonsh which is a python-based shell. It had really good multiline support, and I am searching for a shell with sameish multiline support as xonsh. Fish shell also has good multiline support, it is around the same level, but it is not posix compatible. I want a shell that has that kind of level of multiline, but zsh (bash is also fine) compatible.

Does anyone know of one?

edit: based on the replies, I get this is unclear. My problem with zsh is that if i press enter and it starts a new line, I can't get back to the prevous line, because a new prompt is started. In fish this is possible, all lines are one prompt. But, fish is not posix compatible. So, I guess I want a posix-compatible shell with fish-like lines (multiple line) editing. I wanted zsh support to keep using my custom oh-my-zsh prompt, but remaking it for a new shell is not a big problem. Sorry for being unclear.

edit 2: solution is here! Thanks to @[email protected] I started thinking and made the following: When on the first line, enter accepts and alt-enter inserts a newline. When not on the first line, enter inserts a newline and alt-enter accepts. Here is the code to put in your .zshrc:

# MULTILINE!!!
bindkey '^[e' push-line-or-edit

# enter accepts when only one line found, else creates newline
function _zle_ml_enter {
    if ! [[ $BUFFER == *$'\n'* ]]; then
        zle accept-line
    else
        zle self-insert-unmeta
    fi
}
zle -N _zle_ml_enter
bindkey '^M' _zle_ml_enter

# alt-enter accepts when more than one line found, else creates newline
function _zle_ml_meta_enter {
    if [[ $BUFFER == *$'\n'* ]]; then
        zle accept-line
    else
        zle self-insert-unmeta
    fi
}
zle -N _zle_ml_meta_enter
bindkey '^[^M' _zle_ml_meta_enter

edit:
changed if [[ "$BUFFERLINES" -le 1 ]]; then to if ! [[ $BUFFER == *$'\n'* ]]; then and if [[ "$BUFFERLINES" -gt 1 ]]; then to if [[ $BUFFER == *$'\n'* ]]; then for improving detection. Also added alt-e shortcut because I had that configured myself but forgot to add here.