brenton-leighton / multiple-cursors.nvim

A multi-cursor plugin for Neovim that works in normal, insert/replace, or visual modes, and with almost every command
Apache License 2.0
249 stars 7 forks source link

feat: Public a function `add_cursor(row, col)` to add cursor in customized way #7

Closed mrbeardad closed 10 months ago

mrbeardad commented 10 months ago

Public a function add_cursor(row, col) to add cursor in customized way, such as flash.nvim

brenton-leighton commented 10 months ago

I've added a new function in the feat_add_cursor branch. The signature is add_cursor(lnum, col, curswant). Is that OK?

mrbeardad commented 10 months ago

Maybe a seperate init() is required, because keymap set is too early.

mrbeardad commented 10 months ago

You could take a look at this plugin vscode-multi-cursor.nvim

brenton-leighton commented 10 months ago

Maybe a seperate init() is required, because keymap set is too early.

Do you get an error? Is there a problem with settings key maps when add_cursor is called?

mrbeardad commented 10 months ago

Maybe a seperate init() is required, because keymap set is too early.

Do you get an error? Is there a problem with settings key maps when add_cursor is called?

No, I mean, keymap set too earl that I can't type letters to choose label in flash, I need to init keymaps manually

brenton-leighton commented 10 months ago

I'm not sure how flash.nvim works, and I haven't looked much at how this plugin integrates with other plugins. Is there anyway you can create the cursors after choosing labels?

mrbeardad commented 10 months ago

Yes, flash.nvim allow you to search for pattern, and display labels for user to press and jump, (like hop and easymotion). And it provide a hook function to do something when user input a label, for me, I want add a cursor at label position that have choosed

brenton-leighton commented 10 months ago

You can use the disabled_default_key_maps option to disable the key maps the are causing trouble.

Otherwise is there a way you can save the new cursor positions somewhere, then add them all at once?

mrbeardad commented 10 months ago

Otherwise is there a way you can save the new cursor positions somewhere, then add them all at once?

Sounds like a good idea