From 4c89c5ce52617f0d6a517fb99cd2bc6ca17cc342 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 14 Oct 2024 17:03:09 +0200 Subject: nvim: introduce keybind yp hello! hope nr2char(10) is the correct way of doing this :) --- .config/nvim/lua/core/keymaps.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.config/nvim/lua/core/keymaps.lua b/.config/nvim/lua/core/keymaps.lua index 95e5fcd..318cfc7 100644 --- a/.config/nvim/lua/core/keymaps.lua +++ b/.config/nvim/lua/core/keymaps.lua @@ -49,6 +49,11 @@ map("n", "lp", "gewi[[/papers/Ea]]", "vimwiki: link wrap word -- call CreateReference on word below cursor map("n", "nr", 'call CreateReference(expand(""))', "vimwiki: new reference word under cursor") +-- nr2char(10) is, of course, a newline character +map("n", "yp", + "call setreg('+', expand('%:h') . '/' . expand('%:t') . ':' . line('.') . nr2char(10) . getline('.'))", + "yank the current line contents, filename and line number to clipboard") + -- create a new note map("n", "nn", "call CreateNote()", "vimwiki: new note for slipbox") @@ -70,6 +75,7 @@ map('n', "'", '`') map("n", "n", "nzzzv") map("n", "N", "Nzzzv") + -- switch between light and dark modes map("n", "ut", function() if vim.o.background == "dark" then -- cgit v1.2.3-70-g09d2