nvim-lsp-file-operations
nvim-lsp-file-operations copied to clipboard
Expose a lua API or ex commands for renaming without nvim-tree?
Also came here for this. I don't use a file tree plugin at all and installing one just for the LSP renaming operation feels a bit bad
Yeah, I totally agree. Would be a great addition to the plugin. @IndianBoy42 how would you like the api to look like?
I think for now you can just call this function before moving the files around. https://github.com/antosha417/nvim-lsp-file-operations/blob/master/lua/lsp-file-operations/will-rename.lua#L23-L38
require('lsp-file-operations.will-rename').callback({old_name: "path/to/file", new_name: "new/path/to/file"})
for the API, something like these seems fine to me?
require('lsp-file-operations').rename({ old_name = "foo", new_name = "bar"})
edit: old_name should be optional, defaulting to the current file
@chrisgrieser, do you want it to actually move the files? after calling callback
There should also be a way of specifying which callback you want to call. Right now we have only will-rename but lsp spec supports others. Like did-rename. Or should we call all of them?
I don't have a lot of time to work on this for now. You can try it in your local config and open a pr if you want. I'll happily merge it
@chrisgrieser are you planning to integrate this into genghis wink wink ? :)
@bugabinga No, but I'll gladly accept a PR if someone would wink wink :)