From 8be8d60510dbf5f328587c4fee9ceb36b83eb0a7 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Mon, 8 Jul 2024 16:54:29 +0300 Subject: Neovim: fixed comments on newlines issue --- .config/nvim/plugin/autocmds.lua | 18 ++++++++---------- .config/nvim/plugin/options.lua | 1 - 2 files changed, 8 insertions(+), 11 deletions(-) (limited to '.config/nvim') diff --git a/.config/nvim/plugin/autocmds.lua b/.config/nvim/plugin/autocmds.lua index 5272029..a9a9dc0 100644 --- a/.config/nvim/plugin/autocmds.lua +++ b/.config/nvim/plugin/autocmds.lua @@ -6,13 +6,11 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) --- vim.api.nvim_create_autocmd('FileType', { --- group = vim.api.nvim_create_augroup('disable-auto-comment', { clear = true }), --- pattern = '*', --- callback = function() --- -- c - autowrap using textwidth | r - enter in insert mode | o - o/O in normal mode --- -- vim.opt.formatoptions:remove({ 'c', 'r', 'o' }) --- vim.opt.formatoptions:remove('o') --- -- vim.cmd('set formatoptions-=o') --- end, --- }) +vim.api.nvim_create_autocmd('BufEnter', { + desc = 'Disable newlines on commented lines from continuing the comment', + group = vim.api.nvim_create_augroup('disable-comments-continuation', { clear = true }), + callback = function() + -- vim.opt_local.formatoptions:remove('r') -- no comments on enter + vim.opt_local.formatoptions:remove('o') -- no comments on `o` or `O` + end, +}) diff --git a/.config/nvim/plugin/options.lua b/.config/nvim/plugin/options.lua index ec56b43..91e745d 100644 --- a/.config/nvim/plugin/options.lua +++ b/.config/nvim/plugin/options.lua @@ -35,7 +35,6 @@ vim.opt.termguicolors = true vim.opt.laststatus = 3 -- views can only be fully collapsed with the global statusline vim.opt.splitkeep = 'screen' -- for edgy.nvim vim.opt.inccommand = 'split' -- shows preview for commands like :%s/from/to -vim.opt.formatoptions:remove('o') -- don't have `o` add a comment -- Disable warnings for missing language providers vim.g.loaded_node_provider = 0 -- cgit v1.3.1