Pārlūkot izejas kodu

update: pull from master (#4143)

Christian Chiarulli 2 gadi atpakaļ
vecāks
revīzija
8626cb78d2

+ 1 - 1
.github/workflows/plugins.yml

@@ -45,7 +45,7 @@ jobs:
       - name: Re-install LunarVim
       - name: Re-install LunarVim
         timeout-minutes: 4
         timeout-minutes: 4
         run: |
         run: |
-          ./utils/installer/uninstall.sh --remove-backups
+          ./utils/installer/uninstall.sh --remove-backups --remove-config
           ./utils/installer/install.sh --local --no-install-dependencies
           ./utils/installer/install.sh --local --no-install-dependencies
 
 
       - name: Run unit-tests
       - name: Run unit-tests

+ 1 - 1
init.lua

@@ -5,7 +5,7 @@ local base_dir = vim.env.LUNARVIM_BASE_DIR
   end)()
   end)()
 
 
 if not vim.tbl_contains(vim.opt.rtp:get(), base_dir) then
 if not vim.tbl_contains(vim.opt.rtp:get(), base_dir) then
-  vim.opt.rtp:append(base_dir)
+  vim.opt.rtp:prepend(base_dir)
 end
 end
 
 
 require("lvim.bootstrap"):init(base_dir)
 require("lvim.bootstrap"):init(base_dir)

+ 3 - 0
lua/lvim/core/alpha.lua

@@ -36,6 +36,9 @@ local function resolve_buttons(theme_name, button_section)
     -- this became necessary after recent changes in alpha.nvim (06ade3a20ca9e79a7038b98d05a23d7b6c016174)
     -- this became necessary after recent changes in alpha.nvim (06ade3a20ca9e79a7038b98d05a23d7b6c016174)
     button_element.on_press = on_press
     button_element.on_press = on_press
 
 
+    -- account for different icon byte sizes in cursor offset
+    local _, icon_length = button_element.val:find "[\128-\255]*"
+    button_element.opts.cursor = icon_length + 2
     button_element.opts = vim.tbl_extend("force", button_element.opts, entry[4] or button_section.opts or {})
     button_element.opts = vim.tbl_extend("force", button_element.opts, entry[4] or button_section.opts or {})
 
 
     table.insert(val, button_element)
     table.insert(val, button_element)

+ 5 - 9
lua/lvim/core/lualine/components.lua

