File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 190190
191191k (" y%" , yank_current_path , { desc = " Yank filename (relative)" })
192192
193+ local function yank_current_path_and_line ()
194+ local path = vim .fn .expand (" %:." )
195+ if path == " " then
196+ vim .notify (" No file name" , vim .log .levels .WARN )
197+ return
198+ end
199+ local line = vim .fn .line (" ." )
200+ local result = (" %s:%d" ):format (path , line )
201+ vim .fn .setreg (" +" , result )
202+ vim .notify ((" Yanked %s" ):format (result ), vim .log .levels .INFO )
203+ end
204+
205+ k (" yL" , yank_current_path_and_line , { desc = " Yank filename + line" })
206+
193207--
194208-- }}}
195209
Original file line number Diff line number Diff line change @@ -305,6 +305,11 @@ Random features added.
305305- ` %n ` basename
306306- ` %p ` path (absolute)
307307
308+ Custom keymaps (normal mode):
309+
310+ - ` y% ` path (relative)
311+ - ` yL ` path (relative) + line number
312+
308313### Operators
309314
310315- ` ys{motion}{char} ` add surrounding character
You can’t perform that action at this time.
0 commit comments