From dc11234c3dd3dd2adb29de958b1d50978ce9b459 Mon Sep 17 00:00:00 2001 From: Saurabh Charde Date: Thu, 15 Aug 2024 17:39:38 +0530 Subject: [PATCH] fix(nvim): local options --- config/nvim/after/ftplugin/c.lua | 2 +- config/nvim/after/ftplugin/gitcommit.lua | 2 +- config/nvim/after/ftplugin/help.lua | 6 +++--- config/nvim/after/ftplugin/html.lua | 6 +++--- config/nvim/after/ftplugin/javascript.lua | 2 +- config/nvim/after/ftplugin/markdown.lua | 6 +++--- config/nvim/after/ftplugin/vim.lua | 4 ++-- config/nvim/lua/plugins/gitsigns.lua | 2 ++ 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/config/nvim/after/ftplugin/c.lua b/config/nvim/after/ftplugin/c.lua index e9442ee..6c5b2ca 100644 --- a/config/nvim/after/ftplugin/c.lua +++ b/config/nvim/after/ftplugin/c.lua @@ -10,4 +10,4 @@ vim.bo.shiftwidth = 8 vim.bo.softtabstop = 8 vim.bo.tabstop = 8 -vim.wo.spell = true +vim.opt_local.spell = true diff --git a/config/nvim/after/ftplugin/gitcommit.lua b/config/nvim/after/ftplugin/gitcommit.lua index a182ee1..3e2c7e0 100644 --- a/config/nvim/after/ftplugin/gitcommit.lua +++ b/config/nvim/after/ftplugin/gitcommit.lua @@ -1,3 +1,3 @@ vim.bo.textwidth = 80 vim.bo.spellcapcheck = "" -vim.wo.spell = true +vim.opt_local.spell = true diff --git a/config/nvim/after/ftplugin/help.lua b/config/nvim/after/ftplugin/help.lua index 40a2d13..4fb3953 100644 --- a/config/nvim/after/ftplugin/help.lua +++ b/config/nvim/after/ftplugin/help.lua @@ -1,5 +1,5 @@ -vim.wo.colorcolumn = "" +vim.opt_local.colorcolumn = "" -- Wrap text by default and don't break words -vim.wo.wrap = true -vim.wo.linebreak = true +vim.opt_local.wrap = true +vim.opt_local.linebreak = true diff --git a/config/nvim/after/ftplugin/html.lua b/config/nvim/after/ftplugin/html.lua index 40aca7a..6c4498f 100644 --- a/config/nvim/after/ftplugin/html.lua +++ b/config/nvim/after/ftplugin/html.lua @@ -1,3 +1,3 @@ -vim.wo.colorcolumn = "" -vim.wo.spell = true -vim.wo.wrap = true +vim.opt_local.colorcolumn = "" +vim.opt_local.spell = true +vim.opt_local.wrap = true diff --git a/config/nvim/after/ftplugin/javascript.lua b/config/nvim/after/ftplugin/javascript.lua index 578bc7f..32e92e8 100644 --- a/config/nvim/after/ftplugin/javascript.lua +++ b/config/nvim/after/ftplugin/javascript.lua @@ -1,2 +1,2 @@ -vim.wo.spell = true +vim.opt_local.spell = true vim.opt_local.spelloptions:append("camel") diff --git a/config/nvim/after/ftplugin/markdown.lua b/config/nvim/after/ftplugin/markdown.lua index 2824105..af18a8b 100644 --- a/config/nvim/after/ftplugin/markdown.lua +++ b/config/nvim/after/ftplugin/markdown.lua @@ -31,8 +31,8 @@ end -- There should be no restriction for 80-char limit in markdown files, so wrap -- them but don't break words (easier to read that way) -vim.wo.wrap = true -vim.wo.linebreak = true -vim.wo.colorcolumn = "" +vim.opt_local.wrap = true +vim.opt_local.linebreak = true +vim.opt_local.colorcolumn = "" vim.opt_local.spell = true diff --git a/config/nvim/after/ftplugin/vim.lua b/config/nvim/after/ftplugin/vim.lua index de23029..2949799 100644 --- a/config/nvim/after/ftplugin/vim.lua +++ b/config/nvim/after/ftplugin/vim.lua @@ -1,2 +1,2 @@ -vim.wo.foldmethod = "marker" -vim.wo.spell = true +vim.opt_local.foldmethod = "marker" +vim.opt_local.spell = true diff --git a/config/nvim/lua/plugins/gitsigns.lua b/config/nvim/lua/plugins/gitsigns.lua index 04960e1..e0e4ae5 100644 --- a/config/nvim/lua/plugins/gitsigns.lua +++ b/config/nvim/lua/plugins/gitsigns.lua @@ -34,8 +34,10 @@ return { vnoremap("gs", function() gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) end, { desc = "Stage hunk" }) + nnoremap("gS", gs.stage_buffer, { desc = "Stage buffer" }) nnoremap("gu", gs.undo_stage_hunk, { desc = "Undo stage hunk" }) nnoremap("gr", gs.reset_hunk, { desc = "Reset hunk" }) + nnoremap("gR", gs.reset_buffer, { desc = "Reset buffer" }) nnoremap("gp", gs.preview_hunk, { desc = "Preview hunk" }) nnoremap("gd", gs.diffthis, { desc = "Diffthis" }) -- nnoremap("gD", function()