Skip to content

Commit 6a0a0f0

Browse files
docs(lazyvim): add LazyVim + Neo-tree rename handler guide (#61)
1 parent 110cc94 commit 6a0a0f0

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,36 @@ https://github.com/user-attachments/assets/d10c97dc-a2cd-4a0c-8c4f-d34456362e8b
9898

9999
If you're not using a file explorer, the current alternative would be to manually call `:PympleUpdateImports <source> <destination>` after the file rename operation which will bring up the confirmation window mentioned above.
100100

101+
### 🍰 Using LazyVim
102+
103+
When running **LazyVim**, you may need to forward Neo‑tree’s rename events to *pymple* so that automatic import updates kick in.
104+
Drop the snippet below into your `lazy.nvim` spec (e.g. `plugins/neo-tree.lua`):
105+
106+
```lua
107+
{
108+
"nvim-neo-tree/neo-tree.nvim",
109+
opts = function(_, opts)
110+
local api = require("pymple.api")
111+
local config = require("pymple.config")
112+
113+
local function on_move(args)
114+
api.update_imports(
115+
args.source,
116+
args.destination,
117+
config.user_config.update_imports
118+
)
119+
end
120+
121+
local events = require("neo-tree.events")
122+
opts.event_handlers = opts.event_handlers or {}
123+
vim.list_extend(opts.event_handlers, {
124+
{ event = events.FILE_MOVED, handler = on_move },
125+
{ event = events.FILE_RENAMED, handler = on_move },
126+
})
127+
end,
128+
},
129+
```
130+
101131
### 🦀 Import resolution
102132
By default, pymple will setup a keymap for this (`<leader>li`) which you can change in the configuration:
103133
```lua

0 commit comments

Comments
 (0)