add aerc and fix nvim 0.8

This commit is contained in:
Noah Masur
2022-10-30 13:57:14 -04:00
parent 2af30faf7c
commit dfd903d3c9
8 changed files with 297 additions and 133 deletions

View File

@ -79,6 +79,7 @@ M.packer = function(use)
return vim.fn.executable(program) == 1
end
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
require("null-ls").setup({
sources = {
require("null-ls").builtins.formatting.stylua.with({
@ -132,15 +133,15 @@ M.packer = function(use)
-- require("null-ls").builtins.diagnostics.pylint,
},
-- Format on save
on_attach = function(client)
if client.server_capabilities.document_formatting then
local id = vim.api.nvim_create_augroup("LspFormatting", {
clear = true,
})
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = id,
pattern = "*",
callback = vim.lsp.buf.format,
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end,

View File

@ -53,10 +53,12 @@ M.packer = function(use)
symbols = { " ", "-", "x" },
},
})
-- Save when moving to new buffer
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
command = "set autowriteall",
callback = function()
vim.o.autowriteall = true -- Save in new buffer
vim.o.wrapmargin = 79 -- Wrap text automatically
end,
})
end,
})

View File

@ -8,49 +8,6 @@ M.packer = function(use)
require("impatient")
end,
})
-- Improve speed and filetype detection
use({
"nathom/filetype.nvim",
config = function()
-- Filetype for .env files
local envfiletype = function()
vim.bo.filetype = "text"
vim.bo.syntax = "sh"
end
-- Force filetype patterns that Vim doesn't know about
require("filetype").setup({
overrides = {
extensions = {
Brewfile = "brewfile",
muttrc = "muttrc",
tfvars = "terraform",
tf = "terraform",
},
literal = {
Caskfile = "brewfile",
[".gitignore"] = "gitignore",
config = "config",
},
complex = {
[".*git/config"] = "gitconfig",
["tmux.conf%..*link"] = "tmux",
["gitconfig%..*link"] = "gitconfig",
[".*ignore%..*link"] = "gitignore",
[".*%.toml%..*link"] = "toml",
},
function_extensions = {},
function_literal = {
[".envrc"] = envfiletype,
[".env"] = envfiletype,
[".env.dev"] = envfiletype,
[".env.prod"] = envfiletype,
[".env.example"] = envfiletype,
},
},
})
end,
})
end
return M

View File

@ -32,8 +32,6 @@ vim.opt.completeopt = {
"menuone",
"noselect",
}
-- Required until 0.6.0: do not source the default filetype.vim
vim.g.did_load_filetypes = 1
-- Remember last position when reopening file
vim.api.nvim_exec(
@ -77,6 +75,13 @@ vim.api.nvim_exec(
false
)
vim.api.nvim_create_autocmd("FileType", {
pattern = "*.eml",
callback = function()
vim.o.wrapmargin = 79 -- Wrap text automatically
end,
})
-- Netrw
vim.g.netrw_liststyle = 3 -- Change style to 'tree' view
vim.g.netrw_banner = 0 -- Remove useless banner