From 8a5a751b991f2c6928ec06c724696455bcdfee0e Mon Sep 17 00:00:00 2001 From: tiago Date: Thu, 8 Feb 2024 19:32:01 +0000 Subject: [PATCH] fixed formatoptions not behaving --- .config/nvim/lua/tsousa/init.lua | 11 +++++++++-- .config/nvim/lua/tsousa/set.lua | 31 +++++++++++++++++-------------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.config/nvim/lua/tsousa/init.lua b/.config/nvim/lua/tsousa/init.lua index fbb54c7..b9670c0 100644 --- a/.config/nvim/lua/tsousa/init.lua +++ b/.config/nvim/lua/tsousa/init.lua @@ -1,5 +1,5 @@ -require("tsousa.remap") require("tsousa.set") +require("tsousa.remap") require("tsousa.lazy") local augroup = vim.api.nvim_create_augroup @@ -12,6 +12,14 @@ function R(name) require("plenary.reload").reload_module(name) end +autocmd('BufWinEnter',{ + group= TsousaGroup, + pattern = '*', + callback = function() + vim.opt.formatoptions:remove('o') + end +}) + autocmd('TextYankPost', { group = yank_group, pattern = '*', @@ -46,7 +54,6 @@ autocmd("LspAttach", { end }) - vim.g.netrw_browse_split = 0 vim.g.netrw_banner = 0 vim.g.netrw_winsize = 25 diff --git a/.config/nvim/lua/tsousa/set.lua b/.config/nvim/lua/tsousa/set.lua index 9a0d575..2a0b1e1 100644 --- a/.config/nvim/lua/tsousa/set.lua +++ b/.config/nvim/lua/tsousa/set.lua @@ -1,6 +1,10 @@ -vim.opt.guicursor="" +vim.opt.wildignore = "__pycache__" +vim.opt.wildignore:append { "*.o", "*~", "*.pyc", "*pycache*" } +vim.opt.wildignore:append { "Cargo.lock", "Cargo.Bazel.lock" } -vim.opt.nu = true +vim.opt.guicursor = "" + +vim.opt.number = true vim.opt.relativenumber = true vim.opt.errorbells = false @@ -22,7 +26,7 @@ vim.opt.showmode = false vim.opt.hlsearch = false vim.opt.incsearch = true - +vim.opt.showmatch = true vim.opt.termguicolors = true vim.opt.scrolloff = 8 @@ -31,15 +35,15 @@ vim.opt.isfname:append("@-@") -- from tj devries vim.opt.formatoptions = vim.opt.formatoptions - - "a" -- Auto formatting is BAD. - - "t" -- Don't auto format my code. I got linters for that. - + "c" -- In general, I like it when comments respect textwidth - + "q" -- Allow formatting comments w/ gq - - "o" -- O and o, don't continue comments - + "r" -- But do continue when pressing enter. - + "n" -- Indent past the formatlistpat, not underneath it. - + "j" -- Auto-remove comments if possible. - - "2" -- I'm not in gradeschool anymore + - "o" -- O and o, don't continue comments + - "a" -- Auto formatting is BAD. + - "t" -- Don't auto format my code. I got linters for that. + - "2" -- I'm not in gradeschool anymore + + "c" -- In general, I like it when comments respect textwidth + + "q" -- Allow formatting comments w/ gq + + "r" -- But do continue when pressing enter. + + "n" -- Indent past the formatlistpat, not underneath it. + + "j" -- Auto-remove comments if possible. -- Give more space for displaying messages. vim.opt.cmdheight = 1 @@ -51,7 +55,6 @@ vim.opt.updatetime = 50 -- Don't pass messages to |ins-completion-menu|. vim.opt.shortmess:append("c") -vim.opt.colorcolumn="80" +vim.opt.colorcolumn = "80" vim.g.mapleader = " " -