From ddd018042ef19ffb3e1e0be97f4a305730ac43ab Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sat, 4 Jan 2025 16:29:32 -0800 Subject: [PATCH] feat: Dotfile support --- nix/neovim-overlay.nix | 12 ++++++++++-- nvim/lsp/bash-language-server.lua | 11 +++++++++++ nvim/lua/lsp.lua | 2 +- nvim/lua/plugins/treesitter/nvim-treesitter.lua | 14 ++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 nvim/lsp/bash-language-server.lua diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index a474081..6e054dd 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -69,7 +69,10 @@ with final.pkgs.lib; let bash diff html + fish + git_config gitignore + hyprlang javascript jsdoc json @@ -84,6 +87,7 @@ with final.pkgs.lib; let printf python query + rasi regex toml tsx @@ -129,14 +133,18 @@ with final.pkgs.lib; let chafa # fzf-lua # Language servers + bash-language-server lua-language-server nixd + # Linters + biome + shellcheck + # Formatters + nodePackages.prettier shfmt stylua - biome - nodePackages.prettier ]; in { # This is the neovim derivation returned by the overlay. diff --git a/nvim/lsp/bash-language-server.lua b/nvim/lsp/bash-language-server.lua new file mode 100644 index 0000000..534a8af --- /dev/null +++ b/nvim/lsp/bash-language-server.lua @@ -0,0 +1,11 @@ +return { + filetypes = { 'bash', 'sh' }, + cmd = { 'bash-language-server', 'start' }, + root_markers = { '.git' }, + + settings = { + bashIde = { + globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)', + }, + }, +} diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua index fdc9b96..63efd1b 100644 --- a/nvim/lua/lsp.lua +++ b/nvim/lua/lsp.lua @@ -79,7 +79,7 @@ vim.lsp.config('*', { capabilities = capabilities, }) -vim.lsp.enable({ 'lua-language-server' }) +vim.lsp.enable({ 'bash-language-server', 'lua-language-server' }) -- Keymaps -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- MarleyVim.lsp.on_attach(function(client) diff --git a/nvim/lua/plugins/treesitter/nvim-treesitter.lua b/nvim/lua/plugins/treesitter/nvim-treesitter.lua index 092fee9..93e568c 100644 --- a/nvim/lua/plugins/treesitter/nvim-treesitter.lua +++ b/nvim/lua/plugins/treesitter/nvim-treesitter.lua @@ -9,6 +9,20 @@ return { require('lz.n').trigger_load('which-key.nvim') end, after = function() + vim.filetype.add({ + extension = { rasi = 'rasi', rofi = 'rasi', wofi = 'rasi' }, + pattern = { + ['.*/waybar/config'] = 'jsonc', + ['.*/mako/config'] = 'dosini', + ['.*/kitty/.+%.conf'] = 'kitty', + ['.*/hypr/.+*.conf'] = 'hyprlang', + ['%.env%.[%w_.-]+'] = 'sh', + }, + }) + + -- Use the bash parser for kitty files. + vim.treesitter.language.register('bash', 'kitty') + ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup({ auto_install = false,