diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2024-03-24 10:41:35 +0100 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2024-06-27 22:38:23 +0200 |
| commit | 4576304de6db277d531c261abe29a3d26e8ed913 (patch) | |
| tree | 79c01a4e0bf6130f152f43af50c86b77ee3eba57 | |
| parent | b931f480a6885c0c5b27643f6edf49558fe90be6 (diff) | |
local and global indentation options
| -rw-r--r-- | config/nvim/lua/config/keys.lua | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/config/nvim/lua/config/keys.lua b/config/nvim/lua/config/keys.lua index a0a5546..c662eb3 100644 --- a/config/nvim/lua/config/keys.lua +++ b/config/nvim/lua/config/keys.lua @@ -1,5 +1,15 @@ local keys = require("which-key") +local function indentation(name, setter) + return { + name = name .. " indentation", + ["2"] = {"<cmd>" .. setter .." expandtab shiftwidth=2 tabstop=2<cr>", "2-space"}, + ["4"] = {"<cmd>" .. setter .." expandtab shiftwidth=4 tabstop=4<cr>", "4-space"}, + t = {"<cmd>" .. setter .." noexpandtab shiftwidth=4 tabstop=4<cr>", "small tabs"}, + T = {"<cmd>" .. setter .." noexpandtab shiftwidth=8 tabstop=8<cr>", "big tabs"}, + } +end + local function setup() keys.register({ Y = {"0vg_\"+y", "Copy Line To Clipboard"} @@ -22,13 +32,8 @@ local function setup() r = {"<cmd>Telescope grep_string<cr>", "String"}, p = {"<cmd>Telescope planets<cr>", "Planet"}, }, - x = { - name = "indentation", - ["2"] = {"<cmd>setlocal expandtab shiftwidth=2 tabstop=2<cr>", "2-space"}, - ["4"] = {"<cmd>setlocal expandtab shiftwidth=4 tabstop=4<cr>", "4-space"}, - t = {"<cmd>setlocal noexpandtab shiftwidth=4 tabstop=4<cr>", "small tabs"}, - T = {"<cmd>setlocal noexpandtab shiftwidth=8 tabstop=8<cr>", "big tabs"}, - }, + x = indentation("buffer", "setlocal"), + X = indentation("global", "set"), }, { prefix = "<leader>", }) |
