Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ghost
    @ghost~611c31d06da0373984835e8b
    thanks!
    SwitchAxe
    @SwitchAxe

    hello. Are there any updates on zyedidia/micro#2059 ?

    so?

    lrapava
    @lrapava:matrix.org
    [m]
    Hello, I enjoy using the Micro text editor, but, unfortunately, I know neither Go or Lua. Is this the right place to request features/report bugs?
    lrapava
    @lrapava:matrix.org
    [m]
    I've switched from sudo to doas (and, since I didn't need sudo anymore, uninstalled sudo). Unfortunately, If I forget to write "doas" before "micro /path/to/read-only/file/" if I try to save changes micro doesn't recognize that sudo isn't installed and can't save the changes. For those who don't know, doas is like sudo but without a bunch of features most desktop users don't use anyways. It's a BSD thing but is also ported to Linux. The reason why [most] people switch to doas is that it's source-code is smaller and less code -> probably less bugs -> smaller attack surface, so having both sudo and doas is pointless (since it would only increase attack surface).
    Zachary Yedidia
    @zyedidia
    You can use the sucmd option to configure micro to use doas instead of sudo for saving
    lrapava
    @lrapava:matrix.org
    [m]
    Thanks for your response. Unfortunately "micro -sucmd doas" doesn't work.. Am I doing something wrong?
    lrapava
    @lrapava:matrix.org
    [m]
    To be more specific, "micro -sucmd doas /path/to/read-only/file" does work, but it still tries to run sodo when I don't write "-sucmd doas"
    Is there a more.. permanent solution?
    Zachary Yedidia
    @zyedidia
    If you run > set sucmd doas from inside micro the option should be permanently set to use doas.
    lrapava
    @lrapava:matrix.org
    [m]
    Thanks, that worked! Unfortunately it still writes sudo instead of doas in the editor, but it's not a major issue
    It does run doas though after hitting the y key
    Zachary Yedidia
    @zyedidia
    Ah I see, thanks for the info, I'll push a commit that fixes the message
    lrapava
    @lrapava:matrix.org
    [m]
    There's also another bug I've experienced
    Ctrl+/ comments the line cursor is on
    if you just run micro and try to use ctrl+/ it adds "#" to the beginning of the line the cursor is on
    and it keeps doing that even if you save the file as, let's say, a C++ file (.cpp)
    instead of adding "//" in front of the line
    lrapava
    @lrapava:matrix.org
    [m]
    The key binding works properly if you run "micro /path/to/file" or "open /path/to/file" (in micro)
    lrapava
    @lrapava:matrix.org
    [m]
    This video probably demonstrates the bug better
    That's not a correct behavior because C and C++ use "//" for inline comments
    The bug is likely not only C/C++ specific though
    iirc I've experienced the same bug with html and javascript
    Zachary Yedidia
    @zyedidia
    Thanks, yes it looks like the comment plugin doesn't update its filetype when a file is saved with a new name
    1 reply
    Zachary Yedidia
    @zyedidia
    I have pushed a commit that fixes this problem.
    lrapava
    @lrapava:matrix.org
    [m]
    And here's the last issue I've encountered so far.. I was playing around with reactjs and it seems like javascript syntax highlighting is broken
    You've made transition from GUI text editors to a terminal text editor so easy!
    Zachary Yedidia
    @zyedidia
    I'm glad! The javascript syntax highlighting is fairly primitive and doesn't have support for embedded html like that. It might be worth opening an issue to see if other people have solutions for this.
    lrapava
    @lrapava:matrix.org
    [m]
    The code runs without any issues. It's not pure javascript, it's javascript+reactjs. The html-like code you are seeing is JSX and it works perfectly fine with react
    Zachary Yedidia
    @zyedidia
    Yeah unfortunately micro doesn't have good syntax highlighting support for jsx/non-standard javascript.
    lrapava
    @lrapava:matrix.org
    [m]
    Welp, that's unfortunate. Reactjs is a pretty popular library..
    lrapava
    @lrapava:matrix.org
    [m]
    btw, where can I learn how to make syntax files?
    completely ignoring JSX code would be a good-enough solution for me
    Zachary Yedidia
    @zyedidia
    To disable syntax highlighting you can turn the syntax option off. In ~/.config/micro/settings.json you could make a local option that disables syntax highlighting for *.js files (see the section "Global and local settings" in > help options).
    To learn more about syntax files, see the second half of > help colors, and you can look at all the existing syntax files at https://github.com/zyedidia/micro/tree/master/runtime/syntax
    lrapava
    @lrapava:matrix.org
    [m]
    I've found this (temporary) solution
    I've added another multiline comment that starts with //JSX_start and ends with //JSX_end
    the text editor thinks that the JSX code is a comment
    But javascript ignores //JSX_start and //JSX_end, because it thinks it's just an inline comment
    Zachary Yedidia
    @zyedidia
    Cool! You could probably even use include to get html highlighting within those comments
    but you would have to be careful of recursive includes
    you might need a stripped down html highlighter if you want to do that
    lrapava
    @lrapava:matrix.org
    [m]
    I may try to add proper ReactJS/JSX support later...
    lrapava
    @lrapava:matrix.org
    [m]
    You can find it on the plugins page
    If I knew where the source-code for the web-page (https://micro-editor.github.io/plugins.html) is I'd remove it myself, but I have no idea where to find it
    Zachary Yedidia
    @zyedidia
    thanks i fixed it