1

I would like to get a file path or a file name in netrw easily.

Is there any way to get a file path or a file name in netrw of Vim?

Atsushi Sakai
  • 938
  • 10
  • 22
  • Remark, `s:NetrwGetWord()` function gets the filename under the cursor, but need a hack to call the s: functions https://vi.stackexchange.com/questions/17866/are-script-local-functions-sfuncname-unit-testable – user202729 Dec 28 '22 at 14:52

1 Answers1

0

You can select the file name under cursor in netrw, copy it to the buffer with y and enter the following command: :echo @%."/".@".

Explanation: @{0-9a-z".=*+} executes the contents of the register {0-9a-z".=*+}. The % register is a name of the current file. For netrw, this is the name of the open directory. The " register contains the copied file name. The . operator means concatenation of the strings in the vimscript.

jubnzv
  • 1,526
  • 2
  • 8
  • 20