From 377c00592f98841d8009fc4609dd573148d298d4 Mon Sep 17 00:00:00 2001 From: Tazoeur Date: Sat, 28 Sep 2024 23:11:21 +0200 Subject: [PATCH] automatic relative number toggle --- lazy-lock.json | 1 + lua/custom/keymaps.lua | 3 +++ lua/custom/options.lua | 4 +++- lua/custom/plugins/relative-toggle.lua | 6 ++++++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 lua/custom/plugins/relative-toggle.lua diff --git a/lazy-lock.json b/lazy-lock.json index 52aef4b1..27cb1265 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -33,6 +33,7 @@ "nvim-treesitter": { "branch": "master", "commit": "f027762845fa35ff27fe0487c86537a74a480a0c" }, "nvim-web-devicons": { "branch": "master", "commit": "26220156aafb198b2de6a4cf80c1b120a3768da0" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "relative-toggle.nvim": { "branch": "main", "commit": "fabe2f60f5f148f2bf1fb76e8a542f5adf8d996a" }, "rose-pine": { "branch": "main", "commit": "8b1fd252255a7f2c41b4192a787ab62660b29f72" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua index 6881aeaf..42257019 100644 --- a/lua/custom/keymaps.lua +++ b/lua/custom/keymaps.lua @@ -27,3 +27,6 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the left wind vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) + +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') diff --git a/lua/custom/options.lua b/lua/custom/options.lua index d4f771cc..59a9d2d1 100644 --- a/lua/custom/options.lua +++ b/lua/custom/options.lua @@ -12,8 +12,10 @@ vim.g.loaded_netrwPlugin = 1 -- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = true + -- Make line numbers default --- vim.opt.number = true -- Make line number default +-- see `help: number_relativenumber` +vim.opt.number = true -- Make line number default vim.opt.relativenumber = true -- Make relative line number default -- Enable mouse mode, can be useful for resizing splits for example! diff --git a/lua/custom/plugins/relative-toggle.lua b/lua/custom/plugins/relative-toggle.lua new file mode 100644 index 00000000..1ceeef15 --- /dev/null +++ b/lua/custom/plugins/relative-toggle.lua @@ -0,0 +1,6 @@ +-- Automatically toggling smoothly between relative and absolute line numbers in various Neovim events. +-- This is useful when you want to take advantage of the information on those types of numbers in different situations. +-- +-- https://github.com/cpea2506/relative-toggle.nvim + +return { 'cpea2506/relative-toggle.nvim' }