Comments (5)
Turns out it's totally possible to control what char insert on each key press.
For instance the following prevents the s
char from being inserted into the buffer:
vim.api.nvim_create_autocmd({ "InsertCharPre" }, {
callback = function(ev)
if (vim.v.char == "s") then
vim.v.char = ''
end
end
})
However that doesn't include other content modification methods like replacing, pasting, inc, dec .. etc
Also there are 3rd party plugins that can modify the buffer.
I might implement just the char inserting snippet above tho
from hex.nvim.
Hmm, I understand
Yes rn you are allowed to type stuff other than 00 - FF which isn't ideal but afaik there isn't a "sane" way of preventing it.
The way it works is it dumps the bytes of a file into a buffer, you then can edit your "hex/bytes" are with just 00-FF
values and upon saving it would reconstruct the file out of the buffer.
from hex.nvim.
What happens if you put something else there besides 00-FF though? It just feeds that to xxd and it depends on how it handles it?
from hex.nvim.
That might be very suboptimal, but is there a way to put a hook on any key input and if it's within the hex plane, it can filter what input is allowed.
Something like this may be?
from hex.nvim.
Yeah, that sounds like it could improve things somewhat! Like you can check for the allowed range of characters for example.
from hex.nvim.
Related Issues (16)
- media issue
- wierd string at first load HOT 2
- Hex breaks Oil HOT 1
- not seem to work HOT 5
- Writing binary is no longer executable HOT 4
- Not an editor command: LspStop HOT 5
- Add install inscructions for vim plugged HOT 2
- Trouble opening windows executables HOT 6
- vim.lsp.buf.server_ready is deprecated :help deprecated This feature will be removed in Nvim version 0.10.0 HOT 1
- Disable automatic detection for certain filetypes HOT 3
- DAP UI integration? HOT 5
- Error detected | using Blob as a String HOT 1
- Binary Executable breaks on Write Back HOT 3
- disabling or overriding is_buf_binary_pre_read() HOT 3
- Invalid plugin spec HOT 1
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 hex.nvim.