From 8bd3162ccac3e20402149f91a2fc95a6db11e65c Mon Sep 17 00:00:00 2001 From: Lukas Trumm Date: Tue, 8 Nov 2022 13:31:55 +0100 Subject: [PATCH] chore --- aliases | 26 +++----- bootstrap/configuration/customInstalls.ts | 7 +-- nvim/after/plugin/null-ls.lua | 36 ++++++++--- nvim/after/plugin/telescope.lua | 10 ++- nvim/lua/lsp-settings.lua | 77 +++++++++-------------- zshenv | 10 ++- zshrc | 3 + 7 files changed, 88 insertions(+), 81 deletions(-) diff --git a/aliases b/aliases index 0e4efc8..05c2120 100644 --- a/aliases +++ b/aliases @@ -81,30 +81,18 @@ alias sand="cd ~/sandbox" # npm # ================================================================= -alias nr="npm run" -alias ns="npm start" - alias nb="npm run build" -alias build="npm run build" - alias nd="npm run dev" -alias dev="npm run dev" - -alias nli="npm run lint" -alias lint="npm run lint" - +alias ni="npm install" +alias nid="npm install --save-dev" +alias nl="npm run lint" +alias nr="npm run" +alias ns="npm start" alias nse="npm run serve" -alias serve="npm run serve" -alias server="npm run server" - -alias nw="npm run watch" alias nt="npm run --silent test" -alias ni="npm install" alias nuni="npm uninstall" -alias nid="npm install --save-dev" -alias nig="npm install -g" - -alias sb="npm run storybook" +alias nv="npm run validate" +alias nw="npm run watch" alias pn="pnpm" diff --git a/bootstrap/configuration/customInstalls.ts b/bootstrap/configuration/customInstalls.ts index 90e3def..06ade85 100644 --- a/bootstrap/configuration/customInstalls.ts +++ b/bootstrap/configuration/customInstalls.ts @@ -74,18 +74,15 @@ const voltaPackages = [ "git-standup", "hygen", "json", - "luafmt", + "lua-fmt", "netlify", - "node", "npm-why", "nx", "open-cli", - "pnpm", "pollinate", "prettier", - "prettierd", + "@fsouza/prettierd", "stylelint", - "tsserver", "typescript-language-server", ]; diff --git a/nvim/after/plugin/null-ls.lua b/nvim/after/plugin/null-ls.lua index 2e9154f..9561d28 100644 --- a/nvim/after/plugin/null-ls.lua +++ b/nvim/after/plugin/null-ls.lua @@ -16,39 +16,61 @@ null_ls.setup { null_ls.builtins.formatting.prettierd.with( { condition = function(utils) - return not utils.root_has_file({"deno.json"}) + return not utils.root_has_file({ "deno.json" }) end } ), null_ls.builtins.formatting.deno_fmt.with( { condition = function(utils) - return utils.root_has_file({"deno.json"}) + return utils.root_has_file({ "deno.json" }) end } ), null_ls.builtins.formatting.eslint_d, - -- null_ls.builtins.formatting.stylelint, - null_ls.builtins.formatting.lua_format + null_ls.builtins.formatting.stylelint.with( + { + filetypes = { "scss", "less", "css", "sass", "vue" } + } + ), + null_ls.builtins.formatting.lua_format, -- -- Linting / diagnostics -- - -- These are run as language servers + -- Others are run as language servers + null_ls.builtins.diagnostics.eslint_d.with( + { + -- ignore prettier warnings from eslint-plugin-prettier + filter = function(diagnostic) + return diagnostic.code ~= "prettier/prettier" + end + } + ), + null_ls.builtins.diagnostics.stylelint.with( + { + filetypes = { "scss", "less", "css", "sass", "vue" } + } + ) }, -- https://github.com/jose-elias-alvarez/null-ls.nvim/wiki/Formatting-on-save on_attach = function(client, bufnr) if client.supports_method("textDocument/formatting") then - vim.api.nvim_clear_autocmds({group = augroup, buffer = bufnr}) + 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}) + vim.lsp.buf.format({ bufnr = bufnr }) end } ) end + vim.diagnostic.config( + { + virtual_text = false + } + ) end } diff --git a/nvim/after/plugin/telescope.lua b/nvim/after/plugin/telescope.lua index 5190420..4793301 100644 --- a/nvim/after/plugin/telescope.lua +++ b/nvim/after/plugin/telescope.lua @@ -98,9 +98,17 @@ require("telescope._extensions.zoxide.config").setup( -- show me only the path with '~' for the home directory list_command = "zoxide query -ls | grep -v '\\.local' | awk '{ print $2 }' | sed 's:" .. vim.env.HOME .. "/::'", mappings = { + default = { + action = function(selection) + vim.cmd("cd " .. vim.env.HOME .. "/" .. selection.path) + end, + after_action = function(selection) + print("Directory changed to " .. selection.path) + end + }, [""] = { action = function(selection) - vim.cmd("lcd " .. selection.path) + vim.cmd("lcd " .. vim.env.HOME .. "/" .. selection.path) end } } diff --git a/nvim/lua/lsp-settings.lua b/nvim/lua/lsp-settings.lua index f0a6514..375f592 100644 --- a/nvim/lua/lsp-settings.lua +++ b/nvim/lua/lsp-settings.lua @@ -8,7 +8,7 @@ local servers = { "bashls", "cssls", "denols", - "eslint", + -- "eslint", "gopls", "graphql", "html", @@ -16,7 +16,6 @@ local servers = { "phpactor", "prismals", "sumneko_lua", - "stylelint_lsp", "svelte", "tailwindcss", "terraformls", @@ -83,46 +82,36 @@ local denols = { } } -local stylelint_lsp = { - filetypes = { "css", "less", "scss", "vue", "javascriptreact", "typescriptreact" }, - settings = { - stylelintplus = { - autoFixOnFormat = true, - autoFixOnSave = true - } - } -} - -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#eslint -local eslint = { - { - codeAction = { - disableRuleComment = { - enable = true, - location = "separateLine" - }, - showDocumentation = { - enable = true - } - }, - codeActionOnSave = { - enable = false, - mode = "all" - }, - format = true, - nodePath = "", - onIgnoredFiles = "off", - packageManager = "npm", - quiet = false, - rulesCustomizations = {}, - run = "onType", - useESLintClass = false, - validate = "on", - workingDirectory = { - mode = "location" - } - } -} +-- local eslint = { +-- { +-- codeAction = { +-- disableRuleComment = { +-- enable = true, +-- location = "separateLine" +-- }, +-- showDocumentation = { +-- enable = true +-- } +-- }, +-- codeActionOnSave = { +-- enable = false, +-- mode = "all" +-- }, +-- format = true, +-- nodePath = "", +-- onIgnoredFiles = "off", +-- packageManager = "npm", +-- quiet = false, +-- rulesCustomizations = {}, +-- run = "onType", +-- useESLintClass = false, +-- validate = "on", +-- workingDirectory = { +-- mode = "location" +-- } +-- } +-- } local sumneko_lua = { cmd = { @@ -159,8 +148,7 @@ local jsonls = { local custom_configs = { denols = denols, - stylelint_lsp = stylelint_lsp, - eslint = eslint, + -- eslint = eslint, sumneko_lua = sumneko_lua, vuels = vuels, jsonls = jsonls @@ -201,9 +189,6 @@ local function file_exists(name) end local function setup_server(server) - if server == "stylelint_lsp" and not file_exists(os.getenv("PWD") .. "/package.json") then - return - end if server == "denols" and file_exists(os.getenv("PWD") .. "/package.json") then return end diff --git a/zshenv b/zshenv index 91bde1c..4d7750c 100644 --- a/zshenv +++ b/zshenv @@ -31,9 +31,13 @@ export PATH="$HOME/.local/bin:$PATH" NPM_GLOBAL="$HOME/.npm-global" export PATH="$NPM_GLOBAL/bin:$PATH" -# volta manager -export VOLTA_HOME="$HOME/.volta" -export PATH="$VOLTA_HOME/bin:$PATH" +# pnpm +export PNPM_HOME="$HOME/.local/share/pnpm" +export PATH="$PNPM_HOME:$PATH" + +# FNM +export PATH=/home/lukas/.fnm:$PATH +eval "$(fnm env --use-on-cd)" # deno path export DENO_INSTALL="/home/lukas/.deno" diff --git a/zshrc b/zshrc index 7b348c4..8d8ce35 100644 --- a/zshrc +++ b/zshrc @@ -24,6 +24,9 @@ autoload -Uz compinit bindkey -e +# fix delete key +bindkey "^[[3~" delete-char + # Do not catch Ctrl+q and Ctrl+s by the terminal # (I use it in vim) stty start undef