diff --git a/manjaro.sh b/manjaro.sh index 24f77c3..f22bb14 100755 --- a/manjaro.sh +++ b/manjaro.sh @@ -4,67 +4,73 @@ set -e # general sudo systemctl enable --now sshd.service sudo systemctl enable --now fstrim.timer -yay plymouth tldextract go nodejs unzip exa +yay -S plymouth tldextract go nodejs unzip exa # nvidia -yay cuda nvidia-settings nvidia-docker +yay -S cuda nvidia-settings nvidia-docker # python -yay python-pip pyenv ipython +yay -S python-pip pyenv ipython # sound -yay manjaro-pipewire pavucontrol +yay -S manjaro-pipewire pavucontrol # terminal and shell -yay kitty fish +yay -S kitty fish chsh -s /usr/bin/fish # 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 +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 -yay syncthings rclone +yay -S syncthings rclone glusterfs sudo systemctl enable --now syncthing@hjalmarlucius.service systemctl --user daemon-reload systemctl --user enable --now rclone-gdrive.service +sudo systemctl enable --now glusterd # 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 systemctl enable --now containerd.service sudo systemctl enable --now docker.service # printer -yay manajaro-printer samsung-unified-driver-printer +yay -S manajaro-printer samsung-unified-driver-printer # monitors -yay iftop bpytop nvtop +yay -S iftop bpytop nvtop # pdf -yay zathura zathura-pdf-mupdf zathura-djvu zathura-ps +yay -S zathura zathura-pdf-mupdf zathura-djvu zathura-ps # fonts -yay noto-fonts-emoji ttf-hack +yay -S noto-fonts-emoji ttf-hack # browser # zerotier -yay zerotier-one +yay -S zerotier-one sudo systemctl enable --now zerotier-one.service sudo zerotier-cli join d5e5fb653797795b # coolercontrol -yay coolercontrol +yay -S coolercontrol 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 -yay vlc protobuf -yay castnow +yay -S vlc protobuf +yay -S castnow # div applications -yay i3status \ +yay -S i3status \ rofi \ mutt \ redshift \ diff --git a/nvim/init.lua b/nvim/init.lua index f5da1d6..6e9cb26 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -149,11 +149,6 @@ require("lazy").setup({ vim.g.mkdp_echo_preview_url = 1 end, }, - { - "ellisonleao/glow.nvim", - config = true, - cmd = "Glow", - }, { -- better asterisk search "haya14busa/vim-asterisk", @@ -513,58 +508,85 @@ require("lazy").setup({ end, }, { - "williamboman/mason-lspconfig.nvim", - dependencies = { "williamboman/mason.nvim" }, - }, - { - -- 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() - require("mason-null-ls").setup({ - ensure_installed = nil, - automatic_setup = false, - automatic_installation = false, - }) - end, - }, - { - "jose-elias-alvarez/null-ls.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - config = function() - -- local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) - local null_ls = require("null-ls") - null_ls.setup({ - sources = { - -- null_ls.builtins.diagnostics.mypy, - 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) - -- 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, + "mhartington/formatter.nvim", + -- Utilities for creating configurations + config = function () + + local util = require("formatter.util") + local map = vim.keymap.set + local opts = { silent = true, noremap = true } + map("n", "f", ":Format", opts) + map("n", "F", ":FormatWrite", 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, + }, + lua = { + function () + return { + exe = "stylua", + args = { + "--search-parent-directories", + "--indent-type Spaces", + "--stdin-filepath", + util.escape_path(util.get_current_buffer_file_path()), + "--", + "-", + }, + stdin = true, + } + 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", @@ -609,22 +631,9 @@ require("lazy").setup({ bmap("n", "K", vim.lsp.buf.hover) bmap("n", "", vim.lsp.buf.rename) bmap("n", "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", "f", "Format") - if - client.server_capabilities.documentFormattingProvider - or client.server_capabilities.documentRangeFormattingProvider - then - vim.api.nvim_command([[augroup Format]]) - vim.api.nvim_command([[autocmd! * ]]) - vim.api.nvim_command([[autocmd BufWritePre * lua vim.lsp.buf.format({ timeout_ms = 5000 })]]) - vim.api.nvim_command([[augroup END]]) - end end - local servers = { + local server_configs = { pyright = { python = { analysis = { @@ -645,21 +654,12 @@ require("lazy").setup({ }, telemetry = { enable = false }, diagnostics = { - -- Get the language server to recognize the `vim` global + -- Get the language server to recognize the `vim` global in init.lua globals = { "vim" }, }, - format = { -- disable formatting, stylua handles it - enable = false, - }, + format = {enable = false}, }, }, - marksman = {}, - yamlls = {}, - tsserver = {}, - html = {}, - eslint = {}, - cssls = {}, - bashls = {}, } require("neodev").setup() @@ -668,14 +668,25 @@ require("lazy").setup({ local mason_lspconfig = require("mason-lspconfig") 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({ function(server_name) require("lspconfig")[server_name].setup({ capabilities = capabilities, on_attach = on_attach, - settings = servers[server_name], + settings = server_configs[server_name], }) end, }) @@ -771,16 +782,11 @@ vim.o.foldenable = false vim.o.foldmethod = "expr" vim.o.completeopt = "menu,menuone,noinsert" +vim.opt.formatoptions = vim.opt.formatoptions - {"c", "r", "o"} --- ---------------------------------------- --- AUTOCOMMANDS --- ---------------------------------------- -local cmd = vim.cmd - +-- press enter in quickfix list to goto vim.api.nvim_command([[augroup MYAU]]) 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 ]]) vim.api.nvim_command([[augroup END]]) @@ -837,14 +843,10 @@ map("n", "", "cn", { noremap = true }) map("n", "", "Lazy", { noremap = true }) map("n", "", "Mason", { noremap = true }) map("n", "", "LspInfo", { noremap = true }) -map("n", "", "NullLsInfo", { noremap = true }) map("n", "", "checkt", { noremap = true }) map("n", "", "TodoQuickFix", { noremap = true }) map("n", "", 'lua require("telescope.builtin").colorscheme({enable_preview=1})', { noremap = true }) --- shit HACK -map("n", "b", "!blackdoc %", { noremap = true }) - -- cursor color -- https://codeyarns.com/tech/2011-07-29-vim-chart-of-color-names.html