aboutsummaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2026-01-08 17:25:42 +0100
committerThomas Schmucker <ts@its1.de>2026-01-08 17:25:42 +0100
commit1f2dad0be57a20bca63b251d0b22c57839a6f794 (patch)
tree56844c50cfc60b54b5a8b886113de3e95b551f5e /nvim
parentcab771e6d1cc578e956f8bd9e3544cd0502b65a9 (diff)
downloaddotfiles-1f2dad0be57a20bca63b251d0b22c57839a6f794.tar.gz
dotfiles-1f2dad0be57a20bca63b251d0b22c57839a6f794.tar.bz2
dotfiles-1f2dad0be57a20bca63b251d0b22c57839a6f794.zip
Neovim: Benutze conform.nvim als Standard-Formater
Diffstat (limited to 'nvim')
-rw-r--r--nvim/ftplugin/sh.lua4
-rw-r--r--nvim/lua/config/keymaps.lua5
-rw-r--r--nvim/lua/plugins/format.lua20
-rw-r--r--nvim/lua/plugins/lsp.lua16
-rw-r--r--nvim/stylua.toml13
5 files changed, 57 insertions, 1 deletions
diff --git a/nvim/ftplugin/sh.lua b/nvim/ftplugin/sh.lua
new file mode 100644
index 0000000..cda52f1
--- /dev/null
+++ b/nvim/ftplugin/sh.lua
@@ -0,0 +1,4 @@
1local opt = vim.opt_local
2
3opt.expandtab = true
4opt.shiftwidth = 2
diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua
index 6cc998d..a665e82 100644
--- a/nvim/lua/config/keymaps.lua
+++ b/nvim/lua/config/keymaps.lua
@@ -16,7 +16,10 @@ function M.lsp(buffer, client)
16 map("n", "<leader>rn", vim.lsp.buf.rename, opts) 16 map("n", "<leader>rn", vim.lsp.buf.rename, opts)
17 map("n", "<leader>ca", vim.lsp.buf.code_action, opts) 17 map("n", "<leader>ca", vim.lsp.buf.code_action, opts)
18 map("n", "<leader>cf", function() 18 map("n", "<leader>cf", function()
19 vim.lsp.buf.format({ async = true; }) 19 require("conform").format({
20 async = true,
21 lsp_fallback = true,
22 })
20 end, opts) 23 end, opts)
21 24
22 if client and client.name == "clangd" then 25 if client and client.name == "clangd" then
diff --git a/nvim/lua/plugins/format.lua b/nvim/lua/plugins/format.lua
new file mode 100644
index 0000000..bdfaf03
--- /dev/null
+++ b/nvim/lua/plugins/format.lua
@@ -0,0 +1,20 @@
1return {
2 "stevearc/conform.nvim",
3 event = { "BufReadPre", "BufNewFile" },
4 opts = {
5 formatters_by_ft = {
6 sh = { "shfmt" }, -- brew install
7 bash = { "shfmt" },
8 python = { "ruff_format", "black" }, -- brew install ruff
9 lua = { "stylua" }, -- brew install stylua
10 typescript = { "prettierd", "prettier" },
11 javascript = { "prettierd", "prettier" },
12 json = { "jq" }, -- brew install jq
13 -- cpp = { "clang_format" },
14 },
15 },
16
17 config = function(_, opts)
18 require("conform").setup(opts)
19 end,
20}
diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua
index 4c549a7..30e3924 100644
--- a/nvim/lua/plugins/lsp.lua
+++ b/nvim/lua/plugins/lsp.lua
@@ -20,6 +20,22 @@ return {
20 }, 20 },
21 } 21 }
22 22
23 vim.lsp.config.bashls = {
24 settings = {
25 bashIde = {
26 shellcheck = {
27 enable = true,
28 severity = {
29 error = "error",
30 warning = "warning",
31 info = "info",
32 },
33 },
34 globPattern = "**/*.sh",
35 },
36 },
37 }
38
23 vim.lsp.enable({ 39 vim.lsp.enable({
24 "bashls", -- npm install -g bash-language-server 40 "bashls", -- npm install -g bash-language-server
25 "clangd", -- pkg install llvm 41 "clangd", -- pkg install llvm
diff --git a/nvim/stylua.toml b/nvim/stylua.toml
new file mode 100644
index 0000000..28b83c7
--- /dev/null
+++ b/nvim/stylua.toml
@@ -0,0 +1,13 @@
1syntax = "All"
2column_width = 120
3line_endings = "Unix"
4indent_type = "Spaces"
5indent_width = 2
6quote_style = "AutoPreferDouble"
7call_parentheses = "Always"
8collapse_simple_statement = "ConditionalOnly"
9space_after_function_names = "Never"
10block_newline_gaps = "Never"
11
12[sort_requires]
13enabled = false