Closed JackDinn closed 1 hour ago
I currently wonder why you need a extra lua script, since you could use lua:aspell.togglecheck
directly or can't you?
I cant, it shows an error micro -debug
use Ctrl+e to try: lua:aspell.togglecheck
Unknown command lua:aspell.togglecheck
❱cat log.txt 2024/11/23 17:27:22 Micro started
EDIT: I don't know, I definitely have Lua installed. I have removed and reinstalled micro but it just wont do anything with lua
lua:print("Hello, World!")
outputs Unknown command lua:print("Hello, World!")
❱yay -Qi lua
Name : lua
Version : 5.4.7-1
Description : Powerful lightweight programming language designed for extending applications
Architecture : x86_64
URL : https://www.lua.org/
Licenses : MIT
Groups : None
Provides : None
Depends On : readline
Optional Deps : None
Required By : gpick nmap vlc wireplumber
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 1517.38 KiB
Packager : Anatol Pomozov <anatolik@archlinux.org>
Build Date : Tue 25 Jun 2024 18:41:52 BST
Install Date : Tue 16 Jul 2024 08:59:27 BST
Install Reason : Installed as a dependency for another package
Install Script : No
Validated By : Signature
❱yay -Qi micro
Name : micro
Version : 2.0.14-1
Description : Modern and intuitive terminal-based text editor
Architecture : x86_64
URL : https://micro-editor.github.io/
Licenses : MIT
Groups : None
Provides : None
Depends On : None
Optional Deps : wl-clipboard: for copying/pasting text using Wayland
xclip: for copying/pasting text using X [installed]
Required By : micro-manjaro
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 12.19 MiB
Packager : Alexander F. Rødseth <xyproto@archlinux.org>
Build Date : Wed 28 Aug 2024 12:23:13 BST
Install Date : Sat 23 Nov 2024 17:55:39 GMT
Install Reason : Installed as a dependency for another package
Install Script : No
Validated By : Signature
EDIT:
lua is fine.
❱lua -v
Lua 5.4.7 Copyright (C) 1994-2024 Lua.org, PUC-Rio
⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼ /home/greg ⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼
❱lua
Lua 5.4.7 Copyright (C) 1994-2024 Lua.org, PUC-Rio
> print("hh")
hh
> os.exit()
So i dont know what else to check.
@Andriamanitra: Any ideas? For me it is working, so I assume there is something special with its setup.
The only thing is this plugin that i showed above that says
initlua (0.0.0-unknown)
maybe its a hint what the problem is but i get this.
❱micro -plugin install initlua
Unknown plugin "initlua"
use Ctrl+e to try: lua:aspell.togglecheck
Unknown command lua:aspell.togglecheck
You can't use the "lua:foo.bar" syntax in the command prompt. This syntax is only for keybindings. You can use set aspell.check on
and set aspell.check off
in the command prompt to change the configuration value (there's also a plugin called toggler
that adds a command to toggle any boolean setting). If you want to have a command to toggle the value you can add something like this in your init.lua:
local config = import("micro/config")
function toggleAspell(bp)
bp.Buf:SetOptionNative("aspell.check", not bp.Buf.Settings["aspell.check"])
end
function init()
config.MakeCommand("toggle-aspell", toggleAspell, config.NoComplete)
end
I don't know, I definitely have Lua installed. I have removed and reinstalled micro but it just wont do anything with lua
You don't need to have Lua installed as the interpreter is embedded into micro.
The only thing is this plugin that i showed above that says
initlua (0.0.0-unknown)
maybe its a hint what the problem is but i get this.
❱micro -plugin install initlua Unknown plugin "initlua"
The "initlua" is not a real plugin, it refers to your init script in ~/.config/micro/init.lua
.
What do you get if you run show aspell
and show aspell.check
in micro's command prompt? Does the value for show aspell.check
change if you change the value through the keybinding you have configured? What about if you change it with set aspell.check on
?
show aspell
true
show aspell.check
true
ahh, set aspell.check on
works
hmm, so show aspell.check
was set to true
but that was not working but after i used set aspell.check on
it sets show aspell.check
to on
and set aspell.check off
sets it to off. Neither set it to true
or false
which was what mine was set to (true in this case).
So how do i setup a keybinding to toggle set aspell.check on/off
since my old note/script does not work ?
So how do i setup a keybinding to toggle
set aspell.check on/off
since my old note/script does not work ?
This is, what...
I currently wonder why you need a extra lua script, since you could use
lua:aspell.togglecheck
directly or can't you?
...is used for: bind Alt-l "lua:aspell.togglecheck"
So the root cause most probably was, that aspell.check
was set to a boolean value, while it uses on|off|auto
.
i tried the code i used to use again but it just toggles it back and forth between true/false , but it needs to be on/off.
Something has changed as this used to work.
Anyhow, i have added toggler, but still dont know exactly how to use it to toggle aspell.check on/off.
ok i adjusted my original script,
im still not sure how to use toggler, but never mind.
This work, thank god. I wonder why a toggle-able boolean setting does no longer except true/false but meh.
Cheers @Andriamanitra & @JoeKar
local config = import("micro/config")
function toggleAspell(bp)
if bp.Buf.Settings["aspell.check"] == "on" then
bp.Buf:SetOptionNative("aspell.check", "off")
else
bp.Buf:SetOptionNative("aspell.check", "on")
end
end
function init()
config.MakeCommand("toggleAspell", toggleAspell, config.NoComplete)
end
❱micro --version Version: 2.0.15-dev Commit hash: 04c57704 Compiled on August 28, 2024 ⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼ /home/greg ⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼ ❱micro -plugin list The following plugins are currently installed: initlua (0.0.0-unknown) aspell (1.3.0) autoclose (1.0.0) comment (1.0.0) diff (1.0.0) ftoptions (1.0.0) linter (1.0.0) literate (1.0.0) status (1.0.0) ⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼ /home/greg ⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼ ❱uname -r 6.10.13-3-MANJARO
I used to use spellchecking with micro, i keep a quick note as i always forget how to set it up. This was my note.
However, although this used to work, pressing Alt-l does not do anything now?