feat: add autocommand to toggle relative number
This commit is contained in:
parent
7fb7a08108
commit
aee215c25a
7 changed files with 50 additions and 36 deletions
|
|
@ -1,3 +1,12 @@
|
|||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
local function augroup(name)
|
||||
return vim.api.nvim_create_augroup("lazyvim_" .. name, { clear = true })
|
||||
end
|
||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
group = augroup("toggle_relative_group"),
|
||||
callback = function(_)
|
||||
vim.cmd("set norelativenumber")
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ end
|
|||
local opts = { noremap = true, silent = true }
|
||||
local term_opts = { silent = true }
|
||||
|
||||
map("n", "d", ':set relativenumber<CR>d', opts)
|
||||
map("n", "y", ':set relativenumber<CR>y', opts)
|
||||
map("n", "<ESC>", ':set norelativenumber<CR><ESC>', opts)
|
||||
|
||||
-- debug
|
||||
map("n", "<F5>", ':lua require("dap").toggle_breakpoint()<CR>', opts)
|
||||
map("n", "<F6>", ':lua require("dap").step_over()<CR>', opts)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ local options = {
|
|||
spelllang = "en_us",
|
||||
shell = "/usr/bin/zsh",
|
||||
autochdir = true,
|
||||
relativenumber = false,
|
||||
}
|
||||
|
||||
vim.g.mkdp_browser = "/usr/bin/firefox"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue