module changes
This commit is contained in:
parent
b1fbf302a6
commit
fe34f6c78a
8 changed files with 43 additions and 21 deletions
|
@ -1,16 +1,7 @@
|
|||
-- alias for vim.api.nvim_create_autocmd
|
||||
local create_autocmd = vim.api.nvim_create_autocmd
|
||||
-- alias for vim.api.nvim_create_augroup
|
||||
local create_augroup = vim.api.nvim_create_augroup
|
||||
|
||||
-- taken from https://github.com/sitiom/nvim-numbertoggle
|
||||
-- I would much rather avoid fetching yet another plugin for something
|
||||
-- that should be done locally - and not as a plugin
|
||||
local augroup = create_augroup('NumberToggle', {})
|
||||
|
||||
create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'CmdlineLeave', 'WinEnter' }, {
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'CmdlineLeave', 'WinEnter' }, {
|
||||
pattern = '*',
|
||||
group = augroup,
|
||||
group = vim.api.nvim_create_augroup('NumberToggle', {}),
|
||||
callback = function()
|
||||
if vim.o.nu and vim.api.nvim_get_mode().mode ~= 'i' then
|
||||
vim.opt.relativenumber = true
|
||||
|
@ -18,9 +9,9 @@ create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'CmdlineLeave', 'WinE
|
|||
end,
|
||||
})
|
||||
|
||||
create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'CmdlineEnter', 'WinLeave' }, {
|
||||
vim.api.nvim_create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'CmdlineEnter', 'WinLeave' }, {
|
||||
pattern = '*',
|
||||
group = augroup,
|
||||
group = vim.api.nvim_create_augroup('NumberToggle', {}),
|
||||
callback = function()
|
||||
if vim.o.nu then
|
||||
vim.opt.relativenumber = false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue