From 74de7af4d68e765a5f2641761bc78138e70e9725 Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Tue, 10 Jan 2023 19:39:41 +0100 Subject: Add null-ls to neovim --- .bashrc | 6 +++--- .config/nvim/lua/lsp.lua | 23 +++++++++++++++++++++++ .config/nvim/lua/plugins.lua | 1 + .gitconfig | 2 +- .profile | 2 +- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.bashrc b/.bashrc index a3adf36..f21cf89 100644 --- a/.bashrc +++ b/.bashrc @@ -19,15 +19,15 @@ fi # Put your fun stuff here. alias cls="clear" -BAT="$(which bat || which batcat)" +BAT="$(which bat 2> /dev/null || which batcat 2> /dev/null)" if [ -n $BAT ] then alias cat="$BAT -p" fi -alias ls="$(which lsd || "ls -h -F --color=auto --group-directories-first")" -alias sudo="$(which doas || which sudo || 'su -c')" +alias ls="$(which lsd 2> /dev/null || echo "ls -h -F --color=auto --group-directories-first")" +alias sudo="$(which doas 2> /dev/null || which sudo 2> /dev/null || echo 'su -c')" alias codium="flatpak run com.vscodium.codium --no-sandbox --enable-features=UseOzonePlatform --ozone-platform=wayland" alias tmux="tmux -2" diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 9f9253a..ff46794 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -217,6 +217,29 @@ require("lspconfig").cssls.setup({ on_attach = on_attach; }) +local null_ls = require("null-ls") + +null_ls.setup({ + sources = { + null_ls.builtins.diagnostics.eslint, + null_ls.builtins.formatting.eslint, + null_ls.builtins.formatting.lua_format, + null_ls.builtins.formatting.prettier, + null_ls.builtins.formatting.rustfmt, + null_ls.builtins.code_actions.shellcheck, + null_ls.builtins.completion.spell, + null_ls.builtins.diagnostics.tsc, + null_ls.builtins.formatting.deno_fmt, + null_ls.builtins.code_actions.gitsigns.with({ + config = { + filter_actions = function(title) + return title:lower():match("blame") == nil -- filter out blame actions + end, + }, + }) + }, +}) + vim.diagnostic.config({ virtual_text = false; signs = true; diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 29ddc09..a6a411b 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -61,6 +61,7 @@ local PKGS = { { url = "https://github.com/ray-x/lsp_signature.nvim.git" }; { url = "https://github.com/Hoffs/omnisharp-extended-lsp.nvim.git" }; { url = "https://github.com/lewis6991/gitsigns.nvim.git" }; + { url = "https://github.com/jose-elias-alvarez/null-ls.nvim.git" }; -- Dev container { url = "https://codeberg.org/esensar/nvim-dev-container.git" }; diff --git a/.gitconfig b/.gitconfig index 9b8aa1d..f442193 100644 --- a/.gitconfig +++ b/.gitconfig @@ -15,7 +15,7 @@ defaultBranch = master [push] - push.autoSetupRemote + autoSetupRemote = true [core] pager = delta diff --git a/.profile b/.profile index e6bce23..6ebf84e 100644 --- a/.profile +++ b/.profile @@ -33,5 +33,5 @@ QT_QPA_PLATFORM=wayland; export QT_QPA_PLATFORM; XDG_CURRENT_DESKTOP=sway; export XDG_CURRENT_DESKTOP; XDG_SESSION_DESKTOP=sway; export XDG_SESSION_DESKTOP; -PATH="$HOME/go/bin:$DENO_INSTALL/bin:$BUN_INSTALL/bin:$HOME/.cargo/bin:$HOME/.local/bin:$PATH"; +PATH="$HOME/go/bin:$DENO_INSTALL/bin:$BUN_INSTALL/bin:$HOME/.cargo/bin:$HOME/.local/bin:$HOME/.luarocks/bin:$PATH"; -- cgit v1.2.3