Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Mario Rocha
    @mariorocha2308
    and i need environment variables
    JackDinn
    @JackDinn
    I cant figure how to turn ON/OFF aspell via a key binding? The setting to turn it on/off in the settings.json is "aspell.check": "on" (or off, auto) but how do i do this as a toggle key binding?
    JackDinn
    @JackDinn
    i can do it by changing it like this at the Micro command:- setlocal "aspell.check" "on" OR setlocal "aspell.check" "off" but i just cant execute it as a key binding.
    Zachary Yedidia
    @zyedidia

    You'll have to use a lua script to achieve this. In ~/.config/micro/init.lua, you can make a function:

    function toggleAspell(bp)
        bp.Buf:SetOptionNative("aspell.check", not bp.Buf.Settings["aspell.check"])
    end

    and then in ~/.config/micro/bindings.json, you can bind this function:

    {
        "Alt-l": "lua:initlua.toggleAspell"
    }
    JackDinn
    @JackDinn
    @zyedidia Ok that sounds like something i can spend a few hours looking into. Hopefully i can figure it out (should be able to). Cheers :)
    JackDinn
    @JackDinn
    @zyedidia unfortunately it will turn off but will not turn back on again, cant see why or even how that is possible as if it works to turn it off with >
    not bp.Buf.Settings["aspell.check"] is the test to toggle it, it must work? scratches head
    Zachary Yedidia
    @zyedidia

    oh I looked at the aspell plugin source and it looks like they are using strings for the option which is confusing (so that they can have an "auto" option). So the option shouldn't be set to a boolean, but rather either the string "on" or "off". Try this -- hopefully it works:

    function toggleAspell(bp)
        if bp.Buf.Settings["aspell.check"] == "on" then
            bp.Buf:SetOptionNative("aspell.check", "off")
        elseif bp.Buf.Settings["aspell.check"] == "off" then
            bp.Buf:SetOptionNative("aspell.check", "on")
        end
    end

    You can add behavior if the option is "auto" too if you want.

    JackDinn
    @JackDinn
    Thought it might be the "auto" option, great stuff :)
    yep thats got it. Many thx @zyedidia
    Dmitry Maluka
    @dmaluka
    By the way, here is my lua script: https://github.com/zyedidia/micro/issues/2086#issuecomment-826351299 which adds generic "toggle" and "togglelocal" commands for toggling on/off arbitrary boolean options.
    Perhaps I should release it as a plugin. Or maybe it's better to implement these commands in micro itself (either in Go or just by adding my script as a built-in plugin), to make them available out of the box. @zyedidia what do you think? It's a useful functionality, I see quite a few people ask for it.
    Zachary Yedidia
    @zyedidia
    yeah I think that would be a useful builtin command
    JackDinn
    @JackDinn
    Well this was working just great when we last spoke about it but today when i first want to actually use it (turn off spell checking) its all failing. I have no clue why. setlocal "aspell.check" "on" & setlocal "aspell.check" "off" dont work any more neither does the lua toggle script function. I dont think i did anything to break it. What is the syntax to get a terminal out so i can at least see whats happing inside the function?
    JackDinn
    @JackDinn
    O my mistake, i remembered i had to actually write something before it would "activate/deactivate" not just move the cursor around. Sorry ^^
    Theo
    @C34A

    Hey, does anyone know for sure if net/http is working in lua? I'm not sure if I'm doing something wrong, but this code:

    local http = import("net/http")
    
    function init()
        micro.Log(http)
        micro.Log(http.Get)
        micro.Log(http.Get("http://127.0.0.1:9000/testfile.txt"))
    end

    gives me a runtime error: invalid memory address or nil pointer dereference on any of the lines in init...

    Theo
    @C34A
    nevermind, seems to just be broken in 2.0.6 from apt, building from source it works
    AspirusFromScratch
    @AspirusFromScratch
    HI
    the
    mussol
    @muzzol:matrix.org
    [m]
    hi there
    I'm looking for a color scheme with blue background, similar to mcedit
    is there anyone around?
    Mikko
    @Andriamanitra
    Is it intended that plugins (including the built-in lua:comment.comment) modify bindings.json on every start-up? It's pretty weird, I would expect the plugins to modify it once when they are installed and if I later decide to remove some keybindings just let it be
    Rohith
    @Rohith04MVK
    Hi noob here, How to change the font size?
    priner
    @priner:matrix.org
    [m]
    In your terminal emulator's settings
    AspirusFromScratch
    @AspirusFromScratch
    how to
    make micro
    wiat no
    bye
    /join #voidlinux
    Al-Thorn
    @alopop:matrix.org
    [m]
    Hi there. I couldn't find a way to resize splits. Apparently, you can drag the split separator but Micro's mouse support in Windows terminal seems to have stopped working after v2. Is there a command that allows me to resize splits?
    vivekkoul1
    @vivekkoul1
    How can I open the internal terminal window in micro editor and also text editor simultaneously? I want to see the output and my source code in seperate windows.
    Dmitry Maluka
    @dmaluka
    @Andriamanitra Plugins don't modify bindings.json on every startup, they add a binding only if there is no binding for the given key in bindings.json yet. You can add a binding to None to prevent plugins from installing their own bindings for this key.
    priner
    @priner:matrix.org
    [m]
    @vivekkoul1: you can use vsplit or hsplit command and then run term in one of the splits
    Mohammad Saadman
    @msn-05
    Hello guys!
    pls see this 😃
    João Paulo Albuquerque
    @joaopauloalbq
    I'm not able to edit root files without using "sudo" first :(
    Any tips?
    Zachary Yedidia
    @zyedidia
    I believe that was an issue with 2.0.9 that has been fixed, so you can download the nightly (https://github.com/zyedidia/micro/releases/tag/nightly) or build from master
    João Paulo Albuquerque
    @joaopauloalbq

    I'am using Version: 2.0.9
    Commit hash: 6bc498e6
    Compiled on May 17, 2021

    from Manjaro repository

    Merith
    @Merith-TK
    uhm
    I need to find the docuentation for plugins...
    João Paulo Albuquerque
    @joaopauloalbq
    nightly fix that indeed, thank u @zyedidia :)
    Mario Rocha
    @mariorocha2308
    Hi , friends .. I´ve installed micro in windows with my hyper terminal and say bash micro command not found
    _Arabica
    @PeriodGamingYT
    I have installed micro on many of my computers, works perfectly!
    Kristoffer Franzon
    @KrissLaCross
    Hey! Quick question: can I force hide the ruler from inside a plugin?
    Kristoffer Franzon
    @KrissLaCross
    Never mind! It was as easy as SetOptionNative('ruler', false)
    Kristoffer Franzon
    @KrissLaCross
    How would one run micro specific commands from inside a plugin? It seems like ExecCommand/RunCommand/RunBackgroundShell only run native shell commands. In my case I would like to run micro commands like "open 'file'" or "cd 'path'"
    ice-be
    @ice-be
    is micro has an internal terminal
    1 reply
    Zachary Yedidia
    @zyedidia
    I think buffer panes have a method HandleCommand which will execute the given command.