From 07b070cba04b0b355196e0d8c0f47b448ce06b8b Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Thu, 30 Nov 2023 13:38:09 +0100 Subject: [PATCH] Add in new conf --- playbooks/apt.yaml | 1 + templates/config.lua.j2 | 142 ++++++++++++++++++++++++--------------- templates/sway_config.j2 | 3 +- 3 files changed, 90 insertions(+), 56 deletions(-) diff --git a/playbooks/apt.yaml b/playbooks/apt.yaml index 8541ea3..bef5503 100644 --- a/playbooks/apt.yaml +++ b/playbooks/apt.yaml @@ -22,6 +22,7 @@ - foot - git - grimshot + - hiera-eyaml - inkscape - isort - libreoffice diff --git a/templates/config.lua.j2 b/templates/config.lua.j2 index bb82706..1155a32 100644 --- a/templates/config.lua.j2 +++ b/templates/config.lua.j2 @@ -15,9 +15,9 @@ vim.opt.relativenumber = true -- general lvim.log.level = "info" lvim.format_on_save = { - enabled = true, - pattern = "*.lua", - timeout = 1000, + enabled = true, + pattern = "*.lua", + timeout = 1000, } -- to disable icons and use a minimalist setup, uncomment the following -- lvim.use_icons = false @@ -59,55 +59,56 @@ lvim.builtin.treesitter.ensure_installed = { "comment", "markdown_inline", "rege -- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect -- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers` -- add `pylyzer` to `skipped_servers` list +require("mason").setup() +require("mason-lspconfig").setup() vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pylyzer" }) -- remove `pyright` from `skipped_servers` list lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) - return server ~= "pyright" + return server ~= "pyright" end, lvim.lsp.automatic_configuration.skipped_servers) -require("mason-lspconfig").setup { - automatic_installation = { exclude = { "puppet", "pylyzer" } } -} +require("mason-lspconfig").setup({ + automatic_installation = { exclude = { "puppet", "pylyzer" } }, +}) -- local opts = {} -- check the lspconfig documentation for a list of all possible options -- require("lvim.lsp.manager").setup("pyright", opts) --require 'lspconfig'.puppet.setup {} local null_ls = require("null-ls") null_ls.setup({ - sources = { - null_ls.builtins.diagnostics.puppet_lint, - null_ls.builtins.formatting.puppet_lint, - }, + sources = { + null_ls.builtins.diagnostics.puppet_lint, + null_ls.builtins.formatting.puppet_lint, + }, }) - -- -- linters, formatters and code actions -local formatters = require "lvim.lsp.null-ls.formatters" -formatters.setup { - { command = "stylua" }, - { - command = "prettier", - extra_args = { "--print-width", "100" }, - filetypes = { "typescript", "typescriptreact" }, - }, - { - command = "yapf", - -- extra_args = { "-i" }, - filetypes = { "python" }, - }, - { - command = "isort", - filetypes = { "python" }, - }, - { - command = "yamlfix", - filetypes = { "yaml" }, - }, - { - command = "shfmt", - extra_args = { "-w" }, - filetypes = { "sh" }, - }, -} +local formatters = require("lvim.lsp.null-ls.formatters") +formatters.setup({ + { command = "stylua" }, + { + command = "prettier", + extra_args = { "--print-width", "100" }, + filetypes = { "typescript", "typescriptreact" }, + }, + { + command = "yapf", + -- extra_args = { "-i" }, + filetypes = { "python" }, + }, + { + command = "isort", + filetypes = { "python" }, + }, + { + command = "yamlfix", + filetypes = { "yaml" }, + }, + { + command = "shfmt", + extra_args = { "-w" }, + filetypes = { "sh" }, + }, +}) -- local linters = require "lvim.lsp.null-ls.linters" -- linters.setup { -- { command = "flake8", filetypes = { "python" } }, @@ -126,21 +127,21 @@ formatters.setup { -- -- Additional Plugins lvim.plugins = { - { - "rodjek/vim-puppet", - "tpope/vim-surround", - "TabbyML/vim-tabby", - }, + { + "rodjek/vim-puppet", + "tpope/vim-surround", + "TabbyML/vim-tabby", + }, } -- -- Autocommands (`:help autocmd`) vim.api.nvim_create_autocmd("BufReadPost", { - pattern = { "*" }, - callback = function() - if vim.fn.line("'\"") > 1 and vim.fn.line("'\"") <= vim.fn.line("$") then - vim.api.nvim_exec("normal! g'\"", false) - end - end + pattern = { "*" }, + callback = function() + if vim.fn.line("'\"") > 1 and vim.fn.line("'\"") <= vim.fn.line("$") then + vim.api.nvim_exec("normal! g'\"", false) + end + end, }) -- vim.api.nvim_create_autocmd("FileType", { -- pattern = "zsh", @@ -150,13 +151,44 @@ vim.api.nvim_create_autocmd("BufReadPost", { -- end, -- }) - -vim.g.tabby_keybinding_accept = '' -vim.g.tabby_keybinding_trigger_or_dismiss = '' +vim.g.tabby_keybinding_accept = "" +vim.g.tabby_keybinding_trigger_or_dismiss = "" vim.g.tabby_suggestion_delay = 100 lvim.builtin.which_key.mappings["lh"] = { - "lua vim.lsp.buf.hover()", "Show documentation" + "lua vim.lsp.buf.hover()", + "Show documentation", } lvim.builtin.which_key.mappings["lu"] = { - "lua require('telescope.builtin').lsp_references()", "Show usage" + "lua require('telescope.builtin').lsp_references()", + "Show usage", } +local lspconfig = require("lspconfig") +local configs = require("lspconfig.configs") +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +if not configs.intelephense then + configs.intelephense = { + default_config = { + cmd = { "intelephense", "--stdio" }, + filetypes = { "php" }, + root_dir = function(fname) + return vim.loop.cwd() + end, + settings = { + intelephense = { + files = { + maxSize = 1000000, + }, + environment = { + includePaths = { + "/home/micke/sources/nextcloud/server", + }, + }, + }, + }, + }, + } +end + +lspconfig.intelephense.setup({ capabilities = capabilities }) diff --git a/templates/sway_config.j2 b/templates/sway_config.j2 index ca75731..8589525 100644 --- a/templates/sway_config.j2 +++ b/templates/sway_config.j2 @@ -8,7 +8,7 @@ set $down j set $up k set $right l # Your preferred terminal emulator -set $term foot +set $term foot-client # Your preferred application launcher # Note: pass the final command to swaymsg so that the resulting window can be opened # on the original workspace that the command was run on. @@ -20,6 +20,7 @@ exec --no-startup-id autotiling exec --no-startup-id lxpolkit exec --no-startup-id nextcloud exec --no-startup-id fcitx5 +exec --no-startup-id foot --server include /etc/sway/config-vars.d/*