├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── question.md │ ├── feature_request.md │ └── bug_report.md ├── PULL_REQUEST_TEMPLATE │ ├── fix.md │ ├── chore.md │ └── feature.md ├── workflows │ ├── luacheck.yml │ ├── conventional_commit.yml │ ├── style.yml │ └── updater.yml ├── stale.yml ├── CODE_OF_CONDUCT.md ├── README.md └── CONTRIBUTING.md ├── .gitignore ├── lua ├── default_theme │ ├── plugins │ │ ├── beacon.lua │ │ ├── highlighturl.lua │ │ ├── symbols_outline.lua │ │ ├── which-key.lua │ │ ├── dashboard.lua │ │ ├── hop.lua │ │ ├── gitsigns.lua │ │ ├── rainbow.lua │ │ ├── indent_blankline.lua │ │ ├── neo-tree.lua │ │ ├── vimwiki.lua │ │ ├── nvim-tree.lua │ │ ├── lightspeed.lua │ │ ├── notify.lua │ │ ├── nvim-web-devicons.lua │ │ ├── bufferline.lua │ │ ├── aerial.lua │ │ └── telescope.lua │ ├── utils.lua │ ├── lsp.lua │ ├── init.lua │ ├── colors.lua │ ├── treesitter.lua │ └── base.lua ├── configs │ ├── lsp │ │ ├── server-settings │ │ │ ├── html.lua │ │ │ ├── tsserver.lua │ │ │ ├── pyright.lua │ │ │ ├── rust_analyzer.lua │ │ │ ├── sumneko_lua.lua │ │ │ └── jsonls.lua │ │ ├── init.lua │ │ └── handlers.lua │ ├── null-ls.lua │ ├── better_escape.lua │ ├── indent-o-matic.lua │ ├── cinnamon.lua │ ├── notify.lua │ ├── session_manager.lua │ ├── smart-splits.lua │ ├── nvim-lsp-installer.lua │ ├── gitsigns.lua │ ├── toggleterm.lua │ ├── luasnip.lua │ ├── bufferline.lua │ ├── which-key.lua │ ├── icons.lua │ ├── colorizer.lua │ ├── treesitter.lua │ ├── Comment.lua │ ├── autopairs.lua │ ├── indent-line.lua │ ├── alpha.lua │ ├── aerial.lua │ ├── which-key-register.lua │ ├── neo-tree.lua │ ├── feline.lua │ ├── telescope.lua │ └── cmp.lua ├── core │ ├── utils │ │ ├── git.lua │ │ ├── updater.lua │ │ └── init.lua │ ├── autocmds.lua │ ├── options.lua │ ├── status.lua │ ├── ui.lua │ ├── plugins.lua │ └── mappings.lua └── user_example │ └── init.lua ├── .stylua.toml ├── colors └── default_theme.lua ├── .luacheckrc ├── init.lua └── LICENSE /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://www.buymeacoffee.com/mehalter 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | plugin 2 | lua/user 3 | lua/packer_compiled.lua 4 | ginit.vim 5 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/beacon.lua: -------------------------------------------------------------------------------- 1 | return { Beacon = { bg = C.blue } } 2 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/highlighturl.lua: -------------------------------------------------------------------------------- 1 | return { HighlightURL = { underline = true } } 2 | -------------------------------------------------------------------------------- /lua/configs/lsp/server-settings/html.lua: -------------------------------------------------------------------------------- 1 | return { on_attach = astronvim.lsp.disable_formatting } 2 | -------------------------------------------------------------------------------- /lua/configs/lsp/server-settings/tsserver.lua: -------------------------------------------------------------------------------- 1 | return { on_attach = astronvim.lsp.disable_formatting } 2 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/symbols_outline.lua: -------------------------------------------------------------------------------- 1 | return { FocusedSymbol = { fg = C.yellow, bg = C.none } } 2 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/which-key.lua: -------------------------------------------------------------------------------- 1 | return { 2 | WhichKeyFloat = { fg = C.fg }, 3 | WhichKeyDesc = { fg = C.blue }, 4 | WhichKeyGroup = { fg = C.blue }, 5 | } 6 | -------------------------------------------------------------------------------- /.stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 120 2 | line_endings = "Unix" 3 | indent_type = "Spaces" 4 | indent_width = 2 5 | quote_style = "AutoPreferDouble" 6 | no_call_parentheses = true 7 | -------------------------------------------------------------------------------- /lua/configs/null-ls.lua: -------------------------------------------------------------------------------- 1 | local status_ok, null_ls = pcall(require, "null-ls") 2 | if status_ok then 3 | null_ls.setup(astronvim.user_plugin_opts "plugins.null-ls") 4 | end 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask a general question about AstroNvim usage 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /lua/configs/better_escape.lua: -------------------------------------------------------------------------------- 1 | local status_ok, better_escape = pcall(require, "better_escape") 2 | if status_ok then 3 | better_escape.setup(astronvim.user_plugin_opts "plugins.better_escape") 4 | end 5 | -------------------------------------------------------------------------------- /lua/configs/lsp/server-settings/pyright.lua: -------------------------------------------------------------------------------- 1 | return { 2 | settings = { 3 | python = { 4 | analysis = { 5 | typeCheckingMode = "off", 6 | }, 7 | }, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /lua/configs/indent-o-matic.lua: -------------------------------------------------------------------------------- 1 | local status_ok, indent_o_matic = pcall(require, "indent-o-matic") 2 | if status_ok then 3 | indent_o_matic.setup(astronvim.user_plugin_opts "plugins.indent-o-matic") 4 | end 5 | -------------------------------------------------------------------------------- /lua/configs/cinnamon.lua: -------------------------------------------------------------------------------- 1 | local status_ok, cinnamon = pcall(require, "cinnamon") 2 | if status_ok then 3 | cinnamon.setup(astronvim.user_plugin_opts("plugins.cinnamon", { 4 | default_delay = 2 5 | })) 6 | end 7 | -------------------------------------------------------------------------------- /lua/configs/notify.lua: -------------------------------------------------------------------------------- 1 | local status_ok, notify = pcall(require, "notify") 2 | if status_ok then 3 | notify.setup(astronvim.user_plugin_opts("plugins.notify", { stages = "fade" })) 4 | 5 | vim.notify = notify 6 | end 7 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/dashboard.lua: -------------------------------------------------------------------------------- 1 | return { 2 | DashboardHeader = { fg = C.cyan }, 3 | DashboardShortcut = { fg = C.yellow }, 4 | DashboardFooter = { fg = C.cyan }, 5 | DashboardCenter = { fg = C.blue }, 6 | } 7 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/hop.lua: -------------------------------------------------------------------------------- 1 | return { 2 | HopNextKey = { fg = C.red, bold = true }, 3 | HopNextKey1 = { fg = C.cyan, bold = true }, 4 | HopNextKey2 = { fg = C.blue }, 5 | HopUnmatched = { fg = C.grey }, 6 | } 7 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/fix.md: -------------------------------------------------------------------------------- 1 | Fixes Issue # (If it doesn't fix an issue then delete this line) 2 | 3 | Bugs Fixed: 4 | - A bullet for each bug fixed and a description 5 | 6 | Other: 7 | Anything else relevant goes here 8 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/chore.md: -------------------------------------------------------------------------------- 1 | Fixes Issue # (If it doesn't fix an issue then delete this line) 2 | 3 | Description: 4 | Describe the refactor or cleanup that was completed 5 | 6 | Other: 7 | Anything else relevant goes here 8 | -------------------------------------------------------------------------------- /lua/configs/session_manager.lua: -------------------------------------------------------------------------------- 1 | local status_ok, session_manager = pcall(require, "session_manager") 2 | if status_ok then 3 | session_manager.setup(astronvim.user_plugin_opts("plugins.session_manager", { autosave_last_session = false })) 4 | end 5 | -------------------------------------------------------------------------------- /.github/workflows/luacheck.yml: -------------------------------------------------------------------------------- 1 | name: Lua Linting 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | lint: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: nebularg/actions-luacheck@v1 11 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/feature.md: -------------------------------------------------------------------------------- 1 | Fixes Issue # (If it doesn't fix an issue then delete this line) 2 | 3 | Features Added: 4 | - Plugin Name (Add links if possible too) 5 | 6 | Reasoning: 7 | List why the feature is needed 8 | 9 | Other: 10 | Anything else relevant goes here 11 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/gitsigns.lua: -------------------------------------------------------------------------------- 1 | return { 2 | GitSignsAdd = { fg = C.green, bg = C.none }, 3 | GitSignsChange = { fg = C.orange_1, bg = C.none }, 4 | GitSignsDelete = { fg = C.red_1, bg = C.none }, 5 | MoreMsg = { fg = C.green, bold = true }, 6 | ModeMsg = { fg = C.grey, bold = true }, 7 | } 8 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/rainbow.lua: -------------------------------------------------------------------------------- 1 | return { 2 | rainbowcol1 = { fg = "Gold" }, 3 | rainbowcol2 = { fg = "Orchid" }, 4 | rainbowcol3 = { fg = "LightSkyBlue" }, 5 | rainbowcol4 = { fg = "Gold" }, 6 | rainbowcol5 = { fg = "Orchid" }, 7 | rainbowcol6 = { fg = "LightSkyBlue" }, 8 | rainbowcol7 = { fg = "Orchid" }, 9 | } 10 | -------------------------------------------------------------------------------- /.github/workflows/conventional_commit.yml: -------------------------------------------------------------------------------- 1 | name: Conventional Commits 2 | 3 | on: 4 | pull_request: 5 | branches: [ main ] 6 | 7 | jobs: 8 | build: 9 | name: Conventional Commits 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - uses: webiny/action-conventional-commits@v1.0.3 14 | -------------------------------------------------------------------------------- /colors/default_theme.lua: -------------------------------------------------------------------------------- 1 | vim.g.colors_name = "default_theme" 2 | 3 | package.loaded["default_theme"] = nil 4 | package.loaded["default_theme.base"] = nil 5 | package.loaded["default_theme.treesitter"] = nil 6 | package.loaded["default_theme.lsp"] = nil 7 | package.loaded["default_theme.others"] = nil 8 | 9 | require "default_theme" 10 | -------------------------------------------------------------------------------- /lua/configs/lsp/server-settings/rust_analyzer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | settings = { 3 | ["rust-analyzer"] = { 4 | cargo = { 5 | loadOutDirsFromCheck = true, 6 | }, 7 | checkOnSave = { 8 | command = "clippy", 9 | }, 10 | experimental = { 11 | procAttrMacros = true, 12 | }, 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/configs/smart-splits.lua: -------------------------------------------------------------------------------- 1 | local status_ok, smart_splits = pcall(require, "smart-splits") 2 | if status_ok then 3 | smart_splits.setup(astronvim.user_plugin_opts("plugins.smart-splits", { 4 | ignored_filetypes = { 5 | "nofile", 6 | "quickfix", 7 | "qf", 8 | "prompt", 9 | }, 10 | ignored_buftypes = { "nofile" }, 11 | })) 12 | end 13 | -------------------------------------------------------------------------------- /.github/workflows/style.yml: -------------------------------------------------------------------------------- 1 | name: Style Check 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | style: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: JohnnyMorganz/stylua-action@1.0.0 11 | with: 12 | token: ${{ secrets.GITHUB_TOKEN }} 13 | # CLI arguments 14 | args: --check . 15 | -------------------------------------------------------------------------------- /lua/configs/nvim-lsp-installer.lua: -------------------------------------------------------------------------------- 1 | local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer") 2 | if status_ok then 3 | lsp_installer.setup(astronvim.user_plugin_opts("plugins.nvim-lsp-installer", { 4 | ui = { 5 | icons = { 6 | server_installed = "✓", 7 | server_uninstalled = "✗", 8 | server_pending = "⟳", 9 | }, 10 | }, 11 | })) 12 | end 13 | -------------------------------------------------------------------------------- /lua/configs/gitsigns.lua: -------------------------------------------------------------------------------- 1 | local status_ok, gitsigns = pcall(require, "gitsigns") 2 | if status_ok then 3 | gitsigns.setup(astronvim.user_plugin_opts("plugins.gitsigns", { 4 | signs = { 5 | add = { text = "▎" }, 6 | change = { text = "▎" }, 7 | delete = { text = "▎" }, 8 | topdelete = { text = "契" }, 9 | changedelete = { text = "▎" }, 10 | }, 11 | })) 12 | end 13 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/indent_blankline.lua: -------------------------------------------------------------------------------- 1 | return { 2 | IndentBlanklineSpaceChar = { fg = C.grey_6, nocombine = true }, 3 | IndentBlanklineChar = { fg = C.grey_6, nocombine = true }, 4 | IndentBlanklineContextStart = { fg = C.grey_7, underline = true }, 5 | IndentBlanklineContextChar = { fg = C.grey_7, nocombine = true }, 6 | IndentBlanklineSpaceCharBlankline = { fg = C.grey_6, nocombine = true }, 7 | } 8 | -------------------------------------------------------------------------------- /lua/configs/lsp/server-settings/sumneko_lua.lua: -------------------------------------------------------------------------------- 1 | return { 2 | on_attach = astronvim.lsp.disable_formatting, 3 | settings = { 4 | Lua = { 5 | diagnostics = { 6 | globals = { "vim" }, 7 | }, 8 | workspace = { 9 | library = { 10 | [vim.fn.expand "$VIMRUNTIME/lua"] = true, 11 | [astronvim.install.home .. "/lua"] = true, 12 | }, 13 | }, 14 | }, 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /lua/configs/lsp/server-settings/jsonls.lua: -------------------------------------------------------------------------------- 1 | return { 2 | on_attach = astronvim.lsp.disable_formatting, 3 | settings = { 4 | json = { 5 | schemas = require("schemastore").json.schemas(), 6 | }, 7 | }, 8 | setup = { 9 | commands = { 10 | Format = { 11 | function() 12 | vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) 13 | end, 14 | }, 15 | }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /.luacheckrc: -------------------------------------------------------------------------------- 1 | -- Global objects 2 | globals = { 3 | "PACKER_BOOTSTRAP", 4 | "astronvim", 5 | "astronvim_installation", 6 | "vim", 7 | "C", 8 | "packer_plugins", 9 | } 10 | 11 | -- Rerun tests only if their modification time changed 12 | cache = true 13 | 14 | -- Don't report unused self arguments of methods 15 | self = false 16 | 17 | ignore = { 18 | "631", -- max_line_length 19 | "212/_.*", -- unused argument, for vars with "_" prefix 20 | } 21 | -------------------------------------------------------------------------------- /lua/configs/toggleterm.lua: -------------------------------------------------------------------------------- 1 | local status_ok, toggleterm = pcall(require, "toggleterm") 2 | if status_ok then 3 | toggleterm.setup(astronvim.user_plugin_opts("plugins.toggleterm", { 4 | size = 10, 5 | open_mapping = [[]], 6 | shading_factor = 2, 7 | direction = "float", 8 | float_opts = { 9 | border = "curved", 10 | highlights = { 11 | border = "Normal", 12 | background = "Normal", 13 | }, 14 | }, 15 | })) 16 | end 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | local impatient_ok, impatient = pcall(require, "impatient") 2 | if impatient_ok then 3 | impatient.enable_profile() 4 | end 5 | 6 | for _, source in ipairs { 7 | "core.utils", 8 | "core.options", 9 | "core.plugins", 10 | "core.autocmds", 11 | "core.mappings", 12 | "core.ui", 13 | "configs.which-key-register", 14 | } do 15 | local status_ok, fault = pcall(require, source) 16 | if not status_ok then 17 | vim.api.nvim_err_writeln("Failed to load " .. source .. "\n\n" .. fault) 18 | end 19 | end 20 | 21 | astronvim.conditional_func(astronvim.user_plugin_opts("polish", nil, false)) 22 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/neo-tree.lua: -------------------------------------------------------------------------------- 1 | return { 2 | NeoTreeDirectoryIcon = { fg = C.blue }, 3 | NeoTreeRootName = { fg = C.fg, bold = true }, 4 | NeoTreeFileName = { fg = C.fg }, 5 | NeoTreeFileIcon = { fg = C.fg }, 6 | NeoTreeFileNameOpened = { fg = C.green }, 7 | NeoTreeIndentMarker = { fg = C.blue_3 }, 8 | NeoTreeGitAdded = { fg = C.green }, 9 | NeoTreeGitConflict = { fg = C.red }, 10 | NeoTreeGitModified = { fg = C.orange }, 11 | NeoTreeGitUntracked = { fg = C.yellow }, 12 | NeoTreeNormal = { bg = C.blue_2 }, 13 | NeoTreeNormalNC = { bg = C.blue_2 }, 14 | NeoTreeSymbolicLinkTarget = { fg = C.cyan }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/configs/luasnip.lua: -------------------------------------------------------------------------------- 1 | local user_settings = astronvim.user_plugin_opts "luasnip" 2 | local loader_avail, loader = pcall(require, "luasnip/loaders/from_vscode") 3 | if loader_avail then 4 | if user_settings.vscode_snippet_paths ~= nil then 5 | loader.lazy_load { paths = user_settings.vscode_snippet_paths } 6 | end 7 | loader.lazy_load() 8 | end 9 | local luasnip_avail, luasnip = pcall(require, "luasnip") 10 | if luasnip_avail then 11 | if type(user_settings.filetype_extend) == "table" then 12 | for filetype, snippets in pairs(user_settings.filetype_extend) do 13 | luasnip.filetype_extend(filetype, snippets) 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /lua/configs/bufferline.lua: -------------------------------------------------------------------------------- 1 | local status_ok, bufferline = pcall(require, "bufferline") 2 | if status_ok then 3 | bufferline.setup(astronvim.user_plugin_opts("plugins.bufferline", { 4 | options = { 5 | offsets = { 6 | { filetype = "NvimTree", text = "", padding = 1 }, 7 | { filetype = "neo-tree", text = "", padding = 1 }, 8 | { filetype = "Outline", text = "", padding = 1 }, 9 | }, 10 | buffer_close_icon = "", 11 | modified_icon = "", 12 | close_icon = "", 13 | max_name_length = 24, 14 | max_prefix_length = 13, 15 | tab_size = 28, 16 | separator_style = "thin", 17 | }, 18 | })) 19 | end 20 | -------------------------------------------------------------------------------- /lua/default_theme/utils.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local user_settings = astronvim.user_plugin_opts "default_theme" 4 | 5 | function M.parse_diagnostic_style(default) 6 | if type(user_settings.diagnostics_style) == "table" then 7 | default = vim.tbl_deep_extend("force", user_settings.diagnostics_style, default) 8 | elseif type(user_settings.diagnostics_style) == "string" then 9 | default.style = user_settings.diagnostics_style 10 | end 11 | return default 12 | end 13 | 14 | function M.parse_style(spec) 15 | if spec.style then 16 | for match in (spec.style .. ","):gmatch "(.-)," do 17 | spec[match] = true 18 | end 19 | spec.style = nil 20 | end 21 | return spec 22 | end 23 | 24 | return M 25 | -------------------------------------------------------------------------------- /lua/configs/which-key.lua: -------------------------------------------------------------------------------- 1 | local status_ok, which_key = pcall(require, "which-key") 2 | if status_ok then 3 | local show = which_key.show 4 | local show_override = astronvim.user_plugin_opts("which-key.show", nil, false) 5 | which_key.show = type(show_override) == "function" and show_override(show) 6 | or function(keys, opts) 7 | if vim.bo.filetype ~= "TelescopePrompt" then 8 | show(keys, opts) 9 | end 10 | end 11 | which_key.setup(astronvim.user_plugin_opts("plugins.which-key", { 12 | plugins = { 13 | spelling = { enabled = true }, 14 | presets = { operators = false }, 15 | }, 16 | window = { 17 | border = "rounded", 18 | padding = { 2, 2, 2, 2 }, 19 | }, 20 | })) 21 | end 22 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/vimwiki.lua: -------------------------------------------------------------------------------- 1 | return { 2 | VimwikiLink = { fg = C.cyan, bg = C.none }, 3 | VimwikiHeaderChar = { fg = C.grey, bg = C.none }, 4 | VimwikiHR = { fg = C.yellow, bg = C.none }, 5 | VimwikiList = { fg = C.orange, bg = C.orange }, 6 | VimwikiTag = { fg = C.orange, bg = C.orange }, 7 | VimwikiMarkers = { fg = C.grey, bg = C.none }, 8 | VimwikiHeader1 = { fg = C.orange, bg = C.none, bold = true }, 9 | VimwikiHeader2 = { fg = C.green, bg = C.none, bold = true }, 10 | VimwikiHeader3 = { fg = C.blue, bg = C.none, bold = true }, 11 | VimwikiHeader4 = { fg = C.cyan, bg = C.none, bold = true }, 12 | VimwikiHeader5 = { fg = C.yellow, bg = C.none, bold = true }, 13 | VimwikiHeader6 = { fg = C.purple, bg = C.none, bold = true }, 14 | } 15 | -------------------------------------------------------------------------------- /lua/configs/icons.lua: -------------------------------------------------------------------------------- 1 | local status_ok, icons = pcall(require, "nvim-web-devicons") 2 | if status_ok then 3 | icons.set_icon(astronvim.user_plugin_opts("plugins.nvim-web-devicons", { 4 | deb = { icon = "", name = "Deb" }, 5 | lock = { icon = "", name = "Lock" }, 6 | mp3 = { icon = "", name = "Mp3" }, 7 | mp4 = { icon = "", name = "Mp4" }, 8 | out = { icon = "", name = "Out" }, 9 | ["robots.txt"] = { icon = "ﮧ", name = "Robots" }, 10 | ttf = { icon = "", name = "TrueTypeFont" }, 11 | rpm = { icon = "", name = "Rpm" }, 12 | woff = { icon = "", name = "WebOpenFontFormat" }, 13 | woff2 = { icon = "", name = "WebOpenFontFormat2" }, 14 | xz = { icon = "", name = "Xz" }, 15 | zip = { icon = "", name = "Zip" }, 16 | })) 17 | end 18 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 60 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | - notice 10 | - wip 11 | # Label to use when marking an issue as stale 12 | staleLabel: wontfix 13 | # Comment to post when marking an issue as stale. Set to `false` to disable 14 | markComment: > 15 | This issue has been automatically marked as stale because it has not had 16 | recent activity. It will be closed if no further activity occurs. Thank you 17 | for your contributions. 18 | # Comment to post when closing a stale issue. Set to `false` to disable 19 | closeComment: false 20 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/nvim-tree.lua: -------------------------------------------------------------------------------- 1 | return { 2 | NvimTreeFolderIcon = { fg = C.blue }, 3 | NvimTreeExecFile = { fg = C.green }, 4 | NvimTreeOpenedFile = { fg = C.green }, 5 | NvimTreeRootFolder = { fg = C.bg }, 6 | NvimTreeEndOfBuffer = { fg = C.bg }, 7 | NvimTreeNormal = { bg = C.blue_2 }, 8 | NvimTreeNormalNC = { bg = C.blue_2 }, 9 | NvimTreeVertSplit = { fg = C.blue_2, bg = C.blue_2 }, 10 | NvimTreeImageFile = { fg = C.purple }, 11 | NvimTreeSymlink = { fg = C.cyan }, 12 | NvimTreeSpecialFile = { fg = C.yellow }, 13 | NvimTreeGitDeleted = { fg = C.red }, 14 | NvimTreeGitMerge = { fg = C.orange }, 15 | NvimTreeGitRenamed = { fg = C.purple }, 16 | NvimTreeGitStaged = { fg = C.green }, 17 | NvimTreeGitDirty = { fg = C.red }, 18 | NvimTreeGitNew = { fg = C.yellow }, 19 | } 20 | -------------------------------------------------------------------------------- /lua/configs/colorizer.lua: -------------------------------------------------------------------------------- 1 | local status_ok, colorizer = pcall(require, "colorizer") 2 | if status_ok then 3 | local colorizer_opts = astronvim.user_plugin_opts("plugins.colorizer", { 4 | { "*" }, 5 | { 6 | RGB = true, -- #RGB hex codes 7 | RRGGBB = true, -- #RRGGBB hex codes 8 | names = false, -- "Name" codes like Blue 9 | RRGGBBAA = false, -- #RRGGBBAA hex codes 10 | rgb_fn = false, -- CSS rgb() and rgba() functions 11 | hsl_fn = false, -- CSS hsl() and hsla() functions 12 | css = false, -- Enable all css features: rgb_fn, hsl_fn, names, RGB, RRGGBB 13 | css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn 14 | mode = "background", -- Set the display mode 15 | }, 16 | }) 17 | colorizer.setup(colorizer_opts[1], colorizer_opts[2]) 18 | end 19 | -------------------------------------------------------------------------------- /lua/configs/treesitter.lua: -------------------------------------------------------------------------------- 1 | local status_ok, treesitter = pcall(require, "nvim-treesitter.configs") 2 | if status_ok then 3 | treesitter.setup(astronvim.user_plugin_opts("plugins.treesitter", { 4 | ensure_installed = {}, 5 | sync_install = false, 6 | ignore_install = {}, 7 | highlight = { 8 | enable = true, 9 | additional_vim_regex_highlighting = false, 10 | }, 11 | context_commentstring = { 12 | enable = true, 13 | enable_autocmd = false, 14 | }, 15 | rainbow = { 16 | enable = true, 17 | disable = { "html" }, 18 | extended_mode = false, 19 | max_file_lines = nil, 20 | }, 21 | autopairs = { enable = true }, 22 | autotag = { enable = true }, 23 | incremental_selection = { enable = true }, 24 | indent = { enable = false }, 25 | })) 26 | end 27 | -------------------------------------------------------------------------------- /lua/configs/Comment.lua: -------------------------------------------------------------------------------- 1 | local status_ok, Comment = pcall(require, "Comment") 2 | if status_ok then 3 | local utils = require "Comment.utils" 4 | Comment.setup(astronvim.user_plugin_opts("plugins.Comment", { 5 | pre_hook = function(ctx) 6 | local location = nil 7 | if ctx.ctype == utils.ctype.block then 8 | location = require("ts_context_commentstring.utils").get_cursor_location() 9 | elseif ctx.cmotion == utils.cmotion.v or ctx.cmotion == utils.cmotion.V then 10 | location = require("ts_context_commentstring.utils").get_visual_start_location() 11 | end 12 | 13 | return require("ts_context_commentstring.internal").calculate_commentstring { 14 | key = ctx.ctype == utils.ctype.line and "__default" or "__multiline", 15 | location = location, 16 | } 17 | end, 18 | })) 19 | end 20 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/lightspeed.lua: -------------------------------------------------------------------------------- 1 | return { 2 | LightspeedLabel = { fg = C.red_3, underline = true }, 3 | LightspeedLabelOverlapped = { fg = C.blue, underline = true }, 4 | LightspeedLabelDistant = { fg = C.red_1, underline = true }, 5 | LightspeedLabelDistantOverlapped = { fg = C.blue_1, underline = true }, 6 | LightspeedShortcut = { fg = C.black, bg = C.red_3, bold = true, underline = true }, 7 | LightspeedShortcutOverlapped = { fg = C.black, bg = C.blue, bold = true, underline = true }, 8 | LightspeedMaskedChar = { fg = C.green_1 }, 9 | LightspeedGreyWash = { fg = C.grey_2, bg = C.none }, 10 | LightspeedUnlabeledMatch = { fg = C.white, bold = true }, 11 | LightspeedOneCharMatch = { fg = C.green, bg = C.red_3, bold = true }, 12 | LightspeedUniqueChar = { fg = C.white, bold = true }, 13 | LightspeedPendingOpArea = { fg = C.yellow }, 14 | } 15 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/notify.lua: -------------------------------------------------------------------------------- 1 | return { 2 | NotifyERRORBorder = { fg = C.red }, 3 | NotifyWARNBorder = { fg = C.orange_1 }, 4 | NotifyINFOBorder = { fg = C.green }, 5 | NotifyDEBUGBorder = { fg = C.cyan }, 6 | NotifyTRACERBorder = { fg = C.purple }, 7 | NotifyERRORIcon = { fg = C.red }, 8 | NotifyWARNIcon = { fg = C.orange_1 }, 9 | NotifyINFOIcon = { fg = C.green }, 10 | NotifyDEBUGIcon = { fg = C.cyan }, 11 | NotifyTRACEIcon = { fg = C.purple }, 12 | NotifyERRORTitle = { fg = C.red }, 13 | NotifyWARNTitle = { fg = C.orange_1 }, 14 | NotifyINFOTitle = { fg = C.green }, 15 | NotifyDEBUGTitle = { fg = C.cyan }, 16 | NotifyTRACETitle = { fg = C.purple }, 17 | NotifyERRORBody = { fg = C.fg }, 18 | NotifyWARNBody = { fg = C.fg }, 19 | NotifyINFOBody = { fg = C.fg }, 20 | NotifyDEBUGBody = { fg = C.fg }, 21 | NotifyTRACEBody = { fg = C.fg }, 22 | NotifyLogTime = { fg = C.grey_2 }, 23 | NotifyLogTitle = { fg = C.blue }, 24 | } 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Checklist** 11 | Please confirm you have run the following commands and restarted Neovim and are encountering the issue with the current latest version of AstroNvim 12 | - [ ] `:PackerSync` 13 | - [ ] `:AstroUpdate` 14 | - [ ] restarted AstroNvim 15 | - [ ] Neovim version >= 0.7.0 16 | 17 | **Describe the bug** 18 | A clear and concise description of what the bug is. 19 | 20 | **To Reproduce** 21 | Steps to reproduce the behavior: 22 | 1. Go to '...' 23 | 2. Click on '....' 24 | 3. Scroll down to '....' 25 | 4. See error 26 | 27 | **Expected behavior** 28 | A clear and concise description of what you expected to happen. 29 | 30 | **Screenshots** 31 | If applicable, add screenshots or recording ([Asciinema](asciinema.org)) to help explain your problem. 32 | 33 | **Additional context** 34 | Add any other context about the problem here. 35 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/nvim-web-devicons.lua: -------------------------------------------------------------------------------- 1 | return { 2 | DevIconC = { fg = C.c }, 3 | DevIconCss = { fg = C.css }, 4 | DevIconDeb = { fg = C.deb }, 5 | DevIconDockerfile = { fg = C.docker }, 6 | DevIconHtml = { fg = C.html }, 7 | DevIconJpeg = { fg = C.jpeg }, 8 | DevIconJpg = { fg = C.jpg }, 9 | DevIconJs = { fg = C.js }, 10 | DevIconJsx = { fg = C.jsx }, 11 | DevIconKotlin = { fg = C.kt }, 12 | DevIconLock = { fg = C.lock }, 13 | DevIconLua = { fg = C.lua }, 14 | DevIconMp3 = { fg = C.mp3 }, 15 | DevIconMp4 = { fg = C.mp4 }, 16 | DevIconOut = { fg = C.out }, 17 | DevIconPng = { fg = C.png }, 18 | DevIconPy = { fg = C.py }, 19 | DevIconRb = { fg = C.rb }, 20 | DevIconRobots = { fg = C.robots }, 21 | DevIconRpm = { fg = C.rpm }, 22 | DevIconRs = { fg = C.rs }, 23 | DevIconToml = { fg = C.toml }, 24 | DevIconTrueTypeFont = { fg = C.ttf }, 25 | DevIconTs = { fg = C.ts }, 26 | DevIconVue = { fg = C.vue }, 27 | DevIconWebOpenFontFormat = { fg = C.woff }, 28 | DevIconWebOpenFontFormat2 = { fg = C.woff2 }, 29 | DevIconXz = { fg = C.zip }, 30 | DevIconZip = { fg = C.zip }, 31 | } 32 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/bufferline.lua: -------------------------------------------------------------------------------- 1 | return { 2 | BufferLineFill = { fg = C.grey_9, bg = C.grey_4 }, 3 | BufferLineBackground = { fg = C.grey_9, bg = C.grey_4 }, 4 | BufferLineBufferVisible = { fg = C.fg, bg = C.bg }, 5 | BufferLineBufferSelected = { fg = C.white, bg = C.bg, bold = true }, 6 | BufferLineTab = { fg = C.grey_9, bg = C.bg }, 7 | BufferLineTabSelected = { fg = C.fg, bg = C.bg }, 8 | BufferLineTabClose = { fg = C.red_4, bg = C.bg }, 9 | BufferLineIndicatorSelected = { fg = C.bg, bg = C.bg }, 10 | BufferLineSeparator = { fg = C.grey_4, bg = C.grey_4 }, 11 | BufferLineSeparatorVisible = { fg = C.bg, bg = C.bg }, 12 | BufferLineSeparatorSelected = { fg = C.grey_4, bg = C.grey_4 }, 13 | BufferLineCloseButton = { fg = C.grey_9, bg = C.grey_4 }, 14 | BufferLineCloseButtonVisible = { fg = C.grey_10, bg = C.bg }, 15 | BufferLineCloseButtonSelected = { fg = C.red_4, bg = C.bg }, 16 | BufferLineModified = { fg = C.red_4, bg = C.grey_4 }, 17 | BufferLineModifiedVisible = { fg = C.fg, bg = C.bg }, 18 | BufferLineModifiedSelected = { fg = C.green_2, bg = C.bg }, 19 | BufferLineError = { fg = C.red_1, bg = C.red_1 }, 20 | BufferLineErrorDiagnostic = { fg = C.red_1, bg = C.red_1 }, 21 | } 22 | -------------------------------------------------------------------------------- /lua/configs/autopairs.lua: -------------------------------------------------------------------------------- 1 | local status_ok, npairs = pcall(require, "nvim-autopairs") 2 | if status_ok then 3 | npairs.setup(astronvim.user_plugin_opts("plugins.nvim-autopairs", { 4 | check_ts = true, 5 | ts_config = { 6 | lua = { "string", "source" }, 7 | javascript = { "string", "template_string" }, 8 | java = false, 9 | }, 10 | disable_filetype = { "TelescopePrompt", "spectre_panel" }, 11 | fast_wrap = { 12 | map = "", 13 | chars = { "{", "[", "(", '"', "'" }, 14 | pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), 15 | offset = 0, 16 | end_key = "$", 17 | keys = "qwertyuiopzxcvbnmasdfghjkl", 18 | check_comma = true, 19 | highlight = "PmenuSel", 20 | highlight_grey = "LineNr", 21 | }, 22 | })) 23 | 24 | local rules = astronvim.user_plugin_opts("nvim-autopairs").add_rules 25 | if vim.tbl_contains({ "function", "table" }, type(rules)) then 26 | npairs.add_rules(type(rules) == "function" and rules(npairs) or rules) 27 | end 28 | 29 | local cmp_status_ok, cmp = pcall(require, "cmp") 30 | if cmp_status_ok then 31 | cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done { map_char = { tex = "" } }) 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lua/configs/indent-line.lua: -------------------------------------------------------------------------------- 1 | local status_ok, indent_blankline = pcall(require, "indent_blankline") 2 | if status_ok then 3 | indent_blankline.setup(astronvim.user_plugin_opts("plugins.indent_blankline", { 4 | buftype_exclude = { 5 | "nofile", 6 | "terminal", 7 | "lsp-installer", 8 | "lspinfo", 9 | }, 10 | filetype_exclude = { 11 | "help", 12 | "startify", 13 | "aerial", 14 | "alpha", 15 | "dashboard", 16 | "packer", 17 | "neogitstatus", 18 | "NvimTree", 19 | "neo-tree", 20 | "Trouble", 21 | }, 22 | context_patterns = { 23 | "class", 24 | "return", 25 | "function", 26 | "method", 27 | "^if", 28 | "^while", 29 | "jsx_element", 30 | "^for", 31 | "^object", 32 | "^table", 33 | "block", 34 | "arguments", 35 | "if_statement", 36 | "else_clause", 37 | "jsx_element", 38 | "jsx_self_closing_element", 39 | "try_statement", 40 | "catch_clause", 41 | "import_statement", 42 | "operation_type", 43 | }, 44 | show_trailing_blankline_indent = false, 45 | use_treesitter = true, 46 | char = "▏", 47 | context_char = "▏", 48 | show_current_context = true, 49 | })) 50 | end 51 | -------------------------------------------------------------------------------- /lua/default_theme/lsp.lua: -------------------------------------------------------------------------------- 1 | local utils = require "default_theme.utils" 2 | 3 | local lsp = { 4 | DiagnosticError = utils.parse_diagnostic_style { fg = C.red_1 }, 5 | DiagnosticHint = utils.parse_diagnostic_style { fg = C.yellow_1 }, 6 | DiagnosticInfo = utils.parse_diagnostic_style { fg = C.white_2 }, 7 | DiagnosticWarn = utils.parse_diagnostic_style { fg = C.orange_1 }, 8 | DiagnosticInformation = { fg = C.yellow, bold = true }, 9 | DiagnosticTruncateLine = { fg = C.white_1, bold = true }, 10 | DiagnosticUnderlineError = { sp = C.red_2, undercurl = true }, 11 | DiagnosticUnderlineHint = { sp = C.red_2, undercurl = true }, 12 | DiagnosticUnderlineInfo = { sp = C.red_2, undercurl = true }, 13 | DiagnosticUnderlineWarn = { sp = C.red_2, undercurl = true }, 14 | LspDiagnosticsFloatingError = { fg = C.red_1 }, 15 | LspDiagnosticsFloatingHint = { fg = C.yellow_1 }, 16 | LspDiagnosticsFloatingInfor = { fg = C.white_2 }, 17 | LspDiagnosticsFloatingWarn = { fg = C.orange_1 }, 18 | LspFloatWinBorder = { fg = C.white_1 }, 19 | LspFloatWinNormal = { fg = C.fg, bg = C.black_1 }, 20 | LspReferenceRead = { fg = C.none, bg = C.grey_5 }, 21 | LspReferenceText = { fg = C.none, bg = C.grey_5 }, 22 | LspReferenceWrite = { fg = C.none, bg = C.grey_5 }, 23 | ProviderTruncateLine = { fg = C.white_1 }, 24 | } 25 | 26 | return lsp 27 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/aerial.lua: -------------------------------------------------------------------------------- 1 | return { 2 | AerialLine = { fg = C.yellow, bg = C.none }, 3 | AerialGuide = { fg = C.grey_2 }, 4 | AerialBooleanIcon = { link = "TSBoolean" }, 5 | AerialClassIcon = { link = "TSType" }, 6 | AerialConstantIcon = { link = "TSConstant" }, 7 | AerialConstructorIcon = { link = "TSConstructor" }, 8 | AerialFieldIcon = { link = "TSField" }, 9 | AerialFunctionIcon = { link = "TSFunction" }, 10 | AerialMethodIcon = { link = "TSMethod" }, 11 | AerialNamespaceIcon = { link = "TSNamespace" }, 12 | AerialNumberIcon = { link = "TSNumber" }, 13 | AerialOperatorIcon = { link = "TSOperator" }, 14 | AerialTypeParameterIcon = { link = "TSParameter" }, 15 | AerialPropertyIcon = { link = "TSProperty" }, 16 | AerialStringIcon = { link = "TSString" }, 17 | AerialVariableIcon = { link = "TSConstant" }, 18 | AerialEnumMemberIcon = { link = "TSField" }, 19 | AerialEnumIcon = { link = "TSType" }, 20 | AerialFileIcon = { link = "TSURI" }, 21 | AerialModuleIcon = { link = "TSNamespace" }, 22 | AerialPackageIcon = { link = "TSNamespace" }, 23 | AerialInterfaceIcon = { link = "TSType" }, 24 | AerialStructIcon = { link = "TSType" }, 25 | AerialEventIcon = { link = "TSType" }, 26 | AerialArrayIcon = { link = "TSConstant" }, 27 | AerialObjectIcon = { link = "TSType" }, 28 | AerialKeyIcon = { link = "TSType" }, 29 | AerialNullIcon = { link = "TSType" }, 30 | } 31 | -------------------------------------------------------------------------------- /.github/workflows/updater.yml: -------------------------------------------------------------------------------- 1 | name: Updater Comment 2 | 3 | on: 4 | pull_request_target: 5 | types: 6 | - opened 7 | 8 | jobs: 9 | updater-comment: 10 | name: Comment updater settings 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/github-script@v6 14 | with: 15 | script: | 16 | const src = context.payload.pull_request.head 17 | const user = src.user.login 18 | const tab = " " 19 | let settings = tab + "updater = {\n" + tab + tab + `channel = "nightly",\n` 20 | if (src.ref != "main") { 21 | settings += tab + tab + `branch = "${src.ref}",\n` 22 | } 23 | if (user != "AstroNvim") { 24 | settings += tab + tab + `remote = "${user}",\n` 25 | settings += tab + tab + `remotes = {\n` 26 | settings += tab + tab + tab + `["${user}"] = "${user}/${src.repo.name}",\n` 27 | settings += tab + tab + `},\n` 28 | } 29 | settings += tab + "}," 30 | github.rest.issues.createComment({ 31 | issue_number: context.issue.number, 32 | owner: context.repo.owner, 33 | repo: context.repo.repo, 34 | body: "Use the following `updater` settings in your `user/init.lua` file, restart, and run `:AstroUpdate` to test this pull request:\n```\n" + settings + "\n```", 35 | }) 36 | -------------------------------------------------------------------------------- /lua/default_theme/init.lua: -------------------------------------------------------------------------------- 1 | vim.cmd "highlight clear" 2 | if vim.fn.exists "syntax_on" then 3 | vim.cmd "syntax reset" 4 | end 5 | vim.o.background = "dark" 6 | vim.o.termguicolors = true 7 | vim.g.colors_name = "default_theme" 8 | 9 | local user_plugin_opts = astronvim.user_plugin_opts 10 | local utils = require "default_theme.utils" 11 | 12 | C = require "default_theme.colors" 13 | 14 | local highlights = {} 15 | 16 | for _, module in ipairs { "base", "treesitter", "lsp" } do 17 | highlights = vim.tbl_deep_extend("force", highlights, require("default_theme." .. module)) 18 | end 19 | 20 | for plugin, enabled in 21 | pairs(user_plugin_opts("default_theme.plugins", { 22 | aerial = true, 23 | beacon = false, 24 | bufferline = true, 25 | dashboard = true, 26 | gitsigns = true, 27 | highlighturl = true, 28 | hop = false, 29 | indent_blankline = true, 30 | lightspeed = false, 31 | ["neo-tree"] = true, 32 | notify = true, 33 | ["nvim-tree"] = false, 34 | ["nvim-web-devicons"] = true, 35 | rainbow = true, 36 | symbols_outline = false, 37 | telescope = true, 38 | vimwiki = false, 39 | ["which-key"] = true, 40 | })) 41 | do 42 | if enabled then 43 | highlights = vim.tbl_deep_extend("force", highlights, require("default_theme.plugins." .. plugin)) 44 | end 45 | end 46 | 47 | for group, spec in pairs(user_plugin_opts("default_theme.highlights", highlights)) do 48 | vim.api.nvim_set_hl(0, group, utils.parse_style(spec)) 49 | end 50 | -------------------------------------------------------------------------------- /lua/configs/alpha.lua: -------------------------------------------------------------------------------- 1 | local status_ok, alpha = pcall(require, "alpha") 2 | if status_ok then 3 | local alpha_button = astronvim.alpha_button 4 | alpha.setup(astronvim.user_plugin_opts("plugins.alpha", { 5 | layout = { 6 | { type = "padding", val = vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) } }, 7 | { 8 | type = "text", 9 | val = astronvim.user_plugin_opts("header", { 10 | " █████ ███████ ████████ ██████ ██████", 11 | "██ ██ ██ ██ ██ ██ ██ ██", 12 | "███████ ███████ ██ ██████ ██ ██", 13 | "██ ██ ██ ██ ██ ██ ██ ██", 14 | "██ ██ ███████ ██ ██ ██ ██████", 15 | " ", 16 | " ███  ██ ██  ██ ██ ███  ███", 17 | " ████  ██ ██  ██ ██ ████  ████", 18 | " ██ ██  ██ ██  ██ ██ ██ ████ ██", 19 | " ██  ██ ██  ██  ██  ██ ██  ██  ██", 20 | " ██   ████   ████   ██ ██      ██", 21 | }, false), 22 | opts = { position = "center", hl = "DashboardHeader" }, 23 | }, 24 | { type = "padding", val = 5 }, 25 | { 26 | type = "group", 27 | val = { 28 | alpha_button("LDR f f", " Find File "), 29 | alpha_button("LDR f o", " Recents "), 30 | alpha_button("LDR f w", " Find Word "), 31 | alpha_button("LDR f n", " New File "), 32 | alpha_button("LDR f m", " Bookmarks "), 33 | alpha_button("LDR S l", " Last Session "), 34 | }, 35 | opts = { spacing = 1 }, 36 | }, 37 | }, 38 | opts = {}, 39 | })) 40 | end 41 | -------------------------------------------------------------------------------- /lua/configs/aerial.lua: -------------------------------------------------------------------------------- 1 | local status_ok, aerial = pcall(require, "aerial") 2 | if status_ok then 3 | aerial.setup(astronvim.user_plugin_opts("plugins.aerial", { 4 | close_behavior = "global", 5 | backends = { "lsp", "treesitter", "markdown" }, 6 | min_width = 28, 7 | show_guides = true, 8 | filter_kind = false, 9 | icons = { 10 | Array = "", 11 | Boolean = "⊨", 12 | Class = "", 13 | Constant = "", 14 | Constructor = "", 15 | Key = "", 16 | Function = "", 17 | Method = "ƒ", 18 | Namespace = "", 19 | Null = "NULL", 20 | Number = "#", 21 | Object = "⦿", 22 | Property = "", 23 | TypeParameter = "𝙏", 24 | Variable = "", 25 | Enum = "ℰ", 26 | Package = "", 27 | EnumMember = "", 28 | File = "", 29 | Module = "", 30 | Field = "", 31 | Interface = "ﰮ", 32 | String = "𝓐", 33 | Struct = "𝓢", 34 | Event = "", 35 | Operator = "+", 36 | }, 37 | guides = { 38 | mid_item = "├ ", 39 | last_item = "└ ", 40 | nested_top = "│ ", 41 | whitespace = " ", 42 | }, 43 | on_attach = function(bufnr) 44 | -- Jump forwards/backwards with '{' and '}' 45 | vim.keymap.set("n", "{", "AerialPrev", { buffer = bufnr, desc = "Jump backwards in Aerial" }) 46 | vim.keymap.set("n", "}", "AerialNext", { buffer = bufnr, desc = "Jump forwards in Aerial" }) 47 | -- Jump up the tree with '[[' or ']]' 48 | vim.keymap.set("n", "[[", "AerialPrevUp", { buffer = bufnr, desc = "Jump up and backwards in Aerial" }) 49 | vim.keymap.set("n", "]]", "AerialNextUp", { buffer = bufnr, desc = "Jump up and forwards in Aerial" }) 50 | end, 51 | })) 52 | end 53 | -------------------------------------------------------------------------------- /lua/configs/which-key-register.lua: -------------------------------------------------------------------------------- 1 | local status_ok, which_key = pcall(require, "which-key") 2 | if status_ok then 3 | local is_available = astronvim.is_available 4 | local user_plugin_opts = astronvim.user_plugin_opts 5 | local mappings = { 6 | n = { 7 | [""] = { 8 | f = { name = "File" }, 9 | p = { name = "Packer" }, 10 | l = { name = "LSP" }, 11 | }, 12 | }, 13 | } 14 | 15 | local extra_sections = { 16 | g = "Git", 17 | s = "Search", 18 | S = "Session", 19 | t = "Terminal", 20 | } 21 | 22 | local function init_table(mode, prefix, idx) 23 | if not mappings[mode][prefix][idx] then 24 | mappings[mode][prefix][idx] = { name = extra_sections[idx] } 25 | end 26 | end 27 | 28 | if is_available "neovim-session-manager" then 29 | init_table("n", "", "S") 30 | end 31 | 32 | if is_available "gitsigns.nvim" then 33 | init_table("n", "", "g") 34 | end 35 | 36 | if is_available "toggleterm.nvim" then 37 | init_table("n", "", "g") 38 | init_table("n", "", "t") 39 | end 40 | 41 | if is_available "telescope.nvim" then 42 | init_table("n", "", "s") 43 | init_table("n", "", "g") 44 | end 45 | 46 | mappings = user_plugin_opts("which-key.register_mappings", mappings) 47 | -- support previous legacy notation, deprecate at some point 48 | mappings.n[""] = user_plugin_opts("which-key.register_n_leader", mappings.n[""]) 49 | for mode, prefixes in pairs(mappings) do 50 | for prefix, mapping_table in pairs(prefixes) do 51 | which_key.register(mapping_table, { 52 | mode = mode, 53 | prefix = prefix, 54 | buffer = nil, 55 | silent = true, 56 | noremap = true, 57 | nowait = true, 58 | }) 59 | end 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /lua/configs/neo-tree.lua: -------------------------------------------------------------------------------- 1 | local status_ok, neotree = pcall(require, "neo-tree") 2 | if status_ok then 3 | neotree.setup(astronvim.user_plugin_opts("plugins.neo-tree", { 4 | close_if_last_window = true, 5 | popup_border_style = "rounded", 6 | enable_diagnostics = false, 7 | default_component_configs = { 8 | indent = { 9 | padding = 0, 10 | with_expanders = false, 11 | }, 12 | icon = { 13 | folder_closed = "", 14 | folder_open = "", 15 | folder_empty = "", 16 | default = "", 17 | }, 18 | git_status = { 19 | symbols = { 20 | added = "", 21 | deleted = "", 22 | modified = "", 23 | renamed = "➜", 24 | untracked = "★", 25 | ignored = "◌", 26 | unstaged = "✗", 27 | staged = "✓", 28 | conflict = "", 29 | }, 30 | }, 31 | }, 32 | window = { 33 | width = 60, 34 | mappings = { 35 | ["o"] = "open", 36 | }, 37 | }, 38 | filesystem = { 39 | filtered_items = { 40 | visible = true, 41 | hide_dotfiles = true, 42 | hide_gitignored = false, 43 | hide_by_name = { 44 | ".DS_Store", 45 | "thumbs.db", 46 | "node_modules", 47 | "__pycache__", 48 | }, 49 | }, 50 | follow_current_file = true, 51 | hijack_netrw_behavior = "open_current", 52 | use_libuv_file_watcher = true, 53 | }, 54 | git_status = { 55 | window = { 56 | position = "float", 57 | }, 58 | }, 59 | event_handlers = { 60 | { 61 | event = "vim_buffer_enter", 62 | handler = function(_) 63 | if vim.bo.filetype == "neo-tree" then 64 | vim.wo.signcolumn = "auto" 65 | end 66 | end, 67 | }, 68 | }, 69 | })) 70 | end 71 | -------------------------------------------------------------------------------- /lua/default_theme/colors.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | none = "NONE", 3 | fg = "#abb2bf", 4 | bg = "#1e222a", 5 | bg_1 = "#303742", 6 | black = "#181a1f", 7 | black_1 = "#1f1f25", 8 | green = "#98c379", 9 | green_1 = "#89b06d", 10 | green_2 = "#95be76", 11 | white = "#dedede", 12 | white_1 = "#afb2bb", 13 | white_2 = "#c9c9c9", 14 | blue = "#61afef", 15 | blue_1 = "#40d9ff", 16 | blue_2 = "#1b1f27", 17 | blue_3 = "#8094B4", 18 | orange = "#d19a66", 19 | orange_1 = "#ff9640", 20 | orange_2 = "#ff8800", 21 | yellow = "#e5c07b", 22 | yellow_1 = "#ebae34", 23 | yellow_2 = "#d1b071", 24 | red = "#e06c75", 25 | red_1 = "#ec5f67", 26 | red_2 = "#ffbba6", 27 | red_3 = "#cc626a", 28 | red_4 = "#d47d85", 29 | grey = "#5c6370", 30 | grey_1 = "#4b5263", 31 | grey_2 = "#777d86", 32 | grey_3 = "#282c34", 33 | grey_4 = "#2c323c", 34 | grey_5 = "#3e4452", 35 | grey_6 = "#3b4048", 36 | grey_7 = "#5c5c5c", 37 | grey_8 = "#252931", 38 | grey_9 = "#787e87", 39 | grey_10 = "#D3D3D3", 40 | gold = "#ffcc00", 41 | cyan = "#56b6c2", 42 | purple = "#c678dd", 43 | purple_1 = "#a9a1e1", 44 | 45 | -- icon colors 46 | c = "#519aba", 47 | css = "#61afef", 48 | deb = "#a1b7ee", 49 | docker = "#384d54", 50 | html = "#de8c92", 51 | jpeg = "#c882e7", 52 | jpg = "#c882e7", 53 | js = "#ebcb8b", 54 | jsx = "#519ab8", 55 | kt = "#7bc99c", 56 | lock = "#c4c720", 57 | lua = "#51a0cf", 58 | mp3 = "#d39ede", 59 | mp4 = "#9ea3de", 60 | out = "#abb2bf", 61 | png = "#c882e7", 62 | py = "#a3b8ef", 63 | rb = "#ff75a0", 64 | robots = "#abb2bf", 65 | rpm = "#fca2aa", 66 | rs = "#dea584", 67 | toml = "#39bf39", 68 | ts = "#519aba", 69 | ttf = "#abb2bf", 70 | vue = "#7bc99c", 71 | woff = "#abb2bf", 72 | woff2 = "#abb2bf", 73 | zip = "#f9d71c", 74 | } 75 | 76 | return astronvim.user_plugin_opts("default_theme.colors", colors) 77 | -------------------------------------------------------------------------------- /lua/configs/lsp/init.lua: -------------------------------------------------------------------------------- 1 | local status_ok, lspconfig = pcall(require, "lspconfig") 2 | if status_ok then 3 | require "configs.lsp.handlers" 4 | local insert = table.insert 5 | local tbl_contains = vim.tbl_contains 6 | local sign_define = vim.fn.sign_define 7 | local user_plugin_opts = astronvim.user_plugin_opts 8 | local user_registration = user_plugin_opts("lsp.server_registration", nil, false) 9 | 10 | local signs = { 11 | { name = "DiagnosticSignError", text = "" }, 12 | { name = "DiagnosticSignWarn", text = "" }, 13 | { name = "DiagnosticSignHint", text = "" }, 14 | { name = "DiagnosticSignInfo", text = "" }, 15 | } 16 | for _, sign in ipairs(signs) do 17 | sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) 18 | end 19 | vim.diagnostic.config(user_plugin_opts("diagnostics", { 20 | virtual_text = true, 21 | signs = { active = signs }, 22 | update_in_insert = true, 23 | underline = true, 24 | severity_sort = true, 25 | float = { 26 | focusable = false, 27 | style = "minimal", 28 | border = "rounded", 29 | source = "always", 30 | header = "", 31 | prefix = "", 32 | }, 33 | })) 34 | vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }) 35 | vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded" }) 36 | 37 | local servers = user_plugin_opts "lsp.servers" 38 | local skip_setup = user_plugin_opts "lsp.skip_setup" 39 | local installer_avail, lsp_installer = pcall(require, "nvim-lsp-installer") 40 | if installer_avail then 41 | for _, server in ipairs(lsp_installer.get_installed_servers()) do 42 | insert(servers, server.name) 43 | end 44 | end 45 | for _, server in ipairs(servers) do 46 | if not tbl_contains(skip_setup, server) then 47 | local opts = astronvim.lsp.server_settings(server) 48 | if type(user_registration) == "function" then 49 | user_registration(server, opts) 50 | else 51 | lspconfig[server].setup(opts) 52 | end 53 | end 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /lua/default_theme/treesitter.lua: -------------------------------------------------------------------------------- 1 | local treesitter = { 2 | TSError = { fg = C.red }, 3 | TSPunctDelimiter = { fg = C.fg }, 4 | TSPunctBracket = { fg = C.fg }, 5 | TSPunctSpecial = { fg = C.fg }, 6 | TSConstant = { fg = C.yellow }, 7 | TSConstBuiltin = { fg = C.orange }, 8 | TSConstMacro = { fg = C.red }, 9 | TSStringRegex = { fg = C.green }, 10 | TSString = { fg = C.green }, 11 | TSStringEscap = { fg = C.red }, 12 | TSCharacter = { fg = C.green }, 13 | TSNumber = { fg = C.orange }, 14 | TSBoolean = { fg = C.orange }, 15 | TSFloat = { fg = C.green }, 16 | TSAnnotation = { fg = C.yellow }, 17 | TSAttribute = { fg = C.red }, 18 | TSNamespace = { fg = C.purple }, 19 | TSFuncBuiltin = { fg = C.blue }, 20 | TSFunction = { fg = C.blue }, 21 | TSFuncMacro = { fg = C.yellow }, 22 | TSParameter = { fg = C.red }, 23 | TSParameterReference = { fg = C.cyan }, 24 | TSMethod = { fg = C.blue }, 25 | TSField = { fg = C.red }, 26 | TSProperty = { fg = C.yellow }, 27 | TSConstructor = { fg = C.yellow }, 28 | TSConditional = { fg = C.purple }, 29 | TSRepeat = { fg = C.purple }, 30 | TSLabel = { fg = C.blue }, 31 | TSKeyword = { fg = C.purple }, 32 | TSKeywordFunction = { fg = C.purple }, 33 | TSKeywordOperator = { fg = C.purple }, 34 | TSOperator = { fg = C.cyan }, 35 | TSException = { fg = C.purple }, 36 | TSType = { fg = C.blue }, 37 | TSTypeBuiltin = { fg = C.blue }, 38 | TSStructure = { fg = C.purple }, 39 | TSInclude = { fg = C.purple }, 40 | TSVariable = { fg = C.red }, 41 | TSVariableBuiltin = { fg = C.yellow }, 42 | TSText = { fg = C.fg }, 43 | TSTextReference = { fg = C.yellow }, 44 | TSStrong = { fg = C.blue, style = "bold" }, 45 | TSEmphasis = { fg = C.purple, style = "italic" }, 46 | TSUnderline = { fg = C.fg }, 47 | TSTitle = { fg = C.fg }, 48 | TSLiteral = { fg = C.fg }, 49 | TSURI = { fg = C.green }, 50 | TSTag = { fg = C.red }, 51 | TSTagDelimiter = { fg = C.fg }, 52 | markdownTSNone = { fg = C.fg }, 53 | markdownTSTitle = { fg = C.red }, 54 | markdownTSLiteral = { fg = C.green }, 55 | markdownTSPunctSpecial = { fg = C.red }, 56 | markdownTSPunctDelimiter = { fg = C.fg }, 57 | } 58 | 59 | return treesitter 60 | -------------------------------------------------------------------------------- /lua/default_theme/plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | TelescopeResultsTitle = { fg = C.green }, 3 | TelescopePromptTitle = { fg = C.blue }, 4 | TelescopePreviewTitle = { fg = C.purple }, 5 | TelescopeResultsBorder = { fg = C.fg }, 6 | TelescopePromptBorder = { fg = C.fg }, 7 | TelescopePreviewBorder = { fg = C.fg }, 8 | TelescopeSelectionCaret = { fg = C.red }, 9 | TelescopeMatching = { fg = C.yellow }, 10 | TelescopeSelection = { bg = C.grey_5 }, 11 | TelescopeMultiSelection = { fg = C.blue }, 12 | TelescopeMultiIcon = { fg = C.blue }, 13 | TelescopeNormal = { fg = C.fg, bg = C.bg }, 14 | TelescopePreviewNormal = { fg = C.fg, bg = C.bg }, 15 | TelescopePromptNormal = { fg = C.fg, bg = C.bg }, 16 | TelescopeResultsNormal = { fg = C.fg, bg = C.bg }, 17 | TelescopeBorder = { fg = C.fg }, 18 | TelescopeTitle = { fg = C.fg }, 19 | TelescopePromptCounter = { fg = C.grey_1 }, 20 | TelescopePromptPrefix = { fg = C.blue }, 21 | TelescopePreviewLine = { bg = C.grey_5 }, 22 | TelescopePreviewMatch = { fg = C.yellow }, 23 | TelescopePreviewPipe = { fg = C.yellow }, 24 | TelescopePreviewCharDev = { fg = C.yellow }, 25 | TelescopePreviewDirectory = { fg = C.blue }, 26 | TelescopePreviewBlock = { fg = C.yellow }, 27 | TelescopePreviewLink = { fg = C.blue }, 28 | TelescopePreviewSocket = { fg = C.purple }, 29 | TelescopePreviewRead = { fg = C.yellow }, 30 | TelescopePreviewWrite = { fg = C.purple }, 31 | TelescopePreviewExecute = { fg = C.green }, 32 | TelescopePreviewHyphen = { fg = C.grey_1 }, 33 | TelescopePreviewSticky = { fg = C.blue }, 34 | TelescopePreviewSize = { fg = C.green }, 35 | TelescopePreviewUser = { fg = C.yellow }, 36 | TelescopePreviewGroup = { fg = C.yellow }, 37 | TelescopePreviewDate = { fg = C.blue }, 38 | TelescopePreviewMessage = { fg = C.fg }, 39 | TelescopePreviewMessageFillchar = { fg = C.fg }, 40 | TelescopeResultsClass = { fg = C.yellow }, 41 | TelescopeResultsConstant = { fg = C.yellow }, 42 | TelescopeResultsField = { fg = C.red }, 43 | TelescopeResultsFunction = { fg = C.blue }, 44 | TelescopeResultsMethod = { fg = C.blue }, 45 | TelescopeResultsOperator = { fg = C.cyan }, 46 | TelescopeResultsStruct = { fg = C.purple }, 47 | TelescopeResultsVariable = { fg = C.red }, 48 | TelescopeResultsLineNr = { fg = C.grey_1 }, 49 | TelescopeResultsIdentifier = { fg = C.blue }, 50 | TelescopeResultsNumber = { fg = C.orange }, 51 | TelescopeResultsComment = { fg = C.grey_2 }, 52 | TelescopeResultsSpecialComment = { fg = C.grey }, 53 | TelescopeResultsDiffChange = { fg = C.none, bg = C.yellow }, 54 | TelescopeResultsDiffAdd = { fg = C.none, bg = C.green }, 55 | TelescopeResultsDiffDelete = { fg = C.none, bg = C.red }, 56 | TelescopeResultsDiffUntracked = { fg = C.none, bg = C.grey_1 }, 57 | } 58 | -------------------------------------------------------------------------------- /lua/configs/feline.lua: -------------------------------------------------------------------------------- 1 | local status_ok, feline = pcall(require, "feline") 2 | if status_ok then 3 | local C = require "default_theme.colors" 4 | local hl = require("core.status").hl 5 | local provider = require("core.status").provider 6 | local conditional = require("core.status").conditional 7 | -- stylua: ignore 8 | feline.setup(astronvim.user_plugin_opts("plugins.feline", { 9 | disable = { filetypes = { "^NvimTree$", "^neo%-tree$", "^dashboard$", "^Outline$", "^aerial$" } }, 10 | theme = hl.group("StatusLine", { fg = C.fg, bg = C.bg_1 }), 11 | components = { 12 | active = { 13 | { 14 | { provider = provider.spacer(), hl = hl.mode() }, 15 | { provider = provider.spacer(2) }, 16 | { provider = "git_branch", hl = hl.fg("Conditional", { fg = C.purple_1, style = "bold" }), icon = " " }, 17 | { provider = provider.spacer(3), enabled = conditional.git_available }, 18 | { provider = { name = "file_info", opts = { type = "relative" } }}, 19 | { provider = provider.spacer(2), enabled = conditional.has_fileinfo }, 20 | { provider = "git_diff_added", hl = hl.fg("GitSignsAdd", { fg = C.green }), icon = "  " }, 21 | { provider = "git_diff_changed", hl = hl.fg("GitSignsChange", { fg = C.orange_1 }), icon = " 柳" }, 22 | { provider = "git_diff_removed", hl = hl.fg("GitSignsDelete", { fg = C.red_1 }), icon = "  " }, 23 | { provider = provider.spacer(2), enabled = conditional.git_changed }, 24 | { provider = "diagnostic_errors", hl = hl.fg("DiagnosticError", { fg = C.red_1 }), icon = "  " }, 25 | { provider = "diagnostic_warnings", hl = hl.fg("DiagnosticWarn", { fg = C.orange_1 }), icon = "  " }, 26 | { provider = "diagnostic_info", hl = hl.fg("DiagnosticInfo", { fg = C.white_2 }), icon = "  " }, 27 | { provider = "diagnostic_hints", hl = hl.fg("DiagnosticHint", { fg = C.yellow_1 }), icon = "  " }, 28 | }, 29 | { 30 | { provider = provider.lsp_progress, enabled = conditional.bar_width() }, 31 | { provider = provider.lsp_client_names(true), short_provider = provider.lsp_client_names(), enabled = conditional.bar_width(), icon = "  " }, 32 | { provider = provider.spacer(2), enabled = conditional.bar_width() }, 33 | { provider = provider.treesitter_status, enabled = conditional.bar_width(), hl = hl.fg("GitSignsAdd", { fg = C.green }) }, 34 | { provider = provider.spacer(2) }, 35 | { provider = "position" }, 36 | { provider = provider.spacer(2) }, 37 | { provider = "line_percentage" }, 38 | { provider = provider.spacer() }, 39 | { provider = "scroll_bar", hl = hl.fg("TypeDef", { fg = C.yellow }) }, 40 | { provider = provider.spacer(2) }, 41 | { provider = provider.spacer(), hl = hl.mode() }, 42 | }, 43 | }, 44 | }, 45 | })) 46 | end 47 | -------------------------------------------------------------------------------- /lua/core/utils/git.lua: -------------------------------------------------------------------------------- 1 | local git = { url = "https://github.com/" } 2 | 3 | function git.cmd(args, ...) 4 | return astronvim.cmd("git -C " .. astronvim.install.home .. " " .. args, ...) 5 | end 6 | 7 | function git.is_repo() 8 | return git.cmd("rev-parse --is-inside-work-tree", false) 9 | end 10 | 11 | function git.fetch(remote, ...) 12 | return git.cmd("fetch " .. remote, ...) 13 | end 14 | 15 | function git.pull(...) 16 | return git.cmd("pull --rebase", ...) 17 | end 18 | 19 | function git.checkout(dest, ...) 20 | return git.cmd("checkout " .. dest, ...) 21 | end 22 | 23 | function git.hard_reset(dest, ...) 24 | return git.cmd("reset --hard " .. dest, ...) 25 | end 26 | 27 | function git.branch_contains(remote, branch, commit, ...) 28 | return git.cmd("merge-base --is-ancestor " .. commit .. " " .. remote .. "/" .. branch, ...) ~= nil 29 | end 30 | 31 | function git.remote_add(remote, url, ...) 32 | return git.cmd("remote add " .. remote .. " " .. url, ...) 33 | end 34 | 35 | function git.remote_update(remote, url, ...) 36 | return git.cmd("remote set-url " .. remote .. " " .. url, ...) 37 | end 38 | 39 | function git.remote_url(remote, ...) 40 | return astronvim.trim_or_nil(git.cmd("remote get-url " .. remote, ...)) 41 | end 42 | 43 | function git.current_version(...) 44 | return astronvim.trim_or_nil(git.cmd("describe --tags", ...)) 45 | end 46 | 47 | function git.current_branch(...) 48 | return astronvim.trim_or_nil(git.cmd("rev-parse --abbrev-ref HEAD", ...)) 49 | end 50 | 51 | function git.local_head(...) 52 | return astronvim.trim_or_nil(git.cmd("rev-parse HEAD", ...)) 53 | end 54 | 55 | function git.remote_head(remote, branch, ...) 56 | return astronvim.trim_or_nil(git.cmd("rev-list -n 1 " .. remote .. "/" .. branch, ...)) 57 | end 58 | 59 | function git.tag_commit(tag, ...) 60 | return astronvim.trim_or_nil(git.cmd("rev-list -n 1 " .. tag, ...)) 61 | end 62 | 63 | function git.get_commit_range(start_hash, end_hash, ...) 64 | local log = git.cmd("log --no-merges --pretty='format:[%h] %s' " .. start_hash .. ".." .. end_hash, ...) 65 | return log and vim.fn.split(log, "\n") or {} 66 | end 67 | 68 | function git.get_versions(search, ...) 69 | local tags = git.cmd("tag -l --sort=version:refname '" .. (search == "latest" and "v*" or search) .. "'", ...) 70 | return tags and vim.fn.split(tags, "\n") or {} 71 | end 72 | 73 | function git.latest_version(versions, ...) 74 | versions = versions and versions or git.get_versions(...) 75 | return versions[#versions] 76 | end 77 | 78 | function git.parse_remote_url(str) 79 | return vim.fn.match(str, astronvim.url_matcher) == -1 80 | and git.url .. str .. (vim.fn.match(str, "/") == -1 and "/AstroNvim.git" or ".git") 81 | or str 82 | end 83 | 84 | function git.breaking_changes(commits) 85 | return vim.tbl_filter(function(v) 86 | return vim.fn.match(v, "\\[.*\\]\\s\\+\\w\\+\\((\\w\\+)\\)\\?!:") ~= -1 87 | end, commits) 88 | end 89 | 90 | function git.pretty_changelog(commits) 91 | local changelog = {} 92 | for _, commit in ipairs(commits) do 93 | local hash, type, msg = commit:match "(%[.*%])(.*:)(.*)" 94 | if hash and type and msg then 95 | vim.list_extend(changelog, { { hash, "DiffText" }, { type, "Typedef" }, { msg }, { "\n" } }) 96 | end 97 | end 98 | return changelog 99 | end 100 | 101 | return git 102 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | education, socio-economic status, nationality, personal appearance, race, 10 | religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at {{ email }}. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | -------------------------------------------------------------------------------- /lua/core/autocmds.lua: -------------------------------------------------------------------------------- 1 | local is_available = astronvim.is_available 2 | local cmd = vim.api.nvim_create_autocmd 3 | local augroup = vim.api.nvim_create_augroup 4 | local create_command = vim.api.nvim_create_user_command 5 | 6 | augroup("highlighturl", { clear = true }) 7 | cmd({ "VimEnter", "FileType", "BufEnter", "WinEnter" }, { 8 | desc = "URL Highlighting", 9 | group = "highlighturl", 10 | pattern = "*", 11 | callback = function() 12 | astronvim.set_url_match() 13 | end, 14 | }) 15 | 16 | if is_available "alpha-nvim" then 17 | augroup("alpha_settings", { clear = true }) 18 | if is_available "bufferline.nvim" then 19 | cmd("FileType", { 20 | desc = "Disable tabline for alpha", 21 | group = "alpha_settings", 22 | pattern = "alpha", 23 | callback = function() 24 | local prev_showtabline = vim.opt.showtabline 25 | vim.opt.showtabline = 0 26 | cmd("BufUnload", { 27 | pattern = "", 28 | callback = function() 29 | vim.opt.showtabline = prev_showtabline 30 | end, 31 | }) 32 | end, 33 | }) 34 | end 35 | cmd("FileType", { 36 | desc = "Disable statusline for alpha", 37 | group = "alpha_settings", 38 | pattern = "alpha", 39 | callback = function() 40 | local prev_status = vim.opt.laststatus 41 | vim.opt.laststatus = 0 42 | cmd("BufUnload", { 43 | pattern = "", 44 | callback = function() 45 | vim.opt.laststatus = prev_status 46 | end, 47 | }) 48 | end, 49 | }) 50 | cmd("VimEnter", { 51 | desc = "Start Alpha when vim is opened with no arguments", 52 | group = "alpha_settings", 53 | callback = function() 54 | -- optimized start check from https://github.com/goolord/alpha-nvim 55 | local alpha_avail, alpha = pcall(require, "alpha") 56 | if alpha_avail then 57 | local should_skip = false 58 | if vim.fn.argc() > 0 or vim.fn.line2byte "$" ~= -1 or not vim.o.modifiable then 59 | should_skip = true 60 | else 61 | for _, arg in pairs(vim.v.argv) do 62 | if arg == "-b" or arg == "-c" or vim.startswith(arg, "+") or arg == "-S" then 63 | should_skip = true 64 | break 65 | end 66 | end 67 | end 68 | if not should_skip then 69 | alpha.start(true) 70 | end 71 | end 72 | end, 73 | }) 74 | end 75 | 76 | if is_available "neo-tree.nvim" then 77 | augroup("neotree_start", { clear = true }) 78 | cmd("BufEnter", { 79 | desc = "Open Neo-Tree on startup with directory", 80 | group = "neotree_start", 81 | callback = function() 82 | local stats = vim.loop.fs_stat(vim.api.nvim_buf_get_name(0)) 83 | if stats and stats.type == "directory" then 84 | require("neo-tree.setup.netrw").hijack() 85 | end 86 | end, 87 | }) 88 | end 89 | 90 | if is_available "feline.nvim" then 91 | augroup("feline_setup", { clear = true }) 92 | cmd("ColorScheme", { 93 | desc = "Reload feline on colorscheme change", 94 | group = "feline_setup", 95 | callback = function() 96 | package.loaded["configs.feline"] = nil 97 | require "configs.feline" 98 | end, 99 | }) 100 | end 101 | 102 | create_command("AstroUpdate", astronvim.updater.update, { desc = "Update AstroNvim" }) 103 | create_command("AstroVersion", astronvim.updater.version, { desc = "Check AstroNvim Version" }) 104 | create_command("ToggleHighlightURL", astronvim.toggle_url_match, { desc = "Toggle URL Highlights" }) 105 | -------------------------------------------------------------------------------- /lua/core/options.lua: -------------------------------------------------------------------------------- 1 | astronvim.vim_opts(astronvim.user_plugin_opts("options", { 2 | opt = { 3 | backspace = vim.opt.backspace + { "nostop" }, -- Don't stop backspace at insert 4 | clipboard = "unnamedplus", -- Connection to the system clipboard 5 | completeopt = { "menuone", "noselect" }, -- Options for insert mode completion 6 | copyindent = true, -- Copy the previous indentation on autoindenting 7 | cursorline = true, -- Highlight the text line of the cursor 8 | expandtab = true, -- Enable the use of space in tab 9 | fileencoding = "utf-8", -- File content encoding for the buffer 10 | fillchars = { eob = " " }, -- Disable `~` on nonexistent lines 11 | history = 100, -- Number of commands to remember in a history table 12 | ignorecase = true, -- Case insensitive searching 13 | laststatus = 3, -- globalstatus 14 | lazyredraw = true, -- lazily redraw screen 15 | mouse = "a", -- Enable mouse support 16 | number = true, -- Show numberline 17 | preserveindent = true, -- Preserve indent structure as much as possible 18 | pumheight = 10, -- Height of the pop up menu 19 | relativenumber = true, -- Show relative numberline 20 | scrolloff = 8, -- Number of lines to keep above and below the cursor 21 | shiftwidth = 2, -- Number of space inserted for indentation 22 | showmode = false, -- Disable showing modes in command line 23 | sidescrolloff = 8, -- Number of columns to keep at the sides of the cursor 24 | signcolumn = "yes", -- Always show the sign column 25 | smartcase = true, -- Case sensitivie searching 26 | splitbelow = true, -- Splitting a new window below the current one 27 | splitright = true, -- Splitting a new window at the right of the current one 28 | swapfile = false, -- Disable use of swapfile for the buffer 29 | tabstop = 2, -- Number of space in a tab 30 | termguicolors = true, -- Enable 24-bit RGB color in the TUI 31 | timeoutlen = 300, -- Length of time to wait for a mapped sequence 32 | undofile = true, -- Enable persistent undo 33 | updatetime = 300, -- Length of time to wait before triggering the plugin 34 | wrap = false, -- Disable wrapping of lines longer than the width of window 35 | writebackup = false, -- Disable making a backup before overwriting a file 36 | }, 37 | g = { 38 | do_filetype_lua = 1, -- use filetype.lua 39 | did_load_filetypes = 0, -- don't use filetype.vim 40 | highlighturl_enabled = true, -- highlight URLs by default 41 | mapleader = " ", -- set leader key 42 | zipPlugin = false, -- disable zip 43 | load_black = false, -- disable black 44 | loaded_2html_plugin = true, -- disable 2html 45 | loaded_getscript = true, -- disable getscript 46 | loaded_getscriptPlugin = true, -- disable getscript 47 | loaded_gzip = true, -- disable gzip 48 | loaded_logipat = true, -- disable logipat 49 | loaded_matchit = true, -- disable matchit 50 | loaded_netrwFileHandlers = true, -- disable netrw 51 | loaded_netrwPlugin = true, -- disable netrw 52 | loaded_netrwSettngs = true, -- disable netrw 53 | loaded_remote_plugins = true, -- disable remote plugins 54 | loaded_tar = true, -- disable tar 55 | loaded_tarPlugin = true, -- disable tar 56 | loaded_zip = true, -- disable zip 57 | loaded_zipPlugin = true, -- disable zip 58 | loaded_vimball = true, -- disable vimball 59 | loaded_vimballPlugin = true, -- disable vimball 60 | }, 61 | })) 62 | 63 | local colorscheme = astronvim.user_plugin_opts("colorscheme", nil, false) 64 | vim.api.nvim_command( 65 | "colorscheme " 66 | .. (vim.tbl_contains(vim.fn.getcompletion("", "color"), colorscheme) and colorscheme or "default_theme") 67 | ) 68 | -------------------------------------------------------------------------------- /lua/configs/telescope.lua: -------------------------------------------------------------------------------- 1 | local status_ok, telescope = pcall(require, "telescope") 2 | if status_ok then 3 | local actions = require "telescope.actions" 4 | 5 | astronvim.conditional_func(telescope.load_extension, pcall(require, "notify"), "notify") 6 | astronvim.conditional_func(telescope.load_extension, pcall(require, "aerial"), "aerial") 7 | 8 | telescope.setup(astronvim.user_plugin_opts("plugins.telescope", { 9 | defaults = { 10 | 11 | prompt_prefix = " ", 12 | selection_caret = "❯ ", 13 | path_display = { "truncate" }, 14 | selection_strategy = "reset", 15 | sorting_strategy = "ascending", 16 | layout_strategy = "horizontal", 17 | layout_config = { 18 | horizontal = { 19 | prompt_position = "top", 20 | preview_width = 0.65, 21 | results_width = 0.9, 22 | }, 23 | vertical = { 24 | mirror = false, 25 | }, 26 | width = 0.87, 27 | height = 0.80, 28 | preview_cutoff = 120, 29 | }, 30 | 31 | mappings = { 32 | i = { 33 | [""] = actions.cycle_history_next, 34 | [""] = actions.cycle_history_prev, 35 | 36 | [""] = actions.move_selection_next, 37 | [""] = actions.move_selection_previous, 38 | 39 | [""] = actions.close, 40 | 41 | [""] = actions.move_selection_next, 42 | [""] = actions.move_selection_previous, 43 | 44 | [""] = actions.select_default, 45 | [""] = actions.select_horizontal, 46 | [""] = actions.select_vertical, 47 | [""] = actions.select_tab, 48 | 49 | [""] = actions.preview_scrolling_up, 50 | [""] = actions.preview_scrolling_down, 51 | 52 | [""] = actions.results_scrolling_up, 53 | [""] = actions.results_scrolling_down, 54 | 55 | [""] = actions.toggle_selection + actions.move_selection_worse, 56 | [""] = actions.toggle_selection + actions.move_selection_better, 57 | [""] = actions.send_to_qflist + actions.open_qflist, 58 | [""] = actions.send_selected_to_qflist + actions.open_qflist, 59 | [""] = actions.complete_tag, 60 | }, 61 | 62 | n = { 63 | [""] = actions.close, 64 | [""] = actions.select_default, 65 | [""] = actions.select_horizontal, 66 | [""] = actions.select_vertical, 67 | [""] = actions.select_tab, 68 | 69 | [""] = actions.toggle_selection + actions.move_selection_worse, 70 | [""] = actions.toggle_selection + actions.move_selection_better, 71 | [""] = actions.send_to_qflist + actions.open_qflist, 72 | [""] = actions.send_selected_to_qflist + actions.open_qflist, 73 | 74 | ["j"] = actions.move_selection_next, 75 | ["k"] = actions.move_selection_previous, 76 | ["H"] = actions.move_to_top, 77 | ["M"] = actions.move_to_middle, 78 | ["L"] = actions.move_to_bottom, 79 | 80 | [""] = actions.move_selection_next, 81 | [""] = actions.move_selection_previous, 82 | ["gg"] = actions.move_to_top, 83 | ["G"] = actions.move_to_bottom, 84 | 85 | [""] = actions.preview_scrolling_up, 86 | [""] = actions.preview_scrolling_down, 87 | 88 | [""] = actions.results_scrolling_up, 89 | [""] = actions.results_scrolling_down, 90 | }, 91 | }, 92 | }, 93 | pickers = {}, 94 | extensions = {}, 95 | })) 96 | end 97 | -------------------------------------------------------------------------------- /lua/configs/cmp.lua: -------------------------------------------------------------------------------- 1 | local cmp_status_ok, cmp = pcall(require, "cmp") 2 | local snip_status_ok, luasnip = pcall(require, "luasnip") 3 | if cmp_status_ok and snip_status_ok then 4 | local setup = cmp.setup 5 | local kind_icons = { 6 | Text = "", 7 | Method = "", 8 | Function = "", 9 | Constructor = "", 10 | Field = "ﰠ", 11 | Variable = "", 12 | Class = "", 13 | Interface = "", 14 | Module = "", 15 | Property = "", 16 | Unit = "", 17 | Value = "", 18 | Enum = "", 19 | Keyword = "", 20 | Snippet = "", 21 | Color = "", 22 | File = "", 23 | Reference = "", 24 | Folder = "", 25 | EnumMember = "", 26 | Constant = "", 27 | Struct = "פּ", 28 | Event = "", 29 | Operator = "", 30 | TypeParameter = "", 31 | } 32 | 33 | local function has_words_before() 34 | local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 35 | return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil 36 | end 37 | 38 | setup(astronvim.user_plugin_opts("plugins.cmp", { 39 | preselect = cmp.PreselectMode.None, 40 | formatting = { 41 | fields = { "kind", "abbr", "menu" }, 42 | format = function(_, vim_item) 43 | vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) 44 | return vim_item 45 | end, 46 | }, 47 | snippet = { 48 | expand = function(args) 49 | luasnip.lsp_expand(args.body) 50 | end, 51 | }, 52 | duplicates = { 53 | nvim_lsp = 1, 54 | luasnip = 1, 55 | cmp_tabnine = 1, 56 | buffer = 1, 57 | path = 1, 58 | }, 59 | confirm_opts = { 60 | behavior = cmp.ConfirmBehavior.Replace, 61 | select = false, 62 | }, 63 | window = { 64 | documentation = { 65 | border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, 66 | }, 67 | }, 68 | mapping = { 69 | [""] = cmp.mapping.select_prev_item(), 70 | [""] = cmp.mapping.select_next_item(), 71 | [""] = cmp.mapping.select_prev_item(), 72 | [""] = cmp.mapping.select_next_item(), 73 | [""] = cmp.mapping.select_prev_item(), 74 | [""] = cmp.mapping.select_next_item(), 75 | [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), 76 | [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), 77 | [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), 78 | [""] = cmp.config.disable, 79 | [""] = cmp.mapping { 80 | i = cmp.mapping.abort(), 81 | c = cmp.mapping.close(), 82 | }, 83 | [""] = cmp.mapping.confirm { select = false }, 84 | [""] = cmp.mapping(function(fallback) 85 | if cmp.visible() then 86 | cmp.select_next_item() 87 | elseif luasnip.expandable() then 88 | luasnip.expand() 89 | elseif luasnip.expand_or_jumpable() then 90 | luasnip.expand_or_jump() 91 | elseif has_words_before() then 92 | cmp.complete() 93 | else 94 | fallback() 95 | end 96 | end, { 97 | "i", 98 | "s", 99 | }), 100 | [""] = cmp.mapping(function(fallback) 101 | if cmp.visible() then 102 | cmp.select_prev_item() 103 | elseif luasnip.jumpable(-1) then 104 | luasnip.jump(-1) 105 | else 106 | fallback() 107 | end 108 | end, { 109 | "i", 110 | "s", 111 | }), 112 | }, 113 | })) 114 | for setup_opt, setup_table in pairs(astronvim.user_plugin_opts("cmp.setup", {})) do 115 | for pattern, options in pairs(setup_table) do 116 | setup[setup_opt](pattern, options) 117 | end 118 | end 119 | end 120 | -------------------------------------------------------------------------------- /lua/default_theme/base.lua: -------------------------------------------------------------------------------- 1 | local base = { 2 | Normal = { fg = C.fg, bg = C.bg }, 3 | Comment = { fg = C.grey_2, bg = C.none }, 4 | Constant = { fg = C.yellow, bg = C.none }, 5 | String = { fg = C.green, bg = C.none }, 6 | Character = { fg = C.green, bg = C.none }, 7 | Number = { fg = C.orange, bg = C.none }, 8 | Boolean = { fg = C.blue, bg = C.none }, 9 | Float = { fg = C.yellow, bg = C.none }, 10 | Identifier = { fg = C.blue, bg = C.none }, 11 | Function = { fg = C.yellow, bg = C.none }, 12 | Statement = { fg = C.purple, bg = C.none }, 13 | Conditional = { fg = C.purple_1, bg = C.none }, 14 | Repeat = { fg = C.purple, bg = C.none }, 15 | Label = { fg = C.blue, bg = C.none }, 16 | Operator = { fg = C.purple, bg = C.none }, 17 | Keyword = { fg = C.purple, bg = C.none }, 18 | Exception = { fg = C.purple, bg = C.none }, 19 | Preproc = { fg = C.yellow, bg = C.none }, 20 | Include = { fg = C.purple, bg = C.none }, 21 | Define = { fg = C.purple, bg = C.none }, 22 | Title = { fg = C.cyan, bg = C.none }, 23 | Macro = { fg = C.purple, bg = C.none }, 24 | PreCondit = { fg = C.blue, bg = C.none }, 25 | Type = { fg = C.blue, bg = C.none }, 26 | StorageClass = { fg = C.blue, bg = C.none }, 27 | Structure = { fg = C.yellow, bg = C.none }, 28 | Typedef = { fg = C.yellow, bg = C.none }, 29 | Special = { fg = C.blue, bg = C.none }, 30 | SpecialComment = { fg = C.grey, bg = C.none }, 31 | Error = { fg = C.red, bg = C.none }, 32 | Todo = { fg = C.purple, bg = C.none }, 33 | Underlined = { fg = C.cyan, bg = C.none }, 34 | Cursor = { fg = C.none, bg = C.none }, 35 | ColorColumn = { fg = C.none, bg = C.grey_4 }, 36 | CursorLineNr = { fg = C.fg, bg = C.none }, 37 | Conceal = { fg = C.grey, bg = C.none }, 38 | CursorColumn = { fg = C.none, bg = C.grey_4 }, 39 | CursorLine = { fg = C.none, bg = C.grey_8 }, 40 | Directory = { fg = C.blue, bg = C.none }, 41 | DiffAdd = { fg = C.grey_3, bg = C.green }, 42 | DiffChange = { fg = C.yellow, bg = C.none }, 43 | DiffDelete = { fg = C.grey_3, bg = C.red }, 44 | DiffText = { fg = C.grey_3, bg = C.yellow }, 45 | ErrorMsg = { fg = C.red, bg = C.none }, 46 | VertSplit = { fg = C.black, bg = C.none }, 47 | Folded = { fg = C.grey, bg = C.none }, 48 | FoldColumn = { fg = C.none, bg = C.none }, 49 | IncSearch = { fg = C.yellow, bg = C.grey }, 50 | LineNr = { fg = C.grey_1, bg = C.none }, 51 | NonText = { fg = C.grey_1, bg = C.none }, 52 | Pmenu = { fg = C.fg, bg = C.black_1 }, 53 | PmenuSel = { fg = C.none, bg = C.grey_4 }, 54 | PmenuSbar = { fg = C.none, bg = C.grey_3 }, 55 | PmenuThumb = { fg = C.none, bg = C.fg }, 56 | Question = { fg = C.purple, bg = C.none }, 57 | QuickFixLine = { fg = C.grey_3, bg = C.yellow }, 58 | Search = { fg = C.grey_3, bg = C.yellow }, 59 | SignColumn = { fg = C.none, bg = C.none }, 60 | SpecialKey = { fg = C.grey_1, bg = C.none }, 61 | SpellBad = { fg = C.red, bg = C.none }, 62 | SpellCap = { fg = C.yellow, bg = C.none }, 63 | SpellLocal = { fg = C.yellow, bg = C.none }, 64 | SpellRare = { fg = C.yellow, bg = C.none }, 65 | StatusLine = { fg = C.fg, bg = C.grey_4 }, 66 | StatusLineNC = { fg = C.grey, bg = C.none }, 67 | StatusLineTerm = { fg = C.fg, bg = C.grey_4 }, 68 | StatusLineTermNC = { fg = C.grey_4, bg = C.none }, 69 | TabLine = { fg = C.grey, bg = C.none }, 70 | TabLineSel = { fg = C.fg, bg = C.none }, 71 | TabLineFill = { fg = C.none, bg = C.grey_3 }, 72 | Terminal = { fg = C.fg, bg = C.grey_3 }, 73 | Visual = { fg = C.none, bg = C.grey_5 }, 74 | VisualNOS = { fg = C.grey_5, bg = C.none }, 75 | WarningMsg = { fg = C.yellow, bg = C.none }, 76 | WildMenu = { fg = C.grey_3, bg = C.blue }, 77 | EndOfBuffer = { fg = C.bg, bg = C.none }, 78 | CmpItemAbbrDefault = { fg = C.fg }, 79 | CmpItemAbbrDeprecatedDefault = { fg = C.grey_2 }, 80 | CmpItemAbbrMatchDefault = { fg = C.white }, 81 | CmpItemAbbrMatchFuzzyDefault = { fg = C.white }, 82 | CmpItemKind = { fg = C.yellow }, 83 | CmpItemAbbr = { fg = C.fg }, 84 | CmpItemMenuDefault = { fg = C.fg }, 85 | FloatBorder = { bg = C.none }, 86 | MatchParen = { fg = C.none, bg = C.grey_5 }, 87 | } 88 | 89 | return base 90 | -------------------------------------------------------------------------------- /lua/core/status.lua: -------------------------------------------------------------------------------- 1 | local M = { hl = {}, provider = {}, conditional = {} } 2 | local C = require "default_theme.colors" 3 | 4 | local function hl_by_name(name) 5 | return string.format("#%06x", vim.api.nvim_get_hl_by_name(name.group, true)[name.prop]) 6 | end 7 | 8 | local function hl_prop(group, prop) 9 | local status_ok, color = pcall(hl_by_name, { group = group, prop = prop }) 10 | return status_ok and color or nil 11 | end 12 | 13 | M.modes = { 14 | ["n"] = { "NORMAL", "Normal", C.blue }, 15 | ["no"] = { "N-PENDING", "Normal", C.blue }, 16 | ["i"] = { "INSERT", "Insert", C.green }, 17 | ["ic"] = { "INSERT", "Insert", C.green }, 18 | ["t"] = { "TERMINAL", "Insert", C.green }, 19 | ["v"] = { "VISUAL", "Visual", C.purple }, 20 | ["V"] = { "V-LINE", "Visual", C.purple }, 21 | [""] = { "V-BLOCK", "Visual", C.purple }, 22 | ["R"] = { "REPLACE", "Replace", C.red_1 }, 23 | ["Rv"] = { "V-REPLACE", "Replace", C.red_1 }, 24 | ["s"] = { "SELECT", "Visual", C.orange_1 }, 25 | ["S"] = { "S-LINE", "Visual", C.orange_1 }, 26 | [""] = { "S-BLOCK", "Visual", C.orange_1 }, 27 | ["c"] = { "COMMAND", "Command", C.yellow_1 }, 28 | ["cv"] = { "COMMAND", "Command", C.yellow_1 }, 29 | ["ce"] = { "COMMAND", "Command", C.yellow_1 }, 30 | ["r"] = { "PROMPT", "Inactive", C.grey_7 }, 31 | ["rm"] = { "MORE", "Inactive", C.grey_7 }, 32 | ["r?"] = { "CONFIRM", "Inactive", C.grey_7 }, 33 | ["!"] = { "SHELL", "Inactive", C.grey_7 }, 34 | } 35 | 36 | function M.hl.group(hlgroup, base) 37 | return vim.tbl_deep_extend( 38 | "force", 39 | base or {}, 40 | { fg = hl_prop(hlgroup, "foreground"), bg = hl_prop(hlgroup, "background") } 41 | ) 42 | end 43 | 44 | function M.hl.fg(hlgroup, base) 45 | return vim.tbl_deep_extend("force", base or {}, { fg = hl_prop(hlgroup, "foreground") }) 46 | end 47 | 48 | function M.hl.mode(base) 49 | local lualine_avail, lualine = pcall(require, "lualine.themes." .. (vim.g.colors_name or "default_theme")) 50 | return function() 51 | local lualine_opts = lualine_avail and lualine[M.modes[vim.fn.mode()][2]:lower()] 52 | return M.hl.group( 53 | "Feline" .. M.modes[vim.fn.mode()][2], 54 | vim.tbl_deep_extend( 55 | "force", 56 | lualine_opts and type(lualine_opts.a) == "table" and lualine_opts.a 57 | or { fg = C.bg_1, bg = M.modes[vim.fn.mode()][3] }, 58 | base or {} 59 | ) 60 | ) 61 | end 62 | end 63 | 64 | function M.provider.lsp_progress() 65 | local Lsp = vim.lsp.util.get_progress_messages()[1] 66 | return Lsp 67 | and string.format( 68 | " %%<%s %s %s (%s%%%%) ", 69 | ((Lsp.percentage or 0) >= 70 and { "", "", "" } or { "", "", "" })[math.floor( 70 | vim.loop.hrtime() / 12e7 71 | ) % 3 + 1], 72 | Lsp.title or "", 73 | Lsp.message or "", 74 | Lsp.percentage or 0 75 | ) 76 | or "" 77 | end 78 | 79 | function M.provider.lsp_client_names(expand_null_ls) 80 | return function() 81 | local buf_client_names = {} 82 | for _, client in pairs(vim.lsp.buf_get_clients(0)) do 83 | if client.name == "null-ls" and expand_null_ls then 84 | vim.list_extend(buf_client_names, astronvim.null_ls_sources(vim.bo.filetype, "FORMATTING")) 85 | vim.list_extend(buf_client_names, astronvim.null_ls_sources(vim.bo.filetype, "DIAGNOSTICS")) 86 | else 87 | table.insert(buf_client_names, client.name) 88 | end 89 | end 90 | return table.concat(buf_client_names, ", ") 91 | end 92 | end 93 | 94 | function M.provider.treesitter_status() 95 | local ts = vim.treesitter.highlighter.active[vim.api.nvim_get_current_buf()] 96 | return (ts and next(ts)) and " 綠TS" or "" 97 | end 98 | 99 | function M.provider.spacer(n) 100 | return string.rep(" ", n or 1) 101 | end 102 | 103 | function M.conditional.git_available() 104 | return vim.b.gitsigns_head ~= nil 105 | end 106 | 107 | function M.conditional.git_changed() 108 | local git_status = vim.b.gitsigns_status_dict 109 | return git_status and (git_status.added or 0) + (git_status.removed or 0) + (git_status.changed or 0) > 0 110 | end 111 | 112 | function M.conditional.has_filetype() 113 | return vim.fn.empty(vim.fn.expand "%:t") ~= 1 and vim.bo.filetype and vim.bo.filetype ~= "" 114 | end 115 | 116 | function M.conditional.bar_width(n) 117 | return function() 118 | return (vim.opt.laststatus:get() == 3 and vim.opt.columns:get() or vim.fn.winwidth(0)) > (n or 80) 119 | end 120 | end 121 | 122 | return M 123 | -------------------------------------------------------------------------------- /lua/core/ui.lua: -------------------------------------------------------------------------------- 1 | local ui = {} 2 | 3 | function ui.nui_input() 4 | -- Set up NUI for UI Input 5 | -- From: https://github.com/MunifTanjim/nui.nvim/wiki/vim.ui#vimuiinput 6 | local input_ui 7 | vim.ui.input = function(opts, on_confirm) 8 | local Input = require "nui.input" 9 | local event = require("nui.utils.autocmd").event 10 | if input_ui then 11 | -- ensure single ui.input operation 12 | vim.api.nvim_err_writeln "busy: another input is pending!" 13 | return 14 | end 15 | 16 | local function on_done(value) 17 | if input_ui then 18 | -- if it's still mounted, unmount it 19 | input_ui:unmount() 20 | end 21 | -- pass the input value 22 | on_confirm(value) 23 | -- indicate the operation is done 24 | input_ui = nil 25 | end 26 | 27 | local border_top_text = opts.prompt or "[Input]" 28 | local default_value = opts.default 29 | 30 | input_ui = Input({ 31 | relative = "cursor", 32 | position = { 33 | row = 1, 34 | col = 0, 35 | }, 36 | size = { 37 | -- minimum width 20 38 | width = math.max(20, type(default_value) == "string" and #default_value or 0), 39 | }, 40 | border = { 41 | style = "rounded", 42 | highlight = "Normal", 43 | text = { 44 | top = border_top_text, 45 | top_align = "left", 46 | }, 47 | }, 48 | win_options = { 49 | winhighlight = "Normal:Normal", 50 | }, 51 | }, { 52 | default_value = default_value, 53 | on_close = function() 54 | on_done(nil) 55 | end, 56 | on_submit = function(value) 57 | on_done(value) 58 | end, 59 | }) 60 | 61 | input_ui:mount() 62 | 63 | -- cancel operation if cursor leaves input 64 | input_ui:on(event.BufLeave, function() 65 | on_done(nil) 66 | end, { once = true }) 67 | 68 | -- cancel operation if is pressed 69 | input_ui:map("n", "", function() 70 | on_done(nil) 71 | end, { noremap = true, nowait = true }) 72 | end 73 | end 74 | 75 | function ui.telescope_select() 76 | -- Telescope UI selection 77 | -- From: https://github.com/stevearc/dressing.nvim/blob/master/lua/dressing/select/telescope.lua 78 | vim.ui.select = vim.schedule_wrap(function(items, opts, on_choice) 79 | local themes = require "telescope.themes" 80 | local actions = require "telescope.actions" 81 | local state = require "telescope.actions.state" 82 | local pickers = require "telescope.pickers" 83 | local finders = require "telescope.finders" 84 | local conf = require("telescope.config").values 85 | 86 | if opts.format_item then 87 | local format_item = opts.format_item 88 | opts.format_item = function(item) 89 | return tostring(format_item(item)) 90 | end 91 | else 92 | opts.format_item = tostring 93 | end 94 | 95 | local entry_maker = function(item) 96 | local formatted = opts.format_item(item) 97 | return { 98 | display = formatted, 99 | ordinal = formatted, 100 | value = item, 101 | } 102 | end 103 | 104 | local picker_opts = themes.get_dropdown() 105 | 106 | pickers.new(picker_opts, { 107 | prompt_title = opts.prompt, 108 | previewer = false, 109 | finder = finders.new_table { 110 | results = items, 111 | entry_maker = entry_maker, 112 | }, 113 | sorter = conf.generic_sorter(opts), 114 | attach_mappings = function(prompt_bufnr) 115 | actions.select_default:replace(function() 116 | local selection = state.get_selected_entry() 117 | actions.close(prompt_bufnr) 118 | if not selection then 119 | -- User did not select anything. 120 | on_choice(nil, nil) 121 | return 122 | end 123 | local idx = nil 124 | for i, item in ipairs(items) do 125 | if item == selection.value then 126 | idx = i 127 | break 128 | end 129 | end 130 | on_choice(selection.value, idx) 131 | end) 132 | 133 | actions.close:enhance { post = function() end } 134 | 135 | return true 136 | end, 137 | }):find() 138 | end) 139 | end 140 | 141 | for ui_addition, enabled in pairs(astronvim.user_plugin_opts("ui", { nui_input = true, telescope_select = true })) do 142 | astronvim.conditional_func(ui[ui_addition], enabled) 143 | end 144 | -------------------------------------------------------------------------------- /lua/configs/lsp/handlers.lua: -------------------------------------------------------------------------------- 1 | astronvim.lsp = {} 2 | local user_plugin_opts = astronvim.user_plugin_opts 3 | local conditional_func = astronvim.conditional_func 4 | 5 | local function lsp_highlight_document(client) 6 | if client.resolved_capabilities.document_highlight then 7 | vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true }) 8 | vim.api.nvim_create_autocmd("CursorHold", { 9 | group = "lsp_document_highlight", 10 | pattern = "", 11 | callback = vim.lsp.buf.document_highlight, 12 | }) 13 | vim.api.nvim_create_autocmd("CursorMoved", { 14 | group = "lsp_document_highlight", 15 | pattern = "", 16 | callback = vim.lsp.buf.clear_references, 17 | }) 18 | end 19 | end 20 | 21 | astronvim.lsp.on_attach = function(client, bufnr) 22 | astronvim.set_mappings( 23 | user_plugin_opts("lsp.mappings", { 24 | n = { 25 | ["K"] = { 26 | function() 27 | vim.lsp.buf.hover() 28 | end, 29 | desc = "Hover symbol details", 30 | buffer = bufnr, 31 | }, 32 | ["la"] = { 33 | function() 34 | vim.lsp.buf.code_action() 35 | end, 36 | desc = "LSP code action", 37 | buffer = bufnr, 38 | }, 39 | ["lf"] = { 40 | function() 41 | vim.lsp.buf.formatting_sync() 42 | end, 43 | desc = "Format code", 44 | buffer = bufnr, 45 | }, 46 | ["lh"] = { 47 | function() 48 | vim.lsp.buf.signature_help() 49 | end, 50 | desc = "Signature help", 51 | buffer = bufnr, 52 | }, 53 | ["lr"] = { 54 | function() 55 | vim.lsp.buf.rename() 56 | end, 57 | desc = "Rename current symbol", 58 | buffer = bufnr, 59 | }, 60 | ["gD"] = { 61 | function() 62 | vim.lsp.buf.declaration() 63 | end, 64 | desc = "Declaration of current symbol", 65 | buffer = bufnr, 66 | }, 67 | ["gI"] = { 68 | function() 69 | vim.lsp.buf.implementation() 70 | end, 71 | desc = "Implementation of current symbol", 72 | buffer = bufnr, 73 | }, 74 | ["gd"] = { 75 | function() 76 | vim.lsp.buf.definition() 77 | end, 78 | desc = "Show the definition of current symbol", 79 | buffer = bufnr, 80 | }, 81 | ["gr"] = { 82 | function() 83 | vim.lsp.buf.references() 84 | end, 85 | desc = "References of current symbol", 86 | buffer = bufnr, 87 | }, 88 | ["ld"] = { 89 | function() 90 | vim.diagnostic.open_float() 91 | end, 92 | desc = "Hover diagnostics", 93 | buffer = bufnr, 94 | }, 95 | ["[d"] = { 96 | function() 97 | vim.diagnostic.goto_prev() 98 | end, 99 | desc = "Previous diagnostic", 100 | buffer = bufnr, 101 | }, 102 | ["]d"] = { 103 | function() 104 | vim.diagnostic.goto_next() 105 | end, 106 | desc = "Next diagnostic", 107 | buffer = bufnr, 108 | }, 109 | ["gl"] = { 110 | function() 111 | vim.diagnostic.open_float() 112 | end, 113 | desc = "Hover diagnostics", 114 | buffer = bufnr, 115 | }, 116 | ["Format"] = { 117 | function() 118 | vim.lsp.buf.formatting() 119 | end, 120 | desc = "Format file with LSP", 121 | }, 122 | }, 123 | }), 124 | { buffer = bufnr } 125 | ) 126 | 127 | local on_attach_override = user_plugin_opts("lsp.on_attach", nil, false) 128 | local aerial_avail, aerial = pcall(require, "aerial") 129 | conditional_func(on_attach_override, true, client, bufnr) 130 | conditional_func(aerial.on_attach, aerial_avail, client, bufnr) 131 | lsp_highlight_document(client) 132 | end 133 | 134 | astronvim.lsp.capabilities = vim.lsp.protocol.make_client_capabilities() 135 | astronvim.lsp.capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" } 136 | astronvim.lsp.capabilities.textDocument.completion.completionItem.snippetSupport = true 137 | astronvim.lsp.capabilities.textDocument.completion.completionItem.preselectSupport = true 138 | astronvim.lsp.capabilities.textDocument.completion.completionItem.insertReplaceSupport = true 139 | astronvim.lsp.capabilities.textDocument.completion.completionItem.labelDetailsSupport = true 140 | astronvim.lsp.capabilities.textDocument.completion.completionItem.deprecatedSupport = true 141 | astronvim.lsp.capabilities.textDocument.completion.completionItem.commitCharactersSupport = true 142 | astronvim.lsp.capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } 143 | astronvim.lsp.capabilities.textDocument.completion.completionItem.resolveSupport = { 144 | properties = { "documentation", "detail", "additionalTextEdits" }, 145 | } 146 | 147 | function astronvim.lsp.server_settings(server_name) 148 | local server = require("lspconfig")[server_name] 149 | local opts = user_plugin_opts( 150 | "lsp.server-settings." .. server_name, 151 | user_plugin_opts("lsp.server-settings." .. server_name, { 152 | capabilities = vim.tbl_deep_extend("force", astronvim.lsp.capabilities, server.capabilities or {}), 153 | }, true, "configs") 154 | ) 155 | local old_on_attach = server.on_attach 156 | local user_on_attach = opts.on_attach 157 | opts.on_attach = function(client, bufnr) 158 | conditional_func(old_on_attach, true, client, bufnr) 159 | astronvim.lsp.on_attach(client, bufnr) 160 | conditional_func(user_on_attach, true, client, bufnr) 161 | end 162 | return opts 163 | end 164 | 165 | function astronvim.lsp.disable_formatting(client) 166 | client.resolved_capabilities.document_formatting = false 167 | end 168 | 169 | return astronvim.lsp 170 | -------------------------------------------------------------------------------- /lua/core/utils/updater.lua: -------------------------------------------------------------------------------- 1 | local fn = vim.fn 2 | local git = require "core.utils.git" 3 | local options = astronvim.user_plugin_opts( 4 | "updater", 5 | { remote = "origin", branch = "main", channel = "nightly", show_changelog = true } 6 | ) 7 | 8 | if astronvim.install.is_stable ~= nil then 9 | options.channel = astronvim.install.is_stable and "stable" or "nightly" 10 | end 11 | 12 | astronvim.updater = { options = options } 13 | if options.pin_plugins == nil and options.channel == "stable" or options.pin_plugins then 14 | local loaded, snapshot = pcall(fn.readfile, astronvim.install.home .. "/packer_snapshot") 15 | if loaded then 16 | loaded, snapshot = pcall(fn.json_decode, snapshot) 17 | astronvim.updater.snapshot = type(snapshot) == "table" and snapshot or nil 18 | end 19 | if not loaded then 20 | vim.api.nvim_err_writeln "Error loading packer snapshot" 21 | end 22 | end 23 | 24 | function astronvim.updater.version() 25 | local version = astronvim.install.version or git.current_version(false) 26 | if version then 27 | astronvim.notify("Version: " .. version) 28 | end 29 | end 30 | 31 | local function attempt_update(target) 32 | if options.channel == "stable" or options.commit then 33 | return git.checkout(target, false) 34 | else 35 | return git.pull(false) 36 | end 37 | end 38 | 39 | local cancelled_message = { { "Update cancelled", "WarningMsg" } } 40 | 41 | function astronvim.updater.update() 42 | if not git.is_repo() then 43 | astronvim.notify("Updater not available for non-git installations", "error") 44 | return 45 | end 46 | for remote, entry in pairs(options.remotes and options.remotes or {}) do 47 | local url = git.parse_remote_url(entry) 48 | local current_url = git.remote_url(remote, false) 49 | local check_needed = false 50 | if not current_url then 51 | git.remote_add(remote, url) 52 | check_needed = true 53 | elseif 54 | current_url ~= url 55 | and astronvim.confirm_prompt { 56 | { "Remote " }, 57 | { remote, "Title" }, 58 | { " is currently set to " }, 59 | { current_url, "WarningMsg" }, 60 | { "\nWould you like us to set it to " }, 61 | { url, "String" }, 62 | { "?" }, 63 | } 64 | then 65 | git.remote_update(remote, url) 66 | check_needed = true 67 | end 68 | if check_needed and git.remote_url(remote, false) ~= url then 69 | vim.api.nvim_err_writeln("Error setting up remote " .. remote .. " to " .. url) 70 | return 71 | end 72 | end 73 | local is_stable = options.channel == "stable" 74 | options.branch = is_stable and "main" or options.branch 75 | if not git.fetch(options.remote) then 76 | vim.api.nvim_err_writeln("Error fetching remote: " .. options.remote) 77 | return 78 | end 79 | local local_branch = (options.remote == "origin" and "" or (options.remote .. "_")) .. options.branch 80 | if git.current_branch() ~= local_branch then 81 | astronvim.echo { 82 | { "Switching to branch: " }, 83 | { options.remote .. "/" .. options.branch .. "\n\n", "String" }, 84 | } 85 | if not git.checkout(local_branch, false) then 86 | git.checkout("-b " .. local_branch .. " " .. options.remote .. "/" .. options.branch, false) 87 | end 88 | end 89 | if git.current_branch() ~= local_branch then 90 | vim.api.nvim_err_writeln("Error checking out branch: " .. options.remote .. "/" .. options.branch) 91 | return 92 | end 93 | local source = git.local_head() -- calculate current commit 94 | local target -- calculate target commit 95 | if is_stable then -- if stable get tag commit 96 | options.version = git.latest_version(git.get_versions(options.version or "latest")) 97 | target = git.tag_commit(options.version) 98 | elseif options.commit then -- if commit specified use it 99 | target = git.branch_contains(options.remote, options.branch, options.commit) and options.commit or nil 100 | else -- get most recent commit 101 | target = git.remote_head(options.remote, options.branch) 102 | end 103 | if not source or not target then -- continue if current and target commits were found 104 | vim.api.nvim_err_writeln "Error checking for updates" 105 | return 106 | elseif source == target then 107 | astronvim.echo { { "No updates available", "String" } } 108 | return 109 | elseif -- prompt user if they want to accept update 110 | not options.skip_prompts 111 | and not astronvim.confirm_prompt { 112 | { "Update available to ", "Title" }, 113 | { is_stable and options.version or target, "String" }, 114 | { "\nContinue?" }, 115 | } 116 | then 117 | astronvim.echo(cancelled_message) 118 | return 119 | else -- perform update 120 | local changelog = git.get_commit_range(source, target) 121 | local breaking = git.breaking_changes(changelog) 122 | local breaking_prompt = { { "Update contains the following breaking changes:\n", "WarningMsg" } } 123 | vim.list_extend(breaking_prompt, git.pretty_changelog(breaking)) 124 | vim.list_extend(breaking_prompt, { { "\nWould you like to continue?" } }) 125 | if #breaking > 0 and not options.skip_prompts and not astronvim.confirm_prompt(breaking_prompt) then 126 | astronvim.echo(cancelled_message) 127 | return 128 | end 129 | local updated = attempt_update(target) 130 | if 131 | not updated 132 | and not options.skip_prompts 133 | and not astronvim.confirm_prompt { 134 | { "Unable to pull due to local modifications to base files.\n", "ErrorMsg" }, 135 | { "Reset local files and continue?" }, 136 | } 137 | then 138 | astronvim.echo(cancelled_message) 139 | return 140 | elseif not updated then 141 | git.hard_reset(source) 142 | updated = attempt_update(target) 143 | end 144 | if not updated then 145 | vim.api.nvim_err_writeln "Error ocurred performing update" 146 | return 147 | end 148 | local summary = { 149 | { "AstroNvim updated successfully to ", "Title" }, 150 | { git.current_version(), "String" }, 151 | { "!\n", "Title" }, 152 | { "Please restart and run :PackerSync.\n\n", "WarningMsg" }, 153 | } 154 | if options.show_changelog and #changelog > 0 then 155 | vim.list_extend(summary, { { "Changelog:\n", "Title" } }) 156 | vim.list_extend(summary, git.pretty_changelog(changelog)) 157 | end 158 | astronvim.echo(summary) 159 | end 160 | end 161 | -------------------------------------------------------------------------------- /.github/README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |

