Add new actions#10
Conversation
| bufnr = bufnr or vim.api.nvim_get_current_buf() | ||
|
|
||
| for _, m in ipairs(vim.fn.getmarklist(bufnr)) do | ||
| if M.is_lower(m.mark:sub(2)) then |
There was a problem hiding this comment.
I don't know if I should use m.mark:match("^'[A-Z]") or M.is_lower(m.mark:sub(2). I used is_lower because it may be faster than regex.
There was a problem hiding this comment.
Now I see that I have to import the utils module so it may not be faster. Feel free to comment.
| end | ||
|
|
||
| for _, m in ipairs(vim.fn.getmarklist()) do | ||
| if m.pos[1] == bufnr and M.is_upper(m.mark:sub(2)) then |
| ---@param bufnr number|nil - buffer number to use (default to current buffer) | ||
| ---@param cursor_pos [integer, integer]|nil # (row, col) tuple - mark position to use (default to cursor position) | ||
| M.toggle_mark = function(mark, bufnr, cursor_pos) | ||
| if mark == nil then |
There was a problem hiding this comment.
This could probably be replaced with vim.fn.getcharstr(), but I don't know if that's a good idea
- Simplify input getting
|
Unfortunately |
|
After a positive review I'll add tests for the new actions (or at least try to). |
This PR adds the following actions:
M.toggle_mark)Closes #9