summaryrefslogtreecommitdiffstats
path: root/after/ftplugin/bash.lua
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-05-04 08:44:50 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-05-06 16:43:16 +0200
commit34510ebc63ff65d51f6979a86169bfc52de6180c (patch)
tree36c8b73c99a3c566ccee888818c60204398991fd /after/ftplugin/bash.lua
downloadnvim-config-34510ebc63ff65d51f6979a86169bfc52de6180c.tar.gz
nvim-config-34510ebc63ff65d51f6979a86169bfc52de6180c.zip
feat: initial setup
- `dotfiles` (this project's CLI) - foot configuration - tmux configuration - bash configuration - nvim (as a git submodule) + configuration - ranger configuration - fzf configuration - KDE global shortcuts - Other miscellaneous dependencies
Diffstat (limited to 'after/ftplugin/bash.lua')
-rw-r--r--after/ftplugin/bash.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/after/ftplugin/bash.lua b/after/ftplugin/bash.lua
new file mode 100644
index 0000000..d46657d
--- /dev/null
+++ b/after/ftplugin/bash.lua
@@ -0,0 +1,17 @@
+vim.opt_local.textwidth = 80 -- gw wraps at this value
+vim.opt_local.colorcolumn = "+1" -- Highlight one column after 'textwidth'
+vim.opt_local.complete = {
+ "o", -- 'omnifunc'
+}
+
+vim.b.autoformat = true
+vim.b.format_func = function()
+ local ret = vim.system({ "shfmt" }, { stdin = vim.api.nvim_buf_get_lines(0, 0, -1, false) }):wait()
+ if ret.code ~= 0 then
+ vim.notify("shfmt failed (" .. ret.code .. "):\n" .. ret.stderr, vim.log.levels.WARN)
+ return
+ end
+ local view = vim.fn.winsaveview()
+ vim.cmd("%!shfmt")
+ vim.fn.winrestview(view)
+end