AstroNvim

6 | 7 | 22 | 23 |

24 | AstroNvim is an aesthetic and feature-rich neovim config that is extensible and easy to use with a great set of plugins 25 |

26 | 27 | **_Notice:_** AstroNvim v1.4.0 has added `stable` and `nightly` update channels. For the time being we have kept the default update channel to `nightly` so that the behavior of AstroNvim doesn't change (this could be considered a breaking change to some). We are planning to make the `stable` channel the default update channel when Neovim v0.8 is released and we tag AstroNvim v2.0.0 to incorporate this "breaking" change. 28 | 29 | ## 🌟 Preview 30 | 31 | ![Preview1](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/dashboard.png) 32 | ![Preview2](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/overview.png) 33 | ![Preview33](https://github.com/AstroNvim/astronvim.github.io/raw/main/static/img/lsp_hover.png) 34 | 35 | ## ✨ Features 36 | 37 | - File explorer with [Neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim) 38 | - Autocompletion with [Cmp](https://github.com/hrsh7th/nvim-cmp) 39 | - Git integration with [Gitsigns](https://github.com/lewis6991/gitsigns.nvim) 40 | - Statusline with [Feline](https://github.com/feline-nvim/feline.nvim) 41 | - Terminal with [Toggleterm](https://github.com/akinsho/toggleterm.nvim) 42 | - Fuzzy finding with [Telescope](https://github.com/nvim-telescope/telescope.nvim) 43 | - Syntax highlighting with [Treesitter](https://github.com/nvim-treesitter/nvim-treesitter) 44 | - Formatting and linting with [Null-ls](https://github.com/jose-elias-alvarez/null-ls.nvim) 45 | - Language Server Protocol with [Native LSP](https://github.com/neovim/nvim-lspconfig) 46 | - Buffer Line with [bufferline.nvim](https://github.com/akinsho/bufferline.nvim) 47 | 48 | ## ⚡ Requirements 49 | 50 | - [Nerd Fonts](https://www.nerdfonts.com/font-downloads) 51 | - [Neovim 0.7+](https://github.com/neovim/neovim/releases/tag/v0.7.0) 52 | - [xclip](https://github.com/astrand/xclip) - (Linux only) xclip is necessary for the clipboard integration with the system clipboard 53 | - Terminal with true color support (for the default theme, otherwise it is dependent on the theme you are using) 54 | - Optional Requirements: 55 | - [ripgrep](https://github.com/BurntSushi/ripgrep) - live grep telescope search (`fw`) 56 | - [lazygit](https://github.com/jesseduffield/lazygit) - git ui toggle terminal (`tl` or `gg`) 57 | - [NCDU](https://dev.yorhel.nl/ncdu) - disk usage toggle terminal (`tu`) 58 | - [Htop](https://htop.dev/) - process viewer toggle terminal (`tt`) 59 | - [Python](https://www.python.org/) - python repl toggle terminal (`tp`) 60 | - [Node](https://nodejs.org/en/) - node repl toggle terminal (`tn`) 61 | 62 | > Note when using default theme: For MacOS, the default terminal does not have true color support. You wil need to use [iTerm2](https://iterm2.com/) or another [terminal emulator](https://gist.github.com/XVilka/8346728#terminal-emulators) that has true color support. 63 | 64 | > Note if you are still on Neovim v0.6: You can still install the previous version of AstroNvim that supported. After cloning the repository run `git checkout nvim-0.6` to check out this version. This will no longer be receiving updates. 65 | 66 | ## 🛠️ Installation 67 | 68 | #### Make a backup of your current nvim folder 69 | 70 | ``` 71 | mv ~/.config/nvim ~/.config/nvimbackup 72 | ``` 73 | 74 | #### Clone the repository 75 | 76 | ``` 77 | git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim 78 | nvim +PackerSync 79 | ``` 80 | 81 | ## 📦 Basic Setup 82 | 83 | #### Install LSP 84 | 85 | Enter `:LspInstall` followed by the name of the server you want to install
86 | Example: `:LspInstall pyright` 87 | 88 | #### Install language parser 89 | 90 | Enter `:TSInstall` followed by the name of the language you want to install
91 | Example: `:TSInstall python` 92 | 93 | #### Manage plugins 94 | 95 | Run `:PackerClean` to remove any disabled or unused plugins
96 | Run `:PackerSync` to update and clean plugins
97 | 98 | #### Update AstroNvim 99 | 100 | Run `:AstroUpdate` to get the latest updates from the repository
101 | 102 | ## 🗒️ Links 103 | 104 | [AstroNvim Documentation](https://astronvim.github.io/) 105 | 106 | - [Basic Usage](https://astronvim.github.io/usage/walkthrough) is given for basic usage 107 | - [Default Mappings](https://astronvim.github.io/usage/mappings) more about the default key bindings 108 | - [Default Plugin Configuration](https://astronvim.github.io/configuration/plugin_defaults) more about the provided plugin defaults 109 | - [Advanced Configuration](https://astronvim.github.io/configuration/config_options) more about advanced configuration 110 | 111 | [Watch](https://www.youtube.com/watch?v=JQLZ7NJRTEo&t=4s&ab_channel=JohnCodes) a review video to know about the out of the box experience 112 | 113 | ## ⭐ Credits 114 | 115 | Sincere appreciation to the following repositories, plugin authors and the entire neovim community out there that made the development of AstroNvim possible. 116 | 117 | - [Plugins](https://astronvim.github.io/acknowledgements#plugins-used-in-astronvim) 118 | - [NvChad](https://github.com/NvChad/NvChad) 119 | - [LunarVim](https://github.com/LunarVim) 120 | - [CosmicVim](https://github.com/CosmicNvim/CosmicNvim) 121 | 122 |
123 | 124 | [![Lua](https://img.shields.io/badge/Made%20with%20Lua-blue.svg?style=for-the-badge&logo=lua)](https://lua.org) 125 | 126 |
127 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # CONTRIBUTING 2 | 3 | ## AstroNvim install for contributors 4 | 5 | If you wish to contribute to AstroNvim, you should: 6 | 1. [create a fork on GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo) 7 | 2. clone your fork to your machine 8 | - For ssh: 9 | ```shell 10 | $ git clone git@github.com:/AstroNvim.git ~/.config/nvim 11 | ``` 12 | - For https: 13 | ```shell 14 | $ git clone https://github.com//AstroNvim.git ~/.config/nvim 15 | ``` 16 | 3. [add a new remote repo to track](https://www.atlassian.com/git/tutorials/git-forks-and-upstreams) 17 | - this means you can push/pull as normal to your own repo, but also easily track & update from the AstroNvim repo 18 | - for ssh: 19 | ```shell 20 | $ git remote add upstream git@github.com:AstroNvim/AstroNvim.git 21 | ``` 22 | - for https: 23 | ```shell 24 | $ git remote add upstream https://github.com/AstroNvim/AstroNvim.git 25 | ``` 26 | 4. any time you create a branch to do some work, use 27 | ```shell 28 | $ git fetch upstream && git checkout -b dev-myFEAT upstream/main 29 | ``` 30 | 5. only use the **--rebase** flag to update your dev branch 31 | - this means that there are no `Merge AstroNvim/main into devBranch` commits, which are to be avoided 32 | ```shell 33 | $ git pull upstream --rebase 34 | ``` 35 | 36 | ## Things to know before contributing 37 | 38 | - When making a PR (pull request), please be very descriptive about what you've done! 39 | 40 | - Commit messages must follow [Conventional Commits Specification](https://www.conventionalcommits.org/en/v1.0.0/) 41 | 42 | - PR titles and commit messages should be formatted with 'fix', 'feat', 'docs', 'refactor', or 'chore'. ex: `feat: add new plugin` 43 | 44 | - If your contribution mostly pertains to a single module in AstroNvim, please include that in the title. ex: If you have modified something in the `lua/configs/lsp` folder for the lsp configuration use something like `fix(lsp): typo in lsp mappings` 45 | 46 | - If your contribution contains any sort of breaking change include a `!` at the end of the change type. ex: `feat!: move status bar from lualine to feline` 47 | 48 | - PRs should follow the pull request formats where applicable 49 | 50 | - We are open to all PRs, but if a PR is denied for any reason please don't be discouraged! We'll still be open to discussions. If you have any questions before opening the PR feel free to join the [discord server](https://discord.gg/UcZutyeaFW). 51 | 52 | - AstroNvim aims to provide the best user experience when it comes to being able to support confident updating for users, for this reason please avoid opening PRs with breaking changes. Avoiding breaking changes is not always going to be possible, so if you think it is completely necessary we are open to discussion. 53 | 54 | ## How to remove, squash, or edit commits from your PR 55 | > You may have been directed here to remove a commit such as a merge commit: `Merge AstroNvim/main into devBranch` from your PR 56 | 57 | > As these commands edit your git history, you may need to **force push** with `git push origin --force-with-lease` 58 | 59 | 1. Run the following: 60 | ``` 61 | $ git rebase -i HEAD~ 62 | ``` 63 |
Example 64 |

65 | 66 | ```shell 67 | $ git rebase -i HEAD~4 68 | ``` 69 | 70 | ```shell 71 | pick 28b2dcb feat: statusline add lsp status 72 | pick dad9a39 fix: typo 73 | pick 68f72f1 add clickable btn for exiting nvim 74 | pick b281b53 avoid using q! for quitting vim 75 | 76 | # Rebase 52b655b..b281b53 onto 52b655b (4 commands) 77 | # 78 | # Commands: 79 | # p, pick = use commit 80 | # r, reword = use commit, but edit the commit message 81 | # e, edit = use commit, but stop for amending 82 | # s, squash = use commit, but meld into previous commit 83 | # f, fixup = like "squash", but discard this commit's log message 84 | # x, exec = run command (the rest of the line) using shell 85 | # b, break = stop here (continue rebase later with 'git rebase --continue') 86 | # d, drop = remove commit 87 | # l, label

104 |
105 | 106 | 2. Change the `pick` commands to whatever you wish, you may wish to `s` `squash`, `d` `drop` or `e` `edit` a commit. Then save & quit this git file to run it. 107 | 108 |
Example 109 |

110 | 111 | ```shell {3,4} 112 | pick 28b2dcb feat: statusline add lsp status 113 | squash dad9a39 fix: typo 114 | edit 68f72f1 add clickable btn for exiting nvim 115 | d b281b53 avoid using q! for quitting vim 116 | 117 | # Rebase 52b655b..b281b53 onto 52b655b (4 commands) 118 | # 119 | # Commands: 120 | # p, pick = use commit 121 | # r, reword = use commit, but edit the commit message 122 | # e, edit = use commit, but stop for amending 123 | # s, squash = use commit, but meld into previous commit 124 | # f, fixup = like "squash", but discard this commit's log message 125 | # x, exec = run command (the rest of the line) using shell 126 | # b, break = stop here (continue rebase later with 'git rebase --continue') 127 | # d, drop = remove commit 128 | # l, label

145 |
146 | 147 | 3. If you picked `drop` you are done. If you picked `squash` then you will be brought to a screen to update the commit message for the new aggregated commit, please make sure the new commit message follows the Conventional Commit specification. If you picked `edit` then edit your files, then run: 148 | ```shell 149 | $ git add 150 | ``` 151 | 152 | 4. Continue rebasing until all edits are finished. Run the following command to continue through the rebase if there are more changes: 153 | 154 | ```shell 155 | $ git rebase --continue 156 | ``` 157 | 158 | 5. Push the changes with `--force-with-lease`: 159 | ```shell 160 | $ git push origin --force-with-lease 161 | ``` 162 | 163 | ## Help 164 | For help with contributing and anything else AstroNvim related join the [discord](https://discord.gg/UcZutyeaFW) 165 | -------------------------------------------------------------------------------- /lua/user_example/init.lua: -------------------------------------------------------------------------------- 1 | local config = { 2 | 3 | -- Configure AstroNvim updates 4 | updater = { 5 | remote = "origin", -- remote to use 6 | channel = "nightly", -- "stable" or "nightly" 7 | version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY) 8 | branch = "main", -- branch name (NIGHTLY ONLY) 9 | commit = nil, -- commit hash (NIGHTLY ONLY) 10 | pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only) 11 | skip_prompts = false, -- skip prompts about breaking changes 12 | show_changelog = true, -- show the changelog after performing an update 13 | -- remotes = { -- easily add new remotes to track 14 | -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url 15 | -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut, 16 | -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork 17 | -- }, 18 | }, 19 | 20 | -- Set colorscheme 21 | colorscheme = "default_theme", 22 | 23 | -- set vim options here (vim.. = value) 24 | options = { 25 | opt = { 26 | relativenumber = true, -- sets vim.opt.relativenumber 27 | }, 28 | g = { 29 | mapleader = " ", -- sets vim.g.mapleader 30 | }, 31 | }, 32 | 33 | -- Default theme configuration 34 | default_theme = { 35 | diagnostics_style = { italic = true }, 36 | -- Modify the color table 37 | colors = { 38 | fg = "#abb2bf", 39 | }, 40 | -- Modify the highlight groups 41 | highlights = function(highlights) 42 | local C = require "default_theme.colors" 43 | 44 | highlights.Normal = { fg = C.fg, bg = C.bg } 45 | return highlights 46 | end, 47 | plugins = { -- enable or disable extra plugin highlighting 48 | aerial = true, 49 | beacon = false, 50 | bufferline = true, 51 | dashboard = true, 52 | highlighturl = true, 53 | hop = false, 54 | indent_blankline = true, 55 | lightspeed = false, 56 | ["neo-tree"] = true, 57 | notify = true, 58 | ["nvim-tree"] = false, 59 | ["nvim-web-devicons"] = true, 60 | rainbow = true, 61 | symbols_outline = false, 62 | telescope = true, 63 | vimwiki = false, 64 | ["which-key"] = true, 65 | }, 66 | }, 67 | 68 | -- Disable AstroNvim ui features 69 | ui = { 70 | nui_input = true, 71 | telescope_select = true, 72 | }, 73 | 74 | -- Configure plugins 75 | plugins = { 76 | -- Add plugins, the packer syntax without the "use" 77 | init = { 78 | -- You can disable default plugins as follows: 79 | -- ["goolord/alpha-nvim"] = { disable = true }, 80 | 81 | -- You can also add new plugins here as well: 82 | -- { "andweeb/presence.nvim" }, 83 | -- { 84 | -- "ray-x/lsp_signature.nvim", 85 | -- event = "BufRead", 86 | -- config = function() 87 | -- require("lsp_signature").setup() 88 | -- end, 89 | -- }, 90 | }, 91 | -- All other entries override the setup() call for default plugins 92 | ["null-ls"] = function(config) 93 | local null_ls = require "null-ls" 94 | -- Check supported formatters and linters 95 | -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting 96 | -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics 97 | config.sources = { 98 | -- Set a formatter 99 | null_ls.builtins.formatting.rufo, 100 | -- Set a linter 101 | null_ls.builtins.diagnostics.rubocop, 102 | } 103 | -- set up null-ls's on_attach function 104 | config.on_attach = function(client) 105 | -- NOTE: You can remove this on attach function to disable format on save 106 | if client.resolved_capabilities.document_formatting then 107 | vim.api.nvim_create_autocmd("BufWritePre", { 108 | desc = "Auto format before save", 109 | pattern = "", 110 | callback = vim.lsp.buf.formatting_sync, 111 | }) 112 | end 113 | end 114 | return config -- return final config table 115 | end, 116 | treesitter = { 117 | ensure_installed = { "lua" }, 118 | }, 119 | ["nvim-lsp-installer"] = { 120 | ensure_installed = { "sumneko_lua" }, 121 | }, 122 | packer = { 123 | compile_path = vim.fn.stdpath "data" .. "/packer_compiled.lua", 124 | }, 125 | }, 126 | 127 | -- LuaSnip Options 128 | luasnip = { 129 | -- Add paths for including more VS Code style snippets in luasnip 130 | vscode_snippet_paths = {}, 131 | -- Extend filetypes 132 | filetype_extend = { 133 | javascript = { "javascriptreact" }, 134 | }, 135 | }, 136 | 137 | -- Modify which-key registration 138 | ["which-key"] = { 139 | -- Add bindings 140 | register_mappings = { 141 | -- first key is the mode, n == normal mode 142 | n = { 143 | -- second key is the prefix, prefixes 144 | [""] = { 145 | -- which-key registration table for normal mode, leader prefix 146 | -- ["N"] = { "tabnew", "New Buffer" }, 147 | }, 148 | }, 149 | }, 150 | }, 151 | 152 | -- CMP Source Priorities 153 | -- modify here the priorities of default cmp sources 154 | -- higher value == higher priority 155 | -- The value can also be set to a boolean for disabling default sources: 156 | -- false == disabled 157 | -- true == 1000 158 | cmp = { 159 | source_priority = { 160 | nvim_lsp = 1000, 161 | luasnip = 750, 162 | buffer = 500, 163 | path = 250, 164 | }, 165 | }, 166 | 167 | -- Extend LSP configuration 168 | lsp = { 169 | -- enable servers that you already have installed without lsp-installer 170 | servers = { 171 | -- "pyright" 172 | }, 173 | -- easily add or disable built in mappings added during LSP attaching 174 | mappings = { 175 | n = { 176 | -- ["lf"] = false -- disable formatting keymap 177 | }, 178 | }, 179 | -- add to the server on_attach function 180 | -- on_attach = function(client, bufnr) 181 | -- end, 182 | 183 | -- override the lsp installer server-registration function 184 | -- server_registration = function(server, opts) 185 | -- require("lspconfig")[server].setup(opts) 186 | -- end, 187 | 188 | -- Add overrides for LSP server settings, the keys are the name of the server 189 | ["server-settings"] = { 190 | -- example for addings schemas to yamlls 191 | -- yamlls = { 192 | -- settings = { 193 | -- yaml = { 194 | -- schemas = { 195 | -- ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}", 196 | -- ["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}", 197 | -- ["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}", 198 | -- }, 199 | -- }, 200 | -- }, 201 | -- }, 202 | }, 203 | }, 204 | 205 | -- Diagnostics configuration (for vim.diagnostics.config({})) 206 | diagnostics = { 207 | virtual_text = true, 208 | underline = true, 209 | }, 210 | 211 | mappings = { 212 | -- first key is the mode 213 | n = { 214 | -- second key is the lefthand side of the map 215 | [""] = { ":w!", desc = "Save File" }, 216 | }, 217 | t = { 218 | -- setting a mapping to false will disable it 219 | -- [""] = false, 220 | }, 221 | }, 222 | 223 | -- This function is run last 224 | -- good place to configuring augroups/autocommands and custom filetypes 225 | polish = function() 226 | -- Set key binding 227 | -- Set autocommands 228 | vim.api.nvim_create_augroup("packer_conf", { clear = true }) 229 | vim.api.nvim_create_autocmd("BufWritePost", { 230 | desc = "Sync packer after modifying plugins.lua", 231 | group = "packer_conf", 232 | pattern = "plugins.lua", 233 | command = "source | PackerSync", 234 | }) 235 | 236 | -- Set up custom filetypes 237 | -- vim.filetype.add { 238 | -- extension = { 239 | -- foo = "fooscript", 240 | -- }, 241 | -- filename = { 242 | -- ["Foofile"] = "fooscript", 243 | -- }, 244 | -- pattern = { 245 | -- ["~/%.config/foo/.*"] = "fooscript", 246 | -- }, 247 | -- } 248 | end, 249 | } 250 | 251 | return config 252 | -------------------------------------------------------------------------------- /lua/core/plugins.lua: -------------------------------------------------------------------------------- 1 | local astro_plugins = { 2 | -- Plugin manager 3 | ["wbthomason/packer.nvim"] = {}, 4 | 5 | -- Optimiser 6 | ["lewis6991/impatient.nvim"] = {}, 7 | 8 | -- Lua functions 9 | ["nvim-lua/plenary.nvim"] = { module = "plenary" }, 10 | 11 | -- Popup API 12 | ["nvim-lua/popup.nvim"] = {}, 13 | 14 | -- Indent detection 15 | ["Darazaki/indent-o-matic"] = { 16 | event = "BufReadPost", 17 | config = function() 18 | require "configs.indent-o-matic" 19 | end, 20 | }, 21 | 22 | -- Notification Enhancer 23 | ["rcarriga/nvim-notify"] = { 24 | event = "VimEnter", 25 | config = function() 26 | require "configs.notify" 27 | end, 28 | }, 29 | 30 | -- Neovim UI Enhancer 31 | ["MunifTanjim/nui.nvim"] = { module = "nui" }, 32 | 33 | -- Cursorhold fix 34 | ["antoinemadec/FixCursorHold.nvim"] = { 35 | event = { "BufRead", "BufNewFile" }, 36 | config = function() 37 | vim.g.cursorhold_updatetime = 100 38 | end, 39 | }, 40 | 41 | -- Smarter Splits 42 | ["mrjones2014/smart-splits.nvim"] = { 43 | module = "smart-splits", 44 | config = function() 45 | require "configs.smart-splits" 46 | end, 47 | }, 48 | 49 | -- Icons 50 | ["kyazdani42/nvim-web-devicons"] = { 51 | event = "VimEnter", 52 | config = function() 53 | require "configs.icons" 54 | end, 55 | }, 56 | 57 | -- Better buffer closing 58 | ["famiu/bufdelete.nvim"] = { cmd = { "Bdelete", "Bwipeout" } }, 59 | 60 | -- File explorer 61 | ["nvim-neo-tree/neo-tree.nvim"] = { 62 | branch = "v2.x", 63 | module = "neo-tree", 64 | cmd = "Neotree", 65 | requires = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, 66 | setup = function() 67 | vim.g.neo_tree_remove_legacy_commands = true 68 | end, 69 | config = function() 70 | require "configs.neo-tree" 71 | end, 72 | }, 73 | 74 | -- Statusline 75 | ["feline-nvim/feline.nvim"] = { 76 | after = "nvim-web-devicons", 77 | config = function() 78 | require "configs.feline" 79 | end, 80 | }, 81 | 82 | -- BarfferLine UI 83 | ["akinsho/bufferline.nvim"] = { 84 | tag = "v2.*", 85 | after = "nvim-web-devicons", 86 | config = function() 87 | require "configs.bufferline" 88 | end, 89 | }, 90 | 91 | -- Parenthesis highlighting 92 | ["p00f/nvim-ts-rainbow"] = { after = "nvim-treesitter" }, 93 | 94 | -- Autoclose tags 95 | ["windwp/nvim-ts-autotag"] = { after = "nvim-treesitter" }, 96 | 97 | -- Context based commenting 98 | ["JoosepAlviste/nvim-ts-context-commentstring"] = { after = "nvim-treesitter" }, 99 | 100 | -- Syntax highlighting 101 | ["nvim-treesitter/nvim-treesitter"] = { 102 | run = ":TSUpdate", 103 | event = { "BufRead", "BufNewFile" }, 104 | cmd = { 105 | "TSInstall", 106 | "TSInstallInfo", 107 | "TSInstallSync", 108 | "TSUninstall", 109 | "TSUpdate", 110 | "TSUpdateSync", 111 | "TSDisableAll", 112 | "TSEnableAll", 113 | }, 114 | config = function() 115 | require "configs.treesitter" 116 | end, 117 | }, 118 | 119 | -- Snippet collection 120 | ["rafamadriz/friendly-snippets"] = { opt = true }, 121 | 122 | -- Snippet engine 123 | ["L3MON4D3/LuaSnip"] = { 124 | module = "luasnip", 125 | wants = "friendly-snippets", 126 | config = function() 127 | require "configs.luasnip" 128 | end, 129 | }, 130 | 131 | -- Completion engine 132 | ["hrsh7th/nvim-cmp"] = { 133 | event = "InsertEnter", 134 | config = function() 135 | require "configs.cmp" 136 | end, 137 | }, 138 | 139 | -- Snippet completion source 140 | ["saadparwaiz1/cmp_luasnip"] = { 141 | after = "nvim-cmp", 142 | config = function() 143 | astronvim.add_user_cmp_source "luasnip" 144 | end, 145 | }, 146 | 147 | -- Buffer completion source 148 | ["hrsh7th/cmp-buffer"] = { 149 | after = "nvim-cmp", 150 | config = function() 151 | astronvim.add_user_cmp_source "buffer" 152 | end, 153 | }, 154 | 155 | -- Path completion source 156 | ["hrsh7th/cmp-path"] = { 157 | after = "nvim-cmp", 158 | config = function() 159 | astronvim.add_user_cmp_source "path" 160 | end, 161 | }, 162 | 163 | -- LSP completion source 164 | ["hrsh7th/cmp-nvim-lsp"] = { 165 | after = "nvim-cmp", 166 | config = function() 167 | astronvim.add_user_cmp_source "nvim_lsp" 168 | end, 169 | }, 170 | 171 | -- Built-in LSP 172 | ["neovim/nvim-lspconfig"] = { event = "VimEnter" }, 173 | 174 | -- LSP manager 175 | ["williamboman/nvim-lsp-installer"] = { 176 | after = "nvim-lspconfig", 177 | config = function() 178 | require "configs.nvim-lsp-installer" 179 | require "configs.lsp" 180 | end, 181 | }, 182 | 183 | -- LSP symbols 184 | ["stevearc/aerial.nvim"] = { 185 | module = "aerial", 186 | cmd = { "AerialToggle", "AerialOpen", "AerialInfo" }, 187 | config = function() 188 | require "configs.aerial" 189 | end, 190 | }, 191 | 192 | -- Formatting and linting 193 | ["jose-elias-alvarez/null-ls.nvim"] = { 194 | event = { "BufRead", "BufNewFile" }, 195 | config = function() 196 | require "configs.null-ls" 197 | end, 198 | }, 199 | 200 | -- mkdir 201 | ["jghauser/mkdir.nvim"] = { 202 | }, 203 | 204 | -- Fuzzy finder 205 | ["nvim-telescope/telescope.nvim"] = { 206 | cmd = "Telescope", 207 | module = "telescope", 208 | config = function() 209 | require "configs.telescope" 210 | end, 211 | }, 212 | 213 | -- Fuzzy finder syntax support 214 | [("nvim-telescope/telescope-%s-native.nvim"):format(vim.fn.has "win32" == 1 and "fzy" or "fzf")] = { 215 | after = "telescope.nvim", 216 | run = vim.fn.has "win32" ~= 1 and "make" or nil, 217 | config = function() 218 | require("telescope").load_extension(vim.fn.has "win32" == 1 and "fzy_native" or "fzf") 219 | end, 220 | }, 221 | 222 | -- Git integration 223 | ["lewis6991/gitsigns.nvim"] = { 224 | event = "BufEnter", 225 | config = function() 226 | require "configs.gitsigns" 227 | end, 228 | }, 229 | 230 | -- Start screen 231 | ["goolord/alpha-nvim"] = { 232 | cmd = "Alpha", 233 | module = "alpha", 234 | config = function() 235 | require "configs.alpha" 236 | end, 237 | }, 238 | 239 | -- Color highlighting 240 | ["norcalli/nvim-colorizer.lua"] = { 241 | event = { "BufRead", "BufNewFile" }, 242 | config = function() 243 | require "configs.colorizer" 244 | end, 245 | }, 246 | 247 | -- Autopairs 248 | ["windwp/nvim-autopairs"] = { 249 | event = "InsertEnter", 250 | config = function() 251 | require "configs.autopairs" 252 | end, 253 | }, 254 | 255 | -- Terminal 256 | ["akinsho/toggleterm.nvim"] = { 257 | cmd = "ToggleTerm", 258 | module = { "toggleterm", "toggleterm.terminal" }, 259 | config = function() 260 | require "configs.toggleterm" 261 | end, 262 | }, 263 | 264 | -- Commenting 265 | ["numToStr/Comment.nvim"] = { 266 | module = { "Comment", "Comment.api" }, 267 | keys = { "gc", "gb", "g<", "g>" }, 268 | config = function() 269 | require "configs.Comment" 270 | end, 271 | }, 272 | 273 | -- Indentation 274 | ["lukas-reineke/indent-blankline.nvim"] = { 275 | event = "BufRead", 276 | config = function() 277 | require "configs.indent-line" 278 | end, 279 | }, 280 | 281 | -- Keymaps popup 282 | ["folke/which-key.nvim"] = { 283 | module = "which-key", 284 | config = function() 285 | require "configs.which-key" 286 | end, 287 | }, 288 | 289 | -- Smooth scrolling 290 | ["declancm/cinnamon.nvim"] = { 291 | event = { "BufRead", "BufNewFile" }, 292 | config = function() 293 | require "configs.cinnamon" 294 | end, 295 | }, 296 | 297 | -- Smooth escaping 298 | ["max397574/better-escape.nvim"] = { 299 | event = "InsertCharPre", 300 | config = function() 301 | require "configs.better_escape" 302 | end, 303 | }, 304 | 305 | -- Get extra JSON schemas 306 | ["b0o/SchemaStore.nvim"] = { module = "schemastore" }, 307 | 308 | -- Session manager 309 | ["Shatur/neovim-session-manager"] = { 310 | module = "session_manager", 311 | cmd = "SessionManager", 312 | event = "BufWritePost", 313 | config = function() 314 | require "configs.session_manager" 315 | end, 316 | }, 317 | } 318 | 319 | if astronvim.updater.snapshot then 320 | for plugin, options in pairs(astro_plugins) do 321 | local pin = astronvim.updater.snapshot[plugin:match "/([^/]*)$"] 322 | options.commit = pin and pin.commit or options.commit 323 | end 324 | end 325 | 326 | local user_plugin_opts = astronvim.user_plugin_opts 327 | local packer = astronvim.initialize_packer() 328 | packer.startup { 329 | function(use) 330 | for key, plugin in pairs(user_plugin_opts("plugins.init", astro_plugins)) do 331 | if type(key) == "string" and not plugin[1] then 332 | plugin[1] = key 333 | end 334 | use(plugin) 335 | end 336 | end, 337 | config = user_plugin_opts("plugins.packer", { 338 | compile_path = astronvim.default_compile_path, 339 | display = { 340 | open_fn = function() 341 | return require("packer.util").float { border = "rounded" } 342 | end, 343 | }, 344 | profile = { 345 | enable = true, 346 | threshold = 0.0001, 347 | }, 348 | git = { 349 | clone_timeout = 300, 350 | subcommands = { 351 | update = "pull --rebase", 352 | }, 353 | }, 354 | auto_clean = true, 355 | compile_on_sync = true, 356 | }), 357 | } 358 | 359 | astronvim.compiled() 360 | -------------------------------------------------------------------------------- /lua/core/utils/init.lua: -------------------------------------------------------------------------------- 1 | _G.astronvim = {} 2 | local stdpath = vim.fn.stdpath 3 | local tbl_insert = table.insert 4 | local map = vim.keymap.set 5 | 6 | astronvim.install = astronvim_installation or { home = stdpath "config" } 7 | 8 | local path_avail, path = pcall(require, "plenary/path") 9 | local astronvim_config = nil 10 | if path_avail then 11 | astronvim_config = path:new(stdpath "config"):parent() .. "/astronvim" 12 | vim.opt.rtp:append(astronvim_config) 13 | end 14 | local supported_configs = { astronvim.install.home, astronvim_config } 15 | 16 | local function load_module_file(module) 17 | local found_module = nil 18 | for _, config_path in ipairs(supported_configs) do 19 | local module_path = config_path .. "/lua/" .. module:gsub("%.", "/") .. ".lua" 20 | if vim.fn.filereadable(module_path) == 1 then 21 | found_module = module_path 22 | end 23 | end 24 | if found_module then 25 | local status_ok, loaded_module = pcall(require, module) 26 | if status_ok then 27 | found_module = loaded_module 28 | else 29 | astronvim.notify("Error loading " .. found_module, "error") 30 | end 31 | end 32 | return found_module 33 | end 34 | 35 | astronvim.user_settings = load_module_file "user.init" 36 | astronvim.default_compile_path = stdpath "data" .. "/packer_compiled.lua" 37 | astronvim.user_terminals = {} 38 | astronvim.url_matcher = 39 | "\\v\\c%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)%([&:#*@~%_\\-=?!+;/0-9a-z]+%(%([.;/?]|[.][.]+)[&:#*@~%_\\-=?!+/0-9a-z]+|:\\d+|,%(%(%(h?ttps?|ftp|file|ssh|git)://|[a-z]+[@][a-z]+[.][a-z]+:)@![0-9a-z]+))*|\\([&:#*@~%_\\-=?!+;/.0-9a-z]*\\)|\\[[&:#*@~%_\\-=?!+;/.0-9a-z]*\\]|\\{%([&:#*@~%_\\-=?!+;/.0-9a-z]*|\\{[&:#*@~%_\\-=?!+;/.0-9a-z]*})\\})+" 40 | 41 | local function func_or_extend(overrides, default, extend) 42 | if extend then 43 | if type(overrides) == "table" then 44 | default = vim.tbl_deep_extend("force", default, overrides) 45 | elseif type(overrides) == "function" then 46 | default = overrides(default) 47 | end 48 | elseif overrides ~= nil then 49 | default = overrides 50 | end 51 | return default 52 | end 53 | 54 | function astronvim.conditional_func(func, condition, ...) 55 | if (condition == nil and true or condition) and type(func) == "function" then 56 | return func(...) 57 | end 58 | end 59 | 60 | function astronvim.trim_or_nil(str) 61 | return type(str) == "string" and vim.trim(str) or nil 62 | end 63 | 64 | function astronvim.notify(msg, type, opts) 65 | vim.notify(msg, type, vim.tbl_deep_extend("force", { title = "AstroNvim" }, opts or {})) 66 | end 67 | 68 | function astronvim.echo(messages) 69 | messages = messages or { { "\n" } } 70 | if type(messages) == "table" then 71 | vim.api.nvim_echo(messages, false, {}) 72 | end 73 | end 74 | 75 | function astronvim.confirm_prompt(messages) 76 | if messages then 77 | astronvim.echo(messages) 78 | end 79 | local confirmed = string.lower(vim.fn.input "(y/n) ") == "y" 80 | astronvim.echo() 81 | astronvim.echo() 82 | return confirmed 83 | end 84 | 85 | local function user_setting_table(module) 86 | local settings = astronvim.user_settings or {} 87 | for tbl in string.gmatch(module, "([^%.]+)") do 88 | settings = settings[tbl] 89 | if settings == nil then 90 | break 91 | end 92 | end 93 | return settings 94 | end 95 | 96 | function astronvim.initialize_packer() 97 | local packer_avail, packer = pcall(require, "packer") 98 | if not packer_avail then 99 | local packer_path = stdpath "data" .. "/site/pack/packer/start/packer.nvim" 100 | vim.fn.delete(packer_path, "rf") 101 | vim.fn.system { 102 | "git", 103 | "clone", 104 | "--depth", 105 | "1", 106 | "https://github.com/wbthomason/packer.nvim", 107 | packer_path, 108 | } 109 | astronvim.echo { { "Initializing Packer...\n\n" } } 110 | vim.cmd "packadd packer.nvim" 111 | packer_avail, packer = pcall(require, "packer") 112 | if not packer_avail then 113 | vim.api.nvim_err_writeln("Failed to load packer at:" .. packer_path .. "\n\n" .. packer) 114 | end 115 | end 116 | return packer 117 | end 118 | 119 | function astronvim.vim_opts(options) 120 | for scope, table in pairs(options) do 121 | for setting, value in pairs(table) do 122 | vim[scope][setting] = value 123 | end 124 | end 125 | end 126 | 127 | function astronvim.user_plugin_opts(module, default, extend, prefix) 128 | if extend == nil then 129 | extend = true 130 | end 131 | default = default or {} 132 | local user_settings = load_module_file((prefix or "user") .. "." .. module) 133 | if user_settings == nil and prefix == nil then 134 | user_settings = user_setting_table(module) 135 | end 136 | if user_settings ~= nil then 137 | default = func_or_extend(user_settings, default, extend) 138 | end 139 | return default 140 | end 141 | 142 | function astronvim.compiled() 143 | local run_me, _ = loadfile( 144 | astronvim.user_plugin_opts("plugins.packer", { compile_path = astronvim.default_compile_path }).compile_path 145 | ) 146 | if run_me then 147 | run_me() 148 | else 149 | astronvim.echo { { "Please run " }, { ":PackerSync", "Title" } } 150 | end 151 | end 152 | 153 | function astronvim.url_opener() 154 | if vim.fn.has "mac" == 1 then 155 | vim.fn.jobstart({ "open", vim.fn.expand "" }, { detach = true }) 156 | elseif vim.fn.has "unix" == 1 then 157 | vim.fn.jobstart({ "xdg-open", vim.fn.expand "" }, { detach = true }) 158 | else 159 | astronvim.notify("gx is not supported on this OS!", "error") 160 | end 161 | end 162 | 163 | -- term_details can be either a string for just a command or 164 | -- a complete table to provide full access to configuration when calling Terminal:new() 165 | function astronvim.toggle_term_cmd(term_details) 166 | if type(term_details) == "string" then 167 | term_details = { cmd = term_details, hidden = true } 168 | end 169 | local term_key = term_details.cmd 170 | if vim.v.count > 0 and term_details.count == nil then 171 | term_details.count = vim.v.count 172 | term_key = term_key .. vim.v.count 173 | end 174 | if astronvim.user_terminals[term_key] == nil then 175 | astronvim.user_terminals[term_key] = require("toggleterm.terminal").Terminal:new(term_details) 176 | end 177 | astronvim.user_terminals[term_key]:toggle() 178 | end 179 | 180 | function astronvim.add_cmp_source(source) 181 | local cmp_avail, cmp = pcall(require, "cmp") 182 | if cmp_avail then 183 | local config = cmp.get_config() 184 | tbl_insert(config.sources, source) 185 | cmp.setup(config) 186 | end 187 | end 188 | 189 | function astronvim.get_user_cmp_source(source) 190 | source = type(source) == "string" and { name = source } or source 191 | local priority = astronvim.user_plugin_opts("cmp.source_priority", { 192 | nvim_lsp = 1000, 193 | luasnip = 750, 194 | buffer = 500, 195 | path = 250, 196 | })[source.name] 197 | if priority then 198 | source.priority = priority 199 | end 200 | return source 201 | end 202 | 203 | function astronvim.add_user_cmp_source(source) 204 | astronvim.add_cmp_source(astronvim.get_user_cmp_source(source)) 205 | end 206 | 207 | function astronvim.null_ls_providers(filetype) 208 | local registered = {} 209 | local sources_avail, sources = pcall(require, "null-ls.sources") 210 | if sources_avail then 211 | for _, source in ipairs(sources.get_available(filetype)) do 212 | for method in pairs(source.methods) do 213 | registered[method] = registered[method] or {} 214 | tbl_insert(registered[method], source.name) 215 | end 216 | end 217 | end 218 | return registered 219 | end 220 | 221 | function astronvim.null_ls_sources(filetype, source) 222 | local methods_avail, methods = pcall(require, "null-ls.methods") 223 | return methods_avail and astronvim.null_ls_providers(filetype)[methods.internal[source]] or {} 224 | end 225 | 226 | function astronvim.alpha_button(sc, txt) 227 | local sc_ = sc:gsub("%s", ""):gsub("LDR", "") 228 | if vim.g.mapleader then 229 | sc = sc:gsub("LDR", vim.g.mapleader == " " and "SPC" or vim.g.mapleader) 230 | end 231 | return { 232 | type = "button", 233 | val = txt, 234 | on_press = function() 235 | local key = vim.api.nvim_replace_termcodes(sc_, true, false, true) 236 | vim.api.nvim_feedkeys(key, "normal", false) 237 | end, 238 | opts = { 239 | position = "center", 240 | text = txt, 241 | shortcut = sc, 242 | cursor = 5, 243 | width = 36, 244 | align_shortcut = "right", 245 | hl = "DashboardCenter", 246 | hl_shortcut = "DashboardShortcut", 247 | }, 248 | } 249 | end 250 | 251 | function astronvim.is_available(plugin) 252 | return packer_plugins ~= nil and packer_plugins[plugin] ~= nil 253 | end 254 | 255 | function astronvim.set_mappings(map_table, base) 256 | for mode, maps in pairs(map_table) do 257 | for keymap, options in pairs(maps) do 258 | if options then 259 | local cmd = options 260 | if type(options) == "table" then 261 | cmd = options[1] 262 | options[1] = nil 263 | else 264 | options = {} 265 | end 266 | map(mode, keymap, cmd, vim.tbl_deep_extend("force", options, base or {})) 267 | end 268 | end 269 | end 270 | end 271 | 272 | function astronvim.delete_url_match() 273 | for _, match in ipairs(vim.fn.getmatches()) do 274 | if match.group == "HighlightURL" then 275 | vim.fn.matchdelete(match.id) 276 | end 277 | end 278 | end 279 | 280 | function astronvim.set_url_match() 281 | astronvim.delete_url_match() 282 | if vim.g.highlighturl_enabled then 283 | vim.fn.matchadd("HighlightURL", astronvim.url_matcher, 15) 284 | end 285 | end 286 | 287 | function astronvim.toggle_url_match() 288 | vim.g.highlighturl_enabled = not vim.g.highlighturl_enabled 289 | astronvim.set_url_match() 290 | end 291 | 292 | function astronvim.cmd(cmd, show_error) 293 | local result = vim.fn.system(cmd) 294 | local success = vim.api.nvim_get_vvar "shell_error" == 0 295 | if not success and (show_error == nil and true or show_error) then 296 | vim.api.nvim_err_writeln("Error running command: " .. cmd .. "\nError message:\n" .. result) 297 | end 298 | return success and result or nil 299 | end 300 | 301 | require "core.utils.updater" 302 | 303 | return astronvim 304 | -------------------------------------------------------------------------------- /lua/core/mappings.lua: -------------------------------------------------------------------------------- 1 | local is_available = astronvim.is_available 2 | 3 | local maps = { n = {}, v = {}, t = {}, [""] = {} } 4 | 5 | maps[""][""] = "" 6 | 7 | -- Normal -- 8 | -- Standard Operations 9 | maps.n["w"] = { "w", desc = "Save" } 10 | maps.n["q"] = { "q", desc = "Quit" } 11 | maps.n["h"] = { "nohlsearch", desc = "No Highlight" } 12 | maps.n["u"] = { 13 | function() 14 | astronvim.toggle_url_match() 15 | end, 16 | desc = "Toggle URL Highlights", 17 | } 18 | maps.n["fn"] = { "enew", desc = "New File" } 19 | maps.n["gx"] = { 20 | function() 21 | astronvim.url_opener() 22 | end, 23 | desc = "Open the file under cursor with system app", 24 | } 25 | maps.n[""] = { "w!", desc = "Force write" } 26 | maps.n[""] = { "q!", desc = "Force quit" } 27 | maps.n["Q"] = "" 28 | 29 | -- Packer 30 | maps.n["pc"] = { "PackerCompile", desc = "Packer Compile" } 31 | maps.n["pi"] = { "PackerInstall", desc = "Packer Install" } 32 | maps.n["ps"] = { "PackerSync", desc = "Packer Sync" } 33 | maps.n["pS"] = { "PackerStatus", desc = "Packer Status" } 34 | maps.n["pu"] = { "PackerUpdate", desc = "Packer Update" } 35 | 36 | -- Alpha 37 | if is_available "alpha-nvim" then 38 | maps.n["d"] = { "Alpha", desc = "Alpha Dashboard" } 39 | end 40 | 41 | -- Bufdelete 42 | if is_available "bufdelete.nvim" then 43 | maps.n["c"] = { "Bdelete", desc = "Close buffer" } 44 | else 45 | maps.n["c"] = { "bdelete", desc = "Close buffer" } 46 | end 47 | 48 | -- Navigate buffers 49 | if is_available "bufferline.nvim" then 50 | maps.n[""] = { "BufferLineCycleNext", desc = "Next buffer tab" } 51 | maps.n[""] = { "BufferLineCyclePrev", desc = "Previous buffer tab" } 52 | maps.n[">b"] = { "BufferLineMoveNext", desc = "Move buffer tab right" } 53 | maps.n["BufferLineMovePrev", desc = "Move buffer tab left" } 54 | else 55 | maps.n[""] = { "bnext", desc = "Next buffer" } 56 | maps.n[""] = { "bprevious", desc = "Previous buffer" } 57 | end 58 | 59 | -- Comment 60 | if is_available "Comment.nvim" then 61 | maps.n["/"] = { 62 | function() 63 | require("Comment.api").toggle_current_linewise() 64 | end, 65 | desc = "Comment line", 66 | } 67 | maps.v["/"] = { 68 | "lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())", 69 | desc = "Toggle comment line", 70 | } 71 | end 72 | 73 | -- GitSigns 74 | if is_available "gitsigns.nvim" then 75 | maps.n["gj"] = { 76 | function() 77 | require("gitsigns").next_hunk() 78 | end, 79 | desc = "Next git hunk", 80 | } 81 | maps.n["gk"] = { 82 | function() 83 | require("gitsigns").prev_hunk() 84 | end, 85 | desc = "Previous git hunk", 86 | } 87 | maps.n["gl"] = { 88 | function() 89 | require("gitsigns").blame_line() 90 | end, 91 | desc = "View git blame", 92 | } 93 | maps.n["gp"] = { 94 | function() 95 | require("gitsigns").preview_hunk() 96 | end, 97 | desc = "Preview git hunk", 98 | } 99 | maps.n["gh"] = { 100 | function() 101 | require("gitsigns").reset_hunk() 102 | end, 103 | desc = "Reset git hunk", 104 | } 105 | maps.n["gr"] = { 106 | function() 107 | require("gitsigns").reset_buffer() 108 | end, 109 | desc = "Reset git buffer", 110 | } 111 | maps.n["gs"] = { 112 | function() 113 | require("gitsigns").stage_hunk() 114 | end, 115 | desc = "Stage git hunk", 116 | } 117 | maps.n["gu"] = { 118 | function() 119 | require("gitsigns").undo_stage_hunk() 120 | end, 121 | desc = "Unstage git hunk", 122 | } 123 | maps.n["gd"] = { 124 | function() 125 | require("gitsigns").diffthis() 126 | end, 127 | desc = "View git diff", 128 | } 129 | end 130 | 131 | -- NeoTree 132 | if is_available "neo-tree.nvim" then 133 | maps.n["e"] = { "Neotree toggle", desc = "Toggle Explorer" } 134 | maps.n["o"] = { "Neotree focus", desc = "Focus Explorer" } 135 | end 136 | 137 | -- Session Manager 138 | if is_available "neovim-session-manager" then 139 | maps.n["Sl"] = { "SessionManager! load_last_session", desc = "Load last session" } 140 | maps.n["Ss"] = { "SessionManager! save_current_session", desc = "Save this session" } 141 | maps.n["Sd"] = { "SessionManager! delete_session", desc = "Delete session" } 142 | maps.n["Sf"] = { "SessionManager! load_session", desc = "Search sessions" } 143 | maps.n["S."] = { 144 | "SessionManager! load_current_dir_session", 145 | desc = "Load current directory session", 146 | } 147 | end 148 | 149 | -- LSP Installer 150 | if is_available "nvim-lsp-installer" then 151 | maps.n["li"] = { "LspInfo", desc = "LSP information" } 152 | maps.n["lI"] = { "LspInstallInfo", desc = "LSP installer" } 153 | end 154 | 155 | -- Smart Splits 156 | if is_available "smart-splits.nvim" then 157 | -- Better window navigation 158 | maps.n[""] = { 159 | function() 160 | require("smart-splits").move_cursor_left() 161 | end, 162 | desc = "Move to left split", 163 | } 164 | maps.n[""] = { 165 | function() 166 | require("smart-splits").move_cursor_down() 167 | end, 168 | desc = "Move to below split", 169 | } 170 | maps.n[""] = { 171 | function() 172 | require("smart-splits").move_cursor_up() 173 | end, 174 | desc = "Move to above split", 175 | } 176 | maps.n[""] = { 177 | function() 178 | require("smart-splits").move_cursor_right() 179 | end, 180 | desc = "Move to right split", 181 | } 182 | 183 | -- Resize with arrows 184 | maps.n[""] = { 185 | function() 186 | require("smart-splits").resize_up() 187 | end, 188 | desc = "Resize split up", 189 | } 190 | maps.n[""] = { 191 | function() 192 | require("smart-splits").resize_down() 193 | end, 194 | desc = "Resize split down", 195 | } 196 | maps.n[""] = { 197 | function() 198 | require("smart-splits").resize_left() 199 | end, 200 | desc = "Resize split left", 201 | } 202 | maps.n[""] = { 203 | function() 204 | require("smart-splits").resize_right() 205 | end, 206 | desc = "Resize split right", 207 | } 208 | else 209 | maps.n[""] = { "h", desc = "Move to left split" } 210 | maps.n[""] = { "j", desc = "Move to below split" } 211 | maps.n[""] = { "k", desc = "Move to above split" } 212 | maps.n[""] = { "l", desc = "Move to right split" } 213 | maps.n[""] = { "resize -2", desc = "Resize split up" } 214 | maps.n[""] = { "resize +2", desc = "Resize split down" } 215 | maps.n[""] = { "vertical resize -2", desc = "Resize split left" } 216 | maps.n[""] = { "vertical resize +2", desc = "Resize split right" } 217 | end 218 | 219 | -- SymbolsOutline 220 | if is_available "aerial.nvim" then 221 | maps.n["lS"] = { "AerialToggle", desc = "Symbols outline" } 222 | end 223 | 224 | -- Telescope 225 | if is_available "telescope.nvim" then 226 | maps.n["fw"] = { 227 | function() 228 | require("telescope.builtin").live_grep() 229 | end, 230 | desc = "Search words", 231 | } 232 | maps.n["fW"] = { 233 | function() 234 | require("telescope.builtin").live_grep { 235 | additional_args = function(args) 236 | return vim.list_extend(args, { "--hidden", "--no-ignore" }) 237 | end, 238 | } 239 | end, 240 | desc = "Search words in all files", 241 | } 242 | maps.n["gt"] = { 243 | function() 244 | require("telescope.builtin").git_status() 245 | end, 246 | desc = "Git status", 247 | } 248 | maps.n["gb"] = { 249 | function() 250 | require("telescope.builtin").git_branches() 251 | end, 252 | desc = "Git branchs", 253 | } 254 | maps.n["gc"] = { 255 | function() 256 | require("telescope.builtin").git_commits() 257 | end, 258 | desc = "Git commits", 259 | } 260 | maps.n["ff"] = { 261 | function() 262 | require("telescope.builtin").find_files() 263 | end, 264 | desc = "Search files", 265 | } 266 | maps.n["fF"] = { 267 | function() 268 | require("telescope.builtin").find_files { hidden = true, no_ignore = true } 269 | end, 270 | desc = "Search all files", 271 | } 272 | maps.n["fb"] = { 273 | function() 274 | require("telescope.builtin").buffers() 275 | end, 276 | desc = "Search buffers", 277 | } 278 | maps.n["fh"] = { 279 | function() 280 | require("telescope.builtin").help_tags() 281 | end, 282 | desc = "Search help", 283 | } 284 | maps.n["fm"] = { 285 | function() 286 | require("telescope.builtin").marks() 287 | end, 288 | desc = "Search marks", 289 | } 290 | maps.n["fo"] = { 291 | function() 292 | require("telescope.builtin").oldfiles() 293 | end, 294 | desc = "Search history", 295 | } 296 | maps.n["sb"] = { 297 | function() 298 | require("telescope.builtin").git_branches() 299 | end, 300 | desc = "Git branchs", 301 | } 302 | maps.n["sh"] = { 303 | function() 304 | require("telescope.builtin").help_tags() 305 | end, 306 | desc = "Search help", 307 | } 308 | maps.n["sm"] = { 309 | function() 310 | require("telescope.builtin").man_pages() 311 | end, 312 | desc = "Search man", 313 | } 314 | maps.n["sn"] = { 315 | function() 316 | require("telescope").extensions.notify.notify() 317 | end, 318 | desc = "Search notifications", 319 | } 320 | maps.n["sr"] = { 321 | function() 322 | require("telescope.builtin").registers() 323 | end, 324 | desc = "Search registers", 325 | } 326 | maps.n["sk"] = { 327 | function() 328 | require("telescope.builtin").keymaps() 329 | end, 330 | desc = "Search keymaps", 331 | } 332 | maps.n["sc"] = { 333 | function() 334 | require("telescope.builtin").commands() 335 | end, 336 | desc = "Search commands", 337 | } 338 | maps.n["ls"] = { 339 | function() 340 | local aerial_avail, _ = pcall(require, "aerial") 341 | if aerial_avail then 342 | require("telescope").extensions.aerial.aerial() 343 | else 344 | require("telescope.builtin").lsp_document_symbols() 345 | end 346 | end, 347 | desc = "Search symbols", 348 | } 349 | maps.n["lR"] = { 350 | function() 351 | require("telescope.builtin").lsp_references() 352 | end, 353 | desc = "Search references", 354 | } 355 | maps.n["lD"] = { 356 | function() 357 | require("telescope.builtin").diagnostics() 358 | end, 359 | desc = "Search diagnostics", 360 | } 361 | end 362 | 363 | -- Terminal 364 | if is_available "toggleterm.nvim" then 365 | local toggle_term_cmd = astronvim.toggle_term_cmd 366 | maps.n[""] = { "ToggleTerm", desc = "Toggle terminal" } 367 | maps.n["gg"] = { 368 | function() 369 | toggle_term_cmd "lazygit" 370 | end, 371 | desc = "ToggleTerm lazygit", 372 | } 373 | maps.n["tn"] = { 374 | function() 375 | toggle_term_cmd "node" 376 | end, 377 | desc = "ToggleTerm node", 378 | } 379 | maps.n["tu"] = { 380 | function() 381 | toggle_term_cmd "ncdu" 382 | end, 383 | desc = "ToggleTerm NCDU", 384 | } 385 | maps.n["tt"] = { 386 | function() 387 | toggle_term_cmd "htop" 388 | end, 389 | desc = "ToggleTerm htop", 390 | } 391 | maps.n["tp"] = { 392 | function() 393 | toggle_term_cmd "python" 394 | end, 395 | desc = "ToggleTerm python", 396 | } 397 | maps.n["tl"] = { 398 | function() 399 | toggle_term_cmd "lazygit" 400 | end, 401 | desc = "ToggleTerm lazygit", 402 | } 403 | maps.n["tf"] = { "ToggleTerm direction=float", desc = "ToggleTerm float" } 404 | maps.n["th"] = { "ToggleTerm size=10 direction=horizontal", desc = "ToggleTerm horizontal split" } 405 | maps.n["tv"] = { "ToggleTerm size=80 direction=vertical", desc = "ToggleTerm vertical split" } 406 | end 407 | 408 | -- Stay in indent mode 409 | maps.v["<"] = { ""] = { ">gv", desc = "indent line" } 411 | 412 | -- Improved Terminal Mappings 413 | maps.t[""] = { "", desc = "Terminal normal mode" } 414 | maps.t["jk"] = { "", desc = "Terminal normal mode" } 415 | maps.t[""] = { "h", desc = "Terminal left window navigation" } 416 | maps.t[""] = { "j", desc = "Terminal down window navigation" } 417 | maps.t[""] = { "k", desc = "Terminal up window navigation" } 418 | maps.t[""] = { "l", desc = "Terminal right window naviation" } 419 | 420 | astronvim.set_mappings(astronvim.user_plugin_opts("mappings", maps)) 421 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------