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.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

View file

@ -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 = " "