Comments (17)
A line can usually be added again in bindings.json
because a key binding is being tried to be set in a plugin when micro is opened. I think you were trying to delete a line so that nothing would happen when pressing a key, but the action can be set as None
so that nothing would happen.
For example, the file would be like this when setting the action of Alt-/
as None
:
{
"Alt-/": "None",
"Ctrl-F2": "command:toggleBookmark",
"CtrlShift-F2": "command:clearBookmarks",
"F2": "command:nextBookmark",
"Shift-F2": "command:prevBookmark"
}
from micro.
Got the OLD file !!!
From WHERE ?
So ?
Because micro at start regenerates that file!
from micro.
The bindings for bookmarks were set BY ME NOT by the plugin for a start.
The plugin tells me something different...
from micro.
As a partial workaround we can (can we?) not to rewrite bindings.json if nothing differs so if bindings weren't changed by plugin, user at least won't see annoying "file is changed"...
Isn't that how it already works? (Unless the last argument to TryBindKey
is true, which I also mentioned in #2647, but that's not a very common case.)
from micro.
Micro writes bindings.json
before opening anything. So you start micro. Micro starts plugins. Plugins register bindings. Micro rewrites bindings.json
. Micro finishes initialization and starts to open file you wanted to open. It looks to already overwritten bindings.json
...
You can even delete the line. Open any file but not bindings.json
. Close micro. Open bindings.json
via vim and see that it was rewritten
The file on disk has changed. Reload file (y,n,esc)
is partially solved by #3009 but IIUC only for settings.json
from micro.
Sorry. I stand my ground.
Start with a small bindings built with vim
Here;
{
"Alt-/": "lua:comment.comment",
"Ctrl-F2": "command:toggleBookmark"
}
:wq!
cat .config/micro/bindings.json shows the file (4 lines) as before.
micro .config/micro/bindings.json
Got msg The file on disk has changed. Reload file (y,n,esc)
Did not reply. Did a cat on another terminal for .config/micro/bindings.json and the file has ALREADY BEEN CHANGED by starting micro. It is.
$ cat .config/micro/bindings.json
{
"Alt-/": "lua:comment.comment",
"Ctrl-F2": "command:toggleBookmark",
"CtrlShift-F2": "command:clearBookmarks",
"F2": "command:nextBookmark",
"F5": "lua:wc.wordCount",
"Shift-F2": "command:prevBookmark"
}
Reply n to micro; Exit micro
micro .config/micro/bindings.json
Got the OLD file !!!
From WHERE ?
So ?
Easy to reproduce.
from micro.
It doesn't open old
version. It generates it each time you run micro. You can open ANY file with micro and it will regenerate the bindings file
from micro.
Sorry you are wrong. THERE IS NO reason fro micro to reinstate configuration lines suppressed by user with the user file at .config/micro/bindings.json
They are user bindings NOT system bindings.
On top micro is adding old user bindings (suppressed by me...).
from micro.
They are the bindings set by plugins.
from micro.
You don't believe me. Just disable your bookmark plugin Ctrl+e
and then type> set bookmark off
after it you can again edit your file to:
{
"Alt-/": "lua:comment.comment",
"Ctrl-F2": "command:toggleBookmark"
}
Micro won't add the lines that was configured by bookmark plugin
from micro.
The bindings for bookmarks were set BY ME NOT by the plugin for a start.
From bookmarks plugin page...
How to use:
While editing, press the default key (F11) to set a bookmark at the current line.
You can also use the command toggle_bookmark from the (Ctrl+E) prompt
Press the default key (F10) to loop through all the bookmarks
You can also use the command next_bookmark from the (Ctrl+E) prompt
To remove a bookmark, press the default key again while the cursor is on the bookmarked line
from micro.
You were right and it is a strange design for configuration files. I did a check within the bookmark plugin before reading your last msg.
config.TryBindKey("Ctrl-F2", "command:toggleBookmark", false)
config.TryBindKey("CtrlShift-F2", "command:clearBookmarks", false)
config.TryBindKey("F2", "command:nextBookmark", false)
config.TryBindKey("Shift-F2", "command:prevBookmark", false)
In fact I did not know the bindings..and took the same I was using with Sublime-Text...I was convinced I did it.
It can be confusing. If you start like this
micro .config/micro/bindings.json
micro load the old bindings.json (modified using vim) and after loading plugins (and adjusting bindings.json) tell you file has been changed...
If you start like this
micro and after opening .config/micro/bindings.json no msg of course.
Thanks anyway.
from micro.
it is a strange design for configuration files.
Yes, it is. If I was @zyedidia I would design it differently.
But we can't just change it now, since we need to preserve compatibility with existing plugins and so on, so...
Anyway, @niten94 has already mentioned the solution for preventing a plugin from forcing its default binding for a key when there is no user-defined binding: bind this key to None
.
from micro.
But we can't just change it now, since we need to preserve compatibility with existing plugins and so on, so...
As a partial workaround we can (can we?) not to rewrite bindings.json
if nothing differs so if bindings weren't changed by plugin, user at least won't see annoying "file is changed"...
from micro.
Yeah, you are right it is a last argument of TryBindKey
in one of my test plugins
from micro.
Yes a solution is to bind some keys to None if you do want plugins to populate keys definition (or to change plugins yourself...).
I was using vi (yep..), vim, neovim, emacs, Sublime-Text, gedit, kate NOT a single editor or plugin's editor is changing configuration files during start.
Plugins are offering sometime default key not anything else. You can of course replace the default.
At least emacs has a discovery help..C-h k to discover if a key sequence is used and vim/neovim have plugin(s) to do it.
from micro.
Currently we have `
At least emacs has a discovery help..C-h k to discover if a key sequence is used and vim/neovim have plugin(s) to do it.
Now we have showkey
command that do the same
from micro.
Related Issues (20)
- Child split pane is "lost" as a result of resizing its parent split pane HOT 5
- Tabmove duplicates tab when tab contains splits HOT 1
- micro shows previous mangled text when scrolling up after resizing the terminal HOT 9
- Proposal: Add relative window coordinates API HOT 4
- [question] Is this project still actively maintained? HOT 4
- Micro sometimes doesn't properly open HOT 12
- `-clean` option doesn't replace folders with proper files
- [BUG 100% reproducible] "invalid memory address or nil pointer dereference" when creating a non-existing file HOT 6
- `Clipboard erorr check` isn't after method that can cause it
- Is it possible to save file to stdin of another program? HOT 1
- Problems with key bindings (using KiTTY) HOT 3
- How to remove the background so it uses the configuration from the terminal? HOT 2
- Pressing `Down` when have "visual multiline selection" moves cursor to the second line of selection instead of end HOT 1
- [Feature request]: autocomplete filetypes
- Help using func (*Buffer) FindNext HOT 2
- `SetActive` doesn't properly work (at least in plugins) HOT 2
- Help using WriteLog() function HOT 7
- Does log pane must have one instance? HOT 6
- Micro uses foot's `bright7` color instead of `default` listed in color scheme file HOT 11
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.