Add Neovim relative line delete mappings
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
require("tracer.options")
|
require("tracer.options")
|
||||||
|
require("tracer.keymaps")
|
||||||
require("tracer.plugins")
|
require("tracer.plugins")
|
||||||
pcall(require, "tracer.plugins.telescope")
|
pcall(require, "tracer.plugins.telescope")
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
vim.keymap.set("n", "<Leader>d", function()
|
||||||
|
local count = vim.v.count1
|
||||||
|
local current_line = vim.fn.line(".")
|
||||||
|
local last_line = vim.fn.line("$")
|
||||||
|
local start_line = current_line + 1
|
||||||
|
local end_line = math.min(current_line + count, last_line)
|
||||||
|
|
||||||
|
if start_line > last_line then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_buf_set_lines(0, start_line - 1, end_line, false, {})
|
||||||
|
end, { desc = "Delete lines below" })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<Leader>D", function()
|
||||||
|
local count = vim.v.count1
|
||||||
|
local current_line = vim.fn.line(".")
|
||||||
|
local start_line = math.max(current_line - count, 1)
|
||||||
|
local end_line = current_line - 1
|
||||||
|
|
||||||
|
if end_line < 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_buf_set_lines(0, start_line - 1, end_line, false, {})
|
||||||
|
end, { desc = "Delete lines above" })
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
|
|
||||||
opt.number = true
|
opt.number = true
|
||||||
|
opt.relativenumber = true
|
||||||
opt.cursorline = true
|
opt.cursorline = true
|
||||||
opt.ignorecase = true
|
opt.ignorecase = true
|
||||||
opt.laststatus = 2
|
opt.laststatus = 2
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ vim.lsp.config("*", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Keymaps
|
-- Keymaps
|
||||||
vim.keymap.set("n", "<Leader>d", vim.diagnostic.open_float)
|
vim.keymap.set("n", "<Leader>o", vim.diagnostic.open_float)
|
||||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
||||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
|
||||||
|
|||||||
Reference in New Issue
Block a user