-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[WIP] View based refactoring in workspace #4381
base: master
Are you sure you want to change the base?
Conversation
Yes! I tried to find a plugin in neovim for global searched text replacement, but failed. I know some tricks to do it in neovim with built-in commands and popular plugins like telescope (via sending live grep to quickfix window).
This is the one of the key and important function in my opinion. I can share the experience in nvim: “ all mds under all dirs
:args **/*.md
:argdo %s/pat/replacement/ | update
" or forbid autocmd
:silent! noautocmd argdo %s/pat/replacement/ | update
" restore contents
:argdo undo | update |
Oh cool! This reminds me of Zed's multi-buffers: https://www.youtube.com/watch?v=egI75sLT164 |
Very cool! Would also address #4335 beautifully 💯 |
I love this! Can't wait to have this in core. |
I'm not quite happy with using the enum to separate from a normal file-buffer. |
There are potentially more features that would benefit from custom views (like diff-mode) so there is some overlap there. This approach does however mean that we need commands that behave differently based upon what view is visible. The approach is kind of tricky for this PR because you would have to special case selection commands and introduce a notion of a view without selection but that's it. Ideally you should not have to touch the document or text rendering/positioning itself at all (especially because #5420 will almost fully replace the old rendering/positioning code). Simply calculate the height and offset of each sub-view upfront (and keep it fixed even if text is removed) and then use a simple row-based offset into the view and use a binary search of views to find which views to render (and which not). Since #5420 is mostly done now I might work on such an abstraction next in my quest to get diff-mode working :D |
Yes, one of the main issues here is that the text edit commands use the current document. When more and more things get added to the editor, for example "file-tree view" it makes sense that those things are separate components with their own commands and can have separate key bindings and we can avoid squashing everything into EditorView |
3d18e13
to
f3de299
Compare
Very cool to see this WIP! I was searching to see if there were any plans for something similar to ZEDs multibuffers, and here it is. |
Hello, just to note that before of ZED, vim-esearch was doing that. I used it a lot and is one of my preferred plugins. Maybe give a look into that for ideas :) Hope to see this PR merged asap! |
@pascalkuthe Hi! I'm just a new user but I've found the cursor paradigm extremely powerful and unique so far in Helix. When you say...
and that a |
Hi! Could someone describe what needs to be done to merge this PR? Maybe some of the authors can share a vision of how the feature should look. I can try to take it on and implement it. |
Very good demo. I hope this will be merged to the core. |
@pathwave, are you alive? What happened to this PR ? |
You can check the code . And start new PR based on this PR. It seems this one was abandoned . |
This implements a new command: global_refactor, where one inputs a search regex and a new window shows up with all the lines in different files matching the search.
One can then do edits on the lines and afterwards apply those changes to the documents.
If a file was not opened in the editor from before it will be opened and the change added as a transaction.
This means that the refactoring can be undone in their respective documents.
refactor.mp4
There is still a lot of work to be done but I opened a draft pr to get some feedback: