fixed formatoptions not behaving

This commit is contained in:
Tiago Sousa 2024-02-08 19:32:01 +00:00
parent 6110d93076
commit 8a5a751b99
2 changed files with 26 additions and 16 deletions

View file

@ -1,5 +1,5 @@
require("tsousa.remap")
require("tsousa.set") require("tsousa.set")
require("tsousa.remap")
require("tsousa.lazy") require("tsousa.lazy")
local augroup = vim.api.nvim_create_augroup local augroup = vim.api.nvim_create_augroup
@ -12,6 +12,14 @@ function R(name)
require("plenary.reload").reload_module(name) require("plenary.reload").reload_module(name)
end end
autocmd('BufWinEnter',{
group= TsousaGroup,
pattern = '*',
callback = function()
vim.opt.formatoptions:remove('o')
end
})
autocmd('TextYankPost', { autocmd('TextYankPost', {
group = yank_group, group = yank_group,
pattern = '*', pattern = '*',
@ -46,7 +54,6 @@ autocmd("LspAttach", {
end end
}) })
vim.g.netrw_browse_split = 0 vim.g.netrw_browse_split = 0
vim.g.netrw_banner = 0 vim.g.netrw_banner = 0
vim.g.netrw_winsize = 25 vim.g.netrw_winsize = 25

View file

@ -1,6 +1,10 @@
vim.opt.wildignore = "__pycache__"
vim.opt.wildignore:append { "*.o", "*~", "*.pyc", "*pycache*" }
vim.opt.wildignore:append { "Cargo.lock", "Cargo.Bazel.lock" }
vim.opt.guicursor = "" vim.opt.guicursor = ""
vim.opt.nu = true vim.opt.number = true
vim.opt.relativenumber = true vim.opt.relativenumber = true
vim.opt.errorbells = false vim.opt.errorbells = false
@ -22,7 +26,7 @@ vim.opt.showmode = false
vim.opt.hlsearch = false vim.opt.hlsearch = false
vim.opt.incsearch = true vim.opt.incsearch = true
vim.opt.showmatch = true
vim.opt.termguicolors = true vim.opt.termguicolors = true
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
@ -31,15 +35,15 @@ vim.opt.isfname:append("@-@")
-- from tj devries -- from tj devries
vim.opt.formatoptions = vim.opt.formatoptions vim.opt.formatoptions = vim.opt.formatoptions
- "o" -- O and o, don't continue comments
- "a" -- Auto formatting is BAD. - "a" -- Auto formatting is BAD.
- "t" -- Don't auto format my code. I got linters for that. - "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 + "c" -- In general, I like it when comments respect textwidth
+ "q" -- Allow formatting comments w/ gq + "q" -- Allow formatting comments w/ gq
- "o" -- O and o, don't continue comments
+ "r" -- But do continue when pressing enter. + "r" -- But do continue when pressing enter.
+ "n" -- Indent past the formatlistpat, not underneath it. + "n" -- Indent past the formatlistpat, not underneath it.
+ "j" -- Auto-remove comments if possible. + "j" -- Auto-remove comments if possible.
- "2" -- I'm not in gradeschool anymore
-- Give more space for displaying messages. -- Give more space for displaying messages.
vim.opt.cmdheight = 1 vim.opt.cmdheight = 1
@ -54,4 +58,3 @@ vim.opt.shortmess:append("c")
vim.opt.colorcolumn = "80" vim.opt.colorcolumn = "80"
vim.g.mapleader = " " vim.g.mapleader = " "