@@ -92,16 +92,12 @@ return {
     cond = conditions.hide_in_width,
     cond = conditions.hide_in_width,
   },
   },
   lsp = {
   lsp = {
-    function(msg)
-      msg = msg or "LS Inactive"
-      local buf_clients = vim.lsp.buf_get_clients()
-      if next(buf_clients) == nil then
-        -- TODO: clean up this if statement
-        if type(msg) == "boolean" or #msg == 0 then
-          return "LS Inactive"
-        end
-        return msg
+    function()
+      local buf_clients = vim.lsp.get_active_clients { bufnr = 0 }
+      if #buf_clients == 0 then
+        return "LSP Inactive"
       end
       end
+
       local buf_ft = vim.bo.filetype
       local buf_ft = vim.bo.filetype
       local buf_client_names = {}
       local buf_client_names = {}
       local copilot_active = false
       local copilot_active = false

+ 1 - 1
lua/lvim/core/treesitter.lua

@@ -6,7 +6,7 @@ function M.config()
     on_config_done = nil,
     on_config_done = nil,
 
 
     -- A list of parser names, or "all"
     -- A list of parser names, or "all"
-    ensure_installed = {},
+    ensure_installed = { "comment", "markdown_inline", "regex" },
 
 
     -- List of parsers to ignore installing (for "all")
     -- List of parsers to ignore installing (for "all")
     ignore_install = {},
     ignore_install = {},

+ 12 - 12
lua/lvim/icons.lua

@@ -11,7 +11,7 @@ return {
     Event = "",
     Event = "",
     Field = "",
     Field = "",
     File = "",
     File = "",
-    Folder = "",
+    Folder = "󰉋",
     Function = "",
     Function = "",
     Interface = "",
     Interface = "",
     Key = "",
     Key = "",
@@ -19,7 +19,7 @@ return {
     Method = "",
     Method = "",
     Module = "",
     Module = "",
     Namespace = "",
     Namespace = "",
-    Null = "",
+    Null = "󰟢",
     Number = "",
     Number = "",
     Object = "",
     Object = "",
     Operator = "",
     Operator = "",
@@ -69,7 +69,7 @@ return {
     Bug = "",
     Bug = "",
     Stacks = "",
     Stacks = "",
     Scopes = "",
     Scopes = "",
-    Watches = "",
+    Watches = "󰂥",
     DebugConsole = "",
     DebugConsole = "",
     Calendar = "",
     Calendar = "",
     Check = "",
     Check = "",
@@ -79,7 +79,7 @@ return {
     ChevronShortRight = "",
     ChevronShortRight = "",
     ChevronShortUp = "",
     ChevronShortUp = "",
     Circle = "",
     Circle = "",
-    Close = "",
+    Close = "󰅖",
     CloudDownload = "",
     CloudDownload = "",
     Code = "",
     Code = "",
     Comment = "",
     Comment = "",
@@ -93,10 +93,10 @@ return {
     File = "",
     File = "",
     FileSymlink = "",
     FileSymlink = "",
     Files = "",
     Files = "",
-    FindFile = "",
-    FindText = "",
+    FindFile = "󰈞",
+    FindText = "󰊄",
     Fire = "",
     Fire = "",
-    Folder = "",
+    Folder = "󰉋",
     FolderOpen = "",
     FolderOpen = "",
     FolderSymlink = "",
     FolderSymlink = "",
     Forward = "",
     Forward = "",
@@ -110,19 +110,19 @@ return {
     NewFile = "",
     NewFile = "",
     Note = "",
     Note = "",
     Package = "",
     Package = "",
-    Pencil = "",
+    Pencil = "󰏫",
     Plus = "",
     Plus = "",
     Project = "",
     Project = "",
     Search = "",
     Search = "",
     SignIn = "",
     SignIn = "",
     SignOut = "",
     SignOut = "",
-    Tab = "",
+    Tab = "󰌒",
     Table = "",
     Table = "",
     Target = "󰀘",
     Target = "󰀘",
     Telescope = "",
     Telescope = "",
     Text = "",
     Text = "",
     Tree = "",
     Tree = "",
-    Triangle = "",
+    Triangle = "󰐊",
     TriangleShortArrowDown = "",
     TriangleShortArrowDown = "",
     TriangleShortArrowLeft = "",
     TriangleShortArrowLeft = "",
     TriangleShortArrowRight = "",
     TriangleShortArrowRight = "",
@@ -138,12 +138,12 @@ return {
     BoldQuestion = "",
     BoldQuestion = "",
     Question = "",
     Question = "",
     BoldHint = "",
     BoldHint = "",
-    Hint = "",
+    Hint = "󰌶",
     Debug = "",
     Debug = "",
     Trace = "✎",
     Trace = "✎",
   },
   },
   misc = {
   misc = {
-    Robot = "",
+    Robot = "󰚩",
     Squirrel = "",
     Squirrel = "",
     Tag = "",
     Tag = "",
     Watch = "",
     Watch = "",

+ 9 - 0
lua/lvim/lsp/init.lua

@@ -113,6 +113,15 @@ function M.setup()
   require("lvim.lsp.null-ls").setup()
   require("lvim.lsp.null-ls").setup()
 
 
   autocmds.configure_format_on_save()
   autocmds.configure_format_on_save()
+
+  local function set_handler_opts_if_not_set(name, handler, opts)
+    if debug.getinfo(vim.lsp.handlers[name], "S").source:match(vim.env.VIMRUNTIME) then
+      vim.lsp.handlers[name] = vim.lsp.with(handler, opts)
+    end
+  end
+
+  set_handler_opts_if_not_set("textDocument/hover", vim.lsp.handlers.hover, { border = "rounded" })
+  set_handler_opts_if_not_set("textDocument/signatureHelp", vim.lsp.handlers.signature_help, { border = "rounded" })
 end
 end
 
 
 return M
 return M

+ 13 - 2
lua/lvim/plugin-loader.lua

@@ -42,8 +42,19 @@ function plugin_loader.init(opts)
     vim.api.nvim_create_autocmd("User", { pattern = "LazyDone", callback = require("lvim.lsp").setup })
     vim.api.nvim_create_autocmd("User", { pattern = "LazyDone", callback = require("lvim.lsp").setup })
   end
   end
 
 
-  vim.opt.runtimepath:append(lazy_install_dir)
-  vim.opt.runtimepath:append(join_paths(plugins_dir, "*"))
+  local rtp = vim.opt.rtp:get()
+  local base_dir = (vim.env.LUNARVIM_BASE_DIR or get_runtime_dir() .. "/lvim"):gsub("\\", "/")
+  local idx_base = #rtp + 1
+  for i, path in ipairs(rtp) do
+    path = path:gsub("\\", "/")
+    if path == base_dir then
+      idx_base = i + 1
+      break
+    end
+  end
+  table.insert(rtp, idx_base, lazy_install_dir)
+  table.insert(rtp, idx_base + 1, join_paths(plugins_dir, "*"))
+  vim.opt.rtp = rtp
 
 
   pcall(function()
   pcall(function()
     -- set a custom path for lazy's cache
     -- set a custom path for lazy's cache

+ 4 - 118
utils/installer/config.example.lua

@@ -1,118 +1,4 @@
---[[
- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
- `lvim` is the global options object
-]]
-
--- vim options
-vim.opt.shiftwidth = 2
-vim.opt.tabstop = 2
-vim.opt.relativenumber = true
-
--- general
-lvim.log.level = "info"
-lvim.format_on_save = {
-  enabled = true,
-  pattern = "*.lua",
-  timeout = 1000,
-}
--- to disable icons and use a minimalist setup, uncomment the following
--- lvim.use_icons = false
-
--- keymappings <https://www.lunarvim.org/docs/configuration/keybindings>
-lvim.leader = "space"
--- add your own keymapping
-lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
-
--- lvim.keys.normal_mode["<S-l>"] = ":BufferLineCycleNext<CR>"
--- lvim.keys.normal_mode["<S-h>"] = ":BufferLineCyclePrev<CR>"
-
--- -- Use which-key to add extra bindings with the leader-key prefix
--- lvim.builtin.which_key.mappings["W"] = { "<cmd>noautocmd w<cr>", "Save without formatting" }
--- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
-
--- -- Change theme settings
--- lvim.colorscheme = "lunar"
-
-lvim.builtin.alpha.active = true
-lvim.builtin.alpha.mode = "dashboard"
-lvim.builtin.terminal.active = true
-lvim.builtin.nvimtree.setup.view.side = "left"
-lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
-
--- Automatically install missing parsers when entering buffer
-lvim.builtin.treesitter.auto_install = true
-
--- lvim.builtin.treesitter.ignore_install = { "haskell" }
-
--- -- always installed on startup, useful for parsers without a strict filetype
--- lvim.builtin.treesitter.ensure_installed = { "comment", "markdown_inline", "regex" }
-
--- -- generic LSP settings <https://www.lunarvim.org/docs/configuration/language-features/language-servers>
-
--- --- disable automatic installation of servers
--- lvim.lsp.installer.setup.automatic_installation = false
-
--- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect
--- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers`
--- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
--- local opts = {} -- check the lspconfig documentation for a list of all possible options
--- require("lvim.lsp.manager").setup("pyright", opts)
-
--- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. IMPORTANT: Requires `:LvimCacheReset` to take effect
--- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
--- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
---   return server ~= "emmet_ls"
--- end, lvim.lsp.automatic_configuration.skipped_servers)
-
--- -- you can set a custom on_attach function that will be used for all the language servers
--- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
--- lvim.lsp.on_attach_callback = function(client, bufnr)
---   local function buf_set_option(...)
---     vim.api.nvim_buf_set_option(bufnr, ...)
---   end
---   --Enable completion triggered by <c-x><c-o>
---   buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
--- end
-
--- -- linters, formatters and code actions <https://www.lunarvim.org/docs/configuration/language-features/linting-and-formatting>
--- local formatters = require "lvim.lsp.null-ls.formatters"
--- formatters.setup {
---   { command = "stylua" },
---   {
---     command = "prettier",
---     extra_args = { "--print-width", "100" },
---     filetypes = { "typescript", "typescriptreact" },
---   },
--- }
--- local linters = require "lvim.lsp.null-ls.linters"
--- linters.setup {
---   { command = "flake8", filetypes = { "python" } },
---   {
---     command = "shellcheck",
---     args = { "--severity", "warning" },
---   },
--- }
--- local code_actions = require "lvim.lsp.null-ls.code_actions"
--- code_actions.setup {
---   {
---     exe = "eslint",
---     filetypes = { "typescript", "typescriptreact" },
---   },
--- }
-
--- -- Additional Plugins <https://www.lunarvim.org/docs/configuration/plugins/user-plugins>
--- lvim.plugins = {
---     {
---       "folke/trouble.nvim",
---       cmd = "TroubleToggle",
---     },
--- }
-
--- -- Autocommands (`:help autocmd`) <https://neovim.io/doc/user/autocmd.html>
--- vim.api.nvim_create_autocmd("FileType", {
---   pattern = "zsh",
---   callback = function()
---     -- let treesitter use bash highlight for zsh files as well
---     require("nvim-treesitter.highlight").attach(0, "bash")
---   end,
--- })
+-- Read the docs: https://www.lunarvim.org/docs/configuration
+-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
+-- Forum: https://www.reddit.com/r/lunarvim/
+-- Discord: https://discord.com/invite/Xb9B4Ny

+ 5 - 112
utils/installer/config_win.example.lua

@@ -1,7 +1,7 @@
---[[
- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
- `lvim` is the global options object
-]]
+-- Read the docs: https://www.lunarvim.org/docs/configuration
+-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
+-- Forum: https://www.reddit.com/r/lunarvim/
+-- Discord: https://discord.com/invite/Xb9B4Ny
 
 
 -- Enable powershell as your default shell
 -- Enable powershell as your default shell
 vim.opt.shell = "pwsh.exe -NoLogo"
 vim.opt.shell = "pwsh.exe -NoLogo"
@@ -23,111 +23,4 @@ vim.g.clipboard = {
     ["+"] = "win32yank.exe -o --lf",
     ["+"] = "win32yank.exe -o --lf",
     ["*"] = "win32yank.exe -o --lf",
     ["*"] = "win32yank.exe -o --lf",
   },
   },
-}
-
--- vim options
-vim.opt.shiftwidth = 2
-vim.opt.tabstop = 2
-vim.opt.relativenumber = true
-
--- general
-lvim.log.level = "info"
-lvim.format_on_save = {
-  enabled = true,
-  pattern = "*.lua",
-  timeout = 1000,
-}
--- to disable icons and use a minimalist setup, uncomment the following
--- lvim.use_icons = false
-
--- keymappings <https://www.lunarvim.org/docs/configuration/keybindings>
-lvim.leader = "space"
--- add your own keymapping
-lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
-
--- lvim.keys.normal_mode["<S-l>"] = ":BufferLineCycleNext<CR>"
--- lvim.keys.normal_mode["<S-h>"] = ":BufferLineCyclePrev<CR>"
-
--- -- Use which-key to add extra bindings with the leader-key prefix
--- lvim.builtin.which_key.mappings["W"] = { "<cmd>noautocmd w<cr>", "Save without formatting" }
--- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
-
--- -- Change theme settings
--- lvim.colorscheme = "lunar"
-
-lvim.builtin.alpha.active = true
-lvim.builtin.alpha.mode = "dashboard"
-lvim.builtin.terminal.active = true
-lvim.builtin.nvimtree.setup.view.side = "left"
-lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
-
--- Automatically install missing parsers when entering buffer
-lvim.builtin.treesitter.auto_install = true
-
--- lvim.builtin.treesitter.ignore_install = { "haskell" }
-
--- -- ensure these parsers are always installed, useful for those without a strict filetype
--- lvim.builtin.treesitter.ensure_installed = { "comment", "markdown_inline", "regex" }
-
--- -- generic LSP settings <https://www.lunarvim.org/docs/configuration/language-features/language-servers>
-
--- --- disable automatic installation of servers
--- lvim.lsp.installer.setup.automatic_installation = false
-
--- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect
--- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers`
--- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
--- local opts = {} -- check the lspconfig documentation for a list of all possible options
--- require("lvim.lsp.manager").setup("pyright", opts)
-
--- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. IMPORTANT: Requires `:LvimCacheReset` to take effect
--- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
--- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
---   return server ~= "emmet_ls"
--- end, lvim.lsp.automatic_configuration.skipped_servers)
-
--- -- you can set a custom on_attach function that will be used for all the language servers
--- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
--- lvim.lsp.on_attach_callback = function(client, bufnr)
---   local function buf_set_option(...)
---     vim.api.nvim_buf_set_option(bufnr, ...)
---   end
---   --Enable completion triggered by <c-x><c-o>
---   buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
--- end
-
--- -- linters, formatters and code actions <https://www.lunarvim.org/docs/configuration/language-features/linting-and-formatting>
--- local formatters = require "lvim.lsp.null-ls.formatters"
--- formatters.setup {
---   { command = "stylua" },
---   {
---     command = "prettier",
---     extra_args = { "--print-width", "100" },
---     filetypes = { "typescript", "typescriptreact" },
---   },
--- }
--- local linters = require "lvim.lsp.null-ls.linters"
--- linters.setup {
---   { command = "flake8", filetypes = { "python" } },
---   {
---     command = "shellcheck",
---     args = { "--severity", "warning" },
---   },
--- }
-
--- -- Additional Plugins <https://www.lunarvim.org/docs/configuration/plugins/user-plugins>
--- lvim.plugins = {
---     {
---       "folke/trouble.nvim",
---       cmd = "TroubleToggle",
---     },
--- }
-
--- -- Autocommands (`:help autocmd`) <https://neovim.io/doc/user/autocmd.html>
--- vim.api.nvim_create_autocmd("FileType", {
---   pattern = "zsh",
---   callback = function()
---     -- let treesitter use bash highlight for zsh files as well
---     require("nvim-treesitter.highlight").attach(0, "bash")
---   end,
--- })
+}

+ 4 - 4
utils/installer/install.sh

@@ -33,7 +33,6 @@ declare INTERACTIVE_MODE=1
 declare ADDITIONAL_WARNINGS=""
 declare ADDITIONAL_WARNINGS=""
 
 
 declare -a __lvim_dirs=(
 declare -a __lvim_dirs=(
-  "$LUNARVIM_CONFIG_DIR"
   "$LUNARVIM_RUNTIME_DIR"
   "$LUNARVIM_RUNTIME_DIR"
   "$LUNARVIM_CACHE_DIR"
   "$LUNARVIM_CACHE_DIR"
   "$LUNARVIM_BASE_DIR"
   "$LUNARVIM_BASE_DIR"
@@ -136,13 +135,13 @@ function main() {
 
 
   if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then
   if [ "$ARGS_INSTALL_DEPENDENCIES" -eq 1 ]; then
     if [ "$INTERACTIVE_MODE" -eq 1 ]; then
     if [ "$INTERACTIVE_MODE" -eq 1 ]; then
-      if confirm "Would you like to install LunarVim's NodeJS dependencies: $(stringify_array ${__npm_deps[@]})?"; then
+      if confirm "Would you like to install LunarVim's NodeJS dependencies: $(stringify_array "${__npm_deps[@]}")?"; then
         install_nodejs_deps
         install_nodejs_deps
       fi
       fi
-      if confirm "Would you like to install LunarVim's Python dependencies: $(stringify_array ${__pip_deps[@]})?"; then
+      if confirm "Would you like to install LunarVim's Python dependencies: $(stringify_array "${__pip_deps[@]}")?"; then
         install_python_deps
         install_python_deps
       fi
       fi
-      if confirm "Would you like to install LunarVim's Rust dependencies: $(stringify_array ${__rust_deps[@]})?"; then
+      if confirm "Would you like to install LunarVim's Rust dependencies: $(stringify_array "${__rust_deps[@]}")?"; then
         install_rust_deps
         install_rust_deps
       fi
       fi
     else
     else
@@ -388,6 +387,7 @@ function verify_lvim_dirs() {
     fi
     fi
     mkdir -p "$dir"
     mkdir -p "$dir"
   done
   done
+  mkdir -p "$LUNARVIM_CONFIG_DIR"
 }
 }
 
 
 function clone_lvim() {
 function clone_lvim() {