some Neovim tweaks
This commit is contained in:
@@ -80,6 +80,8 @@ vim.keymap.set("n", "<C-l>", "<C-w>l", { desc = "Navigate right" })
|
|||||||
-- Split windows
|
-- Split windows
|
||||||
vim.keymap.set("n", "<leader>sh", ":split<CR>", { desc = "Split window horizontally" })
|
vim.keymap.set("n", "<leader>sh", ":split<CR>", { desc = "Split window horizontally" })
|
||||||
vim.keymap.set("n", "<leader>sv", ":vsplit<CR>", { desc = "Split window vertically" })
|
vim.keymap.set("n", "<leader>sv", ":vsplit<CR>", { desc = "Split window vertically" })
|
||||||
|
vim.keymap.set("n", "<leader>\"", ":split<CR>", { desc = "Split window horizontally" })
|
||||||
|
vim.keymap.set("n", "<leader>%", ":vsplit<CR>", { desc = "Split window vertically" })
|
||||||
|
|
||||||
-- Resize windows
|
-- Resize windows
|
||||||
vim.keymap.set("n", "<C-Up>", ":resize -2<CR>", { desc = "Resize window up" })
|
vim.keymap.set("n", "<C-Up>", ":resize -2<CR>", { desc = "Resize window up" })
|
||||||
@@ -102,3 +104,24 @@ vim.keymap.set("n", "zo", "zo", { desc = "Open fold under cursor" })
|
|||||||
vim.keymap.set("n", "zc", "zc", { desc = "Close fold under cursor" })
|
vim.keymap.set("n", "zc", "zc", { desc = "Close fold under cursor" })
|
||||||
vim.keymap.set("n", "zO", "zO", { desc = "Open all folds under cursor" })
|
vim.keymap.set("n", "zO", "zO", { desc = "Open all folds under cursor" })
|
||||||
vim.keymap.set("n", "zC", "zC", { desc = "Close all folds under cursor" })
|
vim.keymap.set("n", "zC", "zC", { desc = "Close all folds under cursor" })
|
||||||
|
|
||||||
|
-- Path of current file to clipboard
|
||||||
|
vim.keymap.set("n", "<leader>yp", ":let @+=expand('%:p')<CR>", { desc = "Absolute path of current file to clipboard" })
|
||||||
|
vim.keymap.set("n", "<leader>yr", ":let @+=expand('%:.')<CR>", { desc = "Relative path of current file to clipboard" })
|
||||||
|
vim.keymap.set("n", "<leader>cf", ":let @+=expand('%:t')<CR>", { desc = "Current filename to clipboard" })
|
||||||
|
vim.keymap.set({'n','v'}, '<leader>ya', function()
|
||||||
|
local fname = vim.fn.expand('%:.')
|
||||||
|
local lines = (vim.fn.mode() == 'v' or vim.fn.mode() == 'V')
|
||||||
|
and (tostring(math.min(vim.fn.line("'<"), vim.fn.line("'>")))..'..'..tostring(math.max(vim.fn.line("'<"), vim.fn.line("'>"))))
|
||||||
|
or tostring(vim.fn.line('.'))
|
||||||
|
local result = fname..':'..lines
|
||||||
|
vim.fn.setreg('+', result)
|
||||||
|
print('Copied: '..result)
|
||||||
|
end, {desc = 'Copy file path and line(s) to clipboard'})
|
||||||
|
|
||||||
|
-- clear search highlighting
|
||||||
|
vim.keymap.set("n", "<leader>ch", ":noh<CR>", { desc = "clear search highlighting" })
|
||||||
|
|
||||||
|
-- toggle word wrap
|
||||||
|
vim.keymap.set("n", "<leader>w", ":set wrap!<CR>", { desc = "toggle word wrap" })
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user