nvim ftplugin tweaks
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
-- Standard Git commit wrapping limits
|
||||
vim.opt_local.colorcolumn = "72"
|
||||
vim.opt_local.textwidth = 72
|
||||
|
||||
-- Enable prose reflowing, comment leader formatting, and numbered list handling
|
||||
vim.opt_local.formatoptions:append({ "t", "c", "q", "n", "j" })
|
||||
|
||||
if vim.fn.executable("par") == 1 then vim.bo.formatprg = "par -w72req" end
|
||||
@@ -0,0 +1,16 @@
|
||||
local filename = vim.fn.shellescape(vim.api.nvim_buf_get_name(0))
|
||||
|
||||
-- Indentation & Layout
|
||||
vim.opt_local.colorcolumn = "100"
|
||||
vim.opt_local.textwidth = 100
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
|
||||
-- Formatting Behavior
|
||||
vim.opt_local.formatoptions:remove("t") -- Don't autowrap while typing
|
||||
vim.opt_local.formatoptions:append("j") -- Remove comment markers when joining lines
|
||||
|
||||
-- gq Formatters (Prettier fallback, LSP primary)
|
||||
vim.bo.formatprg = "npx prettier --stdin-filepath " .. filename
|
||||
vim.bo.formatexpr = "v:lua.vim.lsp.formatexpr()"
|
||||
@@ -0,0 +1,16 @@
|
||||
local filename = vim.fn.shellescape(vim.api.nvim_buf_get_name(0))
|
||||
|
||||
-- Indentation & Layout
|
||||
vim.opt_local.colorcolumn = "120"
|
||||
vim.opt_local.textwidth = 120
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
|
||||
-- Formatting Behavior
|
||||
vim.opt_local.formatoptions:remove("t")
|
||||
vim.opt_local.formatoptions:append("j")
|
||||
|
||||
-- gq Formatters (StyLua fallback, LSP primary)
|
||||
vim.bo.formatprg = "stylua --stdin-filepath " .. filename .. " -"
|
||||
vim.bo.formatexpr = "v:lua.vim.lsp.formatexpr()"
|
||||
@@ -0,0 +1,19 @@
|
||||
local filename = vim.fn.shellescape(vim.api.nvim_buf_get_name(0))
|
||||
|
||||
-- Indentation & Layout
|
||||
vim.opt_local.colorcolumn = ""
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.textwidth = 80
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
|
||||
-- Formatting Behavior: wrap text, keep comment/quote headers, parse lists
|
||||
vim.opt_local.formatoptions:append({ "t", "q", "n", "j" })
|
||||
|
||||
-- gq Formatter: Prettier handles links/parentheses cleanly; par as fallback
|
||||
if vim.fn.executable("prettier") == 1 then
|
||||
vim.bo.formatprg = "prettier --parser markdown --stdin-filepath " .. filename
|
||||
elseif vim.fn.executable("par") == 1 then
|
||||
vim.bo.formatprg = "par -w80req"
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
local filename = vim.fn.shellescape(vim.api.nvim_buf_get_name(0))
|
||||
|
||||
-- Indentation & Layout
|
||||
vim.opt_local.colorcolumn = "100"
|
||||
vim.opt_local.textwidth = 100
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
|
||||
-- Formatting Behavior
|
||||
vim.opt_local.formatoptions:remove("t")
|
||||
vim.opt_local.formatoptions:append("j")
|
||||
|
||||
-- gq Formatters (Ruff/Black fallback, LSP primary)
|
||||
vim.bo.formatprg = "ruff format --stdin-filename " .. filename
|
||||
vim.bo.formatexpr = "v:lua.vim.lsp.formatexpr()"
|
||||
@@ -1,4 +0,0 @@
|
||||
vim.opt_local.colorcolumn = "100"
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
@@ -1,4 +0,0 @@
|
||||
vim.opt_local.colorcolumn = "120"
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
@@ -1,5 +0,0 @@
|
||||
vim.opt_local.colorcolumn = ""
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.softtabstop = 2
|
||||
@@ -1,4 +0,0 @@
|
||||
vim.opt_local.colorcolumn = "100"
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.softtabstop = 4
|
||||
Reference in New Issue
Block a user