From ad50838b8a68a390aea5c70443e1665359dd8e89 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Mon, 2 May 2022 11:27:30 +0200 Subject: vim: fix yof mapping --- dotfiles/vim.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dotfiles/vim.lua b/dotfiles/vim.lua index 2010723..5c46e43 100644 --- a/dotfiles/vim.lua +++ b/dotfiles/vim.lua @@ -78,12 +78,13 @@ local mapopts = { noremap = true, silent = true } vim.fn["camelcasemotion#CreateMotionMappings"] "" vim.keymap.set("n", "yof", function() - if vim.bo.formatoptions:match "a" then - vim.bo.formatoptions = vim.bo.format:gsub("a", "") + if vim.opt_local.formatoptions:get().a then + vim.opt_local.formatoptions:remove "a" + print(":setlocal formatoptions-=a") else - vim.bo.formatoptions = vim.bo.format .. "a" + vim.opt_local.formatoptions:append "a" + print(":setlocal formatoptions+=a") end - print(":setlocal formatoptions=" .. vim.bo.formatoptions) end, mapopts) -- Plugins -- cgit v1.2.3