Comments (4)
@Andriamanitra How would I get the information that insert mode is active in a lua plugin?
As far as I know the overwrite mode always starts as false so the simplest way is to catch the ToggleOverwriteMode
event:
local micro = import("micro")
overwriteMode = false
function onToggleOverwriteMode(bufpane)
overwriteMode = not overwriteMode
if overwriteMode then
micro.InfoBar():Message("Insert mode ON")
else
micro.InfoBar():Message("Insert mode OFF")
end
end
You may want to use a table instead of a boolean to keep track of insert mode state per buffer but hopefully this is enough to get you started.
from micro.
There are a few possible complementary ways to achieve it:
- When pressing the Insert key, it will show "Insert" or "Overwrite" in the status line
- It can be supported through a function that's available statusformatl / statusformatl , e.g.
$(overwritemode)
You could write a plugin to accomplish either of these two.
- The cursor can change (may not work on all terminals)
This one probably need changes in the editor itself but I'm not sure if it's a good idea when you consider the terminal support issue.
from micro.
@Andriamanitra How would I get the information that insert mode is active in a lua plugin?
from micro.
You may want to use a table instead of a boolean to keep track of insert mode state per buffer
To be precise, it should be per bufpane, not per buffer. Overwrite mode is per pane, and the same buffer may be opened in multiple panes.
from micro.
Related Issues (20)
- Copy from micro to another program does not work when micro running over ssh from Git Bash HOT 5
- Big file is freeze the micro for a while HOT 2
- Feature request: inline options HOT 4
- > replace powerful or confusing? HOT 2
- Cut command is very slowly on Windows Terminal HOT 4
- Is the BufWindow the same as BufPane? HOT 1
- Nightly builds are not the current master branch 😭 HOT 2
- Not working command and comnand switch HOT 2
- Micro 2.0.13 (Windows only) crashes when selecting a directory with "open" HOT 1
- IsWhitespace from util package not working HOT 6
- Alt-Shift-Left or Alt-Shift-Right are not recognized desipte getting detected in raw HOT 2
- Disable micro auto formatting bindings.json when adding new bindings HOT 1
- Garbled contents when reloading file with DOS line endings HOT 4
- Inconsistent keybindings behavior for Alt Shift Combinations HOT 4
- file manager plugin .. go up not work HOT 2
- Feature Request: Editor Width/Margins HOT 2
- JumpToMatchingBrace inconsistent with adjacent unpaired braces e.g. )[ or }( or )( HOT 8
- disable error HOT 2
- Confusion over missing bindings
- Differing copy-paste mechanics between tmux and non-tmux
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micro.