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

auto-center option for the move submodule #472

Open
perrin4869 opened this issue Jul 19, 2023 · 2 comments
Open

auto-center option for the move submodule #472

perrin4869 opened this issue Jul 19, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@perrin4869
Copy link

Is your feature request related to a problem? Please describe.
Would be nice to have an option to automatically enable auto-centering when executing a move command, similar to the following mappings:

nmap G Gzz
nmap n nzz
nmap N Nzz
nmap } }zz
nmap { {zz
nmap ) )zz
nmap ( (zz

Describe the solution you'd like
Have an option such as autocenter = true/false inside the move submodule that would execute zz after each move... or maybe better, have a TreesitterTextObjMove autocmd to be able to execute zz in after each move?

@perrin4869 perrin4869 added the enhancement New feature or request label Jul 19, 2023
@gmtstephane
Copy link

Up on this.
Is anyone able to somehow achieve this ?

@gmtstephane
Copy link

At the moment, i reset the binding in the config and use TS command directly .
It works great

map(
	"n",
	"]]",
	":TSTextobjectGotoNextStart @function.outer | lua vim.cmd('norm zz') <CR>",
	{ remap = true, desc = "Go to next function and center the cursor" }
)

map(
	"n",
	"[[",
	":TSTextobjectGotoPreviousStart @function.outer | lua vim.cmd('norm zz') <CR>",
	{ remap = true, desc = "Go to previous function and center the cursor" }
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants