From 543b6c0e30ebce183288728994202db441883e16 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 10 Mar 2023 08:28:04 -0500 Subject: [PATCH] chore: simplify user configuration --- .github/README.md | 10 ++++- colorscheme.lua | 2 - diagnostics.lua | 5 --- heirline/attributes.lua | 5 --- heirline/colors.lua | 6 --- heirline/icon_highlights.lua | 9 ---- heirline/separators.lua | 5 --- init.lua | 84 ++++++++++++++++++++++++++++++++++++ lazy.lua | 10 ----- lsp/config/yamlls.lua | 12 ------ lsp/formatting.lua | 20 --------- lsp/mappings.lua | 6 --- lsp/servers.lua | 4 -- lsp/setup_handlers.lua | 10 ----- plugins/alpha.lua | 21 --------- plugins/core.lua | 21 +++++++++ polish.lua | 17 -------- updater.lua | 17 -------- 18 files changed, 113 insertions(+), 151 deletions(-) delete mode 100644 colorscheme.lua delete mode 100644 diagnostics.lua delete mode 100644 heirline/attributes.lua delete mode 100644 heirline/colors.lua delete mode 100644 heirline/icon_highlights.lua delete mode 100644 heirline/separators.lua create mode 100644 init.lua delete mode 100644 lazy.lua delete mode 100644 lsp/config/yamlls.lua delete mode 100644 lsp/formatting.lua delete mode 100644 lsp/mappings.lua delete mode 100644 lsp/servers.lua delete mode 100644 lsp/setup_handlers.lua delete mode 100644 plugins/alpha.lua delete mode 100644 polish.lua delete mode 100644 updater.lua diff --git a/.github/README.md b/.github/README.md index 4949602..a80e1f2 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,4 +1,4 @@ -# AstroNvim Structured User Example +# AstroNvim User Configuration Example A user configuration template for [AstroNvim](https://github.com/AstroNvim/AstroNvim) @@ -19,10 +19,16 @@ mv ~/.local/share/nvim ~/.local/share/nvim.bak git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim ``` +#### Create a new user repository from this template + +Press the "Use this template" button above to create a new repository to store your user configuration. + +You can also just clone this repository directly if you do not want to track your user configuration in GitHub. + #### Clone the repository ```shell -git clone https://github.com/AstroNvim/split_user_example ~/.config/nvim/lua/user +git clone https://github.com// ~/.config/nvim/lua/user ``` #### Start Neovim diff --git a/colorscheme.lua b/colorscheme.lua deleted file mode 100644 index 6f6f3a0..0000000 --- a/colorscheme.lua +++ /dev/null @@ -1,2 +0,0 @@ --- Set colorscheme to use -return "astrodark" diff --git a/diagnostics.lua b/diagnostics.lua deleted file mode 100644 index 247e909..0000000 --- a/diagnostics.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on -return { - virtual_text = true, - underline = true, -} diff --git a/heirline/attributes.lua b/heirline/attributes.lua deleted file mode 100644 index 75f0945..0000000 --- a/heirline/attributes.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Customize attributes of highlighting in Heirline components -return { - -- styling choices for each heirline element, check possible attributes with `:h attr-list` - git_branch = { bold = true }, -- bold the git branch statusline component -} diff --git a/heirline/colors.lua b/heirline/colors.lua deleted file mode 100644 index 8d22abb..0000000 --- a/heirline/colors.lua +++ /dev/null @@ -1,6 +0,0 @@ --- Customize colors for each element each element has a `_fg` and a `_bg` -return function(colors) - local get_hlgroup = require("astronvim.utils").get_hlgroup - colors.git_branch_fg = get_hlgroup("Conditional").fg - return colors -end diff --git a/heirline/icon_highlights.lua b/heirline/icon_highlights.lua deleted file mode 100644 index 0867580..0000000 --- a/heirline/icon_highlights.lua +++ /dev/null @@ -1,9 +0,0 @@ --- Customize if icons should be highlighted -return { - breadcrumbs = false, -- LSP symbols in the breadcrumbs - file_icon = { - winbar = false, -- Filetype icon in the winbar inactive windows - statusline = true, -- Filetype icon in the statusline - tabline = true, -- Filetype icon in the tabline - }, -} diff --git a/heirline/separators.lua b/heirline/separators.lua deleted file mode 100644 index 340de0f..0000000 --- a/heirline/separators.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Customize different separators between sections -return { - breadcrumbs = " > ", - tab = { "", "" }, -} diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..6c4a376 --- /dev/null +++ b/init.lua @@ -0,0 +1,84 @@ +return { + -- Configure AstroNvim updates + updater = { + remote = "origin", -- remote to use + channel = "nightly", -- "stable" or "nightly" + version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY) + branch = "nightly", -- branch name (NIGHTLY ONLY) + commit = nil, -- commit hash (NIGHTLY ONLY) + pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only) + skip_prompts = false, -- skip prompts about breaking changes + show_changelog = true, -- show the changelog after performing an update + auto_quit = false, -- automatically quit the current session after a successful update + remotes = { -- easily add new remotes to track + -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url + -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut, + -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork + }, + }, + + -- Set colorscheme to use + colorscheme = "astrodark", + + -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on + diagnostics = { + virtual_text = true, + underline = true, + }, + + lsp = { + -- customize lsp formatting options + formatting = { + -- control auto formatting on save + format_on_save = { + enabled = true, -- enable or disable format on save globally + allow_filetypes = { -- enable format on save for specified filetypes only + -- "go", + }, + ignore_filetypes = { -- disable format on save for specified filetypes + -- "python", + }, + }, + disabled = { -- disable formatting capabilities for the listed language servers + -- "sumneko_lua", + }, + timeout_ms = 1000, -- default format timeout + -- filter = function(client) -- fully override the default formatting function + -- return true + -- end + }, + -- enable servers that you already have installed without mason + servers = { + -- "pyright" + }, + }, + + -- Configure require("lazy").setup() options + lazy = { + defaults = { lazy = true }, + performance = { + rtp = { + -- customize default disabled vim plugins + disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin", "matchparen" }, + }, + }, + }, + + -- This function is run last and is a good place to configuring + -- augroups/autocommands and custom filetypes also this just pure lua so + -- anything that doesn't fit in the normal config locations above can go here + polish = function() + -- Set up custom filetypes + -- vim.filetype.add { + -- extension = { + -- foo = "fooscript", + -- }, + -- filename = { + -- ["Foofile"] = "fooscript", + -- }, + -- pattern = { + -- ["~/%.config/foo/.*"] = "fooscript", + -- }, + -- } + end, +} diff --git a/lazy.lua b/lazy.lua deleted file mode 100644 index 63d0c8e..0000000 --- a/lazy.lua +++ /dev/null @@ -1,10 +0,0 @@ --- Configure require("lazy").setup() options -return { - defaults = { lazy = true }, - performance = { - rtp = { - -- customize default disabled vim plugins - disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin", "matchparen" }, - }, - }, -} diff --git a/lsp/config/yamlls.lua b/lsp/config/yamlls.lua deleted file mode 100644 index 83a7685..0000000 --- a/lsp/config/yamlls.lua +++ /dev/null @@ -1,12 +0,0 @@ --- example for addings schemas to yamlls -return { -- override table for require("lspconfig").yamlls.setup({...}) - settings = { - yaml = { - schemas = { - ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}", - ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}", - ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}", - }, - }, - }, -} diff --git a/lsp/formatting.lua b/lsp/formatting.lua deleted file mode 100644 index 6035b20..0000000 --- a/lsp/formatting.lua +++ /dev/null @@ -1,20 +0,0 @@ --- customize lsp formatting options -return { - -- control auto formatting on save - format_on_save = { - enabled = true, -- enable or disable format on save globally - allow_filetypes = { -- enable format on save for specified filetypes only - -- "go", - }, - ignore_filetypes = { -- disable format on save for specified filetypes - -- "python", - }, - }, - disabled = { -- disable formatting capabilities for the listed language servers - -- "sumneko_lua", - }, - timeout_ms = 1000, -- default format timeout - -- filter = function(client) -- fully override the default formatting function - -- return true - -- end -} diff --git a/lsp/mappings.lua b/lsp/mappings.lua deleted file mode 100644 index 1d2d6ef..0000000 --- a/lsp/mappings.lua +++ /dev/null @@ -1,6 +0,0 @@ --- easily add or disable built in mappings added during LSP attaching -return { - n = { - -- ["lf"] = false -- disable formatting keymap - }, -} diff --git a/lsp/servers.lua b/lsp/servers.lua deleted file mode 100644 index eac00b1..0000000 --- a/lsp/servers.lua +++ /dev/null @@ -1,4 +0,0 @@ --- enable servers that you already have installed without mason -return { - -- "pyright" -} diff --git a/lsp/setup_handlers.lua b/lsp/setup_handlers.lua deleted file mode 100644 index f96f4b4..0000000 --- a/lsp/setup_handlers.lua +++ /dev/null @@ -1,10 +0,0 @@ --- override the LSP setup handler function based on server name -return { - -- first function changes the default setup handler - function(server, opts) require("lspconfig")[server].setup(opts) end, - -- keys for a specific server name will be used for that LSP - sumneko_lua = function(server, opts) - -- custom sumneko_lua setup handler - require("lspconfig")["sumneko_lua"].setup(opts) - end, -} diff --git a/plugins/alpha.lua b/plugins/alpha.lua deleted file mode 100644 index 3a8cdc9..0000000 --- a/plugins/alpha.lua +++ /dev/null @@ -1,21 +0,0 @@ --- customize alpha options -return { - "goolord/alpha-nvim", - opts = function(_, opts) - -- customize the dashboard header - opts.section.header.val = { - " █████ ███████ ████████ ██████ ██████", - "██ ██ ██ ██ ██ ██ ██ ██", - "███████ ███████ ██ ██████ ██ ██", - "██ ██ ██ ██ ██ ██ ██ ██", - "██ ██ ███████ ██ ██ ██ ██████", - " ", - " ███  ██ ██  ██ ██ ███  ███", - " ████  ██ ██  ██ ██ ████  ████", - " ██ ██  ██ ██  ██ ██ ██ ████ ██", - " ██  ██ ██  ██  ██  ██ ██  ██  ██", - " ██   ████   ████   ██ ██      ██", - } - return opts - end, -} diff --git a/plugins/core.lua b/plugins/core.lua index 9700fc1..483558a 100644 --- a/plugins/core.lua +++ b/plugins/core.lua @@ -1,4 +1,25 @@ return { + -- customize alpha options + { + "goolord/alpha-nvim", + opts = function(_, opts) + -- customize the dashboard header + opts.section.header.val = { + " █████ ███████ ████████ ██████ ██████", + "██ ██ ██ ██ ██ ██ ██ ██", + "███████ ███████ ██ ██████ ██ ██", + "██ ██ ██ ██ ██ ██ ██ ██", + "██ ██ ███████ ██ ██ ██ ██████", + " ", + " ███  ██ ██  ██ ██ ███  ███", + " ████  ██ ██  ██ ██ ████  ████", + " ██ ██  ██ ██  ██ ██ ██ ████ ██", + " ██  ██ ██  ██  ██  ██ ██  ██  ██", + " ██   ████   ████   ██ ██      ██", + } + return opts + end, + }, -- You can disable default plugins as follows: -- { "max397574/better-escape.nvim", enabled = false }, -- diff --git a/polish.lua b/polish.lua deleted file mode 100644 index b4fa4de..0000000 --- a/polish.lua +++ /dev/null @@ -1,17 +0,0 @@ --- This function is run last and is a good place to configuring --- augroups/autocommands and custom filetypes also this just pure lua so --- anything that doesn't fit in the normal config locations above can go here -return function() - -- Set up custom filetypes - -- vim.filetype.add { - -- extension = { - -- foo = "fooscript", - -- }, - -- filename = { - -- ["Foofile"] = "fooscript", - -- }, - -- pattern = { - -- ["~/%.config/foo/.*"] = "fooscript", - -- }, - -- } -end diff --git a/updater.lua b/updater.lua deleted file mode 100644 index 749b45c..0000000 --- a/updater.lua +++ /dev/null @@ -1,17 +0,0 @@ --- Configure AstroNvim updates -return { - remote = "origin", -- remote to use - channel = "nightly", -- "stable" or "nightly" - version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY) - branch = "nightly", -- branch name (NIGHTLY ONLY) - commit = nil, -- commit hash (NIGHTLY ONLY) - pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only) - skip_prompts = false, -- skip prompts about breaking changes - show_changelog = true, -- show the changelog after performing an update - auto_quit = false, -- automatically quit the current session after a successful update - remotes = { -- easily add new remotes to track - -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url - -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut, - -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork - }, -}