Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smoother custom pairs #403

Closed
wants to merge 2 commits into from
Closed

smoother custom pairs #403

wants to merge 2 commits into from

Conversation

Sam-programs
Copy link
Contributor

#396
sorry for bringing this up again but i tested nvim_win_set_cursor and it never broke the undo blocks only arrow keys broke them

vim.keymap.set("i", "<C-r>", function()
   local set_cursor = vim.api.nvim_win_set_cursor
   local r,c = unpack(vim.api.nvim_win_get_cursor(0))
   set_cursor(0,{r,c + 1})
   set_cursor(0,{r - 1,c + 2})
   set_cursor(0,{r - 1,c - 2})
   set_cursor(0,{1,0})
   set_cursor(0,{r,c})
end)

jump_to_last_pair is safe to add to make custom pairs smoother

@windwp
Copy link
Owner

windwp commented Oct 15, 2023

On mapping, I want to use mapping by key only. Using API functions like set_cursor or set_text might interfere with other plugins. I'm not sure what you mean by 'smoother.' What does this pull request aim to achieve?.

@Sam-programs
Copy link
Contributor Author

Sam-programs commented Oct 15, 2023

well say we define a custom rule for lua then's

  rule("then","end","lua")

the cursor moves/draws twice when we press n

 the|
 thene|nd
 thenend|

because of ctrl-g
it's more noticable in single byte pairs like adding a custom () pair

@Sam-programs
Copy link
Contributor Author

i think i found a better way with lazy drawing

@Sam-programs
Copy link
Contributor Author

Sam-programs commented Oct 15, 2023

yea lazyredrawing seems to make everything super clean with no weird cursor movements

@Sam-programs
Copy link
Contributor Author

@windwp here is what i mean by smoother

proof.mp4

in the video it moves the cursor 2 times at second 5 and second 6(the end),
i am not even using vim.api.* functions anymore just setting lazy-redrawing
and sorry for the quality i didn't have my obs setup properly while recording this

@Sam-programs
Copy link
Contributor Author

also can't we pre-escape keys in utils.lua
instead of having to call utils.esc each time we use them?

Copy link

stale bot commented Dec 16, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Dec 16, 2023
@Sam-programs Sam-programs closed this by deleting the head repository Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants