Comments (6)
Thanks for the reply. Looks like this is a feature missing from neovim that may (eventually) be added: neovim/neovim#15527.
In that case, feel free to close this issue as I feel it's a little too far out of the scope of hardtime at the moment.
from hardtime.nvim.
I tried adding a custom hint like this
hints = {
['xi'] = {
message = function()
return 'Use s instead of xi'
end,
length = 2,
},
},
but I can't get it to trigger. I tried with length = 1
, length = 2
, and length = 3
.
Instead of getting my custom message, I just get the same old message. Additionally, I tried adding another hint:
hints = {
['xx'] = {
message = function()
return 'Do not use x multiple times consecutively'
end,
length = 2,
},
},
but I cannot get this one to trigger either.
from hardtime.nvim.
This is because x
same as dl
. So pressing x
is equivalent to pressing dl
.
When you press xi
, it is ultimately interpreted as xdli
, which(dli
) conforms to the ["[^fFtTlt]"
rule, so it matches.
You can use follow script to listener every input key
vim.on_key(function(k)
local mode = vim.fn.mode()
if mode == 'i' or mode == 'c' or mode == 'R' then
return
end
local key = vim.fn.keytrans(k)
vim.notify('k is: ' .. k .. ' , key is: ' .. key, vim.log.levels.WARN, { title = 'test' })
end)
from hardtime.nvim.
It's weird that x actually "presses" dl rather than just doing the underlying operation. For example, the following hint is kind of amusing:
['dl'] = {
message = function()
return 'Use x instead of dl'
end,
length = 2,
},
Each time you press x, it tells you to use x instead 🙃
So I guess hardtime.nvim can't actually distinguish which keypresses are "real" user keypresses. When I try your test function, I get the following notifications:
2024-02-02T09:15:03 test WARNING WARN WARNING | test: k is: x , key is: x
2024-02-02T09:15:03 test WARNING WARN WARNING | test: k is: d , key is: d
2024-02-02T09:15:03 hardtime WARNING WARN WARNING | hardtime: Use x instead of dl
2024-02-02T09:15:03 test WARNING WARN WARNING | test: k is: l , key is: l
This just feels like a very strange behavior of neovim to me.
from hardtime.nvim.
@nullromo hardtime.nvim uses vim.on_key
function to listen to key input. This behavior is expected based on the docs (see :h vim.on_key
)
{fn} will receive the keys after mappings have been evaluated
I currently haven't found other way to listen to the raw key input.
from hardtime.nvim.
Related Issues (20)
- Question: disabling notifications in terminal HOT 1
- can't use C-A C-X to increment/decrement
- feat: daily / weekly / monthly hardtime report
- docs: add vim help file HOT 1
- refactor: plugin state variables
- Key bindings with Space as <leader> stop working HOT 3
- Provide lualine configuration example HOT 3
- Question: Location of `hardtime.nvim.log`
- Mouse is not re-enabled when entering buffer with buftype terminal
- Not picking up j/k repeating when using LazyVim distro HOT 4
- Suggest alternative when blocking repeated keys HOT 1
- hardtime ignores keys mapped to hjkl HOT 2
- Hint timeout HOT 4
- When Installed, I get errors when using telescope HOT 5
- `xi` detected as `li` HOT 1
- Neoscroll compatability HOT 4
- Use D instead of d$ and Y instead of y$ HOT 2
- Feat: Customize popup window HOT 5
- filetype matching doesn't work for types with "-" HOT 4
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 hardtime.nvim.