@@ -230,6 +230,10 @@ M.get_state_for_window = function(winid)
230
230
end
231
231
end
232
232
233
+ --- Gets the path to reveal.
234
+ --- @param include_terminals boolean ?
235
+ --- @return string ? bufname_path The non-canonical path (keeps the symlinks in the path without resolving them )
236
+ --- @return string ? realpath The real path of the item to reveal
233
237
M .get_path_to_reveal = function (include_terminals )
234
238
local win_id = vim .api .nvim_get_current_win ()
235
239
local cfg = vim .api .nvim_win_get_config (win_id )
@@ -240,14 +244,22 @@ M.get_path_to_reveal = function(include_terminals)
240
244
if vim .bo .filetype == " neo-tree" then
241
245
return nil
242
246
end
243
- local path = vim .fn .expand (" %:p" )
244
- if not utils .truthy (path ) then
247
+
248
+ local realpath = vim .fn .expand (" %:p" )
249
+ if not utils .truthy (realpath ) then
245
250
return nil
246
251
end
247
- if not include_terminals and path :match (" term://" ) then
252
+ if not include_terminals and realpath :match (" term://" ) then
248
253
return nil
249
254
end
250
- return path
255
+
256
+ local relative_bufname = vim .fn .fnamemodify (vim .fn .expand (" %" ), " :." )
257
+ local bufname_path = vim .fs .normalize (utils .path_join (vim .fn .getcwd (win_id ), relative_bufname ))
258
+ if utils .is_windows then
259
+ bufname_path = utils .windowize_path (bufname_path )
260
+ end
261
+
262
+ return bufname_path , realpath
251
263
end
252
264
253
265
--- @param source_name string
0 commit comments