null ls removed

This commit is contained in:
Henrik Bakken
2023-08-14 20:22:52 +02:00
parent c3d90ae859
commit 02a696cf24
2 changed files with 121 additions and 113 deletions
+23 -17
View File
@@ -4,67 +4,73 @@ set -e
# general # general
sudo systemctl enable --now sshd.service sudo systemctl enable --now sshd.service
sudo systemctl enable --now fstrim.timer sudo systemctl enable --now fstrim.timer
yay plymouth tldextract go nodejs unzip exa yay -S plymouth tldextract go nodejs unzip exa
# nvidia # nvidia
yay cuda nvidia-settings nvidia-docker yay -S cuda nvidia-settings nvidia-docker
# python # python
yay python-pip pyenv ipython yay -S python-pip pyenv ipython
# sound # sound
yay manjaro-pipewire pavucontrol yay -S manjaro-pipewire pavucontrol
# terminal and shell # terminal and shell
yay kitty fish yay -S kitty fish
chsh -s /usr/bin/fish chsh -s /usr/bin/fish
# code # code
yay neovim tig stylua tmux diff-so-fancy ripgrep prettier jq git-lfs git-secret shfmt yq glow nvimpager git-delta yay -S neovim tmux tig diff-so-fancy ripgrep nvimpager
git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm
# git
yay -S git-secret git-delta git-lfs
# formatters
yay -S python-black python-blackdoc python-pyment python-isort \
eslint_d eslint jq yamlfmt shfmt prettierd
# file sync # file sync
yay syncthings rclone yay -S syncthings rclone glusterfs
sudo systemctl enable --now syncthing@hjalmarlucius.service sudo systemctl enable --now syncthing@hjalmarlucius.service
systemctl --user daemon-reload systemctl --user daemon-reload
systemctl --user enable --now rclone-gdrive.service systemctl --user enable --now rclone-gdrive.service
sudo systemctl enable --now glusterd
# docker incl non-root daemon # docker incl non-root daemon
yay docker docker-compose dry-bin nvidia-docker docker-buildx yay -S docker docker-compose dry-bin nvidia-docker docker-buildx
sudo groupadd docker && sudo usermod -aG docker $USER sudo groupadd docker && sudo usermod -aG docker $USER
sudo systemctl enable --now containerd.service sudo systemctl enable --now containerd.service
sudo systemctl enable --now docker.service sudo systemctl enable --now docker.service
# printer # printer
yay manajaro-printer samsung-unified-driver-printer yay -S manajaro-printer samsung-unified-driver-printer
# monitors # monitors
yay iftop bpytop nvtop yay -S iftop bpytop nvtop
# pdf # pdf
yay zathura zathura-pdf-mupdf zathura-djvu zathura-ps yay -S zathura zathura-pdf-mupdf zathura-djvu zathura-ps
# fonts # fonts
yay noto-fonts-emoji ttf-hack yay -S noto-fonts-emoji ttf-hack
# browser # browser
# zerotier # zerotier
yay zerotier-one yay -S zerotier-one
sudo systemctl enable --now zerotier-one.service sudo systemctl enable --now zerotier-one.service
sudo zerotier-cli join d5e5fb653797795b sudo zerotier-cli join d5e5fb653797795b
# coolercontrol # coolercontrol
yay coolercontrol yay -S coolercontrol
sudo systemctl enable --now coolercontrold.service sudo systemctl enable --now coolercontrold.service
sudo systemctl edit coolercontrold.service # set log level to WARN sudo systemctl edit coolercontrold.service # set log level to WARN
# video streaming # video streaming
yay vlc protobuf yay -S vlc protobuf
yay castnow yay -S castnow
# div applications # div applications
yay i3status \ yay -S i3status \
rofi \ rofi \
mutt \ mutt \
redshift \ redshift \
+92 -90
View File
@@ -149,11 +149,6 @@ require("lazy").setup({
vim.g.mkdp_echo_preview_url = 1 vim.g.mkdp_echo_preview_url = 1
end, end,
}, },
{
"ellisonleao/glow.nvim",
config = true,
cmd = "Glow",
},
{ {
-- better asterisk search -- better asterisk search
"haya14busa/vim-asterisk", "haya14busa/vim-asterisk",
@@ -513,59 +508,86 @@ require("lazy").setup({
end, end,
}, },
{ {
"williamboman/mason-lspconfig.nvim", "mhartington/formatter.nvim",
dependencies = { "williamboman/mason.nvim" }, -- Utilities for creating configurations
},
{
-- autoinstalls stuff specified in null-ls
"jay-babu/mason-null-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"williamboman/mason.nvim",
"jose-elias-alvarez/null-ls.nvim",
},
config = function () config = function ()
require("mason-null-ls").setup({
ensure_installed = nil, local util = require("formatter.util")
automatic_setup = false, local map = vim.keymap.set
automatic_installation = false, local opts = { silent = true, noremap = true }
}) map("n", "<leader>f", ":Format<cr>", opts)
map("n", "<leader>F", ":FormatWrite<cr>", opts)
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
require("formatter").setup({
logging = true,
log_level = vim.log.levels.WARN,
filetype = {
python = {
require("formatter.filetypes.python").black,
-- require("formatter.filetypes.python").pyment,
function ()
return {
exe = "isort",
args = { "--quiet", "--profile black", "--force-single-line-import", "-" },
stdin = true,
}
end,
function ()
return {
exe = "black",
args = { "--quiet", "--preview", "-" },
stdin = true,
}
end,
function ()
return {
exe = "blackdoc",
args = { "-q", "-t py311", },
stdin = false,
}
end, end,
}, },
{ lua = {
"jose-elias-alvarez/null-ls.nvim", function ()
dependencies = { "nvim-lua/plenary.nvim" }, return {
config = function() exe = "stylua",
-- local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) args = {
local null_ls = require("null-ls") "--search-parent-directories",
null_ls.setup({ "--indent-type Spaces",
sources = { "--stdin-filepath",
-- null_ls.builtins.diagnostics.mypy, util.escape_path(util.get_current_buffer_file_path()),
null_ls.builtins.diagnostics.eslint_d, "--",
null_ls.builtins.formatting.black.with({ extra_args = { "--preview" } }), "-",
null_ls.builtins.formatting.eslint_d,
null_ls.builtins.formatting.isort,
null_ls.builtins.formatting.jq,
null_ls.builtins.formatting.prettierd,
null_ls.builtins.formatting.shfmt.with({ extra_args = { "--indent", "4" } }),
null_ls.builtins.formatting.stylua.with({ extra_args = { "--indent-type", "Spaces" } }),
null_ls.builtins.formatting.yamlfmt,
}, },
-- on_attach = function(client, bufnr) stdin = true,
-- if client.supports_method("textDocument/formatting") then }
-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
-- vim.api.nvim_create_autocmd("BufWritePre", {
-- group = augroup,
-- buffer = bufnr,
-- callback = function()
-- vim.lsp.buf.format({ bufnr = bufnr })
-- end,
-- })
-- end
-- end,
})
end, end,
}, },
yaml = {
function ()
return {
exe = "yamlfmt",
args = { "-formatter indentless_arrays=true,retain_line_breaks=true,line_ending=lf,max_line_length=100,pad_line_comments=2", "-in" },
stdin = true,
}
end,
},
sh = { require("formatter.filetypes.sh").shfmt, },
typescript = { require("formatter.filetypes.typescript").eslint_d, },
javascript = { require("formatter.filetypes.javascript").eslint_d, },
html = { require("formatter.filetypes.html").prettierd, },
css = {
require("formatter.filetypes.css").prettierd,
require("formatter.filetypes.css").eslint_d,
},
markdown = { require("formatter.filetypes.markdown").prettierd, },
json = {require("formatter.filetypes.json").jq, },
["*"] = { require("formatter.filetypes.any").remove_trailing_whitespace },
}
})
end
},
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = { dependencies = {
@@ -609,22 +631,9 @@ require("lazy").setup({
bmap("n", "K", vim.lsp.buf.hover) bmap("n", "K", vim.lsp.buf.hover)
bmap("n", "<M-r>", vim.lsp.buf.rename) bmap("n", "<M-r>", vim.lsp.buf.rename)
bmap("n", "<leader>ca", vim.lsp.buf.code_action) bmap("n", "<leader>ca", vim.lsp.buf.code_action)
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
vim.lsp.buf.format({ timeout_ms = 5000 })
end, { desc = "Format current buffer with LSP" })
bmap("n", "<leader>f", "<cmd>Format<cr>")
if
client.server_capabilities.documentFormattingProvider
or client.server_capabilities.documentRangeFormattingProvider
then
vim.api.nvim_command([[augroup Format]])
vim.api.nvim_command([[autocmd! * <buffer>]])
vim.api.nvim_command([[autocmd BufWritePre * lua vim.lsp.buf.format({ timeout_ms = 5000 })]])
vim.api.nvim_command([[augroup END]])
end
end end
local servers = { local server_configs = {
pyright = { pyright = {
python = { python = {
analysis = { analysis = {
@@ -645,21 +654,12 @@ require("lazy").setup({
}, },
telemetry = { enable = false }, telemetry = { enable = false },
diagnostics = { diagnostics = {
-- Get the language server to recognize the `vim` global -- Get the language server to recognize the `vim` global in init.lua
globals = { "vim" }, globals = { "vim" },
}, },
format = { -- disable formatting, stylua handles it format = {enable = false},
enable = false,
}, },
}, },
},
marksman = {},
yamlls = {},
tsserver = {},
html = {},
eslint = {},
cssls = {},
bashls = {},
} }
require("neodev").setup() require("neodev").setup()
@@ -668,14 +668,25 @@ require("lazy").setup({
local mason_lspconfig = require("mason-lspconfig") local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup({ mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers), ensure_installed = {
"bashls", -- bash
"cssls", -- css
"eslint", -- javascript
"html", -- html
"jsonls", -- json
"lua_ls", -- lua
"marksman", -- markdown
"pyright", -- python
"tsserver", -- typescript
"yamlls", -- yaml
},
}) })
mason_lspconfig.setup_handlers({ mason_lspconfig.setup_handlers({
function(server_name) function(server_name)
require("lspconfig")[server_name].setup({ require("lspconfig")[server_name].setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = on_attach, on_attach = on_attach,
settings = servers[server_name], settings = server_configs[server_name],
}) })
end, end,
}) })
@@ -771,16 +782,11 @@ vim.o.foldenable = false
vim.o.foldmethod = "expr" vim.o.foldmethod = "expr"
vim.o.completeopt = "menu,menuone,noinsert" vim.o.completeopt = "menu,menuone,noinsert"
vim.opt.formatoptions = vim.opt.formatoptions - {"c", "r", "o"}
-- ---------------------------------------- -- press enter in quickfix list to goto
-- AUTOCOMMANDS
-- ----------------------------------------
local cmd = vim.cmd
vim.api.nvim_command([[augroup MYAU]]) vim.api.nvim_command([[augroup MYAU]])
vim.api.nvim_command([[autocmd!]]) vim.api.nvim_command([[autocmd!]])
vim.api.nvim_command([[autocmd BufWritePre * %s/\s\+$//e]])
vim.api.nvim_command([[autocmd FileType python setlocal indentkeys-=<:>]])
vim.api.nvim_command([[autocmd BufReadPost quickfix nmap <buffer> <cr> <cr>]]) vim.api.nvim_command([[autocmd BufReadPost quickfix nmap <buffer> <cr> <cr>]])
vim.api.nvim_command([[augroup END]]) vim.api.nvim_command([[augroup END]])
@@ -837,14 +843,10 @@ map("n", "<C-n>", "<cmd>cn<cr>", { noremap = true })
map("n", "<F1>", "<cmd>Lazy<cr>", { noremap = true }) map("n", "<F1>", "<cmd>Lazy<cr>", { noremap = true })
map("n", "<F2>", "<cmd>Mason<cr>", { noremap = true }) map("n", "<F2>", "<cmd>Mason<cr>", { noremap = true })
map("n", "<F3>", "<cmd>LspInfo<cr>", { noremap = true }) map("n", "<F3>", "<cmd>LspInfo<cr>", { noremap = true })
map("n", "<F4>", "<cmd>NullLsInfo<cr>", { noremap = true })
map("n", "<F5>", "<cmd>checkt<cr>", { noremap = true }) map("n", "<F5>", "<cmd>checkt<cr>", { noremap = true })
map("n", "<F6>", "<cmd>TodoQuickFix<cr>", { noremap = true }) map("n", "<F6>", "<cmd>TodoQuickFix<cr>", { noremap = true })
map("n", "<F9>", '<cmd>lua require("telescope.builtin").colorscheme({enable_preview=1})<cr>', { noremap = true }) map("n", "<F9>", '<cmd>lua require("telescope.builtin").colorscheme({enable_preview=1})<cr>', { noremap = true })
-- shit HACK
map("n", "<leader>b", "<cmd>!blackdoc %<cr>", { noremap = true })
-- cursor color -- cursor color
-- https://codeyarns.com/tech/2011-07-29-vim-chart-of-color-names.html -- https://codeyarns.com/tech/2011-07-29-vim-chart-of-color-names.html