nvim: added shell formatter

master
tiyn 10 months ago
parent 3ce32917a1
commit 34c63dd99f

@ -1,4 +1,4 @@
vim.o.go = 'a' vim.o.go = "a"
vim.o.showmode = false vim.o.showmode = false
-- disable netrw -- disable netrw
@ -6,11 +6,11 @@ vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
-- enable mouse for all modes -- enable mouse for all modes
vim.o.mouse = 'a' vim.o.mouse = "a"
vim.o.clipboard = 'unnamedplus' vim.o.clipboard = "unnamedplus"
-- basic color settings -- basic color settings
vim.o.background = 'dark' vim.o.background = "dark"
-- setting Tab-length -- setting Tab-length
vim.o.expandtab = true vim.o.expandtab = true
@ -61,10 +61,10 @@ vim.o.nobackup = true
vim.o.nowritebackup = true vim.o.nowritebackup = true
-- set completeopt to have a better completion experience -- set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect' vim.o.completeopt = "menuone,noselect"
-- set completion option for command mode -- set completion option for command mode
vim.o.wildmode = 'longest:full,full' vim.o.wildmode = "longest:full,full"
-- minimum number of lines around the cursor -- minimum number of lines around the cursor
vim.o.scrolloff = 10 vim.o.scrolloff = 10
@ -78,14 +78,14 @@ vim.o.undofile = true
vim.o.undodir = vim.env.XDG_CACHE_HOME .. "/vim/undo" vim.o.undodir = vim.env.XDG_CACHE_HOME .. "/vim/undo"
-- python programs to use -- python programs to use
vim.g.python_host_prog = '/usr/bin/python2' vim.g.python_host_prog = "/usr/bin/python2"
vim.g.python3_host_prog = '/usr/bin/python3' vim.g.python3_host_prog = "/usr/bin/python3"
-- folding -- folding
vim.o.foldcolumn = '0' vim.o.foldcolumn = "0"
vim.o.foldlevel = 99 vim.o.foldlevel = 99
vim.o.foldlevelstart = 99 vim.o.foldlevelstart = 99
vim.o.foldexpr = 'expr' vim.o.foldexpr = "expr"
vim.o.foldenable = true vim.o.foldenable = true
vim.o.conceallevel = 0 vim.o.conceallevel = 0
vim.g.markdown_folding = 1 vim.g.markdown_folding = 1
@ -98,34 +98,35 @@ vim.o.textwidth = 80
-- read files correctly -- read files correctly
vim.filetype.add({ vim.filetype.add({
extension = { extension = {
c = 'c', c = "c",
h = 'c', h = "c",
html = 'html', html = "html",
java = 'java', java = "java",
js = 'javascript', js = "javascript",
lua = 'lua', lua = "lua",
md = 'markdown', md = "markdown",
nim = 'nim', nim = "nim",
py = 'python', py = "python",
sage = 'python', sage = "python",
tex = 'tex', sh = "shell",
} tex = "tex",
},
}) })
-- set mapleader for hotkeys -- set mapleader for hotkeys
vim.g.mapleader = "," vim.g.mapleader = ","
-- load general mapped keys -- load general mapped keys
require('style') require("style")
-- load dictionaries and helper functions -- load dictionaries and helper functions
require('dictionaries') require("dictionaries")
-- load plugins (autoload all files in plugin folder) -- load plugins (autoload all files in plugin folder)
require('loadplugins') require("loadplugins")
-- load general mapped keys -- load general mapped keys
require('keymap') require("keymap")
vim.cmd([[ vim.cmd([[
set foldopen-=hor set foldopen-=hor

@ -5,10 +5,12 @@ return {
config = function() config = function()
require("conform").setup({ require("conform").setup({
formatters_by_ft = { formatters_by_ft = {
python = { "isort", "yapf" }, lua = { "stylua" },
markdown = { "mdformat" }, markdown = { "mdformat" },
python = { "isort", "yapf" },
sh = { "beautysh" },
shell = { "beautysh" },
tex = { "latexindent" }, tex = { "latexindent" },
lua = { "stylua" },
yaml = { "yamlfmt" }, yaml = { "yamlfmt" },
}, },
}) })
@ -18,6 +20,12 @@ return {
{ "-y=defaultIndent: ' '" } { "-y=defaultIndent: ' '" }
), ),
} }
require("conform").formatters.beautysh = {
args = require("conform.util").extend_args(
require("conform.formatters.beautysh").args,
{ "--indent-size=2", "--force-function-style=fnpar" }
),
}
end, end,
}, },
} }

@ -9,7 +9,7 @@ return {
require("null-ls").setup({ require("null-ls").setup({
sources = { sources = {
-- latex -- latex
require("null-ls").builtins.formatting.latexindent, -- require("null-ls").builtins.formatting.latexindent,
-- lua -- lua
require("null-ls").builtins.formatting.stylua, require("null-ls").builtins.formatting.stylua,
-- markdown -- markdown
@ -17,6 +17,8 @@ return {
-- python -- python
require("null-ls").builtins.formatting.isort, require("null-ls").builtins.formatting.isort,
require("null-ls").builtins.formatting.yapf, require("null-ls").builtins.formatting.yapf,
-- shell
-- require("null-ls").builtins.formatting.beautysh,
-- yaml -- yaml
require("null-ls").builtins.formatting.yamlfmt, require("null-ls").builtins.formatting.yamlfmt,
} }
@ -37,6 +39,8 @@ return {
-- python -- python
"isort", "isort",
"yapf", "yapf",
-- shell
"beautysh",
-- yaml -- yaml
"yamlfmt", "yamlfmt",
} }

Loading…
Cancel
Save