feat(nvim): rnu augroup
This commit is contained in:
parent
49b55576c7
commit
030c16642d
1 changed files with 15 additions and 14 deletions
|
@ -49,6 +49,7 @@ Map("n", "<C-W>-", ":split<CR>")
|
||||||
Map("n", "<C-W>x", ":q<CR>")
|
Map("n", "<C-W>x", ":q<CR>")
|
||||||
-- merge conflicts
|
-- merge conflicts
|
||||||
Map("n", "<leader>gd", ":Gvdiff!<CR>")
|
Map("n", "<leader>gd", ":Gvdiff!<CR>")
|
||||||
|
Map("n", "gd", ":diffget")
|
||||||
Map("n", "gdh", ":diffget //2<CR>")
|
Map("n", "gdh", ":diffget //2<CR>")
|
||||||
Map("n", "gdl", ":diffget //3<CR>")
|
Map("n", "gdl", ":diffget //3<CR>")
|
||||||
-- clipboard
|
-- clipboard
|
||||||
|
@ -74,6 +75,7 @@ vim.api.nvim_create_autocmd("VimResized", {
|
||||||
command = "wincmd =",
|
command = "wincmd =",
|
||||||
desc = "Automatically resize windows when the host window size changes.",
|
desc = "Automatically resize windows when the host window size changes.",
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("TextYankPost", {
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function()
|
callback = function()
|
||||||
|
@ -82,17 +84,16 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
desc = "Highlight yanked text",
|
desc = "Highlight yanked text",
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.cmd([[
|
local trnuGroup = vim.api.nvim_create_augroup("toggleRnu", {})
|
||||||
augroup toggleRelativeLineNumbers
|
vim.api.nvim_create_autocmd("InsertEnter,BufLeave,WinLeave,FocusLost", {
|
||||||
autocmd!
|
callback = function()
|
||||||
|
vim.opt_local.relativenumber = false
|
||||||
autocmd InsertEnter,BufLeave,WinLeave,FocusLost * nested
|
end,
|
||||||
\ if &l:number && empty(&buftype) |
|
group = trnuGroup,
|
||||||
\ setlocal norelativenumber |
|
})
|
||||||
\ endif
|
vim.api.nvim_create_autocmd("InsertLeave,BufEnter,WinEnter,FocusGained", {
|
||||||
autocmd InsertLeave,BufEnter,WinEnter,FocusGained * nested
|
callback = function()
|
||||||
\ if &l:number && empty(&buftype) |
|
vim.opt_local.relativenumber = true
|
||||||
\ setlocal relativenumber |
|
end,
|
||||||
\ endif
|
group = trnuGroup,
|
||||||
augroup END
|
})
|
||||||
]])
|
|
||||||
|
|
Loading…
Reference in a new issue