From 503818b2115ff377356f52be1b6d7e5a05da1891 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Mon, 16 Aug 2021 16:39:55 -0400 Subject: [PATCH 001/290] feat(doom-one): pull upstream changes --- lua/colors/doom-one/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua index 1a91c03e7..dfd6462e3 100644 --- a/lua/colors/doom-one/init.lua +++ b/lua/colors/doom-one/init.lua @@ -332,7 +332,7 @@ high_link('Todo', 'TextWarningBold') local main_syntax = { Tag = { fg = tag, gui = 'bold' }, Link = { fg = tag, gui = 'undercurl' }, - URL = { fg = tag, gui = 'undercurl' }, + URL = { fg = green, gui = 'undercurl' }, Underlined = { fg = tag, gui = 'underline' }, Comment = { From f1182022f613f408f6711b06ee865fef2910f031 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 17 Aug 2021 07:54:30 -0400 Subject: [PATCH 002/290] fix(blankline): disable in norg files --- lua/doom/modules/config/doom-blankline.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-blankline.lua b/lua/doom/modules/config/doom-blankline.lua index e60adec8f..fde45c905 100644 --- a/lua/doom/modules/config/doom-blankline.lua +++ b/lua/doom/modules/config/doom-blankline.lua @@ -9,7 +9,7 @@ return function() and true or false, show_first_indent_level = false, - filetype_exclude = { "help", "dashboard", "packer" }, + filetype_exclude = { "help", "dashboard", "packer", "norg" }, buftype_exclude = { "terminal" }, }) end From 9c905eaddb170eea72cd0d3e92e9b3834a38e2cd Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 20 Aug 2021 17:11:49 -0400 Subject: [PATCH 003/290] fix: proper conditional for enabling undodir --- lua/doom/core/settings/init.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index d161ad27c..cfd007df2 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -114,9 +114,11 @@ M.load_default_options = function() -- Checks to see if undo_dir does not exist. If it doesn't, it will create a undo folder local undo_dir = vim.fn.stdpath("config") .. config.doom.undo_dir - if config.doom.backup and vim.fn.empty(vim.fn.glob(undo_dir)) > 0 then - vim.api.nvim_command("!mkdir " .. undo_dir .. " -p") - vim.opt.undofile = true + if config.doom.backup and vim.fn.empty(vim.fn.glob(undo_dir)) >= 0 then + if vim.fn.isdirectory(undo_dir) ~= 1 then + vim.api.nvim_command("!mkdir -p " .. undo_dir) + end + vim.opt.undofile = true end -- If backup is false but `undo_dir` still exists then it will delete it. From 6925d773270b01e4a1763ad1548fd5210b6896fe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 20 Aug 2021 21:12:11 +0000 Subject: [PATCH 004/290] chore: format source code --- lua/doom/core/settings/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index cfd007df2..4147c3479 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -118,7 +118,7 @@ M.load_default_options = function() if vim.fn.isdirectory(undo_dir) ~= 1 then vim.api.nvim_command("!mkdir -p " .. undo_dir) end - vim.opt.undofile = true + vim.opt.undofile = true end -- If backup is false but `undo_dir` still exists then it will delete it. From ddde3fb7955d9059aee742378e51cb0e4c4d32c0 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 26 Aug 2021 11:43:09 -0400 Subject: [PATCH 005/290] fix(modules): update gitsigns configurations --- lua/doom/modules/config/doom-gitsigns.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/doom/modules/config/doom-gitsigns.lua b/lua/doom/modules/config/doom-gitsigns.lua index cad122a93..40890f821 100644 --- a/lua/doom/modules/config/doom-gitsigns.lua +++ b/lua/doom/modules/config/doom-gitsigns.lua @@ -60,9 +60,10 @@ return function() ["x ih"] = ':lua require"gitsigns".select_hunk()', }, watch_index = { interval = 1000, follow_files = true }, - current_line_blame = false, - current_line_blame_delay = 1000, - current_line_blame_position = "eol", + current_line_blame_opts = { + delay = 1000, + position = "eol", + }, sign_priority = 6, update_debounce = 100, status_formatter = nil, -- Use default From 587af6e3f90208c0972f7582189fd0a576699fae Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 26 Aug 2021 11:44:41 -0400 Subject: [PATCH 006/290] feat(modules): install http tree-sitter parser if `rest.nvim` plugin is enabled --- lua/doom/modules/config/doom-treesitter.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 87e8eb7e7..f3fe421f1 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -34,11 +34,22 @@ return function() branch = "main", }, } - -- selene: allow(undefined_variable) if packer_plugins and packer_plugins["neorg"] then table.insert(doomrc.langs, "norg") end + -- Set up treesitter for HTTP + parser_configs.http = { + install_info = { + url = "https://github.com/NTBBloodbath/tree-sitter-http", + files = { "src/parser.c" }, + branch = "main", + } + } + if packer_plugins and packer_plugins["rest.nvim"] then + table.insert(doomrc.langs, "http") + end + -- macos uses wrong c version require("nvim-treesitter.install").compilers = { "gcc" } @@ -49,6 +60,7 @@ return function() enable = functions.is_plugin_disabled("autopairs") and false or true, }, indent = { enable = true }, + playground = { enable = true }, tree_docs = { enable = true }, context_commentstring = { enable = true }, autotag = { From 79d1a6f4f4017df02e29f48fac893a708222b427 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 26 Aug 2021 15:45:03 +0000 Subject: [PATCH 007/290] chore: format source code --- lua/doom/modules/config/doom-treesitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index f3fe421f1..6c262e893 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -44,7 +44,7 @@ return function() url = "https://github.com/NTBBloodbath/tree-sitter-http", files = { "src/parser.c" }, branch = "main", - } + }, } if packer_plugins and packer_plugins["rest.nvim"] then table.insert(doomrc.langs, "http") From d33836d26657719969958518f576628315ab0aed Mon Sep 17 00:00:00 2001 From: Jackson Law <178053+jlaw@users.noreply.github.com> Date: Fri, 27 Aug 2021 09:01:15 -0700 Subject: [PATCH 008/290] chore: Remove selene comments and references (#106) --- docs/contributing.md | 8 -------- docs/getting_started.md | 2 -- lua/doom/core/config/init.lua | 2 -- lua/doom/extras/logging/init.lua | 1 - lua/doom/modules/built-in/compiler/init.lua | 1 - lua/doom/modules/built-in/runner/init.lua | 1 - lua/doom/modules/config/doom-compe.lua | 2 -- 7 files changed, 17 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index f7291915b..d98e230ae 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -88,13 +88,6 @@ quote_style = "AutoPreferDouble" > **NOTE:** use `--config-path /path/to/doom/nvim/stylua.toml` to use doom's > stylua configuration. -- [selene] is a blazing-fast modern Lua linter written in Rust which is used for - linting doom's source code. We make use of some custom rules so we can be sure - that selene will not raise false errors. - -> **NOTE:** use `selene .` in doom's root dir and selene will automatically -> detect the `selene.toml` and `doom.toml` files. - #### Commits & PRs - Target `develop` instead of `main`. @@ -113,4 +106,3 @@ your pull request :) [gist]: https://gist.github.com/ [stylua]: https://github.com/JohnnyMorganz/StyLua -[selene]: https://github.com/Kampfkarren/selene diff --git a/docs/getting_started.md b/docs/getting_started.md index b6b18581e..5e0a9b2a3 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -544,8 +544,6 @@ But first let's see what's new: documentation is the core of all projects. - Restructured source code. Now the doom nvim source code is much cleaner and easier to understand. -- Added selene linter CI for incoming pull requests and stylua CI for pushes. - Let's get a consistent way to maintain Doom Nvim source! Now that we know what's new we will surely want to update, isn't it? diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 7ccab825f..7727b4592 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -438,7 +438,6 @@ end -- -- @param langs The list of languages in the doomrc M.install_servers = function(langs) - -- selene: allow(undefined_variable) if packer_plugins and packer_plugins["lspinstall"] and packer_plugins["lspinstall"].loaded then local lspinstall = require("lspinstall") local installed_servers = lspinstall.installed_servers() @@ -469,7 +468,6 @@ end -- -- @param langs The list of languages in the doomrc M.install_dap_clients = function(langs) - -- selene: allow(undefined_variable) if packer_plugins and packer_plugins["DAPInstall.nvim"] diff --git a/lua/doom/extras/logging/init.lua b/lua/doom/extras/logging/init.lua index 9dc12de41..93229d47c 100644 --- a/lua/doom/extras/logging/init.lua +++ b/lua/doom/extras/logging/init.lua @@ -65,7 +65,6 @@ local default_config = { -- {{{ NO NEED TO CHANGE local log = {} --- selene: allow(incorrect_standard_library_use) local unpack = unpack or table.unpack log.new = function(config, standalone) diff --git a/lua/doom/modules/built-in/compiler/init.lua b/lua/doom/modules/built-in/compiler/init.lua index 8da8b7408..087911f22 100644 --- a/lua/doom/modules/built-in/compiler/init.lua +++ b/lua/doom/modules/built-in/compiler/init.lua @@ -1,7 +1,6 @@ local log = require("doom.extras.logging") local term --- selene: allow(undefined_variable) if packer_plugins and packer_plugins["nvim-toggleterm.lua"] then term = require("toggleterm.terminal").Terminal else diff --git a/lua/doom/modules/built-in/runner/init.lua b/lua/doom/modules/built-in/runner/init.lua index 7294f06b6..a378ac9ac 100644 --- a/lua/doom/modules/built-in/runner/init.lua +++ b/lua/doom/modules/built-in/runner/init.lua @@ -1,7 +1,6 @@ local log = require("doom.extras.logging") local term --- selene: allow(undefined_variable) if packer_plugins and packer_plugins["nvim-toggleterm.lua"] then term = require("toggleterm.terminal").Terminal else diff --git a/lua/doom/modules/config/doom-compe.lua b/lua/doom/modules/config/doom-compe.lua index 1f7c5e60e..18c4c7c4a 100644 --- a/lua/doom/modules/config/doom-compe.lua +++ b/lua/doom/modules/config/doom-compe.lua @@ -1,5 +1,3 @@ ---# selene: allow(global_usage) - --- nvim-compe configuration -- https://github.com/hrsh7th/nvim-compe#lua-config return function() From a43aa48e5a70adbc874cc163c33e83b77ef8f185 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 27 Aug 2021 12:07:49 -0400 Subject: [PATCH 009/290] fix(ci): accessing undefined variable --- lua/doom/utils/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 41d4ae59f..7def3745a 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -153,7 +153,7 @@ M.load_modules = function(module_path, modules) string.format("%s.%s", module_path, modules[i]) ) if not ok then - log.error( + require("doom.extras.logging").error( string.format( "There was an error loading the module '%s.%s'. Traceback:\n%s", module_path, From d27a3b3425cbf3b5049a38dab3269d57267c7147 Mon Sep 17 00:00:00 2001 From: Jackson Law <178053+jlaw@users.noreply.github.com> Date: Wed, 1 Sep 2021 17:55:45 -0700 Subject: [PATCH 010/290] feat: Refactor config handling (#108) - Rename `doomrc.lua` and `plugins.lua` to `doom_modules.lua` and `doom_userplugins.lua`, respectively. - Rename `doom.core.config.doomrc` to `doom.core.config.modules`. - Change config files to modules to utilize `requires` mechanism. Add property `M.source` to hold load path of file. - Alphabetize `doom_modules.lua` and sync defaults with `doom.core.config.modules`. - Update help file. - Add `doom.core.config.userplugins` to be consistent. --- doc/doom_nvim.txt | 30 +- docs/contributing.md | 2 +- docs/getting_started.md | 161 ++--- docs/modules.md | 103 +-- doom_config.lua | 731 ++++++++++---------- doomrc.lua => doom_modules.lua | 60 +- plugins.lua => doom_userplugins.lua | 17 +- lua/doom/core/README.md | 2 +- lua/doom/core/config/doomrc.lua | 119 ---- lua/doom/core/config/init.lua | 83 +-- lua/doom/core/config/modules.lua | 105 +++ lua/doom/core/config/ui.lua | 2 +- lua/doom/core/config/userplugins.lua | 35 + lua/doom/core/functions/init.lua | 37 +- lua/doom/core/init.lua | 24 +- lua/doom/core/settings/init.lua | 6 +- lua/doom/core/system/init.lua | 44 +- lua/doom/extras/autocmds/init.lua | 4 +- lua/doom/extras/keybindings/init.lua | 2 +- lua/doom/extras/logging/init.lua | 34 +- lua/doom/modules/built-in/compiler/init.lua | 2 +- lua/doom/modules/built-in/runner/init.lua | 2 +- lua/doom/modules/config/doom-blankline.lua | 2 +- lua/doom/modules/config/doom-dashboard.lua | 2 +- lua/doom/modules/config/doom-eviline.lua | 2 +- lua/doom/modules/config/doom-lspconfig.lua | 2 +- lua/doom/modules/config/doom-symbols.lua | 2 +- lua/doom/modules/config/doom-toggleterm.lua | 2 +- lua/doom/modules/config/doom-tree.lua | 2 +- lua/doom/modules/config/doom-treesitter.lua | 8 +- lua/doom/modules/init.lua | 9 +- lua/doom/utils/init.lua | 15 +- 32 files changed, 820 insertions(+), 831 deletions(-) rename doomrc.lua => doom_modules.lua (87%) rename plugins.lua => doom_userplugins.lua (55%) delete mode 100644 lua/doom/core/config/doomrc.lua create mode 100644 lua/doom/core/config/modules.lua create mode 100644 lua/doom/core/config/userplugins.lua diff --git a/doc/doom_nvim.txt b/doc/doom_nvim.txt index 6096587cb..4bf880187 100644 --- a/doc/doom_nvim.txt +++ b/doc/doom_nvim.txt @@ -56,11 +56,11 @@ INTRODUCTION *doom_nvim_intro* Doom Neovim is a Neovim port of the Doom Emacs configuration framework, adapted for the Neovim user that wants less framework in their framework and the performance -of a hand-made configuration. You can use it as a base for your own setup or as +of a hand-made configuration. You can use it as a base for your own setup or as a learning resource on how to achieve a great Neovim configuration. Doom Neovim features an opinionated collection of reasonable and optional -defaults, with a focus on runtime and startup performance, and a clean, +defaults, with a focus on runtime and startup performance, and a clean, readable code base. @@ -81,7 +81,7 @@ COLORSCHEME *doom_nvim_colorscheme* The colorscheme of Doom Nvim. Default is `doom-one`. There are some additional doom emacs' colorschemes port for Neovim that can be enabled by uncommenting -the `doom-themes` in your `doomrc.lua`. +the `doom-themes` in your `doom_modules.lua`. You can switch between colorschemes by doing ds and then type the name of the colorscheme you want to use. You can also edit the `doom_config.lua` @@ -129,7 +129,7 @@ See |doom_nvim_commands| for more information. ============================================================================== FILE EXPLORER *doom_nvim_configuration_layout_explorer* -Doom Neovim uses the `kyazdani42/nvim-tree.lua` plugin as a file explorer. +Doom Neovim uses the `kyazdani42/nvim-tree.lua` plugin as a file explorer. It can be toggled by running the following commands: oe for `FileExplorer` for `FileExplorer` @@ -222,11 +222,11 @@ and Doom Nvim will automatically handle your changes on here. ============================================================================== CUSTOM PLUGINS *doom_nvim_configuration_custom_plugins* -To use your own plugins in Doom Nvim you can use the `plugins.lua` file -located in the Doom Nvim root directory. +To use your own plugins in Doom Nvim you can use the `doom_userplugins.lua` +file located in the Doom Nvim root directory. NOTE: if you are familiar with `packer.nvim` (the plugins manager used by Doom -Nvim) then you can see the `plugins.lua` file as a wrapper for it. +Nvim) then you can see the `doom_userplugins.lua` file as a wrapper for it. To add plugins without extra configurations (e.g., if a plugin does not depend on other plugins), you can simply set it as follow: @@ -259,8 +259,8 @@ having to manually configure servers, Doom Nvim makes use of To enable the language server for a certain programming language and automatically install it, just append a `+lsp` flag at the end of the language -field in your `doomrc.lua`, e.g. for enabling Rust support in Doom and install -`rust-analyzer`: +field in your `doom_modules.lua`, e.g. for enabling Rust support in Doom and +install `rust-analyzer`: ` local doom = {` ` langs = {` @@ -495,9 +495,9 @@ development environment without spending a lot of time setting everything up. - Why does Doom Nvim only support Neovim 0.5.0 (and beyond)? -Doom Nvim relies on lua for the configuration and use of many plugins. Since +Doom Nvim relies on lua for the configuration and use of many plugins. Since lua is not available in neovim 0.4.4 and below, it is not possible to use Doom -Nvim with a neovim version lower than 0.5.0. However, the Doom Nvim installer +Nvim with a neovim version lower than 0.5.0. However, the Doom Nvim installer automatically installs Neovim 0.5.0 for you! ============================================================================== @@ -515,7 +515,9 @@ This is the structure of Doom Nvim: ├── doc # Doom Nvim documentation to be used inside Nvim │ └── doom_nvim.txt # Doom Nvim help file ├── docs # Doom Nvim docs meant to be readed on GitHub -├── doomrc # Doom Nvim user configurations file +├── doom_config.lua # Doom Nvim user configurations file +├── doom_modules.lua # Doom Nvim user module selection +├── doom_userplugins.lua # Doom Nvim user plugins ├── init.lua # init.lua file ├── install.sh # Doom Nvim installer ├── LICENSE # Doom Nvim License @@ -537,8 +539,8 @@ This is the structure of Doom Nvim: │ └── init.lua # packer.nvim setup └── sessions # Location of Neovim workspaces -Doom Nvim also sets default configurations for the `doomrc.lua` and the -`doom_config.lua` files, which serves as the user configuration file +Doom Nvim also sets default configurations for the `doom_config.lua` and the +`doom_modules.lua` files, which serves as the user configuration file if it is not present on the system. It allows a fine control over the core functions of Doom Nvim. diff --git a/docs/contributing.md b/docs/contributing.md index d98e230ae..acb2008ca 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -50,7 +50,7 @@ thus reach a solution more quickly. Some important data would be: - Your custom configuration if you have one - (`doomrc.lua`, `doom_config.lua` and `plugins.lua`) + (`doom_modules.lua`, `doom_config.lua` and `doom_userplugins.lua`) - Which branch of Doom Nvim are you using - Which plugins are you using diff --git a/docs/getting_started.md b/docs/getting_started.md index 3ec4fa1ac..61ee5ce1e 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -305,11 +305,11 @@ a previous release (for main branch) or a previous commit (for development branc ## Configuration -You can configure Doom Nvim by tweaking the `doomrc.lua`, `doom_config.lua` and -the `plugins.lua` files located in your Doom Nvim root directory -(`$HOME/.config/doom-nvim/` by default). +You can configure Doom Nvim by tweaking the `doom_config.lua`, +`doom_modules.lua` and the `doom_userplugins.lua` files located in your +Doom Nvim root directory (`$HOME/.config/doom-nvim/` by default). -### doomrc.lua +### doom_modules.lua This file handles all the Doom Nvim modules, its structure is really simple and easy to understand. @@ -317,74 +317,81 @@ easy to understand. This one will look like that: ```lua -local doom = { - ui = { - 'dashboard', -- Start screen - -- 'doom-themes', -- Additional doom emacs' colorschemes - 'statusline', -- Statusline - 'tabline', -- Tabline, shows your buffers list at top - -- 'zen', -- Distraction free environment - 'which-key', -- Keybindings popup menu like Emacs' guide-key - -- 'indentlines', -- Show indent lines - }, - doom = { - -- 'neorg', -- Life Organization Tool - -- 'runner', -- Open a REPL for the current language or run the current file - -- 'compiler', -- Compile (and run) your code with just pressing three keys! - }, - editor = { - 'auto-session', -- A small automated session manager for Neovim - -- 'terminal', -- Terminal for Neovim (NOTE: needed for runner and compiler) - 'explorer', -- Tree explorer - 'symbols', -- LSP symbols and tags - -- 'minimap', -- Code minimap, requires github.com/wfxr/code-minimap - 'gitsigns', -- Git signs - 'telescope', -- Highly extendable fuzzy finderover lists - -- 'restclient', -- A fast Neovim http client - 'formatter', -- File formatting - 'autopairs', -- Autopairs - -- 'editorconfig', -- EditorConfig support for Neovim - 'kommentary', -- Comments plugin - 'lsp', -- Language Server Protocols - 'snippets', -- LSP snippets - }, - langs = { - -- To enable the language server for a language justadd the +lsp flag - -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter - -- parser and rust-analyzer - -- - -- 'html', -- HTML support - -- 'css', -- CSS support - -- 'javascript', -- JavaScript support - -- 'typescript', -- TypeScript support - -- 'bash', -- The terminal gods language - -- 'python +lsp', -- Python support + lsp - -- 'ruby', -- Look ma, I love the gems! - 'lua', -- Support for our gods language - -- 'elixir', -- Build scalable and maintainablesoftware - -- 'haskell', -- Because Functional programming is fun, isn't it? - - -- 'rust +lsp', -- Let's get rusty! - -- 'go', -- Hello, gopher - -- 'cpp', -- C++ support - -- 'java', -- Java support - - -- 'config', -- Configuration files (JSON, YAML, TOML) - -- 'dockerfile', -- Do you like containers, right? - }, - utilities = { - -- 'suda', -- Write and read files without sudo permissions - -- 'lazygit', -- LazyGit integration for Neovim, requires LazyGit - -- 'neogit', -- Magit for Neovim - -- 'colorizer', -- Fastets colorizer for Neovim - 'range-highlight', -- hightlights ranges you haveentered in commandline - }, +local M = {} +M.source = debug.getinfo(1, "S").source:sub(2) + +M.modules = { + ui = { + "dashboard", -- Start screen + -- "doom-themes", -- Additional doom emacs' colorschemes + -- "indentlines", -- Show indent lines + -- "show_registers", -- popup that shows register contents + "statusline", -- Statusline + "tabline", -- Tabline, shows your buffers list at top + "which-key", -- Keybindings popup menu like Emacs' guide-key + -- "zen", -- Distraction free environment + }, + doom = { + -- "compiler", -- Compile (and run) your code with just pressing three keys! + -- "neorg", -- Life Organization Tool + -- "runner", -- Open a REPL for the current language or run the current file + }, + editor = { + "autopairs", -- Autopairs + "auto-session", -- A small automated session manager for Neovim + "dap", -- Debug Adapter Protocol + -- "editorconfig", -- EditorConfig support for Neovim + "explorer", -- Tree explorer + "formatter", -- File formatting + "gitsigns", -- Git signs + "kommentary", -- Comments plugin + "lsp", -- Language Server Protocols + -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap + -- "ranger", -- Ranger File Browser, requires ranger file browser + "snippets", -- LSP snippets + "symbols", -- LSP symbols and tags + "telescope", -- Highly extendable fuzzy finder over lists + -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) + }, + langs = { + -- To enable the language server for a language just add the +lsp flag + -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter + -- parser and rust-analyzer + -- + -- "bash", -- The terminal gods language + -- "config", -- Configuration files (JSON, YAML, TOML) + -- "cpp", -- C++ support + -- "css", -- CSS support + -- "dockerfile", -- Do you like containers, right? + -- "elixir", -- Build scalable and maintainable software + -- "go", -- Hello, gopher + -- "haskell", -- Because Functional programming is fun, isn't it? + -- "html", -- HTML support + -- "java", -- Java support + -- "javascript", -- JavaScript support + "lua", -- Support for our gods language + -- "python +lsp", -- Python support + lsp + -- "ruby", -- Look ma, I love the gems! + -- "rust +lsp", -- Let's get rusty! + -- "typescript", -- TypeScript support + }, + utilities = { + -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit + -- "neogit", -- Magit for Neovim + "range-highlight", -- hightlights ranges you have entered in commandline + -- "suda", -- Write and read files without sudo permissions + }, + web = { + -- "colorizer", -- Fastest colorizer for Neovim + -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config + -- "restclient", -- A fast Neovim http client + } } -return doom +return M ``` -And as the `doomrc.lua` file self-documentation says, you will only need to uncomment +And as the `doom_modules.lua` file self-documentation says, you will only need to uncomment or comment the plugins names in order to enable or disable them. e.g. to enable the `terminal` plugin you will only need to uncomment the `-- 'terminal',` line and restart Neovim. Doom will automatically handle your changes and install the `terminal` plugin for you. @@ -419,7 +426,7 @@ return { > **NOTE**: all your used-defined configurations here will be live-reloaded, e.g. > mappings, autocommands, etc. -### plugins.lua +### doom_userplugins.lua This file handles your custom plugins, in other words, it handles all the extra plugins you need that are not covered by Doom Nvim. @@ -440,7 +447,7 @@ return { } ``` -And as with the `doomrc.lua` file, Doom Nvim will automatically handle your changes +And as with the `doom_modules.lua` file, Doom Nvim will automatically handle your changes and install or uninstall the plugins declared on here. > **NOTE**: all the valid options for declaring plugins can be found in @@ -450,7 +457,7 @@ and install or uninstall the plugins declared on here. Doom Nvim consists of around 5 modules. A Doom Nvim Module is a bundle of plugins, configuration and commands, organized into a unit that can be toggled easily by -tweaking your `doomrc.lua` (found in `$HOME/.config/doom-nvim`). +tweaking your `doom_modules.lua` (found in `$HOME/.config/doom-nvim`). Please see [Plugin Management](#plugin-management) for more information. @@ -464,7 +471,7 @@ in your Doom Nvim root directory. Read on to learn how to use this system to ins your own plugins. > **WARNING:** Do not install plugins directly in `lua/doom/modules/init.lua`. Instead, -> use your `doomrc.lua` and `plugins.lua` files to modify them. +> use your `doom_modules.lua` and `doom_userplugins.lua` files to modify them. ### Configuring Doom @@ -480,7 +487,7 @@ Do you want to change some configurations of some modules? Go to `lua/doom/modules/config` directory and you will find the configurations for the plugins. -Otherwise if you want to configure a plugin declared in your `plugins.lua` you +Otherwise if you want to configure a plugin declared in your `doom_userplugins.lua` you can use the packer's `config` field, e.g. ```lua @@ -500,7 +507,7 @@ To easily install language servers and without having to do it system-wide or ha manually configure servers, Doom Nvim makes use of [kabouzeid/nvim-lspinstall](https://github.com/kabouzeid/nvim-lspinstall). To enable the language server for a certain programming language and automatically -install it, just append a `+lsp` flag at the end of the language field in your `doomrc.lua`, +install it, just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`, e.g. for enabling Rust support in Doom and install `rust-analyzer`: ```lua @@ -545,7 +552,7 @@ But first let's see what's new: - New logging system powered by [vlog]. A faster and smaller logging system because complexity is not always the best choice. - Easily enable and disable plugins. Now toggling the doom default plugins is easier - than before, just comment or uncomment it in your `doomrc.lua`! + than before, just comment or uncomment it in your `doom_modules.lua`! - Better custom plugins management. Now the custom plugins are being directly handled by packer as it should be, no more nonsense wrappers around it. - Better updating mechanism. Forget these annoying merging issues and save the @@ -618,12 +625,12 @@ And now, how can I start using the new configuration files? I'm going to explain you in a short way because the new configuration files has a rich documentation inside them. -- `doomrc.lua`, this file handles the Doom Nvim modules, in other words, which +- `doom_modules.lua`, this file handles the Doom Nvim modules, in other words, which plugins are being installed and loaded and which plugins are not. - `doom_config.lua`, this file handles the user configurations for doom nvim, e.g. if mouse is enabled or not. This one also handles user-defined Neovim configurations like global variables and mappings. -- `plugins.lua`, this file handles the user-defined plugins, it is the +- `doom_userplugins.lua`, this file handles the user-defined plugins, it is the replacement for the `custom_plugins` field in the old doomrc. > Are you having issues with the 3.0.0 version? Don't hesitate to [report them] diff --git a/docs/modules.md b/docs/modules.md index 648d89de3..e00d58804 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -10,7 +10,7 @@ organized into a unit that can be toggled easily. ## Tweaking Doom Nvim Modules -You can easily tweak Doom Nvim Modules by tweaking your `doomrc.lua` file +You can easily tweak Doom Nvim Modules by tweaking your `doom_modules.lua` file (found in `~/.config/doom-nvim`). ## List of modules @@ -37,56 +37,54 @@ without them. These plugins are the following: - Vim dashboard (start screen). - [doom-themes] - Additional doom emacs' colorschemes. +- [indentlines] + - Show indent lines. - [statusline] - Neovim statusline. - [tabline] - Tabline, shows your buffers list at top. -- [zen] - - Distraction free environment. - [which-key] - Keybindings popup like Emacs' guide-key. -- [indentlines] - - Show indent lines. +- [zen] + - Distraction free environment. ### Doom +- [compiler] (built-in) + - Compile _and run_ your projects with only a few keystrokes. - [neorg] - Life Organization Tool. - [runner] (built-in) - A code runner for your interpreted code. -- [compiler] (built-in) - - Compile _and run_ your projects with only a few keystrokes. ### Editor +- [autopairs] + - Autopairs. - [auto-session] - A small automated session manager for Neovim. -- [terminal] - - Terminal for Neovim. +- [editorconfig] + - EditorConfig support for Neovim, let other argue about tabs vs spaces. - [explorer] - Tree explorer. -- [symbols] - - LSP symbols and tags. -- [minimap] - - Code minimap, requires [wfxr/code-minimap](https://github.com/wfxr/code-minimap). -- [gitsigns] - - Git signs. -- [telescope] - - Highly extendable fuzzy finder over lists. -- [restclient] - - A fast Neovim http client. - [formatter] - File formatting. -- [autopairs] - - Autopairs. -- [editorconfig] - - EditorConfig support for Neovim, let other argue about tabs vs spaces. +- [gitsigns] + - Git signs. - [kommentary] - Comments plugin. - [lsp] - Language Server Protocols ([compe] + [lspinstall]). +- [minimap] + - Code minimap, requires [wfxr/code-minimap](https://github.com/wfxr/code-minimap). - snippets - Code snippets ([LuaSnip] + [friendly-snippets]). +- [symbols] + - LSP symbols and tags. +- [telescope] + - Highly extendable fuzzy finder over lists. +- [terminal] + - Terminal for Neovim. ### Langs @@ -105,13 +103,13 @@ The currently available flags are the following: #### Web development -- **html** - - HTML support. +- **css** + - CSS support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. -- **css** - - CSS support. +- **html** + - HTML support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. @@ -133,6 +131,15 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. +- **elixir** + - Elixir support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. +- **lua** + - Lua support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: no (it has but isn't supported by Doom _yet_, requires extra setup). - **python** - Python support. - TreeSitter based syntax highlighting: yes. @@ -143,25 +150,11 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: yes. -- **lua** - - Lua support. - - TreeSitter based syntax highlighting: yes. - - LSP: yes. - - DAP client: no (it has but isn't supported by Doom _yet_, requires extra setup). -- **elixir** - - Elixir support. - - TreeSitter based syntax highlighting: yes. - - LSP: yes. #### Compiled -- **haskell** - - Haskell support. - - TreeSitter based syntax highlighting: yes. - - LSP: yes. - - DAP client: no. -- **rust** - - Rust support. +- **cpp** + - CPP support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: yes (not supported _yet_ by Doom for automatic installation). @@ -170,16 +163,21 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: yes. -- **cpp** - - CPP support. +- **haskell** + - Haskell support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - - DAP client: yes (not supported _yet_ by Doom for automatic installation). + - DAP client: no. - **java** - Java support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. +- **rust** + - Rust support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: yes (not supported _yet_ by Doom for automatic installation). #### Configs & DevOps @@ -196,16 +194,21 @@ The currently available flags are the following: ### Utilities -- [suda] - - Write and read files without sudo permissions. - [lazygit] - LazyGit integration for neovim, requires LazyGit. - [neogit] - Magit for Neovim. -- [colorizer] - - Fastest colorizer for Neovim. - [range-highlight] - Highlights ranges you have entered in commandline +- [suda] + - Write and read files without sudo permissions. + +### Web + +- [colorizer] + - Fastest colorizer for Neovim. +- [restclient] + - A fast Neovim http client. ## Managing modules diff --git a/doom_config.lua b/doom_config.lua index 70181722e..2148eb807 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -1,3 +1,5 @@ +local M = {} +M.source = debug.getinfo(1, "S").source:sub(2) -- doom_config - Doom Nvim user configurations file -- -- This file contains the user-defined configurations for Doom nvim and consists @@ -8,379 +10,380 @@ -- 2. Nvim, this one defines all the custom configurations that you want to -- use in Neovim, e.g. a colorscheme italic_comments global variable --- {{{ Doom -local doom = { - -- Autosave - -- false : Disable autosave - -- true : Enable autosave - -- @default = false - autosave = false, - - -- Format on save - -- false : Disable format on save - -- true : Enable format on save - -- @default = false - fmt_on_save = false, - - -- Disable Vim macros - -- false : Enable Vim macros - -- true : Disable Vim macros - -- @default = false - disable_macros = false, - - -- Autosave sessions - -- false : Disable session autosave - -- true : Enable session autosave - -- @default = false - autosave_sessions = false, - - -- Autoload sessions - -- false : Disable session autoload - -- true : Enable session autoload - -- @default = false - autoload_last_session = false, - - -- Enable Swap files - -- false : no swap files - -- true : enables swap files - -- @default = false - swap_files = false, - - -- Undo Directories - -- the backup variable enables backup related settings (undofile, undodir) - -- false : ignores undo Directories (this code block will be ignored) - -- true : enable undo files/undo dirs. - -- @default = false - backup = false, -- WARNING: if you change this to false and you have an undo dir already, it will REMOVE the undodir (loss of data might take place) - - -- Enable Line wrapping - -- false : disables line wrapping - -- true : enables line wrapping - -- @default = false - line_wrap = false, - - -- Enable Show mode ( -- INSERT --, -- NORMAL --, -- VISUAL -- ) - -- false : disables show mode - -- true : enables show mode - -- @default = false - show_mode = false, - - -- Enable scroll off - -- false : disables scroll off - -- true : enables scroll off - -- @default = true, @default scrolloff_amount = 4, - scrolloff = true, - scrolloff_amount = 4, - - -- Enable mouse - -- false : disables mouse - -- true : enables mouse - -- @default = true - mouse = true, - - -- Preserve last editing position - -- false : Disable preservation of last editing position - -- true : Enable preservation of last editing position - -- @default = false - preserve_edit_pos = false, - - -- Allow overriding the default Doom Nvim keybinds - -- false : Default keybinds cannot be overwritten - -- true : Default keybinds can be overwritten - -- @default = true - allow_default_keymaps_overriding = true, - - -- horizontal split on creating a new file (fn) - -- false : doesn't split the window when creating a new file - -- true : horizontal split on creating a new file - -- @default = true - new_file_split = true, - - -- enable current line highlight - -- false : disables current line highlight - -- true : enables current line highlight - -- @default = true - line_highlight = true, - - -- Automatically split right - -- false : splits right (vertically) - -- true : splits left (vertically) - -- @default = true - split_right = true, - - -- Automatically split above - -- false : splits above (horizontally) - -- true : splits below (horizontally) - -- @default = true - split_below = true, - - -- Use clipboard outside of vim - -- false : won't use third party clipboard - -- true : enables third part clipboard - -- @default = true - clipboard = true, - - -- Enable auto comment (current line must be commented) - -- false : disables auto comment - -- true : enables auto comment - -- @default = false - auto_comment = false, - - -- Show indent lines - -- @default = true - show_indent = true, - - -- Expand tabs - -- Specifies if spaces or tabs must be used - -- false : spaces - -- true : tabs - -- @default = true - expand_tabs = true, - - -- Set numbering - -- false : Shows absolute number lines - -- true : Shows relative number lines - -- @default = true - relative_num = true, - - -- Enable winwidth - -- false : Manually set win width - -- true : Active window auto sets width - -- @default = false, @default win_width_nr = 85 - win_width = false, - win_width_nr = 85, - - -- Enable Highlight on yank - -- false : disables highligh on yank - -- true : enables highlight on yank - -- @default = true - highlight_yank = true, - - -- Enable guicolors - -- Enables gui colors on GUI versions of Neovim - -- @default = true - enable_guicolors = true, - - -- Tree explorer on the right - -- Places the Tree explorer buffer to the right when enabled - -- @default = false - explorer_right = false, - - -- Show hidden files - -- @default = true - show_hidden = true, - - -- Checkupdates on start - -- @default = false - check_updates = false, - - -- Auto install plugins on launch, useful if you don't want to run - -- PackerInstall every time you add a new plugin - -- @default = true - auto_install_plugins = true, - - -- Disable dashboard status line (does not work perfectly) - -- false : disables dashboard status line - -- true : enables dashboard status line - -- @default = true - dashboard_statline = true, - - -- Default indent size - -- @default = 4 - indent = 4, - - -- Set max cols - -- Defines the column to show a vertical marker - -- @default = 80 - max_columns = 80, - - -- Completion box height - -- @default = 10 - complete_size = 10, - - -- Completion box transparency - -- 0 = no transparency - -- 100 = fully transparent - -- @default = 25 - complete_transparency = 25, - - -- Sidebar sizing - -- Specifies the default width of Tree Explorer and Tagbar - -- @default = 25 - sidebar_width = 25, - - -- Set the Terminal width - -- Applies only to float direction - -- @default = 70 - terminal_width = 70, - - -- Set the Terminal height - -- Applies to all directions except window - -- @default = 20 - terminal_height = 20, - - -- Conceal level - -- Set Neovim conceal level - -- 0 : Disable indentline and show all - -- 1 : Conceal some functions and show indentlines - -- 2 : Concealed text is completely hidden unless it has a custom replacement - -- character defined - -- 3 : Concealed text is completely hidden - conceallevel = 0, - - -- Logging level - -- Set Doom logging level - -- Available levels: - -- · trace - -- · debug - -- · info - -- · warn - -- · error - -- · fatal - -- @default = 'info' - logging = "info", - - -- Set the Terminal direction - -- Available directions: - -- - vertical - -- - horizontal - -- - window - -- - float - -- @default = 'horizontal' - terminal_direction = "horizontal", - - -- NOTE: This will only be activated if 'backup' is true. - -- We don'recommend you put this outside of neovim so we've restricted to the path: ~/.config/nvim - -- WARNING: only put the folder name that you want. (eg: undo_dir = '/undodir') - -- @default_directory = '~/.config/nvim/undodir' - undo_dir = "/undodir", - - -- Default colorscheme - -- @default = doom-one - colorscheme = "doom-one", - - -- Background color - -- @default = dark - colorscheme_bg = "dark", - - -- Doom One colorscheme settings - doom_one = { - -- If the cursor color should be blue +M.config = { + -- {{{ Doom + doom = { + -- Autosave + -- false : Disable autosave + -- true : Enable autosave -- @default = false - cursor_coloring = false, - -- If TreeSitter highlighting should be enabled + autosave = false, + + -- Format on save + -- false : Disable format on save + -- true : Enable format on save + -- @default = false + fmt_on_save = false, + + -- Disable Vim macros + -- false : Enable Vim macros + -- true : Disable Vim macros + -- @default = false + disable_macros = false, + + -- Autosave sessions + -- false : Disable session autosave + -- true : Enable session autosave + -- @default = false + autosave_sessions = false, + + -- Autoload sessions + -- false : Disable session autoload + -- true : Enable session autoload + -- @default = false + autoload_last_session = false, + + -- Enable Swap files + -- false : no swap files + -- true : enables swap files + -- @default = false + swap_files = false, + + -- Undo Directories + -- the backup variable enables backup related settings (undofile, undodir) + -- false : ignores undo Directories (this code block will be ignored) + -- true : enable undo files/undo dirs. + -- @default = false + -- WARNING: if you change this to false and you have an undo dir already, + -- it will REMOVE the undodir (loss of data might take place) + backup = false, + + -- Enable Line wrapping + -- false : disables line wrapping + -- true : enables line wrapping + -- @default = false + line_wrap = false, + + -- Enable Show mode ( -- INSERT --, -- NORMAL --, -- VISUAL -- ) + -- false : disables show mode + -- true : enables show mode + -- @default = false + show_mode = false, + + -- Enable scroll off + -- false : disables scroll off + -- true : enables scroll off + -- @default = true, @default scrolloff_amount = 4, + scrolloff = true, + scrolloff_amount = 4, + + -- Enable mouse + -- false : disables mouse + -- true : enables mouse -- @default = true - enable_treesitter = true, - -- If the comments should be italic + mouse = true, + + -- Preserve last editing position + -- false : Disable preservation of last editing position + -- true : Enable preservation of last editing position -- @default = false - italic_comments = false, - -- If the telescope plugin window should be colored + preserve_edit_pos = false, + + -- Allow overriding the default Doom Nvim keybinds + -- false : Default keybinds cannot be overwritten + -- true : Default keybinds can be overwritten + -- @default = true + allow_default_keymaps_overriding = true, + + -- horizontal split on creating a new file (fn) + -- false : doesn't split the window when creating a new file + -- true : horizontal split on creating a new file + -- @default = true + new_file_split = true, + + -- enable current line highlight + -- false : disables current line highlight + -- true : enables current line highlight + -- @default = true + line_highlight = true, + + -- Automatically split right + -- false : splits right (vertically) + -- true : splits left (vertically) + -- @default = true + split_right = true, + + -- Automatically split above + -- false : splits above (horizontally) + -- true : splits below (horizontally) -- @default = true - telescope_highlights = true, - -- If the built-in Neovim terminal should use the doom-one - -- colorscheme palette + split_below = true, + + -- Use clipboard outside of vim + -- false : won't use third party clipboard + -- true : enables third part clipboard + -- @default = true + clipboard = true, + + -- Enable auto comment (current line must be commented) + -- false : disables auto comment + -- true : enables auto comment -- @default = false - terminal_colors = true, - -- If the Neovim instance should be transparent + auto_comment = false, + + -- Show indent lines + -- @default = true + show_indent = true, + + -- Expand tabs + -- Specifies if spaces or tabs must be used + -- false : spaces + -- true : tabs + -- @default = true + expand_tabs = true, + + -- Set numbering + -- false : Shows absolute number lines + -- true : Shows relative number lines + -- @default = true + relative_num = true, + + -- Enable winwidth + -- false : Manually set win width + -- true : Active window auto sets width + -- @default = false, @default win_width_nr = 85 + win_width = false, + win_width_nr = 85, + + -- Enable Highlight on yank + -- false : disables highligh on yank + -- true : enables highlight on yank + -- @default = true + highlight_yank = true, + + -- Enable guicolors + -- Enables gui colors on GUI versions of Neovim + -- @default = true + enable_guicolors = true, + + -- Tree explorer on the right + -- Places the Tree explorer buffer to the right when enabled -- @default = false - transparent_background = false, - }, + explorer_right = false, - -- Set gui fonts here - -- @default = "FiraCode Nerd Font", @default font size = 15, - -- WARNING: Font sizes must be in string format! - guifont = "FiraCode Nerd Font", - guifont_size = "15", - - -- change Which Key background color - -- can use hex, or normal color names (eg: Red, Gree, Blue) - -- @default = #202328 - whichkey_bg = "#202328", - - -- set your custom lsp diagnostic symbols below - lsp_error = "", - lsp_warning = "", - lsp_hint = "", - lsp_information = "", - lsp_virtual_text = " ", - - -- Set your dashboard custom colors below - -- @default = doom emacs' default dashboard colors - dashboard_custom_colors = { - header_color = "#586268", - center_color = "#51afef", - shortcut_color = "#a9a1e1", - footer_color = "#586268", - }, + -- Show hidden files + -- @default = true + show_hidden = true, - -- Set your custom dashboard header below - -- @default = doom emacs' default dashboard header - dashboard_custom_header = {}, -} --- }}} - --- {{{ Nvim -local nvim = { - -- Set custom Neovim global variables - -- @default = {} - -- example: - -- { ['sonokai_style'] = 'andromeda' } - global_variables = {}, - - -- Set custom autocommands - -- @default = {} - -- example: - -- augroup_name = { - -- { 'BufNewFile,BufRead', 'doomrc', 'set ft=lua'} - -- } - autocmds = {}, - - -- Set custom key bindings - -- @default = {} - -- example: - -- { - -- {'n', 'ca', ':Lspsaga code_action', options} - -- } - -- - -- where - -- 'n' is the map scope - -- 'ca' is the map activator - -- ':Lspsaga ...' is the command to be executed - -- options is a Lua table containing the mapping options, e.g. - -- { silent = true }, see ':h map-arguments'. - mappings = {}, - - -- Set custom commands - -- @default = {} - -- example: - -- { - -- 'echo "Hello, custom commands!"' - -- } - commands = {}, - - -- Set custom functions - -- @default = {} - -- example: - -- { - -- hello_custom_func = function() - -- print("Hello, custom functions!") - -- end - -- } - functions = {}, - - -- Set custom options - -- @default = {} - -- example: - -- { - -- { ['shiftwidth'] = 4 } - -- } - options = {}, -} --- }}} + -- Checkupdates on start + -- @default = false + check_updates = false, -return { - doom = doom, - nvim = nvim, + -- Auto install plugins on launch, useful if you don't want to run + -- PackerInstall every time you add a new plugin + -- @default = true + auto_install_plugins = true, + + -- Disable dashboard status line (does not work perfectly) + -- false : disables dashboard status line + -- true : enables dashboard status line + -- @default = true + dashboard_statline = true, + + -- Default indent size + -- @default = 4 + indent = 4, + + -- Set max cols + -- Defines the column to show a vertical marker + -- @default = 80 + max_columns = 80, + + -- Completion box height + -- @default = 10 + complete_size = 10, + + -- Completion box transparency + -- 0 = no transparency + -- 100 = fully transparent + -- @default = 25 + complete_transparency = 25, + + -- Sidebar sizing + -- Specifies the default width of Tree Explorer and Tagbar + -- @default = 25 + sidebar_width = 25, + + -- Set the Terminal width + -- Applies only to float direction + -- @default = 70 + terminal_width = 70, + + -- Set the Terminal height + -- Applies to all directions except window + -- @default = 20 + terminal_height = 20, + + -- Conceal level + -- Set Neovim conceal level + -- 0 : Disable indentline and show all + -- 1 : Conceal some functions and show indentlines + -- 2 : Concealed text is completely hidden unless it has a custom replacement + -- character defined + -- 3 : Concealed text is completely hidden + conceallevel = 0, + + -- Logging level + -- Set Doom logging level + -- Available levels: + -- · trace + -- · debug + -- · info + -- · warn + -- · error + -- · fatal + -- @default = 'info' + logging = "info", + + -- Set the Terminal direction + -- Available directions: + -- - vertical + -- - horizontal + -- - window + -- - float + -- @default = 'horizontal' + terminal_direction = "horizontal", + + -- NOTE: This will only be activated if 'backup' is true. + -- We don'recommend you put this outside of neovim so we've restricted to the path: ~/.config/nvim + -- WARNING: only put the folder name that you want. (eg: undo_dir = '/undodir') + -- @default_directory = '~/.config/nvim/undodir' + undo_dir = "/undodir", + + -- Default colorscheme + -- @default = doom-one + colorscheme = "doom-one", + + -- Background color + -- @default = dark + colorscheme_bg = "dark", + + -- Doom One colorscheme settings + doom_one = { + -- If the cursor color should be blue + -- @default = false + cursor_coloring = false, + -- If TreeSitter highlighting should be enabled + -- @default = true + enable_treesitter = true, + -- If the comments should be italic + -- @default = false + italic_comments = false, + -- If the telescope plugin window should be colored + -- @default = true + telescope_highlights = true, + -- If the built-in Neovim terminal should use the doom-one + -- colorscheme palette + -- @default = false + terminal_colors = true, + -- If the Neovim instance should be transparent + -- @default = false + transparent_background = false, + }, + + -- Set gui fonts here + -- @default = "FiraCode Nerd Font", @default font size = 15, + -- WARNING: Font sizes must be in string format! + guifont = "FiraCode Nerd Font", + guifont_size = "15", + + -- change Which Key background color + -- can use hex, or normal color names (eg: Red, Gree, Blue) + -- @default = #202328 + whichkey_bg = "#202328", + + -- set your custom lsp diagnostic symbols below + lsp_error = "", + lsp_warning = "", + lsp_hint = "", + lsp_information = "", + lsp_virtual_text = " ", + + -- Set your dashboard custom colors below + -- @default = doom emacs' default dashboard colors + dashboard_custom_colors = { + header_color = "#586268", + center_color = "#51afef", + shortcut_color = "#a9a1e1", + footer_color = "#586268", + }, + + -- Set your custom dashboard header below + -- @default = doom emacs' default dashboard header + dashboard_custom_header = {}, + }, + -- }}} + + -- {{{ Nvim + nvim = { + -- Set custom Neovim global variables + -- @default = {} + -- example: + -- { ['sonokai_style'] = 'andromeda' } + global_variables = {}, + + -- Set custom autocommands + -- @default = {} + -- example: + -- augroup_name = { + -- { 'BufNewFile,BufRead', 'doom_modules.lua', 'set ft=lua'} + -- } + autocmds = {}, + + -- Set custom key bindings + -- @default = {} + -- example: + -- { + -- {'n', 'ca', ':Lspsaga code_action', options} + -- } + -- + -- where + -- 'n' is the map scope + -- 'ca' is the map activator + -- ':Lspsaga ...' is the command to be executed + -- options is a Lua table containing the mapping options, e.g. + -- { silent = true }, see ':h map-arguments'. + mappings = {}, + + -- Set custom commands + -- @default = {} + -- example: + -- { + -- 'echo "Hello, custom commands!"' + -- } + commands = {}, + + -- Set custom functions + -- @default = {} + -- example: + -- { + -- hello_custom_func = function() + -- print("Hello, custom functions!") + -- end + -- } + functions = {}, + + -- Set custom options + -- @default = {} + -- example: + -- { + -- { ['shiftwidth'] = 4 } + -- } + options = {}, + }, + -- }}} } +return M + -- vim: fdm=marker diff --git a/doomrc.lua b/doom_modules.lua similarity index 87% rename from doomrc.lua rename to doom_modules.lua index 57c221957..a7cba70b4 100644 --- a/doomrc.lua +++ b/doom_modules.lua @@ -1,7 +1,9 @@ --- doomrc - Doom nvim configurations file +local M = {} +M.source = debug.getinfo(1, "S").source:sub(2) +-- doom_modules - Doom nvim module selection -- --- The doomrc controls what Doom nvim plugins modules are enabled and what --- features are being used. +-- The doom_modules controls what Doom nvim plugins modules are enabled and +-- what features are being used. -- -- Comment out a plugin to enable it and comment a non-commented one to -- disable and uninstall it. @@ -11,75 +13,75 @@ -- "Configuration" one. In that section you will find a comprehensive list of -- the available modules and all their supported flags. -local doom = { +M.modules = { ui = { "dashboard", -- Start screen -- "doom-themes", -- Additional doom emacs' colorschemes + -- "indentlines", -- Show indent lines + -- "show_registers", -- popup that shows register contents "statusline", -- Statusline "tabline", -- Tabline, shows your buffers list at top - -- "zen", -- Distraction free environment "which-key", -- Keybindings popup menu like Emacs' guide-key - -- "indentlines", -- Show indent lines - -- "show_registers", -- popup that shows register contents + -- "zen", -- Distraction free environment }, doom = { + -- "compiler", -- Compile (and run) your code with just pressing three keys! -- "neorg", -- Life Organization Tool -- "runner", -- Open a REPL for the current language or run the current file - -- "compiler", -- Compile (and run) your code with just pressing three keys! }, editor = { + "autopairs", -- Autopairs "auto-session", -- A small automated session manager for Neovim - "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) + "dap", -- Debug Adapter Protocol + -- "editorconfig", -- EditorConfig support for Neovim "explorer", -- Tree explorer - -- "ranger", -- Ranger File Browser, requires ranger file browser - "symbols", -- LSP symbols and tags - -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap - "gitsigns", -- Git signs - "telescope", -- Highly extendable fuzzy finder over lists "formatter", -- File formatting - "autopairs", -- Autopairs - -- "editorconfig", -- EditorConfig support for Neovim + "gitsigns", -- Git signs "kommentary", -- Comments plugin "lsp", -- Language Server Protocols - "dap", -- Debug Adapter Protocol - "snippets", -- Snippets + -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap + -- "ranger", -- Ranger File Browser, requires ranger file browser + "snippets", -- LSP snippets + "symbols", -- LSP symbols and tags + "telescope", -- Highly extendable fuzzy finder over lists + -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) }, langs = { -- To enable the language server for a language just add the +lsp flag -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter -- parser and rust-analyzer -- - -- "html", -- HTML support -- "css", -- CSS support + -- "html", -- HTML support -- "javascript", -- JavaScript support -- "typescript", -- TypeScript support + -- "bash", -- The terminal gods language + -- "elixir", -- Build scalable and maintainable software + "lua", -- Support for our gods language -- "python +lsp", -- Python support + lsp -- "ruby", -- Look ma, I love the gems! - "lua", -- Support for our gods language - -- "elixir", -- Build scalable and maintainable software - -- "haskell", -- Because Functional programming is fun, isn't it? - -- "rust +lsp", -- Let's get rusty! - -- "go", -- Hello, gopher -- "cpp", -- C++ support + -- "go", -- Hello, gopher + -- "haskell", -- Because Functional programming is fun, isn't it? -- "java", -- Java support + -- "rust +lsp", -- Let's get rusty! -- "config", -- Configuration files (JSON, YAML, TOML) -- "dockerfile", -- Do you like containers, right? }, utilities = { - -- "suda", -- Write and read files without sudo permissions -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit -- "neogit", -- Magit for Neovim - -- "colorizer", -- Fastest colorizer for Neovim "range-highlight", -- hightlights ranges you have entered in commandline + -- "suda", -- Write and read files without sudo permissions }, web = { - -- "restclient", -- A fast Neovim http client - -- "firenvim", -- requires firenvim web extension; change fontsize by increasing guifontsize in doom_config -- "colorizer", -- Fastest colorizer for Neovim + -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config + -- "restclient", -- A fast Neovim http client } } -return doom +return M diff --git a/plugins.lua b/doom_userplugins.lua similarity index 55% rename from plugins.lua rename to doom_userplugins.lua index 1412a966c..513e478ee 100644 --- a/plugins.lua +++ b/doom_userplugins.lua @@ -1,15 +1,18 @@ --- plugins - Doom nvim custom plugins +local M = {} +M.source = debug.getinfo(1, "S").source:sub(2) +-- doom_userplugins - Doom nvim custom plugins -- -- This file contains all the custom plugins that are not in Doom nvim but that -- the user requires. All the available fields can be found here -- https://github.com/wbthomason/packer.nvim#specifying-plugins -- -- By example, for including a plugin with a dependency on telescope: --- return { --- { --- 'user/repository', --- requires = { 'nvim-lua/telescope.nvim' }, --- }, +-- M.plugins { +-- { +-- 'user/repository', +-- requires = { 'nvim-lua/telescope.nvim' }, +-- }, -- } +M.plugins = {} -return {} +return M diff --git a/lua/doom/core/README.md b/lua/doom/core/README.md index 5c8a547bf..aa1a2ec85 100644 --- a/lua/doom/core/README.md +++ b/lua/doom/core/README.md @@ -5,7 +5,7 @@ be Doom. Those modules are the following: -- config - Doom configurations, handles doomrc file and UI settings. +- config - Doom configurations, handles `doom_*` file and UI settings. - settings - Doom configurations for Neovim, e.g. `tabwidth`, `showmode`. - functions - Doom core functions, e.g. `create_report`. - health - Doom health add-on. diff --git a/lua/doom/core/config/doomrc.lua b/lua/doom/core/config/doomrc.lua deleted file mode 100644 index 7ba82cc76..000000000 --- a/lua/doom/core/config/doomrc.lua +++ /dev/null @@ -1,119 +0,0 @@ ----[[---------------------------------------]]--- --- doomrc.lua - Load Doom Nvim doomrc -- --- Author: NTBBloodbath -- --- License: GPLv2 -- ----[[---------------------------------------]]--- - -local utils = require("doom.utils") -local system = require("doom.core.system") -local log = require("doom.extras.logging") - -local M = {} - -log.debug("Loading Doom doomrc module ...") - --- default_doomrc_values loads the default doomrc values --- @return table -local function default_doomrc_values() - return { - ui = { - "dashboard", -- Start screen - -- 'doom-themes', -- Additional doom emacs' colorschemes - "statusline", -- Statusline - "tabline", -- Tabline, shows your buffers list at top - -- 'zen', -- Distraction free environment - "which-key", -- Keybindings popup menu like Emacs' guide-key - -- "show_registers", -- popup that shows register contents - -- 'indentlines', -- Show indent lines - }, - doom = { - -- 'neorg', -- Life Organization Tool - -- 'runner', -- Open a REPL for the current language or run the current file - -- 'compiler', -- Compile (and run) your code with just pressing three keys! - }, - editor = { - "auto-session", -- A small automated session manager for Neovim - -- 'terminal', -- Terminal for Neovim (NOTE: needed for runner and compiler) - "explorer", -- Tree explorer - -- "ranger", -- Ranger File Browser, requires ranger file browser - "symbols", -- LSP symbols and tags - -- 'minimap', -- Code minimap, requires github.com/wfxr/code-minimap - "gitsigns", -- Git signs - "telescope", -- Highly extendable fuzzy finder over lists - "formatter", -- File formatting - "autopairs", -- Autopairs - -- 'editorconfig', -- EditorConfig support for Neovim - "kommentary", -- Comments plugin - "lsp", -- Language Server Protocols - "snippets", -- LSP snippets - }, - langs = { - -- To enable the language server for a language just add the +lsp flag - -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter - -- parser and rust-analyzer - -- - -- 'html', -- HTML support - -- 'css', -- CSS support - -- 'javascript', -- JavaScript support - -- 'typescript', -- TypeScript support - -- 'bash', -- The terminal gods language - -- 'python +lsp', -- Python support + lsp - -- 'ruby', -- Look ma, I love the gems! - "lua", -- Support for our gods language - -- 'elixir', -- Build scalable and maintainable software - -- 'haskell', -- Because Functional programming is fun, isn't it? - - -- 'rust +lsp', -- Let's get rusty! - -- 'go', -- Hello, gopher - -- 'cpp', -- C++ support - -- 'java', -- Java support - - -- 'config', -- Configuration files (JSON, YAML, TOML) - -- 'dockerfile', -- Do you like containers, right? - }, - utilities = { - -- 'suda', -- Write and read files without sudo permissions - -- 'lazygit', -- LazyGit integration for Neovim, requires LazyGit - -- 'neogit', -- Magit for Neovim - "range-highlight", -- hightlights ranges you have entered in commandline - }, - web = { - -- 'restclient', -- A fast Neovim http client - -- "firenvim", -- requires firenvim extension to be installed in webbrowser - -- 'colorizer', -- Fastets colorizer for Neovim - } - } -end - --- load_doomrc Loads the doomrc if it exists, otherwise it'll fallback to doom --- default configs. -M.load_doomrc = function() - local config, doomrc_path - - -- Path cases: - -- 1. /home/user/.config/doom-nvim/doomrc.lua - -- 2. /home/user/.config/nvim/doomrc.lua - if utils.file_exists(string.format("%s%sdoomrc.lua", system.doom_configs_root, system.sep)) then - doomrc_path = string.format("%s%sdoomrc.lua", system.doom_configs_root, system.sep) - elseif utils.file_exists(string.format("%s%sdoomrc.lua", system.doom_root, system.sep)) then - doomrc_path = string.format("%s%sdoomrc.lua", system.doom_root, system.sep) - end - - if doomrc_path then - local loaded_doomrc, err = pcall(function() - log.debug("Loading the doomrc file ...") - config = dofile(doomrc_path) - end) - - if not loaded_doomrc then - log.error("Error while loading the doomrc. Traceback:\n" .. err) - end - else - log.warn("No doomrc.lua file found, falling to defaults") - config = default_doomrc_values() - end - - return config -end - -return M diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 7727b4592..e911ce274 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -30,11 +30,9 @@ end -- {{{ Default doom_config values --- default_doom_config_values loads the default doom_config values --- @return table -local function default_doom_config_values() +M.config = { -- {{{ Doom - local doom = { + doom = { -- Autosave -- false : Disable autosave -- true : Enable autosave @@ -111,6 +109,12 @@ local function default_doom_config_values() -- @default = false preserve_edit_pos = false, + -- Allow overriding the default Doom Nvim keybinds + -- false : Default keybinds cannot be overwritten + -- true : Default keybinds can be overwritten + -- @default = true + allow_default_keymaps_overriding = true, + -- horizontal split on creating a new file (fn) -- false : doesn't split the window when creating a new file -- true : horizontal split on creating a new file @@ -337,11 +341,11 @@ local function default_doom_config_values() -- Set your custom dashboard header below -- @default = doom emacs' default dashboard header dashboard_custom_header = {}, - } + }, -- }}} -- {{{ Nvim - local nvim = { + nvim = { -- Set custom Neovim global variables -- @default = {} -- example: @@ -352,7 +356,7 @@ local function default_doom_config_values() -- @default = {} -- example: -- augroup_name = { - -- { 'BufNewFile,BufRead', 'doomrc', 'set ft=lua'} + -- { 'BufNewFile,BufRead', 'doom_modules.lua', 'set ft=lua'} -- } autocmds = {}, @@ -360,13 +364,15 @@ local function default_doom_config_values() -- @default = {} -- example: -- { - -- {'n', 'ca', ':Lspsaga code_action'} + -- {'n', 'ca', ':Lspsaga code_action', options} -- } -- -- where -- 'n' is the map scope -- 'ca' is the map activator -- ':Lspsaga ...' is the command to be executed + -- options is a Lua table containing the mapping options, e.g. + -- { silent = true }, see ':h map-arguments'. mappings = {}, -- Set custom commands @@ -386,57 +392,38 @@ local function default_doom_config_values() -- end -- } functions = {}, - } + }, -- }}} - - return { - doom = doom, - nvim = nvim, - } -end +} -- }}} --- load_config Loads the doom_config.lua file if it exists --- @return table -M.load_config = function() - local config = { - doom = {}, - nvim = {}, - } - local doom_config_path - - -- Path cases: - -- 1. /home/user/.config/doom-nvim/doom_config.lua - -- 2. /home/user/.config/nvim/doom_config.lua - if - utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) - then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep) - elseif utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_root, system.sep) - end +M.source = nil - if doom_config_path then - local loaded_doom_config, err = pcall(function() - config = dofile(doom_config_path) - end) +log.debug("Loading Doom config module ...") - if not loaded_doom_config then - log.error("Error while loading the doom_config file. Traceback:\n" .. err) - end +-- Path cases: +-- 1. /doom_config.lua +-- 2. /home/user/.config/doom-nvim/doom_config.lua +-- 3. stdpath('config')/doom_config.lua +local ok, ret = pcall(require, "doom_config") +if ok then + M.config = ret.config + M.source = ret.source +else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_config.lua") + if ok then + M.config = ret.config + M.source = ret.source else - log.warn("No doom_config.lua file found, falling to defaults") - default_doom_config_values() + log.error("Error while loading doom_config.lua. Traceback:\n" .. ret) end - - return config end -- install_servers will install the language servers for the languages with -- the +lsp flag. -- --- @param langs The list of languages in the doomrc +-- @param langs The list of languages in the doom_modules.lua M.install_servers = function(langs) if packer_plugins and packer_plugins["lspinstall"] and packer_plugins["lspinstall"].loaded then local lspinstall = require("lspinstall") @@ -466,7 +453,7 @@ end -- install_dap_clients will install the DAP clients for the languages with -- the +debug flag. -- --- @param langs The list of languages in the doomrc +-- @param langs The list of languages in the doom_modules.lua M.install_dap_clients = function(langs) if packer_plugins @@ -501,7 +488,7 @@ M.install_dap_clients = function(langs) end -- Check plugins updates on start if enabled -if M.load_config().doom.check_updates then +if M.config.doom.check_updates then require("doom.core.functions").check_updates() end diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua new file mode 100644 index 000000000..715c479f1 --- /dev/null +++ b/lua/doom/core/config/modules.lua @@ -0,0 +1,105 @@ +---[[---------------------------------------------]]--- +-- modules - Load Doom Nvim doom_modules.lua -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------------]]--- + +local system = require("doom.core.system") +local log = require("doom.extras.logging") + +local M = {} + +M.modules = { + ui = { + "dashboard", -- Start screen + -- "doom-themes", -- Additional doom emacs' colorschemes + -- "indentlines", -- Show indent lines + -- "show_registers", -- popup that shows register contents + "statusline", -- Statusline + "tabline", -- Tabline, shows your buffers list at top + "which-key", -- Keybindings popup menu like Emacs' guide-key + -- "zen", -- Distraction free environment + }, + doom = { + -- "compiler", -- Compile (and run) your code with just pressing three keys! + -- "neorg", -- Life Organization Tool + -- "runner", -- Open a REPL for the current language or run the current file + }, + editor = { + "autopairs", -- Autopairs + "auto-session", -- A small automated session manager for Neovim + "dap", -- Debug Adapter Protocol + -- "editorconfig", -- EditorConfig support for Neovim + "explorer", -- Tree explorer + "formatter", -- File formatting + "gitsigns", -- Git signs + "kommentary", -- Comments plugin + "lsp", -- Language Server Protocols + -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap + -- "ranger", -- Ranger File Browser, requires ranger file browser + "snippets", -- LSP snippets + "symbols", -- LSP symbols and tags + "telescope", -- Highly extendable fuzzy finder over lists + -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) + }, + langs = { + -- To enable the language server for a language just add the +lsp flag + -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter + -- parser and rust-analyzer + -- + -- "css", -- CSS support + -- "html", -- HTML support + -- "javascript", -- JavaScript support + -- "typescript", -- TypeScript support + + -- "bash", -- The terminal gods language + -- "elixir", -- Build scalable and maintainable software + "lua", -- Support for our gods language + -- "python +lsp", -- Python support + lsp + -- "ruby", -- Look ma, I love the gems! + + -- "cpp", -- C++ support + -- "go", -- Hello, gopher + -- "haskell", -- Because Functional programming is fun, isn't it? + -- "java", -- Java support + -- "rust +lsp", -- Let's get rusty! + + -- "config", -- Configuration files (JSON, YAML, TOML) + -- "dockerfile", -- Do you like containers, right? + }, + utilities = { + -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit + -- "neogit", -- Magit for Neovim + "range-highlight", -- hightlights ranges you have entered in commandline + -- "suda", -- Write and read files without sudo permissions + }, + web = { + -- "colorizer", -- Fastest colorizer for Neovim + -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config + -- "restclient", -- A fast Neovim http client + } +} + +M.source = nil + +log.debug("Loading Doom modules module ...") + +-- Path cases: +-- 1. /doom_modules.lua +-- 2. /home/user/.config/doom-nvim/doom_modules.lua +-- 3. stdpath('config')/doom_modules.lua +local ok, ret = pcall(require, "doom_modules") +if ok then + M.modules = ret.modules + M.source = ret.source +else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_modules.lua") + if ok then + M.modules = ret.modules + M.source = ret.source + else + log.error("Error while loading doom_modules.lua. Traceback:\n" .. ret) + end +end + +return M diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua index 9bc9f383e..d2bfebef7 100644 --- a/lua/doom/core/config/ui.lua +++ b/lua/doom/core/config/ui.lua @@ -6,7 +6,7 @@ local utils = require("doom.utils") local log = require("doom.extras.logging") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config log.debug("Loading Doom UI module ...") diff --git a/lua/doom/core/config/userplugins.lua b/lua/doom/core/config/userplugins.lua new file mode 100644 index 000000000..a70f8422c --- /dev/null +++ b/lua/doom/core/config/userplugins.lua @@ -0,0 +1,35 @@ +local M = {} +---[[---------------------------------------]]--- +-- userplugins - Load Doom Nvim doom_userplugins -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------]]--- + +local system = require("doom.core.system") +local log = require("doom.extras.logging") + +M.plugins = {} + +M.source = nil + +log.debug("Loading Doom userplugins module...") + +-- Path cases: +-- 1. /doom_userplugins.lua +-- 2. /home/user/.config/doom-nvim/doom_userplugins.lua +-- 3. stdpath('config')/doom_userplugins.lua +local ok, ret = pcall(require, "doom_userplugins") +if ok then + M.plugins = ret.plugins + M.source = ret.source +else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_userplugins.lua") + if ok then + M.plugins = ret.plugins + M.source = ret.source + else + log.error("Error while loading doom_userplugins.lua. Traceback:\n" .. ret) + end +end + +return M diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 17f58cada..cbfdb25de 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -7,7 +7,7 @@ local log = require("doom.extras.logging") local utils = require("doom.utils") local system = require("doom.core.system") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config local M = {} @@ -27,14 +27,14 @@ M.check_plugin = function(plugin_name, path) ) == 1 end --- is_plugin_disabled checks if the given plugin is disabled in doomrc +-- is_plugin_disabled checks if the given plugin is disabled in doom_modules.lua -- @tparam string plugin The plugin identifier, e.g. statusline -- @return bool M.is_plugin_disabled = function(plugin) - local doomrc = require("doom.core.config.doomrc").load_doomrc() + local modules = require("doom.core.config.modules").modules - -- Iterate over all doomrc sections (e.g. ui) and their plugins - for _, section in pairs(doomrc) do + -- Iterate over all modules sections (e.g. ui) and their plugins + for _, section in pairs(modules) do if utils.has_value(section, plugin) then return false end @@ -43,7 +43,7 @@ M.is_plugin_disabled = function(plugin) return true end --- Load user-defined settings from the Neovim field in the doomrc +-- Load user-defined settings from the Neovim field in the doom_config.lua -- @param settings_tbl The settings table to iterate over -- @param scope The settings scope, e.g. autocmds M.load_custom_settings = function(settings_tbl, scope) @@ -81,7 +81,7 @@ end -- in the 'doom_config.lua' file. M.reload_custom_settings = function() -- Get the user-defined settings, the 'nvim' field in our 'doom_config.lua' - local custom_settings = require("doom.core.config").load_config().nvim + local custom_settings = require("doom.core.config").config.nvim -- iterate over all the custom settings fields, e.g. global_variables, mappings, etc. for scope, _ in pairs(custom_settings) do M.load_custom_settings(custom_settings[scope], scope) @@ -97,16 +97,7 @@ M.change_colors_and_bg = function() local target_background = vim.opt.background:get() -- Set the correct path for the 'doom_config.lua' file - local doom_config_path - if - utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) - then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep) - elseif - utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) - then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_root, system.sep) - end + local doom_config_path = require("doom.core.config").source if target_colorscheme ~= config.doom.colorscheme then local doom_config = utils.read_file(doom_config_path) @@ -135,7 +126,7 @@ M.change_colors_and_bg = function() end end --- Quit Neovim and change the colorscheme at doomrc if the colorscheme is not the same, +-- Quit Neovim and change the colorscheme at doom_config.lua if the colorscheme is not the same, -- dump all messages to doom.log file -- @tparam bool write If doom should save before exiting -- @tparam bool force If doom should force the exiting @@ -455,17 +446,17 @@ M.edit_config = function() local selected_config = tonumber(vim.fn.inputlist({ "Select a configuration file to edit:", "1. doom_config.lua", - "2. doomrc.lua", - "3. plugins.lua", + "2. doom_modules.lua", + "3. doom_userplugins.lua", })) local open_command = config.doom.new_file_split and "split" or "edit" if selected_config == 1 then - vim.cmd(string.format("%s %s%sdoom_config.lua", open_command, system.doom_root, system.sep)) + vim.cmd(("%s %s"):format(open_command, require("doom.core.config").source)) elseif selected_config == 2 then - vim.cmd(string.format("%s %s%sdoomrc.lua", open_command, system.doom_root, system.sep)) + vim.cmd(("%s %s"):format(open_command, require("doom.core.config.modules").source)) elseif selected_config == 3 then - vim.cmd(string.format("%s %s%splugins.lua", open_command, system.doom_root, system.sep)) + vim.cmd(("%s %s"):format(open_command, require("doom.core.config.userplugins").source)) elseif selected_config ~= 0 then log.error("Invalid option selected.") end diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index 265cb0c23..aa2592393 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -6,17 +6,7 @@ local log = require("doom.extras.logging") local core_modules = { "config", "config.ui", "settings" } for i = 1, #core_modules, 1 do - local ok, err = xpcall(require, debug.traceback, string.format("doom.core.%s", core_modules[i])) - if not ok then - log.error( - string.format( - "There was an error loading the module 'doom.core.%s'. Traceback:\n%s", - core_modules[i], - err - ) - ) - end - + local ok, err = xpcall(require, debug.traceback, ("doom.core.%s"):format(core_modules[i])) if ok then if core_modules[i] == "settings" then -- Neovim configurations, e.g. shiftwidth @@ -26,12 +16,20 @@ for i = 1, #core_modules, 1 do elseif core_modules[i] == "config" then -- Automatically install language servers require("doom.core.config").install_servers( - require("doom.core.config.doomrc").load_doomrc().langs + require("doom.core.config.modules").modules.langs ) -- Automatically install language DAP clients require("doom.core.config").install_dap_clients( - require("doom.core.config.doomrc").load_doomrc().langs + require("doom.core.config.modules").modules.langs ) end + else + log.error( + string.format( + "There was an error loading the module 'doom.core.%s'. Traceback:\n%s", + core_modules[i], + err + ) + ) end end diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index e2e346ac9..fc3083c18 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -6,13 +6,13 @@ local functions = require("doom.core.functions") local log = require("doom.extras.logging") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config local M = {} log.debug("Loading Doom defaults module ...") --- load_default_options sets and loads default Neovim options based on doomrc values +-- load_default_options sets and loads default Neovim options based on doom_config.lua values M.load_default_options = function() ----- Default Neovim configurations -- Set colorscheme @@ -149,7 +149,7 @@ M.custom_options = function() -- can be called by using :DoomRollback vim.cmd('command! DoomRollback lua require("doom.core.functions").rollback_doom()') - -- Load user-defined settings from the Neovim field in the doomrc file + -- Load user-defined settings from the Neovim field in the doom_config.lua file functions.load_custom_settings(config.nvim.autocmds, "autocmds") functions.load_custom_settings(config.nvim.commands, "commands") functions.load_custom_settings(config.nvim.functions, "functions") diff --git a/lua/doom/core/system/init.lua b/lua/doom/core/system/init.lua index afd232f85..9da0fd18e 100644 --- a/lua/doom/core/system/init.lua +++ b/lua/doom/core/system/init.lua @@ -5,43 +5,27 @@ ---[[---------------------------------------]]--- local M = {} +local stdpath = vim.fn.stdpath +local config_dir = stdpath("config"):match(".*[/\\]"):sub(1,-2) --- get_config_dir will get the config path based in the current system, e.g. --- 'C:\Users\JohnDoe\AppData\Local' for windows and '~/.config' for *nix --- @return string -local function get_config_dir() - if string.find(vim.loop.os_uname().sysname, "Windows") then - return os.getenv("USERPROFILE") .. "\\AppData\\Local\\" - end - - return (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME")) - or (os.getenv("HOME") .. "/.config") -end - --- get_separator will return the system paths separator, e.g. \ for Windows and / for *nix --- @return string -local function get_separator() - if vim.loop.os_uname().sysname == "Windows" then - return "\\" - end - - return "/" -end - -M.config_dir = get_config_dir() - -M.sep = get_separator() +M.sep = package.config:sub(1,1) -- The doom-nvim root directory, works as a fallback for looking Doom Nvim configurations -- in case that doom_configs_root directory does not exists. -M.doom_root = string.format("%s%snvim", M.config_dir, M.sep) +M.doom_root = stdpath("config") -- The doom-nvim configurations root directory -M.doom_configs_root = string.format("%s%sdoom-nvim", M.config_dir, M.sep) +M.doom_configs_root = table.concat({config_dir, "doom-nvim"}, M.sep) +local testdir = vim.loop.fs_opendir(M.doom_configs_root) +if testdir then + vim.loop.fs_closedir(testdir) +else + M.doom_configs_root = stdpath("config") +end -- The doom-nvim logs file path -M.doom_logs = vim.fn.stdpath("data") .. string.format("%sdoom.log", M.sep) +M.doom_logs = table.concat({stdpath("data"), "doom.log"}, M.sep) -- The doom-nvim bug report file path -M.doom_report = vim.fn.stdpath("data") .. string.format("%sdoom_report.md", M.sep) +M.doom_report = table.concat({stdpath("data"), "doom_report.md"}, M.sep) -- The git workspace for doom-nvim, e.g. 'git -C /home/JohnDoe/.config/nvim' -M.git_workspace = string.format("git -C %s ", M.doom_root) +M.git_workspace = string.format("git -C %s", stdpath("config")) return M diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 99173199d..7432dba31 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -6,7 +6,7 @@ local utils = require("doom.utils") local log = require("doom.extras.logging") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config log.debug("Loading Doom autocmds module ...") @@ -15,7 +15,7 @@ local autocmds = { -- Compile new plugins changes at save { "BufWritePost", - "*/doom-*.lua,doomrc.lua,plugins.lua", + "*/doom-*.lua,doom_modules.lua,doom_userplugins.lua", "PackerCompile profile=true", }, -- Reload user-defined settings when 'doom_config.lua' file was modified diff --git a/lua/doom/extras/keybindings/init.lua b/lua/doom/extras/keybindings/init.lua index f1953582d..14eb59ee5 100644 --- a/lua/doom/extras/keybindings/init.lua +++ b/lua/doom/extras/keybindings/init.lua @@ -6,7 +6,7 @@ local utils = require("doom.utils") local log = require("doom.extras.logging") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config local functions = require("doom.core.functions") log.debug("Loading Doom keybindings module ...") diff --git a/lua/doom/extras/logging/init.lua b/lua/doom/extras/logging/init.lua index 93229d47c..e46ea033c 100644 --- a/lua/doom/extras/logging/init.lua +++ b/lua/doom/extras/logging/init.lua @@ -9,22 +9,19 @@ ----- CUSTOM SECTION -------------------------------------- ----------------------------------------------------------- -local utils = require("doom.utils") local system = require("doom.core.system") -- logging defaults to "info" level -local doom_config = { - doom = { - logging = "info", - }, -} - --- /home/user/.config/doom-nvim/doom_config.lua -if utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) then - doom_config = dofile(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) -elseif - utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) -then - doom_config = dofile(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) +local logging_level = "info" + +-- Manually load doom_config.lua to avoid circular dependencies +local ok, ret = pcall(require, "doom_config") +if ok then + logging_level = ret.config.doom.logging or logging_level +else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_config.lua") + if ok then + logging_level = ret.config.doom.logging or logging_level + end end ----------------------------------------------------------- @@ -46,7 +43,7 @@ local default_config = { -- Any messages above this level will be logged. -- defaults to info - level = doom_config.doom.logging, + level = logging_level; -- Level configuration modes = { @@ -70,12 +67,7 @@ local unpack = unpack or table.unpack log.new = function(config, standalone) config = vim.tbl_deep_extend("force", default_config, config) - local outfile = string.format( - "%s%s%s.log", - vim.api.nvim_call_function("stdpath", { "data" }), - system.sep, - config.plugin - ) + local outfile = ("%s/%s.log"):format(vim.fn.stdpath("data"), config.plugin) local obj if standalone then diff --git a/lua/doom/modules/built-in/compiler/init.lua b/lua/doom/modules/built-in/compiler/init.lua index 087911f22..f861e949e 100644 --- a/lua/doom/modules/built-in/compiler/init.lua +++ b/lua/doom/modules/built-in/compiler/init.lua @@ -5,7 +5,7 @@ if packer_plugins and packer_plugins["nvim-toggleterm.lua"] then term = require("toggleterm.terminal").Terminal else log.error( - "Doom compiler needs toggleterm plugin, please uncomment the 'terminal' entry in your doomrc" + "Doom compiler needs toggleterm plugin, please uncomment the 'terminal' entry in your doom_modules.lua" ) end diff --git a/lua/doom/modules/built-in/runner/init.lua b/lua/doom/modules/built-in/runner/init.lua index a378ac9ac..1a604d065 100644 --- a/lua/doom/modules/built-in/runner/init.lua +++ b/lua/doom/modules/built-in/runner/init.lua @@ -5,7 +5,7 @@ if packer_plugins and packer_plugins["nvim-toggleterm.lua"] then term = require("toggleterm.terminal").Terminal else log.error( - "Doom runner needs toggleterm plugin, please uncomment the 'terminal' entry in your doomrc" + "Doom runner needs toggleterm plugin, please uncomment the 'terminal' entry in your doom_modules.lua" ) end diff --git a/lua/doom/modules/config/doom-blankline.lua b/lua/doom/modules/config/doom-blankline.lua index 88fa18994..793035354 100644 --- a/lua/doom/modules/config/doom-blankline.lua +++ b/lua/doom/modules/config/doom-blankline.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config require("indent_blankline").setup({ enabled = config.doom.show_indent, diff --git a/lua/doom/modules/config/doom-dashboard.lua b/lua/doom/modules/config/doom-dashboard.lua index b52216f8f..5e57931d5 100644 --- a/lua/doom/modules/config/doom-dashboard.lua +++ b/lua/doom/modules/config/doom-dashboard.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config vim.g.dashboard_session_directory = require("doom.core.system").doom_root .. "/sessions" vim.g.dashboard_default_executive = "telescope" diff --git a/lua/doom/modules/config/doom-eviline.lua b/lua/doom/modules/config/doom-eviline.lua index 973ad7905..0372d91f3 100644 --- a/lua/doom/modules/config/doom-eviline.lua +++ b/lua/doom/modules/config/doom-eviline.lua @@ -1,6 +1,6 @@ return function() local utils = require("doom.utils") - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config local get_color = require("doom.modules.config.doom-eviline-palettes").get_color local bo = vim.bo diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index cf573a815..1ef7a1376 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -1,7 +1,7 @@ return function() local fn = vim.fn local lsp = vim.lsp - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config -- Snippets support local capabilities = lsp.protocol.make_client_capabilities() diff --git a/lua/doom/modules/config/doom-symbols.lua b/lua/doom/modules/config/doom-symbols.lua index 492bb0633..f58992c5c 100644 --- a/lua/doom/modules/config/doom-symbols.lua +++ b/lua/doom/modules/config/doom-symbols.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config vim.g.symbols_outline = { highlight_hovered_item = true, diff --git a/lua/doom/modules/config/doom-toggleterm.lua b/lua/doom/modules/config/doom-toggleterm.lua index 0384b3316..89f9037ae 100644 --- a/lua/doom/modules/config/doom-toggleterm.lua +++ b/lua/doom/modules/config/doom-toggleterm.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config require("toggleterm").setup({ size = config.doom.terminal_height, diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index 0d5c2dbcd..bdf520483 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config local tree_cb = require("nvim-tree.config").nvim_tree_callback -- Empty by default diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 6c262e893..9b8b2ca27 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -1,6 +1,6 @@ return function() local has_value = require("doom.utils").has_value - local doomrc = require("doom.core.config.doomrc").load_doomrc() + local modules = require("doom.core.config.modules").modules local functions = require("doom.core.functions") local function get_ts_parsers(languages) @@ -35,7 +35,7 @@ return function() }, } if packer_plugins and packer_plugins["neorg"] then - table.insert(doomrc.langs, "norg") + table.insert(modules.langs, "norg") end -- Set up treesitter for HTTP @@ -47,14 +47,14 @@ return function() }, } if packer_plugins and packer_plugins["rest.nvim"] then - table.insert(doomrc.langs, "http") + table.insert(modules.langs, "http") end -- macos uses wrong c version require("nvim-treesitter.install").compilers = { "gcc" } require("nvim-treesitter.configs").setup({ - ensure_installed = get_ts_parsers(doomrc.langs), + ensure_installed = get_ts_parsers(modules.langs), highlight = { enable = true }, autopairs = { enable = functions.is_plugin_disabled("autopairs") and false or true, diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 35db525f8..04d3f9f77 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -3,8 +3,6 @@ -- NOTE: We do not provide other LSP integration like coc.nvim, please refer -- to our FAQ to see why. -local utils = require("doom.utils") -local system = require("doom.core.system") local functions = require("doom.core.functions") ---- Packer Bootstrap --------------------------- @@ -496,12 +494,7 @@ packer.startup(function(use) --- Custom Plugins --- -----]]----------------[[----- -- If there are custom plugins then also require them - local custom_plugins - if utils.file_exists(string.format("%s%splugins.lua", system.doom_configs_root, system.sep)) then - custom_plugins = dofile(string.format("%s%splugins.lua", system.doom_configs_root, system.sep)) - else - custom_plugins = dofile(string.format("%s%splugins.lua", system.doom_root, system.sep)) - end + local custom_plugins = require("doom.core.config.userplugins").plugins for _, plug in pairs(custom_plugins or {}) do packer.use(plug) diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 7def3745a..e1be91f65 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -59,13 +59,16 @@ if is_module_available("nvim-mapper") then end else -- Manually load the doom_config.lua file to avoid circular dependencies - local doom_config_path - if M.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep) - elseif M.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_root, system.sep) + local config = {} + local ok, ret = pcall(require, "doom_config") + if ok then + config = ret.config + else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_config.lua") + if ok then + config = ret.config + end end - local config = dofile(doom_config_path) M.map = function(mode, lhs, rhs, opts, _, _, _) local options = config.doom.allow_default_keymaps_overriding and {} or { noremap = true } From d0ae4b5ef9aedd96e5341af3eb3f3ba585f75993 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 2 Sep 2021 00:56:00 +0000 Subject: [PATCH 011/290] chore: format source code --- doom_modules.lua | 36 +++++++++++++------------- lua/doom/core/config/init.lua | 2 +- lua/doom/core/config/modules.lua | 38 ++++++++++++++-------------- lua/doom/core/config/userplugins.lua | 2 +- lua/doom/core/init.lua | 4 +-- lua/doom/core/system/init.lua | 10 ++++---- lua/doom/extras/logging/init.lua | 4 +-- lua/doom/utils/init.lua | 2 +- 8 files changed, 48 insertions(+), 50 deletions(-) diff --git a/doom_modules.lua b/doom_modules.lua index a7cba70b4..9f1608dae 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -15,13 +15,13 @@ M.source = debug.getinfo(1, "S").source:sub(2) M.modules = { ui = { - "dashboard", -- Start screen + "dashboard", -- Start screen -- "doom-themes", -- Additional doom emacs' colorschemes -- "indentlines", -- Show indent lines -- "show_registers", -- popup that shows register contents - "statusline", -- Statusline - "tabline", -- Tabline, shows your buffers list at top - "which-key", -- Keybindings popup menu like Emacs' guide-key + "statusline", -- Statusline + "tabline", -- Tabline, shows your buffers list at top + "which-key", -- Keybindings popup menu like Emacs' guide-key -- "zen", -- Distraction free environment }, doom = { @@ -30,20 +30,20 @@ M.modules = { -- "runner", -- Open a REPL for the current language or run the current file }, editor = { - "autopairs", -- Autopairs - "auto-session", -- A small automated session manager for Neovim - "dap", -- Debug Adapter Protocol + "autopairs", -- Autopairs + "auto-session", -- A small automated session manager for Neovim + "dap", -- Debug Adapter Protocol -- "editorconfig", -- EditorConfig support for Neovim - "explorer", -- Tree explorer - "formatter", -- File formatting - "gitsigns", -- Git signs - "kommentary", -- Comments plugin - "lsp", -- Language Server Protocols + "explorer", -- Tree explorer + "formatter", -- File formatting + "gitsigns", -- Git signs + "kommentary", -- Comments plugin + "lsp", -- Language Server Protocols -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap -- "ranger", -- Ranger File Browser, requires ranger file browser - "snippets", -- LSP snippets - "symbols", -- LSP symbols and tags - "telescope", -- Highly extendable fuzzy finder over lists + "snippets", -- LSP snippets + "symbols", -- LSP symbols and tags + "telescope", -- Highly extendable fuzzy finder over lists -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) }, langs = { @@ -58,7 +58,7 @@ M.modules = { -- "bash", -- The terminal gods language -- "elixir", -- Build scalable and maintainable software - "lua", -- Support for our gods language + "lua", -- Support for our gods language -- "python +lsp", -- Python support + lsp -- "ruby", -- Look ma, I love the gems! @@ -74,14 +74,14 @@ M.modules = { utilities = { -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit -- "neogit", -- Magit for Neovim - "range-highlight", -- hightlights ranges you have entered in commandline + "range-highlight", -- hightlights ranges you have entered in commandline -- "suda", -- Write and read files without sudo permissions }, web = { -- "colorizer", -- Fastest colorizer for Neovim -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config -- "restclient", -- A fast Neovim http client - } + }, } return M diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index e911ce274..bc37e352c 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -411,7 +411,7 @@ if ok then M.config = ret.config M.source = ret.source else - ok, ret = pcall(dofile, system.doom_configs_root.."/doom_config.lua") + ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_config.lua") if ok then M.config = ret.config M.source = ret.source diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua index 715c479f1..a4634955f 100644 --- a/lua/doom/core/config/modules.lua +++ b/lua/doom/core/config/modules.lua @@ -11,13 +11,13 @@ local M = {} M.modules = { ui = { - "dashboard", -- Start screen + "dashboard", -- Start screen -- "doom-themes", -- Additional doom emacs' colorschemes -- "indentlines", -- Show indent lines -- "show_registers", -- popup that shows register contents - "statusline", -- Statusline - "tabline", -- Tabline, shows your buffers list at top - "which-key", -- Keybindings popup menu like Emacs' guide-key + "statusline", -- Statusline + "tabline", -- Tabline, shows your buffers list at top + "which-key", -- Keybindings popup menu like Emacs' guide-key -- "zen", -- Distraction free environment }, doom = { @@ -26,20 +26,20 @@ M.modules = { -- "runner", -- Open a REPL for the current language or run the current file }, editor = { - "autopairs", -- Autopairs - "auto-session", -- A small automated session manager for Neovim - "dap", -- Debug Adapter Protocol + "autopairs", -- Autopairs + "auto-session", -- A small automated session manager for Neovim + "dap", -- Debug Adapter Protocol -- "editorconfig", -- EditorConfig support for Neovim - "explorer", -- Tree explorer - "formatter", -- File formatting - "gitsigns", -- Git signs - "kommentary", -- Comments plugin - "lsp", -- Language Server Protocols + "explorer", -- Tree explorer + "formatter", -- File formatting + "gitsigns", -- Git signs + "kommentary", -- Comments plugin + "lsp", -- Language Server Protocols -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap -- "ranger", -- Ranger File Browser, requires ranger file browser - "snippets", -- LSP snippets - "symbols", -- LSP symbols and tags - "telescope", -- Highly extendable fuzzy finder over lists + "snippets", -- LSP snippets + "symbols", -- LSP symbols and tags + "telescope", -- Highly extendable fuzzy finder over lists -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) }, langs = { @@ -54,7 +54,7 @@ M.modules = { -- "bash", -- The terminal gods language -- "elixir", -- Build scalable and maintainable software - "lua", -- Support for our gods language + "lua", -- Support for our gods language -- "python +lsp", -- Python support + lsp -- "ruby", -- Look ma, I love the gems! @@ -70,14 +70,14 @@ M.modules = { utilities = { -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit -- "neogit", -- Magit for Neovim - "range-highlight", -- hightlights ranges you have entered in commandline + "range-highlight", -- hightlights ranges you have entered in commandline -- "suda", -- Write and read files without sudo permissions }, web = { -- "colorizer", -- Fastest colorizer for Neovim -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config -- "restclient", -- A fast Neovim http client - } + }, } M.source = nil @@ -93,7 +93,7 @@ if ok then M.modules = ret.modules M.source = ret.source else - ok, ret = pcall(dofile, system.doom_configs_root.."/doom_modules.lua") + ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_modules.lua") if ok then M.modules = ret.modules M.source = ret.source diff --git a/lua/doom/core/config/userplugins.lua b/lua/doom/core/config/userplugins.lua index a70f8422c..ba3227d37 100644 --- a/lua/doom/core/config/userplugins.lua +++ b/lua/doom/core/config/userplugins.lua @@ -23,7 +23,7 @@ if ok then M.plugins = ret.plugins M.source = ret.source else - ok, ret = pcall(dofile, system.doom_configs_root.."/doom_userplugins.lua") + ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_userplugins.lua") if ok then M.plugins = ret.plugins M.source = ret.source diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index aa2592393..4e6abd6fa 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -15,9 +15,7 @@ for i = 1, #core_modules, 1 do require("doom.core.settings").custom_options() elseif core_modules[i] == "config" then -- Automatically install language servers - require("doom.core.config").install_servers( - require("doom.core.config.modules").modules.langs - ) + require("doom.core.config").install_servers(require("doom.core.config.modules").modules.langs) -- Automatically install language DAP clients require("doom.core.config").install_dap_clients( require("doom.core.config.modules").modules.langs diff --git a/lua/doom/core/system/init.lua b/lua/doom/core/system/init.lua index 9da0fd18e..7bf9050ba 100644 --- a/lua/doom/core/system/init.lua +++ b/lua/doom/core/system/init.lua @@ -6,15 +6,15 @@ local M = {} local stdpath = vim.fn.stdpath -local config_dir = stdpath("config"):match(".*[/\\]"):sub(1,-2) +local config_dir = stdpath("config"):match(".*[/\\]"):sub(1, -2) -M.sep = package.config:sub(1,1) +M.sep = package.config:sub(1, 1) -- The doom-nvim root directory, works as a fallback for looking Doom Nvim configurations -- in case that doom_configs_root directory does not exists. M.doom_root = stdpath("config") -- The doom-nvim configurations root directory -M.doom_configs_root = table.concat({config_dir, "doom-nvim"}, M.sep) +M.doom_configs_root = table.concat({ config_dir, "doom-nvim" }, M.sep) local testdir = vim.loop.fs_opendir(M.doom_configs_root) if testdir then vim.loop.fs_closedir(testdir) @@ -22,9 +22,9 @@ else M.doom_configs_root = stdpath("config") end -- The doom-nvim logs file path -M.doom_logs = table.concat({stdpath("data"), "doom.log"}, M.sep) +M.doom_logs = table.concat({ stdpath("data"), "doom.log" }, M.sep) -- The doom-nvim bug report file path -M.doom_report = table.concat({stdpath("data"), "doom_report.md"}, M.sep) +M.doom_report = table.concat({ stdpath("data"), "doom_report.md" }, M.sep) -- The git workspace for doom-nvim, e.g. 'git -C /home/JohnDoe/.config/nvim' M.git_workspace = string.format("git -C %s", stdpath("config")) diff --git a/lua/doom/extras/logging/init.lua b/lua/doom/extras/logging/init.lua index e46ea033c..53f2f7d1e 100644 --- a/lua/doom/extras/logging/init.lua +++ b/lua/doom/extras/logging/init.lua @@ -18,7 +18,7 @@ local ok, ret = pcall(require, "doom_config") if ok then logging_level = ret.config.doom.logging or logging_level else - ok, ret = pcall(dofile, system.doom_configs_root.."/doom_config.lua") + ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_config.lua") if ok then logging_level = ret.config.doom.logging or logging_level end @@ -43,7 +43,7 @@ local default_config = { -- Any messages above this level will be logged. -- defaults to info - level = logging_level; + level = logging_level, -- Level configuration modes = { diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index e1be91f65..e96a29de2 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -64,7 +64,7 @@ else if ok then config = ret.config else - ok, ret = pcall(dofile, system.doom_configs_root.."/doom_config.lua") + ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_config.lua") if ok then config = ret.config end From b01c9cb8fad626a0e5af04b1e3b5ecc43d8afdc0 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 1 Sep 2021 22:29:06 -0400 Subject: [PATCH 012/290] fix(ci): avoid formatting `doom_modules.lua` to preserve comments spacing --- .github/workflows/format.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 0f0568355..4a4e76a89 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -2,7 +2,7 @@ name: format on: push: - paths: '**.lua' + paths: "**.lua" branches: [main, develop] jobs: @@ -14,7 +14,7 @@ jobs: uses: JohnnyMorganz/stylua-action@1.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --config-path=./.stylua.toml -g *.lua -g !doomrc.lua -g !lua/colors/**/*.lua -- . + args: --config-path=./.stylua.toml -g *.lua -g !doom_modules.lua -g !lua/colors/**/*.lua -- . - name: Commit files run: | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" From af279b6a70f560d73231c7deb1fdfa13f62c433a Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 1 Sep 2021 22:31:14 -0400 Subject: [PATCH 013/290] fix(modules): update bufferline configs --- lua/doom/modules/config/doom-bufferline.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/doom/modules/config/doom-bufferline.lua b/lua/doom/modules/config/doom-bufferline.lua index 09464e38f..0635279cc 100644 --- a/lua/doom/modules/config/doom-bufferline.lua +++ b/lua/doom/modules/config/doom-bufferline.lua @@ -1,9 +1,9 @@ return function() require("bufferline").setup({ options = { - numbers = "buffer_id", - number_style = "none", - mappings = false, + numbers = function(opts) + return string.format("%s", opts.id) + end, indicator_icon = "▎", buffer_close_icon = "", modified_icon = "●", From 367300e1363c484bdd4358ffc688b6d8121a2187 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 1 Sep 2021 22:33:23 -0400 Subject: [PATCH 014/290] fix(modules): update Neorg treesitter parser files --- lua/doom/modules/config/doom-treesitter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 9b8b2ca27..0d1769249 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -30,7 +30,7 @@ return function() parser_configs.norg = { install_info = { url = "https://github.com/vhyrro/tree-sitter-norg", - files = { "src/parser.c" }, + files = { "src/parser.c", "src/scanner.cc" }, branch = "main", }, } From 3fb772379384a7cad969b2a21c97c8c2c37ed9b0 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 2 Sep 2021 00:52:41 -0400 Subject: [PATCH 015/290] feat: add new languages in `doom_modules` file - Add missing entries for disabling certain plugins - Fixed comments formatting in `doom_modules` - Lazy-load some new plugins --- doom_modules.lua | 41 ++++++++++++++++++++++----------------- lua/doom/modules/init.lua | 14 ++++++++++++- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/doom_modules.lua b/doom_modules.lua index 9f1608dae..13434f086 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -15,13 +15,13 @@ M.source = debug.getinfo(1, "S").source:sub(2) M.modules = { ui = { - "dashboard", -- Start screen + "dashboard", -- Start screen -- "doom-themes", -- Additional doom emacs' colorschemes -- "indentlines", -- Show indent lines -- "show_registers", -- popup that shows register contents - "statusline", -- Statusline - "tabline", -- Tabline, shows your buffers list at top - "which-key", -- Keybindings popup menu like Emacs' guide-key + "statusline", -- Statusline + "tabline", -- Tabline, shows your buffers list at top + "which-key", -- Keybindings popup menu like Emacs' guide-key -- "zen", -- Distraction free environment }, doom = { @@ -30,21 +30,22 @@ M.modules = { -- "runner", -- Open a REPL for the current language or run the current file }, editor = { - "autopairs", -- Autopairs - "auto-session", -- A small automated session manager for Neovim - "dap", -- Debug Adapter Protocol + "autopairs", -- Autopairs + "auto-session", -- A small automated session manager for Neovim + "dap", -- Debug Adapter Protocol -- "editorconfig", -- EditorConfig support for Neovim - "explorer", -- Tree explorer - "formatter", -- File formatting - "gitsigns", -- Git signs - "kommentary", -- Comments plugin - "lsp", -- Language Server Protocols + "explorer", -- Tree explorer + "formatter", -- File formatting + "gitsigns", -- Git signs + "kommentary", -- Comments plugin + "lsp", -- Language Server Protocols -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap -- "ranger", -- Ranger File Browser, requires ranger file browser - "snippets", -- LSP snippets - "symbols", -- LSP symbols and tags - "telescope", -- Highly extendable fuzzy finder over lists + "snippets", -- Code snippets + "symbols", -- LSP symbols and tags + "telescope", -- Highly extendable fuzzy finder over lists -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) + -- "trouble", -- A pretty list to help you solve all the trouble your code is causing. }, langs = { -- To enable the language server for a language just add the +lsp flag @@ -58,28 +59,32 @@ M.modules = { -- "bash", -- The terminal gods language -- "elixir", -- Build scalable and maintainable software - "lua", -- Support for our gods language + "lua", -- Support for our gods language -- "python +lsp", -- Python support + lsp -- "ruby", -- Look ma, I love the gems! + -- "c", -- Core dumped: segmentation fault -- "cpp", -- C++ support -- "go", -- Hello, gopher -- "haskell", -- Because Functional programming is fun, isn't it? -- "java", -- Java support -- "rust +lsp", -- Let's get rusty! + -- "comment", -- Better annotations and comments -- "config", -- Configuration files (JSON, YAML, TOML) -- "dockerfile", -- Do you like containers, right? }, utilities = { -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit -- "neogit", -- Magit for Neovim - "range-highlight", -- hightlights ranges you have entered in commandline + "range-highlight", -- Hightlights ranges you have entered in commandline -- "suda", -- Write and read files without sudo permissions + -- "superman", -- Read Unix man pages faster than a speeding bullet! + -- "todo_comments", -- Highlight, list and search todo comments in your projects }, web = { -- "colorizer", -- Fastest colorizer for Neovim - -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config + -- "firenvim", -- Requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config -- "restclient", -- A fast Neovim http client }, } diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 04d3f9f77..c6355ec65 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -478,17 +478,29 @@ packer.startup(function(use) config = require("doom.modules.config.doom-fire"), }) + local disabled_todo = functions.is_plugin_disabled("todo_comments") use({ "folke/todo-comments.nvim", requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), + disable = disabled_todo, }) + + local disabled_trouble = functions.is_plugin_disabled("trouble") use({ "folke/trouble.nvim", + cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" }, requires = "kyazdani42/nvim-web-devicons", config = require("doom.modules.config.doom-trouble"), + disable = disabled_trouble, + }) + + local disabled_superman = functions.is_plugin_disabled("superman") + use({ + "jez/vim-superman", + cmd = "SuperMan", + disable = disabled_superman, }) - use({ "jez/vim-superman" }) -----[[----------------]]----- --- Custom Plugins --- From c412993ff765bfeea00738be83e5683b50056874 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 2 Sep 2021 16:33:44 -0400 Subject: [PATCH 016/290] feat(modules): add `contrib` entry in `doom_modules.lua` file - `contrib` is intended for Doom Nvim contributors, this entry will install Lua 5.1 and libuv documentation plugins --- doom_modules.lua | 1 + lua/doom/modules/init.lua | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/doom_modules.lua b/doom_modules.lua index 13434f086..17dd9396d 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -26,6 +26,7 @@ M.modules = { }, doom = { -- "compiler", -- Compile (and run) your code with just pressing three keys! + -- "contrib", -- Special plugins intended for Doom Nvim contributors (lua docs, etc) -- "neorg", -- Life Organization Tool -- "runner", -- Open a REPL for the current language or run the current file }, diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index c6355ec65..e36a73cf8 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -430,6 +430,18 @@ packer.startup(function(use) event = "BufWinEnter", }) + local disabled_contrib = functions.is_plugin_disabled("contrib") + -- Lua 5.1 docs + use({ + "milisims/nvim-luaref", + disable = disabled_contrib, + }) + -- LibUV docs + use({ + "nanotee/luv-vimdocs", + disable = disabled_contrib, + }) + -----[[-------------]]----- --- Web Related --- -----]]-------------[[----- From 3a30fbd8092c02505b2bdf320fd1cce46d1057b2 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 2 Sep 2021 17:24:51 -0400 Subject: [PATCH 017/290] feat(modules): add nvim-lint plugin - Require `is_plugin_disabled` function directly instead of requiring the whole functions module --- doom_modules.lua | 3 +- lua/doom/extras/autocmds/init.lua | 10 ++++ lua/doom/modules/config/doom-lint.lua | 16 ++++++ lua/doom/modules/init.lua | 81 +++++++++++++++------------ 4 files changed, 73 insertions(+), 37 deletions(-) create mode 100644 lua/doom/modules/config/doom-lint.lua diff --git a/doom_modules.lua b/doom_modules.lua index 17dd9396d..aa0b99342 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -39,11 +39,12 @@ M.modules = { "formatter", -- File formatting "gitsigns", -- Git signs "kommentary", -- Comments plugin + -- "linter", -- Asynchronous linter, see errors in your code on the fly "lsp", -- Language Server Protocols -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap -- "ranger", -- Ranger File Browser, requires ranger file browser "snippets", -- Code snippets - "symbols", -- LSP symbols and tags + -- "symbols", -- LSP symbols and tags "telescope", -- Highly extendable fuzzy finder over lists -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) -- "trouble", -- A pretty list to help you solve all the trouble your code is causing. diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 7432dba31..0a6ec713f 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -7,6 +7,7 @@ local utils = require("doom.utils") local log = require("doom.extras.logging") local config = require("doom.core.config").config +local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled log.debug("Loading Doom autocmds module ...") @@ -120,5 +121,14 @@ if config.doom.preserve_edit_pos then }) end +-- Linting +if not is_plugin_disabled("linter") then + table.insert(autocmds["doom_extras"], { + "BufWritePost,InsertLeave,TextChanged", + "*", + "lua require('lint').try_lint()", + }) +end + -- Create augroups utils.create_augroups(autocmds) diff --git a/lua/doom/modules/config/doom-lint.lua b/lua/doom/modules/config/doom-lint.lua new file mode 100644 index 000000000..7a011ed49 --- /dev/null +++ b/lua/doom/modules/config/doom-lint.lua @@ -0,0 +1,16 @@ +return function() + require("lint").linters_by_ft = { + c = { "clangtidy" }, + cpp = { "cppcheck" }, + css = { "stylelint" }, + html = { "tidy", "eslint" }, + javascript = { "eslint" }, + lua = { "luacheck" }, + markdown = { "vale", "markdownlint" }, + nix = { "nix" }, + python = { "pylint", "flake8", "pycodestyle" }, + ruby = { "ruby", "standardrb" }, + sh = { "shellcheck" }, + typescript = { "eslint" }, + } +end diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index e36a73cf8..f6b4ec8c0 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -3,7 +3,7 @@ -- NOTE: We do not provide other LSP integration like coc.nvim, please refer -- to our FAQ to see why. -local functions = require("doom.core.functions") +local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled ---- Packer Bootstrap --------------------------- ------------------------------------------------- @@ -69,7 +69,7 @@ packer.startup(function(use) }) -- Neorg - local disabled_neorg = functions.is_plugin_disabled("neorg") + local disabled_neorg = is_plugin_disabled("neorg") use({ "vhyrro/neorg", branch = "unstable", @@ -79,7 +79,7 @@ packer.startup(function(use) }) -- Sessions - local disabled_sessions = functions.is_plugin_disabled("auto-session") + local disabled_sessions = is_plugin_disabled("auto-session") use({ "folke/persistence.nvim", config = require("doom.modules.config.doom-persistence"), @@ -91,7 +91,7 @@ packer.startup(function(use) --- UI Related --- -----]]------------[[----- -- Fancy start screen - local disabled_dashboard = functions.is_plugin_disabled("dashboard") + local disabled_dashboard = is_plugin_disabled("dashboard") use({ "glepnir/dashboard-nvim", config = require("doom.modules.config.doom-dashboard"), @@ -99,7 +99,7 @@ packer.startup(function(use) }) -- Doom Colorschemes - local disabled_doom_themes = functions.is_plugin_disabled("doom-themes") + local disabled_doom_themes = is_plugin_disabled("doom-themes") use({ "GustavoPrietoP/doom-themes.nvim", disable = disabled_doom_themes, @@ -113,7 +113,7 @@ packer.startup(function(use) }) -- File tree - local disabled_tree = functions.is_plugin_disabled("explorer") + local disabled_tree = is_plugin_disabled("explorer") use({ "kyazdani42/nvim-tree.lua", requires = "nvim-web-devicons", @@ -130,7 +130,7 @@ packer.startup(function(use) }) -- Ranger File Browser - local disabled_ranger = functions.is_plugin_disabled("ranger") + local disabled_ranger = is_plugin_disabled("ranger") use({ "francoiscabrol/ranger.vim", requires = "rbgrouleff/bclose.vim", @@ -139,7 +139,7 @@ packer.startup(function(use) -- Statusline -- can be disabled to use your own statusline - local disabled_statusline = functions.is_plugin_disabled("statusline") + local disabled_statusline = is_plugin_disabled("statusline") use({ "glepnir/galaxyline.nvim", config = require("doom.modules.config.doom-eviline"), @@ -149,7 +149,7 @@ packer.startup(function(use) -- Tabline -- can be disabled to use your own tabline - local disabled_tabline = functions.is_plugin_disabled("tabline") + local disabled_tabline = is_plugin_disabled("tabline") use({ "akinsho/nvim-bufferline.lua", config = require("doom.modules.config.doom-bufferline"), @@ -159,7 +159,7 @@ packer.startup(function(use) -- Better terminal -- can be disabled to use your own terminal plugin - local disabled_terminal = functions.is_plugin_disabled("terminal") + local disabled_terminal = is_plugin_disabled("terminal") use({ "akinsho/nvim-toggleterm.lua", config = require("doom.modules.config.doom-toggleterm"), @@ -170,7 +170,7 @@ packer.startup(function(use) }) -- Viewer & finder for LSP symbols and tags - local disabled_outline = functions.is_plugin_disabled("symbols") + local disabled_outline = is_plugin_disabled("symbols") use({ "simrat39/symbols-outline.nvim", config = require("doom.modules.config.doom-symbols"), @@ -184,7 +184,7 @@ packer.startup(function(use) -- Minimap -- Depends on wfxr/code-minimap to work! - local disabled_minimap = functions.is_plugin_disabled("minimap") + local disabled_minimap = is_plugin_disabled("minimap") use({ "wfxr/minimap.vim", disable = disabled_minimap, @@ -198,7 +198,7 @@ packer.startup(function(use) }) -- Keybindings menu like Emacs's guide-key - local disabled_whichkey = functions.is_plugin_disabled("which-key") + local disabled_whichkey = is_plugin_disabled("which-key") use({ "folke/which-key.nvim", opt = true, @@ -207,14 +207,14 @@ packer.startup(function(use) }) -- popup that shows contents of each register - local disabled_show_registers = functions.is_plugin_disabled("show_registers") + local disabled_show_registers = is_plugin_disabled("show_registers") use({ "tversteeg/registers.nvim", disable = disabled_show_registers, }) -- Distraction free environment - local disabled_zen = functions.is_plugin_disabled("zen") + local disabled_zen = is_plugin_disabled("zen") use({ "kdav5758/TrueZen.nvim", config = require("doom.modules.config.doom-zen"), @@ -235,7 +235,7 @@ packer.startup(function(use) module = "popup", }) - local disabled_telescope = functions.is_plugin_disabled("telescope") + local disabled_telescope = is_plugin_disabled("telescope") use({ "nvim-telescope/telescope.nvim", cmd = "Telescope", @@ -267,7 +267,7 @@ packer.startup(function(use) -----]]-------------[[----- -- Git gutter better alternative, written in Lua -- can be disabled to use your own git gutter plugin - local disabled_gitsigns = functions.is_plugin_disabled("gitsigns") + local disabled_gitsigns = is_plugin_disabled("gitsigns") use({ "lewis6991/gitsigns.nvim", config = require("doom.modules.config.doom-gitsigns"), @@ -277,7 +277,7 @@ packer.startup(function(use) }) -- Neogit - local disabled_neogit = functions.is_plugin_disabled("neogit") + local disabled_neogit = is_plugin_disabled("neogit") use({ "TimUntersberger/neogit", config = function() @@ -289,7 +289,7 @@ packer.startup(function(use) }) -- LazyGit integration - local disabled_lazygit = functions.is_plugin_disabled("lazygit") + local disabled_lazygit = is_plugin_disabled("lazygit") use({ "kdheepak/lazygit.nvim", requires = "plenary.nvim", @@ -300,7 +300,7 @@ packer.startup(function(use) -----[[------------]]----- --- Completion --- -----]]------------[[----- - local disabled_lsp = functions.is_plugin_disabled("lsp") + local disabled_lsp = is_plugin_disabled("lsp") -- Built-in LSP Config use({ "neovim/nvim-lspconfig", @@ -326,7 +326,7 @@ packer.startup(function(use) }) -- Snippets - local disabled_snippets = functions.is_plugin_disabled("snippets") + local disabled_snippets = is_plugin_disabled("snippets") use({ "L3MON4D3/LuaSnip", config = require("doom.modules.config.doom-luasnip"), @@ -353,7 +353,7 @@ packer.startup(function(use) -----[[-----------]]----- --- Debugging --- -----]]-----------[[----- - local disabled_dap = functions.is_plugin_disabled("dap") + local disabled_dap = is_plugin_disabled("dap") use({ "mfussenegger/nvim-dap", disable = disabled_dap, @@ -378,7 +378,7 @@ packer.startup(function(use) -----]]--------------[[----- -- Write / Read files without permissions (e.vim.g. /etc files) without having -- to use `sudo nvim /path/to/file` - local disabled_suda = functions.is_plugin_disabled("suda") + local disabled_suda = is_plugin_disabled("suda") use({ "lambdalisue/suda.vim", disable = disabled_suda, @@ -387,7 +387,7 @@ packer.startup(function(use) -- File formatting -- can be disabled to use your own file formatter - local disabled_formatter = functions.is_plugin_disabled("formatter") + local disabled_formatter = is_plugin_disabled("formatter") use({ "lukas-reineke/format.nvim", config = require("doom.modules.config.doom-format"), @@ -395,9 +395,18 @@ packer.startup(function(use) event = "BufWinEnter", }) + -- Linting + local disabled_linter = is_plugin_disabled("linter") + use({ + "mfussenegger/nvim-lint", + config = require("doom.modules.config.doom-lint"), + disable = disabled_linter, + event = "BufWinEnter", + }) + -- Autopairs -- can be disabled to use your own autopairs - local disabled_autopairs = functions.is_plugin_disabled("autopairs") + local disabled_autopairs = is_plugin_disabled("autopairs") use({ "windwp/nvim-autopairs", config = require("doom.modules.config.doom-autopairs"), @@ -406,7 +415,7 @@ packer.startup(function(use) }) -- Indent Lines - local disabled_indent_lines = functions.is_plugin_disabled("indentlines") + local disabled_indent_lines = is_plugin_disabled("indentlines") use({ "lukas-reineke/indent-blankline.nvim", config = require("doom.modules.config.doom-blankline"), @@ -415,7 +424,7 @@ packer.startup(function(use) }) -- EditorConfig support - local disabled_editorconfig = functions.is_plugin_disabled("editorconfig") + local disabled_editorconfig = is_plugin_disabled("editorconfig") use({ "editorconfig/editorconfig-vim", disable = disabled_editorconfig, @@ -423,14 +432,14 @@ packer.startup(function(use) -- Comments -- can be disabled to use your own comments plugin - local disabled_kommentary = functions.is_plugin_disabled("kommentary") + local disabled_kommentary = is_plugin_disabled("kommentary") use({ "b3nj5m1n/kommentary", disable = disabled_kommentary, event = "BufWinEnter", }) - local disabled_contrib = functions.is_plugin_disabled("contrib") + local disabled_contrib = is_plugin_disabled("contrib") -- Lua 5.1 docs use({ "milisims/nvim-luaref", @@ -446,7 +455,7 @@ packer.startup(function(use) --- Web Related --- -----]]-------------[[----- -- Fastest colorizer without external dependencies! - local disabled_colorizer = functions.is_plugin_disabled("colorizer") + local disabled_colorizer = is_plugin_disabled("colorizer") use({ "norcalli/nvim-colorizer.lua", config = require("doom.modules.config.doom-colorizer"), @@ -456,7 +465,7 @@ packer.startup(function(use) -- HTTP Client support -- Depends on bayne/dot-http to work! - local disabled_restclient = functions.is_plugin_disabled("restclient") + local disabled_restclient = is_plugin_disabled("restclient") use({ "NTBBloodbath/rest.nvim", requires = "plenary.nvim", @@ -467,7 +476,7 @@ packer.startup(function(use) event = "BufWinEnter", }) - local disabled_range_highlight = functions.is_plugin_disabled("range-highlight") + local disabled_range_highlight = is_plugin_disabled("range-highlight") use({ "winston0410/range-highlight.nvim", requires = { @@ -480,7 +489,7 @@ packer.startup(function(use) event = "BufRead", }) - local disabled_firenvim = functions.is_plugin_disabled("firenvim") + local disabled_firenvim = is_plugin_disabled("firenvim") use({ "glacambre/firenvim", disable = disabled_firenvim, @@ -490,7 +499,7 @@ packer.startup(function(use) config = require("doom.modules.config.doom-fire"), }) - local disabled_todo = functions.is_plugin_disabled("todo_comments") + local disabled_todo = is_plugin_disabled("todo_comments") use({ "folke/todo-comments.nvim", requires = "nvim-lua/plenary.nvim", @@ -498,7 +507,7 @@ packer.startup(function(use) disable = disabled_todo, }) - local disabled_trouble = functions.is_plugin_disabled("trouble") + local disabled_trouble = is_plugin_disabled("trouble") use({ "folke/trouble.nvim", cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" }, @@ -507,7 +516,7 @@ packer.startup(function(use) disable = disabled_trouble, }) - local disabled_superman = functions.is_plugin_disabled("superman") + local disabled_superman = is_plugin_disabled("superman") use({ "jez/vim-superman", cmd = "SuperMan", From b6d5a1a0c61ce8ca2e86dd799cffddea8476c008 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 2 Sep 2021 17:26:25 -0400 Subject: [PATCH 018/290] chore: bump Doom Nvim version to `3.2.0-beta1` --- lua/doom/utils/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index e96a29de2..74c584044 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -9,7 +9,7 @@ local system = require("doom.core.system") -------------------- HELPERS -------------------- -- Doom Nvim version -M.doom_version = "3.1.0" +M.doom_version = "3.2.0-beta1" -- file_exists checks if the given file exists -- @tparam string path The path to the file From d092b44aba055a8fd2b593f38cf04811c111750b Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 2 Sep 2021 17:48:53 -0400 Subject: [PATCH 019/290] fix: proper conditional for triggering dashboard-nvim plugin (re-apply) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 22527fc3f..70bea7106 100644 --- a/init.lua +++ b/init.lua @@ -47,7 +47,7 @@ vim.defer_fn(function() -- If the current buffer name is empty then trigger Dashboard. -- NOTE: this is done to avoid some weird issues with Dashboard and -- number / signcolumn when Dashboard gets triggered automatically - if vim.api.nvim_buf_get_name(0):len() == 0 then + if (vim.api.nvim_buf_get_name(0):len() == 0) and packer_plugins["dashboard-nvim"] then vim.cmd("Dashboard") end end From a4bee984897d49115a9bf33d1abfe5f1056d92ad Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 2 Sep 2021 18:52:53 -0400 Subject: [PATCH 020/290] fix(autocmds): small linting fix, less aggresive linting --- lua/doom/extras/autocmds/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 0a6ec713f..37529637e 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -122,10 +122,10 @@ if config.doom.preserve_edit_pos then end -- Linting -if not is_plugin_disabled("linter") then +if not is_plugin_disabled("linter") and packer_plugins and packer_plugins["nvim-lint"] then table.insert(autocmds["doom_extras"], { - "BufWritePost,InsertLeave,TextChanged", - "*", + "BufWritePost", + "", "lua require('lint').try_lint()", }) end From 50f1e1d35389a1c73775419729ce285c6ab7c887 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 7 Sep 2021 03:35:05 -0400 Subject: [PATCH 021/290] feat(doom-one): pull upstream changes --- lua/colors/doom-one/init.lua | 162 +++++++++++++++++------------------ 1 file changed, 80 insertions(+), 82 deletions(-) diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua index dfd6462e3..29bc67c15 100644 --- a/lua/colors/doom-one/init.lua +++ b/lua/colors/doom-one/init.lua @@ -331,8 +331,8 @@ high_link('Todo', 'TextWarningBold') local main_syntax = { Tag = { fg = tag, gui = 'bold' }, - Link = { fg = tag, gui = 'undercurl' }, - URL = { fg = green, gui = 'undercurl' }, + Link = { fg = green, gui = 'underline' }, + URL = { fg = green, gui = 'underline' }, Underlined = { fg = tag, gui = 'underline' }, Comment = { @@ -490,86 +490,78 @@ apply_highlight(barbar) -- https://github.com/NTBBloodbath/doom-one.nvim/issues/8#issuecomment-883737667 -- for more information about this if transparent_bg then - local bufferline = { - BufferLineTab = { fg = fg, bg = bg }, - BufferLineTabClose = { fg = fg, bg = bg, gui = 'bold' }, - BufferLineTabSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, - BufferLineBackground = { fg = fg_alt, bg = bg }, - BufferLineBufferSelected = { fg = fg, bg = bg, gui = 'bold,italic' }, - BufferLineBufferVisible = { fg = fg, bg = bg }, - BufferLineCloseButton = { fg = fg_alt, bg = bg }, - BufferLineCloseButtonSelected = { fg = fg, bg = bg, gui = 'bold' }, - BufferLineCloseButtonVisible = { fg = fg, bg = bg }, - BufferLineModified = { fg = green, bg = bg }, - BufferLineModifiedSelected = { fg = green, bg = bg }, - BufferLineModifiedVisible = { fg = green, bg = bg }, - BufferLineFill = { fg = blue, bg = bg_alt }, - BufferLineIndicatorSelected = { fg = blue, bg = bg }, - BufferLineSeparator = { fg = base0, bg = bg }, - BufferLineSeparatorSelected = { fg = base0, bg = bg }, - BufferLineSeparatorVisible = { fg = base0, bg = bg_alt }, - BufferLinePick = { fg = fg, bg = bg, gui = 'bold' }, - BufferLinePickSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, - BufferLinePickVisible = { fg = fg, bg = bg_alt }, - - BufferLineDiagnostic = { fg = fg, bg = bg, sp = fg }, - BufferLineDiagnosticSelected = { fg = fg, bg = bg, sp = fg }, - BufferLineDiagnosticVisible = { fg = fg, bg = bg, sp = fg }, - - BufferLineInfo = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, - BufferLineInfoSelected = { - fg = cyan, - bg = bg, - sp = cyan, - gui = 'bold,italic', - }, - BufferLineInfoVisible = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, - BufferLineInfoDiagnostic = { fg = cyan, bg = bg, sp = cyan }, - BufferLineInfoDiagnosticSelected = { fg = cyan, bg = bg, sp = cyan }, - BufferLineInfoDiagnosticVisible = { fg = cyan, bg = bg, sp = cyan }, - BufferLineError = { fg = red, bg = bg, sp = red, gui = 'bold' }, - BufferLineErrorSelected = { - fg = red, - bg = bg, - sp = red, - gui = 'bold,italic', - }, - BufferLineErrorVisible = { fg = red, bg = bg, sp = red, gui = 'bold' }, - BufferLineErrorDiagnostic = { fg = red, bg = bg, sp = red }, - BufferLineErrorDiagnosticSelected = { fg = red, bg = bg, sp = red }, - BufferLineErrorDiagnosticVisible = { fg = red, bg = bg, sp = red }, - BufferLineWarning = { - fg = yellow, - bg = bg, - sp = yellow, - gui = 'bold,italic', - }, - BufferLineWarningSelected = { - fg = yellow, - bg = bg, - sp = yellow, - gui = 'bold,italic', - }, - BufferLineWarningVisible = { - fg = yellow, - bg = bg, - sp = yellow, - gui = 'bold', - }, - BufferLineWarningDiagnostic = { fg = yellow, bg = bg, sp = yellow }, - BufferLineWarningDiagnosticSelected = { - fg = yellow, - bg = bg, - sp = yellow, - }, - BufferLineWarningDiagnosticVisible = { - fg = yellow, - bg = bg, - sp = yellow, - }, - } - - apply_highlight(bufferline) + local bufferline = { + BufferLineTab = { fg = fg, bg = bg }, + BufferLineTabClose = { fg = fg, bg = bg, gui = 'bold' }, + BufferLineTabSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, + BufferLineBackground = { fg = fg_alt, bg = bg }, + BufferLineBufferSelected = { fg = fg, bg = bg, gui = 'bold,italic' }, + BufferLineBufferVisible = { fg = fg, bg = bg }, + BufferLineCloseButton = { fg = fg_alt, bg = bg }, + BufferLineCloseButtonSelected = { fg = fg, bg = bg, gui = 'bold' }, + BufferLineCloseButtonVisible = { fg = fg, bg = bg }, + BufferLineModified = { fg = green, bg = bg }, + BufferLineModifiedSelected = { fg = green, bg = bg }, + BufferLineModifiedVisible = { fg = green, bg = bg }, + BufferLineFill = { fg = blue, bg = bg_alt }, + BufferLineIndicatorSelected = { fg = blue, bg = bg }, + BufferLineSeparator = { fg = base0, bg = bg }, + BufferLineSeparatorSelected = { fg = base0, bg = bg }, + BufferLineSeparatorVisible = { fg = base0, bg = bg_alt }, + BufferLinePick = { fg = fg, bg = bg, gui = 'bold' }, + BufferLinePickSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, + BufferLinePickVisible = { fg = fg, bg = bg_alt }, + + BufferLineDiagnostic = { fg = fg, bg = bg, sp = fg }, + BufferLineDiagnosticSelected = { fg = fg, bg = bg, sp = fg }, + BufferLineDiagnosticVisible = { fg = fg, bg = bg, sp = fg }, + + BufferLineInfo = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, + BufferLineInfoSelected = { + fg = cyan, + bg = bg, + sp = cyan, + gui = 'bold,italic', + }, + BufferLineInfoVisible = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, + BufferLineInfoDiagnostic = { fg = cyan, bg = bg, sp = cyan }, + BufferLineInfoDiagnosticSelected = { fg = cyan, bg = bg, sp = cyan }, + BufferLineInfoDiagnosticVisible = { fg = cyan, bg = bg, sp = cyan }, + BufferLineError = { fg = red, bg = bg, sp = red, gui = 'bold' }, + BufferLineErrorSelected = { + fg = red, + bg = bg, + sp = red, + gui = 'bold,italic', + }, + BufferLineErrorVisible = { fg = red, bg = bg, sp = red, gui = 'bold' }, + BufferLineErrorDiagnostic = { fg = red, bg = bg, sp = red }, + BufferLineErrorDiagnosticSelected = { fg = red, bg = bg, sp = red }, + BufferLineErrorDiagnosticVisible = { fg = red, bg = bg, sp = red }, + BufferLineWarning = { + fg = yellow, + bg = bg, + sp = yellow, + gui = 'bold,italic', + }, + BufferLineWarningSelected = { + fg = yellow, + bg = bg, + sp = yellow, + gui = 'bold,italic', + }, + BufferLineWarningVisible = { + fg = yellow, + bg = bg, + sp = yellow, + gui = 'bold', + }, + BufferLineWarningDiagnostic = { fg = yellow, bg = bg, sp = yellow }, + BufferLineWarningDiagnosticSelected = { fg = yellow, bg = bg, sp = yellow }, + BufferLineWarningDiagnosticVisible = { fg = yellow, bg = bg, sp = yellow }, + } + + apply_highlight(bufferline) end -- }}} @@ -805,6 +797,12 @@ high_link('LspLinesDiagBorder', 'Bold') -- TreeSitter {{{ if vim.g.doom_one_enable_treesitter then + -- We will set a special definition for TSStrike here + local treesitter = { + TSStrike = { fg = utils.Darken(violet, 0.2), cterm = 'strikethrough', gui = 'strikethrough' }, + } + + apply_highlight(treesitter) high_link('TSException', 'Exception') high_link('TSAnnotation', 'PreProc') high_link('TSAttribute', 'Attribute') From af8be09d3101a484fffdd11a515ae27c5950257b Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 7 Sep 2021 03:52:17 -0400 Subject: [PATCH 022/290] feat(modules): update nvim-tree setup, improve some icons --- lua/doom/modules/config/doom-tree.lua | 46 +++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index bdf520483..68f353f63 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -1,43 +1,66 @@ return function() local config = require("doom.core.config").config + local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled + local tree_cb = require("nvim-tree.config").nvim_tree_callback -- Empty by default vim.g.nvim_tree_ignore = { ".git", "node_modules", ".cache", "__pycache__" } + -- False by default, opens the tree when typing `vim $DIR` or `vim` vim.g.nvim_tree_auto_open = 0 + -- False by default, closes the tree when it is the last window vim.g.nvim_tree_auto_close = 0 + -- False by default, closes the tree when you open a file vim.g.nvim_tree_quit_on_open = 1 + -- False by default, this option allows the cursor to be updated when entering a buffer vim.g.nvim_tree_follow = 1 + + -- False by default, will update the path of the current dir if the file is not inside the tree. + vim.g.nvim_tree_follow_update_path = 1 + -- False by default, this option shows indent markers when folders are open vim.g.nvim_tree_indent_markers = 1 + -- Show hidden files vim.g.nvim_tree_hide_dotfiles = config.doom.show_hidden + -- Set tree width vim.g.nvim_tree_width = config.doom.sidebar_width + -- False by default, will enable file highlight for git attributes (can be used without the icons). vim.g.nvim_tree_git_hl = 1 + -- This is the default. See :help filename-modifiers for more options vim.g.nvim_tree_root_folder_modifier = ":~" + -- False by default, will open the tree when entering a new tab and the tree was previously open vim.g.nvim_tree_tab_open = 1 + -- False by default, will not resize the tree when opening a file vim.g.nvim_tree_width_allow_resize = 1 + -- False by default, append a trailing slash to folder names vim.g.nvim_tree_add_trailing = 1 + -- False by default, compact folders that only contain a single folder into one node in the file tree vim.g.nvim_tree_group_empty = 1 - --- Tree icons + + -- False by default, will show lsp diagnostics in the signcolumn. See :help nvim_tree_lsp_diagnostics + vim.g.nvim_tree_lsp_diagnostics = is_plugin_disabled("lsp") and 0 or 1 + -- If false, do not show the icons for one of 'git' 'folder' and 'files' -- true by default, notice that if 'files' is 1, it will only display -- if nvim-web-devicons is installed and on your runtimepath - vim.g.nvim_tree_show_icons = { git = 1, folders = 1, files = 1 } + vim.g.nvim_tree_show_icons = { git = 1, folders = 1, files = 1, folder_arrows = 0 } if config.doom.explorer_right then vim.g.nvim_tree_side = "right" end + + --- Tree keybindings -- You can edit keybindings be defining this variable -- You don't have to define all keys. -- NOTE: the 'edit' key will wrap/unwrap a folder and open a file @@ -70,19 +93,24 @@ return function() { key = "q", cb = tree_cb("close") }, } + --- Tree icons -- default will show icon by default if no icon is provided -- default shows no icon by default vim.g.nvim_tree_icons = { default = "", symlink = "", git = { - unstaged = "✗", - staged = "✓", + unstaged = "", + staged = "", unmerged = "", - renamed = "➜", - untracked = "★", + renamed = "", + untracked = "", + deleted = "", + ignored = "◌", }, folder = { + arrow_open = "", + arrow_closed = "", default = "", open = "", empty = "", @@ -90,6 +118,12 @@ return function() symlink = "", symlink_open = "", }, + lsp = { + hint = config.doom.lsp_hint, + info = config.doom.lsp_information, + warning = config.doom.lsp_warning, + error = config.doom.lsp_error, + }, } -- Make sure nvim-tree loads itself when lazy loaded From 8c9c003c30adec5aa61131c5bc80f9103d305124 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 7 Sep 2021 06:14:42 -0400 Subject: [PATCH 023/290] feat: implement `keybinds_modules` in `doom_config.lua`, enable or disable Doom keybindings modules as you wish - Modularize keybindings - Improve error handling for luasnip keybinds --- doom_config.lua | 15 + lua/doom/extras/keybindings/completion.lua | 191 ++++ lua/doom/extras/keybindings/core.lua | 95 ++ lua/doom/extras/keybindings/init.lua | 1111 +------------------- lua/doom/extras/keybindings/leader.lua | 689 ++++++++++++ lua/doom/extras/keybindings/movement.lua | 139 +++ 6 files changed, 1146 insertions(+), 1094 deletions(-) create mode 100644 lua/doom/extras/keybindings/completion.lua create mode 100644 lua/doom/extras/keybindings/core.lua create mode 100644 lua/doom/extras/keybindings/leader.lua create mode 100644 lua/doom/extras/keybindings/movement.lua diff --git a/doom_config.lua b/doom_config.lua index 2148eb807..9dff109d7 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -190,6 +190,21 @@ M.config = { -- @default = true dashboard_statline = true, + -- Set the keybindings modules that you want to use + -- false : disables keybindings module + -- true : enables keybindings module + keybinds_modules = { + -- Core doom keybindings + core = true, + -- Movement keybindings, jump between your windows, buffers and code + movement = true, + -- Leader keybindings, a bunch of useful keybindings managed by space key + -- WARNING: disabling this will break which-key plugin if the plugin is enabled + leader = true, + -- Completion and snippets keybindings + completion = true, + }, + -- Default indent size -- @default = 4 indent = 4, diff --git a/lua/doom/extras/keybindings/completion.lua b/lua/doom/extras/keybindings/completion.lua new file mode 100644 index 000000000..ca67e9b8a --- /dev/null +++ b/lua/doom/extras/keybindings/completion.lua @@ -0,0 +1,191 @@ +---[[-----------------]]--- +-- LSP Keybindings -- +---]]-----------------[[--- + +local utils = require("doom.utils") +local check_plugin = require("doom.core.functions").check_plugin + +local opts = { silent = true } +local lsp_opts = vim.tbl_extend("force", opts, { expr = true }) + +-- If the LSP is not disabled and compe is installed then set its mappings. +if check_plugin("nvim-compe", "opt") then + -- https://github.com/hrsh7th/nvim-compe#mappings + utils.map( + "i", + "", + "compe#complete()", + lsp_opts, + "Completion", + "compe_complete", + "Complete" + ) + utils.map( + "i", + "", + 'compe#confirm("")', + lsp_opts, + "Completion", + "compe_confirm", + "Confirm completion" + ) + utils.map( + "i", + "", + 'compe#close("")', + lsp_opts, + "Completion", + "compe_close", + "Close compe menu" + ) + utils.map( + "i", + "", + 'compe#scroll({ "delta": +4 })', + lsp_opts, + "Completion", + "compe_indent", + "Indent current line" + ) + utils.map( + "i", + "", + 'compe#scroll({ "delta": -4 })', + lsp_opts, + "Completion", + "compe_dedent", + "Dedent current line" + ) + -- gd: jump to definition + utils.map( + "n", + "gd", + ":lua vim.lsp.buf.definition()", + opts, + "LSP", + "jump_to_definition", + "Jump to definition" + ) + -- gr: go to reference + utils.map( + "n", + "gr", + ":lua vim.lsp.buf.references()", + opts, + "LSP", + "goto_reference", + "Goto reference" + ) + -- gi: buf implementation + utils.map( + "n", + "gi", + ":lua vim.lsp.buf.implementation()", + opts, + "LSP", + "goto_implementation", + "List implementations" + ) + -- ca: code actions + utils.map( + "n", + "ca", + ":lua vim.lsp.buf.code_action()", + opts, + "LSP", + "code_action", + "Code action" + ) + -- K: hover doc + utils.map( + "n", + "K", + ":lua vim.lsp.buf.hover()", + opts, + "LSP", + "hover_doc", + "Hover documentation" + ) + -- Control+p: Jump to previous diagnostic + utils.map( + "n", + "", + ":lua vim.lsp.diagnostic.goto_prev()", + opts, + "LSP", + "prev_diagnostic", + "Jump to previous diagnostic" + ) + -- Control+n: Jump to next diagnostic + utils.map( + "n", + "", + ":lua vim.lsp.diagnostic.goto_next()", + opts, + "LSP", + "next_diagnostic", + "Jump to next diagnostic" + ) + + vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') +end + +-- LuaSnip mappings +if check_plugin("LuaSnip", "opt") then + utils.map( + "n", + "", + 'luasnip#expand_or_jumpable() ? "luasnip-expand-or-jump" : ""', + lsp_opts, + "Snippets", + "luasnip_expand", + "Expand snippet" + ) + utils.map( + "i", + "", + 'lua require("luasnip").jump(-1)', + opts, + "Snippets", + "luasnip_prev_sel", + "Previous snippet" + ) + + utils.map( + "s", + "", + 'lua require("luasnip").jump(1)', + opts, + "Snippets", + "luasnip_next_sel", + "Next snippet" + ) + utils.map( + "s", + "", + 'lua require("luasnip").jump(-1)', + opts, + "Snippets", + "luasnip_prev_sel_s", + "Previous snippet (Select mode)" + ) + + utils.map( + "i", + "", + 'luasnip#choice_active() ? "luasnip-next-choice" : ""', + lsp_opts, + "Snippets", + "luasnip_next_choice", + "Next snippets field" + ) + utils.map( + "s", + "", + 'luasnip#choice_active() ? "luasnip-next-choice" : ""', + lsp_opts, + "Snippets", + "luasnip_next_choice_s", + "Next snippet field" + ) +end diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua new file mode 100644 index 000000000..8e401c593 --- /dev/null +++ b/lua/doom/extras/keybindings/core.lua @@ -0,0 +1,95 @@ +local utils = require("doom.utils") +local config = require("doom.core.config").config +local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled + +-- Additional options for mappings +local opts = { silent = true } + +-- Set Space key as leader +utils.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu") +vim.g.mapleader = " " + +-- Fast exit from Doom Nvim +utils.map( + "n", + "ZZ", + 'lua require("doom.core.functions").quit_doom(true, true)', + opts, + "Editor", + "fast_exit", + "Fast exit from Doom Nvim" +) + +-- ESC to turn off search highlighting +utils.map("n", "", ":noh", opts, "Editor", "no_highlight", "Turn off search highlighting") + +---[[-----------------]]--- +-- Disable keys -- +---]]-----------------[[--- +-- Disable accidentally pressing ctrl-z and suspending +utils.map("n", "", "", opts, "Editor", "disable_suspending", "Disable suspending") + +-- Disable ex mode +utils.map("n", "Q", "", opts, "Editor", "disable_ex", "Disable ex mode") + +-- Disable recording macros +if config.doom.disable_macros then + utils.map("n", "q", "", opts, "Editor", "disable_macros", "Disable macros") +end + +---[[-----------------]]--- +-- Escape Remaps -- +---]]-----------------[[--- +utils.map("i", "jk", "", opts, "Editor", "exit_insert", "Exit insert mode") +utils.map("i", "kj", "", opts, "Editor", "exit_insert_alt", "Exit insert mode") + +---[[-----------------]]--- +-- Make inclusive -- +---]]-----------------[[--- +-- BUG: my nvim freezes from this when which key shows up +-- NOTE: IMO inclusive is better +-- utils.map("o", "T", "vT", opts, "Editor", "occurence_backw_inclusive", "Backwards occurence inclusive") +-- utils.map("o", "F", "vF", opts, "Editor", "occurence_backw_till_inclusive", "Backwards occurence till inclusive") + +---[[------------------]]--- +-- F keybindings -- +---]]------------------[[--- +if not is_plugin_disabled("symbols") then + utils.map( + "n", + "", + ":SymbolsOutline", + opts, + "Editor", + "open_symbols", + "Toggle SymbolsOutline (LSP tags)" + ) +end +if not is_plugin_disabled("explorer") then + utils.map("n", "", ":NvimTreeToggle", opts, "Editor", "open_tree", "Toggle file explorer") +end +if not is_plugin_disabled("minimap") then + utils.map( + "n", + "", + ":MinimapToggle", + opts, + "Editor", + "open_minimap", + "Toggle code minimap" + ) +end +if not is_plugin_disabled("zen") then + utils.map("n", "", ":TZAtaraxis", opts, "Editor", "open_zen", "Toggle Zen mode") +end +if not is_plugin_disabled("restclient") then + utils.map( + "n", + "", + ":RestNvim", + opts, + "Editor", + "exec_http", + "Execute http client under cursor" + ) +end diff --git a/lua/doom/extras/keybindings/init.lua b/lua/doom/extras/keybindings/init.lua index 14eb59ee5..ac3644c18 100644 --- a/lua/doom/extras/keybindings/init.lua +++ b/lua/doom/extras/keybindings/init.lua @@ -4,19 +4,11 @@ -- License: GPLv2 -- ---[[---------------------------------------]]--- -local utils = require("doom.utils") local log = require("doom.extras.logging") local config = require("doom.core.config").config -local functions = require("doom.core.functions") log.debug("Loading Doom keybindings module ...") --- Additional options for mappings -local opts = { silent = true } - -utils.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu") -vim.g.mapleader = " " - ------------------------------------------------- ---[[---------------------------------]]--- @@ -28,7 +20,7 @@ vim.g.mapleader = " " -- p = Plugin Menu -- -- r = Runner Menu -- -- s = Session Menu -- --- t = Toggle Menu -- +-- o = Open Menu -- -- w = Window Menu -- -- -- -- TAB = Cycle buffers -- @@ -43,1089 +35,20 @@ vim.g.mapleader = " " ------------------------------------------------- ----[[-----------------]]--- --- LSP Keybindings -- ----]]-----------------[[--- - -local lsp_opts = vim.tbl_extend("force", opts, { expr = true }) - --- If the LSP is not disabled and compe is installed then set its mappings. -if functions.check_plugin("nvim-compe", "opt") then - -- https://github.com/hrsh7th/nvim-compe#mappings - utils.map( - "i", - "", - "compe#complete()", - lsp_opts, - "Completion", - "compe_complete", - "Complete" - ) - utils.map( - "i", - "", - 'compe#confirm("")', - lsp_opts, - "Completion", - "compe_confirm", - "Confirm completion" - ) - utils.map( - "i", - "", - 'compe#close("")', - lsp_opts, - "Completion", - "compe_close", - "Close compe menu" - ) - utils.map( - "i", - "", - 'compe#scroll({ "delta": +4 })', - lsp_opts, - "Completion", - "compe_indent", - "Indent current line" - ) - utils.map( - "i", - "", - 'compe#scroll({ "delta": -4 })', - lsp_opts, - "Completion", - "compe_dedent", - "Dedent current line" - ) - -- gd: jump to definition - utils.map( - "n", - "gd", - ":lua vim.lsp.buf.definition()", - opts, - "LSP", - "jump_to_definition", - "Jump to definition" - ) - -- gr: go to reference - utils.map( - "n", - "gr", - ":lua vim.lsp.buf.references()", - opts, - "LSP", - "goto_reference", - "Goto reference" - ) - -- gi: buf implementation - utils.map( - "n", - "gi", - ":lua vim.lsp.buf.implementation()", - opts, - "LSP", - "goto_implementation", - "List implementations" - ) - -- ca: code actions - utils.map( - "n", - "ca", - ":lua vim.lsp.buf.code_action()", - opts, - "LSP", - "code_action", - "Code action" - ) - -- K: hover doc - utils.map( - "n", - "K", - ":lua vim.lsp.buf.hover()", - opts, - "LSP", - "hover_doc", - "Hover documentation" - ) - -- Control+p: Jump to previous diagnostic - utils.map( - "n", - "", - ":lua vim.lsp.diagnostic.goto_prev()", - opts, - "LSP", - "prev_diagnostic", - "Jump to previous diagnostic" - ) - -- Control+n: Jump to next diagnostic - utils.map( - "n", - "", - ":lua vim.lsp.diagnostic.goto_next()", - opts, - "LSP", - "next_diagnostic", - "Jump to next diagnostic" - ) - - vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') -end - --- LuaSnip mappings -utils.map( - "n", - "", - 'luasnip#expand_or_jumpable() ? "luasnip-expand-or-jump" : ""', - lsp_opts, - "Snippets", - "luasnip_expand", - "Expand snippet" -) -utils.map( - "i", - "", - 'lua require("luasnip").jump(-1)', - opts, - "Snippets", - "luasnip_prev_sel", - "Previous snippet" -) - -utils.map( - "s", - "", - 'lua require("luasnip").jump(1)', - opts, - "Snippets", - "luasnip_next_sel", - "Next snippet" -) -utils.map( - "s", - "", - 'lua require("luasnip").jump(-1)', - opts, - "Snippets", - "luasnip_prev_sel_s", - "Previous snippet (Select mode)" -) - -utils.map( - "i", - "", - 'luasnip#choice_active() ? "luasnip-next-choice" : ""', - lsp_opts, - "Snippets", - "luasnip_next_choice", - "Next snippets field" -) -utils.map( - "s", - "", - 'luasnip#choice_active() ? "luasnip-next-choice" : ""', - lsp_opts, - "Snippets", - "luasnip_next_choice_s", - "Next snippet field" -) - -if config.doom.new_file_split then - utils.map( - "n", - "fn", - ":new", - opts, - "Editor", - "new_buffer", - "Open a new unnamed buffer" - ) -else - utils.map( - "n", - "fn", - ":enew", - opts, - "Editor", - "new_buffer_split", - "Open a new unnamed buffer in a split window" - ) -end - --- TAB to cycle buffers too, why not? -utils.map("n", "", ":bnext", opts, "Movement", "cycle_next_buffer", "Goto next buffer") -utils.map( - "n", - "", - ":bprevious", - opts, - "Movement", - "cycle_prev_buffer", - "Goto prev buffer" -) - --- ESC to turn off search highlighting -utils.map("n", "", ":noh", opts, "Editor", "no_highlight", "Turn off search highlighting") - ---- F keybindings -if not functions.is_plugin_disabled("symbols") then - utils.map( - "n", - "", - ":SymbolsOutline", - opts, - "Editor", - "open_symbols", - "Toggle SymbolsOutline (LSP tags)" - ) -end -if not functions.is_plugin_disabled("explorer") then - utils.map("n", "", ":NvimTreeToggle", opts, "Editor", "open_tree", "Toggle file explorer") -end -if not functions.is_plugin_disabled("minimap") then - utils.map( - "n", - "", - ":MinimapToggle", - opts, - "Editor", - "open_minimap", - "Toggle code minimap" - ) -end -if not functions.is_plugin_disabled("zen") then - utils.map("n", "", ":TZAtaraxis", opts, "Editor", "open_zen", "Toggle Zen mode") -end -if not functions.is_plugin_disabled("restclient") then - utils.map( - "n", - "", - ":RestNvim", - opts, - "Editor", - "exec_http", - "Execute http client under cursor" - ) +local keybinds_modules = config.doom.keybinds_modules or { + -- Core doom keybindings + core = true, + -- Movement keybindings, jump between your windows, buffers and code + movement = true, + -- Leader keybindings, a bunch of useful keybindings managed by space key + -- WARNING: disabling this will break which-key plugin if the plugin is enabled + leader = true, + -- Completion and snippets keybindings + completion = true, +} + +for module in pairs(keybinds_modules) do + if keybinds_modules[module] then + require(string.format("doom.extras.keybindings.%s", module)) + end end - ----[[-------------------------]]--- --- Window Movements keys -- ----]]-------------------------]]--- -utils.map("n", "", "h", opts, "Movement", "left_window", "Goto left window") -utils.map("n", "", "j", opts, "Movement", "down_window", "Goto down window") -utils.map("n", "", "k", opts, "Movement", "up_window", "Goto upper window") -utils.map("n", "", "l", opts, "Movement", "right_window", "Goto right window") - ----[[-----------------]]--- --- Escape Remaps -- ----]]-----------------[[--- -utils.map("i", "jk", "", opts, "Editor", "exit_insert", "Exit insert mode") - ----[[-----------------]]--- --- Make inclusive -- ----]]-----------------[[--- --- BUG: my nvim freezes from this when which key shows up --- NOTE: IMO inclusive is better --- utils.map("o", "T", "vT", opts, "Editor", "occurence_backw_inclusive", "Backwards occurence inclusive") --- utils.map("o", "F", "vF", opts, "Editor", "occurence_backw_till_inclusive", "Backwards occurence till inclusive") - ----[[-----------------]]--- --- Move Lines -- ----]]-----------------[[--- -utils.map( - "n", - "", - ":m .+1==", - opts, - "Editor", - "normal_move_line_down", - "Normal Move line down" -) -utils.map( - "n", - "", - ":m .-2==", - opts, - "Editor", - "normal_move_line_up", - "Normal Move line up" -) -utils.map( - "i", - "", - ":m .+1==gi", - opts, - "Editor", - "instert_move_line_down", - "Insert Move line down" -) -utils.map( - "i", - "", - ":m .-2==gi", - opts, - "Editor", - "instert_move_line_up", - "Insert Move line up" -) -utils.map( - "v", - "", - ":m '>+1gv=gv", - opts, - "Editor", - "visual_move_line_down", - "Visual Move line down" -) -utils.map( - "v", - "", - ":m '<-2gv=gv", - opts, - "Editor", - "visual_move_line_up", - "Visual Move line up" -) - ----[[-----------------]]--- --- Select Movement -- ----]]-----------------[[--- -utils.map("x", "K", ":move '<-2gv-gv", opts, "Editor", "select_right", "Move selection right") -utils.map("x", "J", ":move '>+1gv-gv", opts, "Editor", "select_left", "Move selection left") - --- get out of terminal insert mode into normal mode with Esc -utils.map( - "t", - "", - "", - opts, - "Editor", - "exit_insert_term", - "Exit insert mode (inside a terminal)" -) - ----[[-----------------]]--- --- Resizing Splits -- ----]]-----------------[[--- -utils.map( - "n", - "", - ":resize +2", - opts, - "Window", - "resize_up", - "Resize window (increase width)" -) -utils.map( - "n", - "", - ":resize -2", - opts, - "Window", - "resize_down", - "Resize window (decrease width)" -) -utils.map( - "n", - "", - ":vertical resize -2", - opts, - "Window", - "resize_right", - "Resize window (decrease height)" -) -utils.map( - "n", - "", - ":vertical resize +2", - opts, - "Window", - "resize_left", - "Resize window (increase height)" -) - ----[[-----------------]]--- --- Disable keys -- ----]]-----------------[[--- --- Disable accidentally pressing ctrl-z and suspending -utils.map("n", "", "", opts, "Editor", "disable_suspending", "Disable suspending") - --- Disable ex mode -utils.map("n", "Q", "", opts, "Editor", "disable_ex", "Disable ex mode") - --- Disable recording macros -if config.doom.disable_macros then - utils.map("n", "q", "", opts, "Editor", "disable_macros", "Disable macros") -end - --- Fast exit from Doom Nvim -utils.map( - "n", - "ZZ", - 'lua require("doom.core.functions").quit_doom(true, true)', - opts, - "Editor", - "fast_exit", - "Fast exit from Doom Nvim" -) - ----[[-----------------]]--- --- WhichKey binds -- ----]]-----------------[[--- - --- Misc -utils.map( - "n", - "`", - "Telescope find_files", - opts, - "Editor", - "find_files", - "Find file" -) -utils.map( - "n", - ".", - "Telescope file_browser", - opts, - "Editor", - "file_browser", - "Browse files" -) -utils.map( - "n", - ",", - "Telescope buffers show_all_buffers=true", - opts, - "Movement", - "switch_buffers", - "Switch buffers" -) -utils.map( - "n", - "/", - "Telescope live_grep", - opts, - "Editor", - "live_grep", - "Search a word" -) -utils.map( - "n", - ":", - "Telescope command_history", - opts, - "Editor", - "command_history", - "Command history" -) - --- Buffers -utils.map( - "n", - "bc", - 'lua require("bufferline").handle_close_buffer(vim.fn.bufnr("%"))', - opts, - "Buffer", - "close_current_buffer", - "Close current buffer" -) -utils.map( - "n", - "bb", - "e #", - opts, - "Buffer", - "switch_buffer", - "Switch to other buffer" -) -utils.map( - "n", - "b]", - 'lua require("bufferline").cycle(1)', - opts, - "Buffer", - "next_buffer_alt", - "Goto next buffer" -) -utils.map( - "n", - "bn", - 'lua require("bufferline").cycle(1)', - opts, - "Buffer", - "next_buffer", - "Goto next buffer" -) -utils.map( - "n", - "bg", - 'lua require("bufferline").pick_buffer()', - opts, - "Buffer", - "goto_buffer", - "Goto buffer" -) -utils.map( - "n", - "b[", - 'lua require("bufferline").cycle(-1)', - opts, - "Buffer", - "prev_buffer_alt", - "Goto previous buffer" -) -utils.map( - "n", - "bp", - 'lua require("bufferline").cycle(-1)', - opts, - "Buffer", - "prev_buffer", - "Goto previous buffer" -) -utils.map( - "n", - "bf", - "FormatWrite", - opts, - "Buffer", - "format_buffer", - "Format buffer" -) - --- Doom -utils.map( - "n", - "dc", - 'lua require("doom.core.functions").edit_config()', - opts, - "Doom", - "edit_doom_config", - "Edit Doom configuration" -) -utils.map( - "n", - "dd", - "help doom_nvim", - opts, - "Doom", - "help_doom", - "Open Doom help pages" -) -utils.map("n", "du", "DoomUpdate", opts, "Doom", "update_doom", "Update Doom Nvim") -utils.map( - "n", - "dr", - "DoomRollback", - opts, - "Doom", - "rollback_doom", - "Rollback Doom Nvim version" -) -utils.map( - "n", - "dR", - 'lua require("doom.core.functions").create_report()', - opts, - "Doom", - "create_crash_report", - "Create crash report" -) -utils.map( - "n", - "ds", - "lua require('telescope.builtin.internal').colorscheme({enable_preview = true})", - opts, - "Editor", - "change_colorscheme", - "Change colorscheme" -) -utils.map( - "n", - "db", - "Telescope mapper", - opts, - "Doom", - "show_keybindings", - "Show Doom keybindings" -) -utils.map( - "n", - "dl", - "lua require('doom.core.functions').reload_custom_settings()", - opts, - "Doom", - "reload_user_settings", - "Reload user custom settings" -) - --- Plugins -utils.map( - "n", - "ps", - "PackerSync", - opts, - "Plugins", - "packer_sync", - "Synchronize your plugins" -) -utils.map( - "n", - "pi", - "PackerInstall", - opts, - "Plugins", - "packer_install", - "Install missing plugins" -) -utils.map( - "n", - "pc", - "PackerClean", - opts, - "Plugins", - "packer_clean", - "Clean unused plugins" -) -utils.map( - "n", - "pC", - "PackerCompile", - opts, - "Plugins", - "packer_compile", - "Compile your plugins changes" -) -utils.map( - "n", - "pS", - "PackerStatus", - opts, - "Plugins", - "packer_status", - "Plugins status" -) -utils.map( - "n", - "pp", - "PackerProfile", - opts, - "Plugins", - "packer_profile", - "Profile the time taken loading your plugins" -) - --- files -utils.map( - "n", - "fc", - "e $MYVIMRC", - opts, - "Editor", - "edit_vimrc", - "Edit your Neovim rc" -) -utils.map( - "n", - "ff", - "Telescope find_files", - opts, - "Editor", - "find_files_alt", - "Find files" -) - -utils.map( - "n", - "fr", - "Telescope oldfiles", - opts, - "Editor", - "recent_files", - "Recently opened files" -) -utils.map( - "n", - "ft", - "Telescope help_tags", - opts, - "Editor", - "help_tags", - "Help tags" -) -utils.map( - "n", - "fR", - "SudaRead", - opts, - "Editor", - "read_sudo", - "Re-open file with sudo permissions" -) -utils.map( - "n", - "fw", - "SudaWrite", - opts, - "Editor", - "write_sudo", - "Write file with sudo permissions" -) - --- search -utils.map( - "n", - "sg", - "Telescope live_grep", - opts, - "Editor", - "live_grep_alt", - "Search a word" -) -utils.map( - "n", - "sb", - "Telescope current_buffer_fuzzy_find", - opts, - "Editor", - "fzf", - "Search in buffer" -) -utils.map( - "n", - "ss", - "Telescope lsp_document_symbols", - opts, - "LSP", - "lsp_symbols", - "Goto symbol" -) -utils.map( - "n", - "sh", - "Telescope command_history", - opts, - "Editor", - "command_history_alt", - "Command history" -) -utils.map( - "n", - "sm", - "Telescope marks", - opts, - "Editor", - "jump_mark", - "Jump to mark" -) - --- windows -utils.map("n", "ww", "p", opts, "Window", "other_window", "Goto other window") -utils.map("n", "wd", "c", opts, "Window", "close_window", "Close current window") -utils.map("n", "w-", "s", opts, "Window", "split_below", "Split window below") -utils.map("n", "w|", "v", opts, "Window", "split_right", "Split window right") -utils.map("n", "w2", "v", opts, "Window", "double_layout", "Layout double columns") -utils.map("n", "wh", "h", opts, "Window", "window_left", "Window left") -utils.map("n", "wj", "j", opts, "Window", "window_below", "Window below") -utils.map("n", "wl", "l", opts, "Window", "window_right", "Window right") -utils.map("n", "wk", "k", opts, "Window", "window_up", "Window up") -utils.map("n", "wH", "5<", opts, "Window", "expand_window_left", "Expand window left") -utils.map( - "n", - "wJ", - "resize +5", - opts, - "Window", - "expand_window_below", - "Expand window below" -) -utils.map( - "n", - "wL", - "5>", - opts, - "Window", - "expand_window_right", - "Expand window right" -) -utils.map( - "n", - "wK", - "resize -5", - opts, - "Window", - "expand_window_up", - "Expand window up" -) -utils.map("n", "w=", "=", opts, "Window", "balance_window", "Balance window") -utils.map("n", "ws", "s", opts, "Window", "split_below_alt", "Split window below") -utils.map("n", "wv", "v", opts, "Window", "split_right_alt", "Split window right") - --- quit / sessions -utils.map( - "n", - "qq", - 'lua require("doom.core.functions").quit_doom()', - opts, - "Editor", - "save_nvim", - "Exit Neovim" -) -utils.map( - "n", - "qw", - 'lua require("doom.core.functions").quit_doom(true, true)', - opts, - "Editor", - "save_exit_nvim", - "Save and exit Neovim" -) -utils.map( - "n", - "qr", - "lua require('persistence').load({ last = true })", - opts, - "Editor", - "restore_session", - "Restore previously saved session" -) - --- toggle -utils.map( - "n", - "ob", - "lua require('dapui').toggle()", - opts, - "Editor", - "open_dapui", - "Open debugging UI" -) -utils.map( - "n", - "od", - "Dashboard", - opts, - "Editor", - "open_dashboard", - "Open start screen" -) -utils.map( - "n", - "oe", - "NvimTreeToggle", - opts, - "Editor", - "open_tree_alt", - "Toggle file explorer" -) -utils.map( - "n", - "om", - "MinimapToggle", - opts, - "Editor", - "open_minimap_alt", - "Toggle code minimap" -) -utils.map( - "n", - "or", - "Ranger", - opts, - "Editor", - "open_ranger_browser", - "Toggle Ranger File Browser" -) -utils.map( - "n", - "os", - "SymbolsOutline", - opts, - "Editor", - "open_symbols_alt", - "Toggle SymbolsOutline (LSP symbols)" -) -utils.map( - "n", - "ot", - "ToggleTerm", - opts, - "Editor", - "open_terminal", - "Toggle terminal" -) - --- git -utils.map("n", "go", "LazyGit", opts, "Git", "lazygit", "Open LazyGit") -utils.map( - "n", - "gl", - 'TermExec cmd="git pull"', - opts, - "Git", - "git_pull", - "Pull remote changes" -) -utils.map( - "n", - "gp", - 'TermExec cmd="git push"', - opts, - "Git", - "git_push", - "Push git changes" -) -utils.map( - "n", - "gs", - "Telescope git_status", - opts, - "Git", - "git_status", - "Browse git status" -) -utils.map( - "n", - "gB", - "Telescope git_branches", - opts, - "Git", - "git_branches", - "Browse git branches" -) -utils.map( - "n", - "gc", - "Telescope git_commits", - opts, - "Git", - "git_commits", - "Browse git commits" -) - --- code -utils.map( - "n", - "ch", - "RestNvim", - opts, - "Editor", - "exec_http_alt", - "Execute http client under cursor" -) -utils.map( - "n", - "ci", - 'lua require("doom.modules.built-in.runner").start_repl()', - opts, - "Editor", - "start_repl", - "Start a REPL" -) -utils.map( - "n", - "cr", - 'lua require("doom.modules.built-in.runner").run_code()', - opts, - "Editor", - "run_file", - "Run the current file" -) -utils.map( - "n", - "cb", - 'lua require("doom.modules.built-in.compiler").compile()', - opts, - "Editor", - "compile", - "Compile project" -) -utils.map( - "n", - "cc", - 'lua require("doom.modules.built-in.compiler").compile_and_run()', - opts, - "Editor", - "compile_and_run", - "Compile and run project" -) - --- debugging -utils.map( - "n", - "cde", - "lua require('dapui').eval()", - opts, - "DAP", - "dap_eval", - "Evaluate word under cursor" -) -utils.map( - "v", - "cds", - "lua require('dapui').eval()", - opts, - "DAP", - "dap_eval_selection", - "Evaluate selection" -) - --- lsp -utils.map("n", "cli", "LspInfo", opts, "LSP", "lsp_info", "LSP Information") -utils.map( - "n", - "cla", - "lua vim.lsp.buf.code_action()", - opts, - "LSP", - "code_action_alt", - "Code actions" -) -utils.map( - "n", - "cld", - "lua vim.lsp.buf.type_definition()", - opts, - "LSP", - "type_definition", - "Show type definition" -) -utils.map( - "n", - "cll", - "lua vim.lsp.diagnostic.show_line_diagnostics()", - opts, - "LSP", - "line_diagnostic", - "Show line diagnostics" -) -utils.map( - "n", - "clq", - "lua vim.lsp.diagnostic.set_loclist()", - opts, - "LSP", - "diagnostic_list", - "Diagnostics into location list" -) - --- jumps -utils.map("n", "ja", "", opts, "Jumps", "jump_alternate_file", "Alternate file") -utils.map("n", "jj", "", opts, "Jumps", "jump_older", "Jump to older pos") -utils.map("n", "jk", "", opts, "Jumps", "jump_newer", "Jump to newer pos") -utils.map("n", "jp", ":pop", opts, "Jumps", "jump_pop_tag", "Pop from tag stack") -utils.map( - "n", - "jt", - ":tag", - opts, - "Jumps", - "jump_folow_tag", - "Follow tag / add to stack" -) --- save -utils.map("n", "v", "w", opts, "Save", "save_left", "Save v") -utils.map("n", "m", "w", opts, "Save", "save_right", "Save m") - --- man pages -utils.map("n", "h", ":Man ", { silent = false }, "Man page", "man_page", "Man page") diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua new file mode 100644 index 000000000..6bacb6a79 --- /dev/null +++ b/lua/doom/extras/keybindings/leader.lua @@ -0,0 +1,689 @@ +---[[-----------------]]--- +-- WhichKey binds -- +---]]-----------------[[--- + +local utils = require("doom.utils") +local config = require("doom.core.config").config + +-- Additional options for mappings +local opts = { silent = true } + +if config.doom.new_file_split then + utils.map( + "n", + "fn", + ":new", + opts, + "Editor", + "new_buffer", + "Open a new unnamed buffer" + ) +else + utils.map( + "n", + "fn", + ":enew", + opts, + "Editor", + "new_buffer_split", + "Open a new unnamed buffer in a split window" + ) +end + +-- Misc +utils.map( + "n", + "`", + "Telescope find_files", + opts, + "Editor", + "find_files", + "Find file" +) +utils.map( + "n", + ".", + "Telescope file_browser", + opts, + "Editor", + "file_browser", + "Browse files" +) +utils.map( + "n", + ",", + "Telescope buffers show_all_buffers=true", + opts, + "Movement", + "switch_buffers", + "Switch buffers" +) +utils.map( + "n", + "/", + "Telescope live_grep", + opts, + "Editor", + "live_grep", + "Search a word" +) +utils.map( + "n", + ":", + "Telescope command_history", + opts, + "Editor", + "command_history", + "Command history" +) + +-- Buffers +utils.map( + "n", + "bc", + 'lua require("bufferline").handle_close_buffer(vim.fn.bufnr("%"))', + opts, + "Buffer", + "close_current_buffer", + "Close current buffer" +) +utils.map( + "n", + "bb", + "e #", + opts, + "Buffer", + "switch_buffer", + "Switch to other buffer" +) +utils.map( + "n", + "b]", + 'lua require("bufferline").cycle(1)', + opts, + "Buffer", + "next_buffer_alt", + "Goto next buffer" +) +utils.map( + "n", + "bn", + 'lua require("bufferline").cycle(1)', + opts, + "Buffer", + "next_buffer", + "Goto next buffer" +) +utils.map( + "n", + "bg", + 'lua require("bufferline").pick_buffer()', + opts, + "Buffer", + "goto_buffer", + "Goto buffer" +) +utils.map( + "n", + "b[", + 'lua require("bufferline").cycle(-1)', + opts, + "Buffer", + "prev_buffer_alt", + "Goto previous buffer" +) +utils.map( + "n", + "bp", + 'lua require("bufferline").cycle(-1)', + opts, + "Buffer", + "prev_buffer", + "Goto previous buffer" +) +utils.map( + "n", + "bf", + "FormatWrite", + opts, + "Buffer", + "format_buffer", + "Format buffer" +) + +-- Doom +utils.map( + "n", + "dc", + 'lua require("doom.core.functions").edit_config()', + opts, + "Doom", + "edit_doom_config", + "Edit Doom configuration" +) +utils.map( + "n", + "dd", + "help doom_nvim", + opts, + "Doom", + "help_doom", + "Open Doom help pages" +) +utils.map("n", "du", "DoomUpdate", opts, "Doom", "update_doom", "Update Doom Nvim") +utils.map( + "n", + "dr", + "DoomRollback", + opts, + "Doom", + "rollback_doom", + "Rollback Doom Nvim version" +) +utils.map( + "n", + "dR", + 'lua require("doom.core.functions").create_report()', + opts, + "Doom", + "create_crash_report", + "Create crash report" +) +utils.map( + "n", + "ds", + "lua require('telescope.builtin.internal').colorscheme({enable_preview = true})", + opts, + "Editor", + "change_colorscheme", + "Change colorscheme" +) +utils.map( + "n", + "db", + "Telescope mapper", + opts, + "Doom", + "show_keybindings", + "Show Doom keybindings" +) +utils.map( + "n", + "dl", + "lua require('doom.core.functions').reload_custom_settings()", + opts, + "Doom", + "reload_user_settings", + "Reload user custom settings" +) + +-- Plugins +utils.map( + "n", + "ps", + "PackerSync", + opts, + "Plugins", + "packer_sync", + "Synchronize your plugins" +) +utils.map( + "n", + "pi", + "PackerInstall", + opts, + "Plugins", + "packer_install", + "Install missing plugins" +) +utils.map( + "n", + "pc", + "PackerClean", + opts, + "Plugins", + "packer_clean", + "Clean unused plugins" +) +utils.map( + "n", + "pC", + "PackerCompile", + opts, + "Plugins", + "packer_compile", + "Compile your plugins changes" +) +utils.map( + "n", + "pS", + "PackerStatus", + opts, + "Plugins", + "packer_status", + "Plugins status" +) +utils.map( + "n", + "pp", + "PackerProfile", + opts, + "Plugins", + "packer_profile", + "Profile the time taken loading your plugins" +) + +-- files +utils.map( + "n", + "fc", + "e $MYVIMRC", + opts, + "Editor", + "edit_vimrc", + "Edit your Neovim rc" +) +utils.map( + "n", + "ff", + "Telescope find_files", + opts, + "Editor", + "find_files_alt", + "Find files" +) + +utils.map( + "n", + "fr", + "Telescope oldfiles", + opts, + "Editor", + "recent_files", + "Recently opened files" +) +utils.map( + "n", + "ft", + "Telescope help_tags", + opts, + "Editor", + "help_tags", + "Help tags" +) +utils.map( + "n", + "fR", + "SudaRead", + opts, + "Editor", + "read_sudo", + "Re-open file with sudo permissions" +) +utils.map( + "n", + "fw", + "SudaWrite", + opts, + "Editor", + "write_sudo", + "Write file with sudo permissions" +) + +-- search +utils.map( + "n", + "sg", + "Telescope live_grep", + opts, + "Editor", + "live_grep_alt", + "Search a word" +) +utils.map( + "n", + "sb", + "Telescope current_buffer_fuzzy_find", + opts, + "Editor", + "fzf", + "Search in buffer" +) +utils.map( + "n", + "ss", + "Telescope lsp_document_symbols", + opts, + "LSP", + "lsp_symbols", + "Goto symbol" +) +utils.map( + "n", + "sh", + "Telescope command_history", + opts, + "Editor", + "command_history_alt", + "Command history" +) +utils.map( + "n", + "sm", + "Telescope marks", + opts, + "Editor", + "jump_mark", + "Jump to mark" +) + +-- windows +utils.map("n", "ww", "p", opts, "Window", "other_window", "Goto other window") +utils.map("n", "wd", "c", opts, "Window", "close_window", "Close current window") +utils.map("n", "w-", "s", opts, "Window", "split_below", "Split window below") +utils.map("n", "w|", "v", opts, "Window", "split_right", "Split window right") +utils.map("n", "w2", "v", opts, "Window", "double_layout", "Layout double columns") +utils.map("n", "wh", "h", opts, "Window", "window_left", "Window left") +utils.map("n", "wj", "j", opts, "Window", "window_below", "Window below") +utils.map("n", "wl", "l", opts, "Window", "window_right", "Window right") +utils.map("n", "wk", "k", opts, "Window", "window_up", "Window up") +utils.map("n", "wH", "5<", opts, "Window", "expand_window_left", "Expand window left") +utils.map( + "n", + "wJ", + "resize +5", + opts, + "Window", + "expand_window_below", + "Expand window below" +) +utils.map( + "n", + "wL", + "5>", + opts, + "Window", + "expand_window_right", + "Expand window right" +) +utils.map( + "n", + "wK", + "resize -5", + opts, + "Window", + "expand_window_up", + "Expand window up" +) +utils.map("n", "w=", "=", opts, "Window", "balance_window", "Balance window") +utils.map("n", "ws", "s", opts, "Window", "split_below_alt", "Split window below") +utils.map("n", "wv", "v", opts, "Window", "split_right_alt", "Split window right") + +-- quit / sessions +utils.map( + "n", + "qq", + 'lua require("doom.core.functions").quit_doom()', + opts, + "Editor", + "save_nvim", + "Exit Neovim" +) +utils.map( + "n", + "qw", + 'lua require("doom.core.functions").quit_doom(true, true)', + opts, + "Editor", + "save_exit_nvim", + "Save and exit Neovim" +) +utils.map( + "n", + "qr", + "lua require('persistence').load({ last = true })", + opts, + "Editor", + "restore_session", + "Restore previously saved session" +) + +-- toggle +utils.map( + "n", + "ob", + "lua require('dapui').toggle()", + opts, + "Editor", + "open_dapui", + "Open debugging UI" +) +utils.map( + "n", + "od", + "Dashboard", + opts, + "Editor", + "open_dashboard", + "Open start screen" +) +utils.map( + "n", + "oe", + "NvimTreeToggle", + opts, + "Editor", + "open_tree_alt", + "Toggle file explorer" +) +utils.map( + "n", + "om", + "MinimapToggle", + opts, + "Editor", + "open_minimap_alt", + "Toggle code minimap" +) +utils.map( + "n", + "or", + "Ranger", + opts, + "Editor", + "open_ranger_browser", + "Toggle Ranger File Browser" +) +utils.map( + "n", + "os", + "SymbolsOutline", + opts, + "Editor", + "open_symbols_alt", + "Toggle SymbolsOutline (LSP symbols)" +) +utils.map( + "n", + "ot", + "ToggleTerm", + opts, + "Editor", + "open_terminal", + "Toggle terminal" +) + +-- git +utils.map("n", "go", "LazyGit", opts, "Git", "lazygit", "Open LazyGit") +utils.map( + "n", + "gl", + 'TermExec cmd="git pull"', + opts, + "Git", + "git_pull", + "Pull remote changes" +) +utils.map( + "n", + "gp", + 'TermExec cmd="git push"', + opts, + "Git", + "git_push", + "Push git changes" +) +utils.map( + "n", + "gs", + "Telescope git_status", + opts, + "Git", + "git_status", + "Browse git status" +) +utils.map( + "n", + "gB", + "Telescope git_branches", + opts, + "Git", + "git_branches", + "Browse git branches" +) +utils.map( + "n", + "gc", + "Telescope git_commits", + opts, + "Git", + "git_commits", + "Browse git commits" +) + +-- code +utils.map( + "n", + "ch", + "RestNvim", + opts, + "Editor", + "exec_http_alt", + "Execute http client under cursor" +) +utils.map( + "n", + "ci", + 'lua require("doom.modules.built-in.runner").start_repl()', + opts, + "Editor", + "start_repl", + "Start a REPL" +) +utils.map( + "n", + "cr", + 'lua require("doom.modules.built-in.runner").run_code()', + opts, + "Editor", + "run_file", + "Run the current file" +) +utils.map( + "n", + "cb", + 'lua require("doom.modules.built-in.compiler").compile()', + opts, + "Editor", + "compile", + "Compile project" +) +utils.map( + "n", + "cc", + 'lua require("doom.modules.built-in.compiler").compile_and_run()', + opts, + "Editor", + "compile_and_run", + "Compile and run project" +) + +-- debugging +utils.map( + "n", + "cde", + "lua require('dapui').eval()", + opts, + "DAP", + "dap_eval", + "Evaluate word under cursor" +) +utils.map( + "v", + "cds", + "lua require('dapui').eval()", + opts, + "DAP", + "dap_eval_selection", + "Evaluate selection" +) + +-- lsp +utils.map("n", "cli", "LspInfo", opts, "LSP", "lsp_info", "LSP Information") +utils.map( + "n", + "cla", + "lua vim.lsp.buf.code_action()", + opts, + "LSP", + "code_action_alt", + "Code actions" +) +utils.map( + "n", + "cld", + "lua vim.lsp.buf.type_definition()", + opts, + "LSP", + "type_definition", + "Show type definition" +) +utils.map( + "n", + "cll", + "lua vim.lsp.diagnostic.show_line_diagnostics()", + opts, + "LSP", + "line_diagnostic", + "Show line diagnostics" +) +utils.map( + "n", + "clq", + "lua vim.lsp.diagnostic.set_loclist()", + opts, + "LSP", + "diagnostic_list", + "Diagnostics into location list" +) + +-- jumps +utils.map("n", "ja", "", opts, "Jumps", "jump_alternate_file", "Alternate file") +utils.map("n", "jj", "", opts, "Jumps", "jump_older", "Jump to older pos") +utils.map("n", "jk", "", opts, "Jumps", "jump_newer", "Jump to newer pos") +utils.map("n", "jp", ":pop", opts, "Jumps", "jump_pop_tag", "Pop from tag stack") +utils.map( + "n", + "jt", + ":tag", + opts, + "Jumps", + "jump_folow_tag", + "Follow tag / add to stack" +) +-- save +utils.map("n", "v", "w", opts, "Save", "save_left", "Save v") +utils.map("n", "m", "w", opts, "Save", "save_right", "Save m") + +-- man pages +utils.map("n", "h", ":Man ", { silent = false }, "Man page", "man_page", "Man page") diff --git a/lua/doom/extras/keybindings/movement.lua b/lua/doom/extras/keybindings/movement.lua new file mode 100644 index 000000000..826c54ec1 --- /dev/null +++ b/lua/doom/extras/keybindings/movement.lua @@ -0,0 +1,139 @@ +local utils = require("doom.utils") + +-- Additional options for mappings +local opts = { silent = true } + +-- TAB to cycle buffers too, why not? +utils.map("n", "", ":bnext", opts, "Movement", "cycle_next_buffer", "Goto next buffer") +utils.map( + "n", + "", + ":bprevious", + opts, + "Movement", + "cycle_prev_buffer", + "Goto prev buffer" +) + +---[[-------------------------]]--- +-- Window Movements keys -- +---]]-------------------------]]--- +utils.map("n", "", "h", opts, "Movement", "left_window", "Goto left window") +utils.map("n", "", "j", opts, "Movement", "down_window", "Goto down window") +utils.map("n", "", "k", opts, "Movement", "up_window", "Goto upper window") +utils.map("n", "", "l", opts, "Movement", "right_window", "Goto right window") + +---[[-----------------]]--- +-- Move Lines -- +---]]-----------------[[--- +utils.map( + "n", + "", + ":m .+1==", + opts, + "Editor", + "normal_move_line_down", + "Normal Move line down" +) +utils.map( + "n", + "", + ":m .-2==", + opts, + "Editor", + "normal_move_line_up", + "Normal Move line up" +) +utils.map( + "i", + "", + ":m .+1==gi", + opts, + "Editor", + "instert_move_line_down", + "Insert Move line down" +) +utils.map( + "i", + "", + ":m .-2==gi", + opts, + "Editor", + "instert_move_line_up", + "Insert Move line up" +) +utils.map( + "v", + "", + ":m '>+1gv=gv", + opts, + "Editor", + "visual_move_line_down", + "Visual Move line down" +) +utils.map( + "v", + "", + ":m '<-2gv=gv", + opts, + "Editor", + "visual_move_line_up", + "Visual Move line up" +) + +---[[-----------------]]--- +-- Select Movement -- +---]]-----------------[[--- +utils.map("x", "K", ":move '<-2gv-gv", opts, "Editor", "select_right", "Move selection right") +utils.map("x", "J", ":move '>+1gv-gv", opts, "Editor", "select_left", "Move selection left") + +-- get out of terminal insert mode into normal mode with Esc +utils.map( + "t", + "", + "", + opts, + "Editor", + "exit_insert_term", + "Exit insert mode (inside a terminal)" +) + +---[[-----------------]]--- +-- Resizing Splits -- +---]]-----------------[[--- +utils.map( + "n", + "", + ":resize +2", + opts, + "Window", + "resize_up", + "Resize window (increase width)" +) +utils.map( + "n", + "", + ":resize -2", + opts, + "Window", + "resize_down", + "Resize window (decrease width)" +) +utils.map( + "n", + "", + ":vertical resize -2", + opts, + "Window", + "resize_right", + "Resize window (decrease height)" +) +utils.map( + "n", + "", + ":vertical resize +2", + opts, + "Window", + "resize_left", + "Resize window (increase height)" +) From 6b68248c7a478446ec589964754e52048ee9470a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Sep 2021 10:16:07 +0000 Subject: [PATCH 024/290] chore: format source code --- lua/doom/extras/keybindings/init.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lua/doom/extras/keybindings/init.lua b/lua/doom/extras/keybindings/init.lua index ac3644c18..90db4729e 100644 --- a/lua/doom/extras/keybindings/init.lua +++ b/lua/doom/extras/keybindings/init.lua @@ -35,17 +35,18 @@ log.debug("Loading Doom keybindings module ...") ------------------------------------------------- -local keybinds_modules = config.doom.keybinds_modules or { - -- Core doom keybindings - core = true, - -- Movement keybindings, jump between your windows, buffers and code - movement = true, - -- Leader keybindings, a bunch of useful keybindings managed by space key - -- WARNING: disabling this will break which-key plugin if the plugin is enabled - leader = true, - -- Completion and snippets keybindings - completion = true, -} +local keybinds_modules = config.doom.keybinds_modules + or { + -- Core doom keybindings + core = true, + -- Movement keybindings, jump between your windows, buffers and code + movement = true, + -- Leader keybindings, a bunch of useful keybindings managed by space key + -- WARNING: disabling this will break which-key plugin if the plugin is enabled + leader = true, + -- Completion and snippets keybindings + completion = true, + } for module in pairs(keybinds_modules) do if keybinds_modules[module] then From 182d5c11faa866a5f28f1993c964315fbef48644 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 7 Sep 2021 19:10:58 -0400 Subject: [PATCH 025/290] fix(keybindings): move mapleader logic to leader module --- lua/doom/extras/keybindings/core.lua | 4 ---- lua/doom/extras/keybindings/leader.lua | 8 ++++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua index 8e401c593..3975352a1 100644 --- a/lua/doom/extras/keybindings/core.lua +++ b/lua/doom/extras/keybindings/core.lua @@ -5,10 +5,6 @@ local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled -- Additional options for mappings local opts = { silent = true } --- Set Space key as leader -utils.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu") -vim.g.mapleader = " " - -- Fast exit from Doom Nvim utils.map( "n", diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 6bacb6a79..2c9f37594 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -8,10 +8,14 @@ local config = require("doom.core.config").config -- Additional options for mappings local opts = { silent = true } +-- Set Space key as leader +utils.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu") +vim.g.mapleader = " " + if config.doom.new_file_split then utils.map( "n", - "fn", + "fn", ":new", opts, "Editor", @@ -21,7 +25,7 @@ if config.doom.new_file_split then else utils.map( "n", - "fn", + "fn", ":enew", opts, "Editor", From f811f9ad0fa1387cc224f1cf5bd8ec91cfcc434b Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 7 Sep 2021 19:54:21 -0400 Subject: [PATCH 026/290] feat(keybindings): better error handling for keybinds modules --- lua/doom/extras/keybindings/init.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/doom/extras/keybindings/init.lua b/lua/doom/extras/keybindings/init.lua index 90db4729e..81e7c7b73 100644 --- a/lua/doom/extras/keybindings/init.lua +++ b/lua/doom/extras/keybindings/init.lua @@ -50,6 +50,14 @@ local keybinds_modules = config.doom.keybinds_modules for module in pairs(keybinds_modules) do if keybinds_modules[module] then - require(string.format("doom.extras.keybindings.%s", module)) + local ok, err = xpcall(require, debug.traceback, ("doom.extras.keybindings.%s"):format(module)) + if not ok then + log.error( + string.format( + "There was an error loading the module 'doom.extras.keybindings.%s'. Traceback:\n%s", + module, err + ) + ) + end end end From 6e67586365aed98e29ff417be05d2b316e3b62b3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 7 Sep 2021 23:55:16 +0000 Subject: [PATCH 027/290] chore: format source code --- lua/doom/extras/keybindings/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/doom/extras/keybindings/init.lua b/lua/doom/extras/keybindings/init.lua index 81e7c7b73..1d5340976 100644 --- a/lua/doom/extras/keybindings/init.lua +++ b/lua/doom/extras/keybindings/init.lua @@ -55,7 +55,8 @@ for module in pairs(keybinds_modules) do log.error( string.format( "There was an error loading the module 'doom.extras.keybindings.%s'. Traceback:\n%s", - module, err + module, + err ) ) end From ecba68ff8cc5dac47c21436c16da7ae38298ab76 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 7 Sep 2021 19:59:31 -0400 Subject: [PATCH 028/290] feat(doom_modules): enable neorg by default --- doom_modules.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doom_modules.lua b/doom_modules.lua index aa0b99342..977770ab2 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -27,7 +27,7 @@ M.modules = { doom = { -- "compiler", -- Compile (and run) your code with just pressing three keys! -- "contrib", -- Special plugins intended for Doom Nvim contributors (lua docs, etc) - -- "neorg", -- Life Organization Tool + "neorg", -- Life Organization Tool, used by Doom Nvim user manual -- "runner", -- Open a REPL for the current language or run the current file }, editor = { From 9576e434ec4188fc03571368ba60bc076c5b86bd Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 7 Sep 2021 20:07:15 -0400 Subject: [PATCH 029/290] feat: replace built-in Neovim `.txt` docs with Neorg-based docs - Added `:DoomManual` command --- doc/doom_nvim.norg | 599 +++++++++++++++++++++ doc/doom_nvim.txt | 597 -------------------- doc/tags | 55 +- lua/doom/core/functions/init.lua | 34 ++ lua/doom/core/settings/init.lua | 3 + lua/doom/extras/keybindings/leader.lua | 4 +- lua/doom/modules/config/doom-dashboard.lua | 2 +- 7 files changed, 665 insertions(+), 629 deletions(-) create mode 100644 doc/doom_nvim.norg delete mode 100644 doc/doom_nvim.txt diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg new file mode 100644 index 000000000..b79c6e39d --- /dev/null +++ b/doc/doom_nvim.norg @@ -0,0 +1,599 @@ +@document.meta + title: doom manual + description: Doom Nvim User Manual + author: NTBBloodbath + categories: doom neovim manual + created: 2021-08-15 + version: 0.1 +@end + += TOC Table of Contents + +* Table of Contents + -> [Introduction](#Introduction) + -> [Using Doom Nvim as your daily setup](#Using Doom Nvim as your daily setup) + --> [Moving around](#Moving around) + --> [Configuration](#Configuration) + ---> [Modules](#Modules) + ----> [Tweaking modules](#Tweaking modules) + ---> [Custom plugins](#Custom plugins) + ---> [Language Server Protocols](#Language Server Protocols) + --> [Autocompletion](#Autocompletion) + --> [Colorscheme](#Colorscheme) + --> [Layout](#Layout) + ---> [File Explorer](#File Explorer) + ---> [Main Buffer](#Main Buffer) + ---> [Terminal](#Terminal) + ---> [Minimap](#Minimap) + ---> [Outline](#Outline) + --> [Commands](#Commands) + --> [Keybindings](#Keybindings) + --> [Hacking Doom Nvim](#Hacking Doom Nvim) + -> [Known issues](#Known issues) + -> [FAQ](#FAQ) + --> [General](#General) + ---> [Who is Doom Nvim intended for?](#Who is Doom Nvim intended for?) + ---> [Why does Doom Nvim only support Neovim 0.5.0 (and beyond)?](#Why does Doom Nvim only support Neovim 0.5.0 and beyond?) + -> [Acknowledgements](#Acknowledgements) + -> [Contributing](#Contributing) + -> [License](#License) + +* Introduction + Doom Nvim is a Neovim port of the [Doom Emacs](https://github.com/hlissner/doom-emacs) configuration framework, adapted for the Neovim user + that wants less framework in their framework and the performance of a hand-made configuration. + You can use it as your own setup or as a learning resource on how to achieve a great Neovim configuration. + + Doom Nvim features an opinionated collection of reasonable and optional defaults, with a focus on + runtime and startup performance, and a clean, readable and very robust code base. + +* Using Doom Nvim as your daily setup + You can start Doom Nvim by typing `nvim` in a terminal emulator or by executing your preferred + Neovim GUI client. + + By default, if no files were opened, Doom Nvim will show the start menu ([dashboard-nvim](https://github.com/glepnir/dashboard-nvim)) where you + can select files to edit or if you have a saved session in the current workspace, Doom Nvim will load + it automatically if you want to. + + ** Moving around + Doom Nvim uses the default Neovim keybindings to move around: `k, j, k, l` and the cursor keys. + Use `h` to go left, `j` to go down, `k` to go up and `l` to go right. + + See `:Tutor` to know how to use Neovim and its keybindings. + + To move around buffers press `SPC - b` to select the `Buffers` section of keybindings and then press + the key `g` to select a buffer or press `TAB` to cycle buffers. + + ** Configuration + The Doom Nvim configuration files resides under the `$HOME/.config/nvim` directory by default. + See [Hacking Doom Nvim](**Hacking Doom Nvim) for more information. + + *** Modules + Doom Nvim consists of around `6` modules. A Doom Nvim module is a bundle of plugins, + configurations and commands, organized into a unit that can be toggled easily. + + To give a quick summary, the modules are as follows: + - UI, everything related to Neovim UI. + - Doom, neorg and built-in plugins. + - Editor, everything related to editing, e.g. tree explorer, git signs, lsp, debugging. + - Langs, languages support for Doom, languages servers and debuggers. + - Utilities, some utility plugins like `neogit`. + - Web, web development related plugins like `rest.nvim`. + + You can see in a more detailed view the modules and its plugins at [modules.md](https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/modules.md). + + **** Tweaking modules + For tweaking a module (enable / disable its plugins) you will only need to + comment or uncomment the desired plugin, e.g. for disabling the tree explorer + you will only need to comment it. + +@code lua + -- Right now the Tree explorer is enabled + "explorer", + + -- Now the Tree Explorer is disabled + -- "explorer", +@end + + *NOTE*: after doing changes to your modules you will only need to restart Neovim + and Doom Nvim will automatically handle your changes on here. + + *** Custom plugins + To use your own plugins in Doom Nvim you can use the `doom_userplugins.lua` file located + in the Doom Nvim root directory (`$HOME/.config/nvim` by default). + + To add plugins without extra configurations (e.g. if a plugin does not depends on other plugins), + you can simply set it as follow: + +@code lua + M.plugins = { + "andweeb/presence.nvim", + } +@end + + Otherwise, if your plugin depends on other or you do not want to enable it then you can + do it as follow: + +@code lua + M.plugins = { + { + "andweeb/presence.nvim", + -- Plugin dependencies + requires = { + "JohnDoe/foo" + }, + -- Disable plugin + disable = true, + }, + } +@end + + *NOTE*: if you are familiar with [packer.nvim](https://github.com/wbthomason/packer.nvim) then you can see that the `doom_userplugins.lua` file + is just a wrapper for it. + + *** Language Server Protocols + To easily install language servers and without having to do it system-wide or having to manually + configure servers, Doom Nvim makes use of [nvim-lspinstall](https://github.com/kabouzeid/nvim-lspinstall). + + To enable the language server for a certain programming language and automatically install it, + just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`, + e.g. for enabling Rust support in Doom Nvim and install `rust-analyzer`: + +@code lua + M.modules = { + langs = { + "rust +lsp", -- Let's get rusty! + }, + } +@end + + *NOTE*: You can see a list of currently supported languages at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall#bundled-installers). + + ** Autocompletion + Doom Nvim uses the [built-in LSP](https://neovim.io/doc/user/lsp.html) plus [nvim-compe](https://github.com/hrsh7th/nvim-compe) plugin as completion engine. + + Use `` to select the next suggestion and `` to select the current one. + + Autocompletion for parenthesis can be disabled by disabling the [nvim-autopairs](https://github.com/windwp/nvim-autopairs) + plugin (see [Tweaking modules](***Tweaking modules) for more information). + + ** Colorscheme + The colorscheme of Doom Nvim. Default is `doom-one`. There are some additional + doom emacs' colorschemes port for Neovim that can be enabled by uncommenting + the `doom-themes` entry in your `doom_modules.lua`. + + You can switch between colorschemes by doing `SPC - d - s` and then type the name + of the colorscheme you want to use. You can also edit the `doom_config.lua` + file located at `$HOME/.config/nvim` (see [Hacking Doom Nvim](**Hacking Doom Nvim)). + + *NOTE*: If you exit Neovim and you changed the colorscheme then Doom Nvim will automatically + update the `doom_config.lua` file to use the new colorscheme on next launch. + + ** Layout + Excluding the statusline and the tabline, Doom Nvim will mostly have the + following layout: + + ┌─────┬────────────────────┬────┬──────┐ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ A* │ B │ D* │ E* │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ ├────────────────────┤ │ │ + │ │ C* │ │ │ + └─────┴────────────────────┴────┴──────┘ + + Where: + - 'A' is the file explorer (plugin: [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua)) + - 'B' is the main buffer + - 'C' is the terminal (plugin: [toggleterm.nvim](https://github.com/akinsho/toggleterm.nvim)) + - 'D' is the minimap (plugin: [minimap.vim](https://github.com/wfxr/minimap.vim)) + - 'E' is the symbol outline (plugin: [symbols-outline.nvim](https://github.com/simrat39/symbols-outline.nvim)) + + *NOTE*: Sections with `*` are not opened by default but can be toggled. + See [Commands](**Commands) for more information. + + *** File Explorer + Doom Nvim uses the `nvim-tree.lua` plugin as a file explorer. It can be toggled by + running the following keybinds: + - `SPC - o - e` + - `` + + To create a new file within the file explorer, press `a` and type the name of the + file. Append a `/` at the end if you want to create a directory. + + Check [nvim-tree.lua repository](https://github.com/kyazdani42/nvim-tree.lua) for more information. + + *** Main Buffer + The main buffer is the buffer where the code is opened. + + To split the main buffer, do `SPC - w` and then select the split method you + want to use horizontally (`s`), or vertically (`v`). + + *** Terminal + The terminal is placed like in others editors, e.g. Visual Studio Code. The + buffer of the terminal is automatically set to `INSERT` mode. + + The only way to close it is to enter `exit` to close the shell session, or if you + just want to toggle it, you can use the following keybinds: + - `SPC - o - t` (only `NORMAL` mode!) + - `` + + Check [nvim-toggleterm.lua repository](https://github.com/akinsho/nvim-toggleterm.lua) for more information. + + *** Minimap + Doom Nvim uses `wfxr/minimap.vim` plugin as its minimap. It can be toggled by + performing the following keybinds: + - `SPC - o - m` + - `` + + Check [minimap.vim repository](https://github.com/wfxr/minimap.vim) for more information. + + *** Outline + `Symbols-Outline` is a plugin that can show the tags and structure of the opened + file, ordered by its scope. + + For this function, Doom Nvim makes use of `simrat39/symbols-outline.nvim`. + It can be toggled by performing the following keybinds: + - `SPC - o - s` + - `` + + Check [symbols-outline.nvim repository](https://github.com/simrat39/symbols-outline.nvim) for more information. + + ** Commands + Doom Nvim has its own commands, to make your life easier when developing on it. + + ┌─────────────┬──────────────────────────────────────────┐ + │Command │ Description │ + ├─────────────┼──────────────────────────────────────────┤ + │DoomUpdate │ Update Doom Nvim if there are updates │ + ├─────────────┼──────────────────────────────────────────┤ + │DoomRollback │ Rollback Doom Nvim to a previous version │ + └─────────────┴──────────────────────────────────────────┘ + + Doom Nvim also uses [which-key.nvim](https://github.com/folke/which-key.nvim) as a commands manager, inspired by emacs' guide-key. + To open it, press `SPC` and wait for the popup to show, it should not take much time. + Each section has a label and is mnemonic, e.g. + + `Open Terminal` > `SPC - o - t` + + There are multiple sections for Doom Nvim commands. Those sections create a path in the + decision tree that identifies any command. + + Let's say you want to go to the next buffer you are working on. You will need to perform + the following keystrokes: + + `SPC - b` + + In order to open the `Buffers` section. There we want to go to the next buffer. + + `SPC - b - n` + + Finally, we changed our current buffer to the next one in our workspace. You can see more + keybindings in [Keybindings](**Keybindings). + + ** Keybindings + In Doom Nvim, we make use of the `SPC` keystroke as the map leader. + + This is the list of all Doom Nvim leader mappings, `SPC` is omitted here to avoid redundancy. + + ┌─────────────────────┬────────────────────────────────────────────────────┐ + │ Keybind │ Description │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ , │ Switch buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ . │ Browse files │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ / │ Search │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ : │ Command history │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ ` │ Find file │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ h │ Man pages │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ m │ Save │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ v │ Save │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ b - [ │ Previous buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ b - ] │ Next Buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ b - b │ Switch to other buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ b - c │ Close current buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ b - f │ Format buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ b - g │ Goto buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ b - n │ Next buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ b - p │ Previous buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - b │ Compile project │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - c │ Compile and run project │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - d │ +debug │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - d - e │ Evaluate word under cursor │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - d - s │ Evaluate selection │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - h │ Run rest client on the line that the cursor is │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - i │ Start a REPL │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - r │ Run current file │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - l │ +lsp │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - l - a │ Code actions │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - l - d │ Show type definition │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - l - i │ Lsp info │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - l - L │ Diagnostics into location list │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ c - l - l │ Show line diagnostics │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ d - c │ Edit your Doom Nvim configurations │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ d - d │ Open Doom Nvim documentation │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ d - R │ Create crash reports, useful for debugging issues │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ d - r │ Rollback Doom Nvim version │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ d - s │ Change colorscheme │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ d - u │ Update Doom Nvim │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ f - c │ Edit Neovim configurations │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ f - f │ Find files │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ f - n │ New unnamed buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ f - R │ Re-open an unreadable file with sudo permissions │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ f - r │ Recently opened files │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ f - t │ Help tags │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ f - w │ Write an unwritable file with sudo permissions │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - B │ Branches │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - b │ Blame line │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - c │ Commits │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - h │ Preview hunk │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - R │ Reset buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - r │ Reset hunk │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - o │ Open LazyGit │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - l │ Pull │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - p │ Push │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - S │ Stage hunk │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - s │ Status │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - u │ Undo stage hunk │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ j - a │ Alternate file │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ j - j │ Jump back │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ j - k │ Jump forward │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ j - p │ Pop tag stack │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ j - t │ Jump to tag │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ o - d │ Start screen │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ o - e │ Tree Explorer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ o - m │ Minimap │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ o - s │ LSP Symbols │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ o - t │ Terminal │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ p - C │ Compile your plugins changes │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ p - c │ Clean unused plugins │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ p - i │ Install missing plugins │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ p - p │ Profile the time taken loading your plugins │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ p - S │ Sync plugins (runs Clean and Update) │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ p - s │ Plugins status │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ q - q │ Quit Neovim │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ q - r │ Restore previously saved session │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ q - w │ Save and quit Neovim │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ s - b │ Buffer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ s - g │ Grep │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ s - h │ Command history │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ s - m │ Jump to mark │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ s - s │ Goto symbol │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - - │ Split window below │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - = │ Balance windows size │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - | │ Split window right │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - 2 │ Layout double columns │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - d │ Delete window │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - H │ Expand window left │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - h │ Window left │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - J │ Expand window below │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - j │ Window below │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - K │ Expand window up │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - k │ Window up │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - L │ Expand window right │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - l │ Window right │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - s │ Split window below │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - v │ Split window right │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ w - w │ Other window │ + └─────────────────────┴────────────────────────────────────────────────────┘ + + But there is still more, Doom Nvim knows that you love to use the keyboard but you do not + like to be typing so much so it has more keybindings that will make your life easier! + + | The following keybindings does not use the leader key. + + ┌─────────────────────┬────────────────────────────────────────────────────┐ + │ Keybind │ Description │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ TAB │ Cycle buffers (next buffer) │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Shift - TAB │ Cycle buffers (prev buffer) │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ ESC │ Search highlighting off │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ F2 │ Toggle Symbols-Outline │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ F3 │ Toggle Tree Explorer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ F4 │ Toggle Terminal │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ F5 │ Toggle Minimap │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ F6 │ Toggle Zen mode │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ F7 │ Run rest client on current cursor position │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Z - Z │ Toggle Symbols-Outline │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ j - k │ Toggle Tree Explorer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - c - c │ Comment current line (NORMAL mode) │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ g - c │ Comment selected block (VISUAL mode) │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Control + h │ Select window left │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Control + j │ Select window below │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Control + k │ Select window up │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Control + l │ Select window right │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Control + Up │ Resize window up │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Control + Down │ Resize window below │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Control + Left │ Resize window left │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ Control + Right │ Resize window right │ + └─────────────────────┴────────────────────────────────────────────────────┘ + + You can modify the default keybindings my modifying the following files: + - General keybindings: `lua/doom/extras/keybindings/init.lua` + - Plugins keybindings: `lua/doom/modules/config` + - which-key keybindings: `lua/doom/modules/config/doom-whichkey.lua` + + *NOTE*: You can also make your own keybindings or override the default ones + by editing your `doom_config.lua` file. + + ** Hacking Doom Nvim + Doom Nvim aims to be hackable to suit everyone's needs. Therefore this is the structure of Doom Nvim: + +@code + . -> Doom Nvim root + ├── colors -> Pre-installed colorschemes directory + │ └── doom-one.lua -> doom-one colorscheme ported to Nvim (default one) + ├── doc -> Docs to be used inside Nvim + │ └── doom_nvim.norg -> Doom Nvim User Manual + ├── docs -> Docs meant to be readed on GitHub + ├── doom_modules.lua -> Doom modules configurations file + ├── doom_config.lua -> Doom main configurations file + ├── doom_userplugins.lua -> User defined plugins + ├── init.lua -> Init file + ├── LICENSE -> License + └── lua -> Location of Doom Nvim Lua files + ├── doom -> Doom Nvim core + │ ├── core -> Doom Nvim core functionality + │ │ ├── config -> Doom Nvim configuration files + │ │ ├── settings -> Doom Nvim Neovim settings + │ │ ├── functions -> Doom Nvim functions + │ │ └── system -> Doom Nvim system utilities + │ ├── extras -> Doom Nvim extra functionalities + │ │ ├── autocmds -> Doom Nvim autocommands + │ │ ├── keybindings -> Doom Nvim keybindings + │ │ └── logging -> Doom Nvim logging system + │ └── utils -> Doom Nvim utilities + └── modules -> Location of Doom Nvim plugins + ├── configs -> Plugins configurations + ├── built-in -> Doom Nvim built-in plugins + └── init.lua -> packer.nvim setup +@end + +* Known issues + Nothing here but chickens ... + + *NOTE*: If you are facing an undocummented issue, feel free to [open an issue](https://github.com/NTBBloodbath/doom-nvim/issues/new) at Doom Nvim repository on + GitHub and we will try to fix it together! + +* FAQ + ** General + *** Who is Doom Nvim intended for? + Doom Nvim is intended for anyone who wants a stable and efficient + development environment that just works without spending a lot of time setting everything up. + + *** Why does Doom Nvim only support Neovim 0.5.0 and beyond? + Doom Nvim relies on lua for the configuration and use of many plugins. Since + lua is not available in neovim 0.4.4 and below, it is not possible to use Doom + Nvim with a neovim version lower than 0.5.0. + +* Acknowledgements + Doom Nvim would not have been possible had it not been for + - hlissner, creator of Doom Emacs + - All our contributors + +* Contributing + I really love pull requests and bug reports, please see the [Contributing Guidelines](https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/contributing.md) on GitHub + before contributing. + + Don't hesitate to tell me my Lua coding style sucks, but please tell me why. + +* License + Doom Nvim is distributed under GPLv2 license. + +$comment +vim:sw=2:ts=2:cole=3:cocu=n:tw=100:cc=100:norl: diff --git a/doc/doom_nvim.txt b/doc/doom_nvim.txt deleted file mode 100644 index 4bf880187..000000000 --- a/doc/doom_nvim.txt +++ /dev/null @@ -1,597 +0,0 @@ -*doom_nvim.txt* A Neovim configuration for the advanced martian hacker - -================= =============== =============== ======== ========~ -\\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //~ -||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||~ -|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||~ -||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||~ -|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||~ -||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .||~ -|| . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . ||~ -||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.||~ -|| ||_-' || || `-_|| || || ||_-' || || | \ / | `||~ -|| `' || || `' || || `' || || | \ / | ||~ -|| .===' `===. .==='.`===. .===' /==. | \/ | ||~ -|| .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | ||~ -|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | ||~ -|| .==' _-' '-__\._-' '-_./__-' `' |. /| | ||~ -||.==' _-' `' | /==.||~ -==' _-' N E O V I M \/ `==~ -\ _-' `-_ /~ - `'' ``'~ - - NTBBloodbath *doom_nvim* - - ============================================================================= - CONTENTS *doom_nvim_contents* - 1. Introduction...........................................|doom_nvim_intro| - 2. Autocomplete..........................|doom_nvim_options_autocomplete| - 3. Colorscheme............................|doom_nvim_options_colorscheme| - 4. Configuration..................................|doom_nvim_configuration| - 1. Layout................................|doom_nvim_configuration_layout| - 2. File Explorer................|doom_nvim_configuration_layout_explorer| - 3. Main Buffer................|doom_nvim_configuration_layout_mainbuffer| - 4. Outline.......................|doom_nvim_configuration_layout_outline| - 5. Minimap.......................|doom_nvim_configuration_layout_minimap| - 6. Terminal.....................|doom_nvim_configuration_layout_terminal| - 7. Modules..............................|doom_nvim_configuration_modules| - 1. Tweaking modules..........|doom_nvim_configuration_modules_tweaking| - 8. Custom Plugins................|doom_nvim_configuration_custom_plugins| - 9. LSP......................................|doom_nvim_configuration_lsp| - 5. Commands............................................|doom_nvim_commands| - 1. Keybindings...........................|doom_nvim_commands_keybindings| - 6. Usage..................................................|doom_nvim_usage| - 1. Moving around..........................|doom_nvim_usage_moving_around| - 7. Known issues..........................................|doom_nvim_issues| - 8. FAQ......................................................|doom_nvim_faq| - 9. Hacking Doom Nvim....................................|doom_nvim_hacking| - 10. Acknowledgements...........................|doom_nvim_acknowledgements| - 11. License.............................................|doom_nvim_license| - 12. Contributing...................................|doom_nvim_contributing| - 13. Changelog.........................................|doom_nvim_changelog| - - -============================================================================== -INTRODUCTION *doom_nvim_intro* - -Doom Neovim is a Neovim port of the Doom Emacs configuration framework, adapted -for the Neovim user that wants less framework in their framework and the performance -of a hand-made configuration. You can use it as a base for your own setup or as -a learning resource on how to achieve a great Neovim configuration. - -Doom Neovim features an opinionated collection of reasonable and optional -defaults, with a focus on runtime and startup performance, and a clean, -readable code base. - - -============================================================================== -AUTOCOMPLETE *doom_nvim_autocomplete* - -Doom Neovim uses the built-in LSP as completion engine in Neovim 0.5.0. - -Use to select the next suggestion and to select the current -suggestion. - -Autocompletion for parenthesis can be disabled by disabling the autopairs -plugin (see |doom_nvim_configuration_modules_disabling| for more information) - - -============================================================================== -COLORSCHEME *doom_nvim_colorscheme* - -The colorscheme of Doom Nvim. Default is `doom-one`. There are some additional -doom emacs' colorschemes port for Neovim that can be enabled by uncommenting -the `doom-themes` in your `doom_modules.lua`. - -You can switch between colorschemes by doing ds and then type the name -of the colorscheme you want to use. You can also edit the `doom_config.lua` -file located at `$HOME/.config/doom-nvim` (see |doom_nvim_hacking|). - - -============================================================================== -CONFIGURATION *doom_nvim_configuration* - -The Doom Neovim configuration files reside under the -`$HOME/.config/doom-nvim/` directory. See |doom_nvim_hacking| for more -info. - - -============================================================================== -LAYOUT *doom_nvim_configuration_layout* - -Excluding the statusline and the tabline, Doom Nvim will mostly have the -following layout: - -|--------------------------------------|~ -| | | | |~ -| | | | |~ -| | | | |~ -| | B | D* | E* |~ -| A* | | | |~ -| | | | |~ -| | | | |~ -| |--------------------| | |~ -| | C* | | |~ -|--------------------------------------|~ - - - -'A' : The file explorer (Plugin: nvim-tree.lua) -'B' : The main buffer -'C' : The terminal (Plugin: nvim-toggleterm.lua) -'D' : The minimap (Plugin: minimap.vim) -'E' : The symbol outline (Plugin: SymbolsOutline) - -Sections with `*` are not opened by default but can be toggled. -See |doom_nvim_commands| for more information. - - -============================================================================== -FILE EXPLORER *doom_nvim_configuration_layout_explorer* - -Doom Neovim uses the `kyazdani42/nvim-tree.lua` plugin as a file explorer. -It can be toggled by running the following commands: -oe for `FileExplorer` - for `FileExplorer` - -To create a new file within the file explorer, do [name_of_file] -Append a `/` if you want to create a directory. - -Check https://github.com/kyazdani42/nvim-tree.lua for more info. - - -============================================================================== -MAIN BUFFER *doom_nvim_configuration_layout_mainbuffer* - -The main buffer is the buffer where the code is opened. - -To split the main buffer, do w and then select the split method you -want to use horizontally (`s`), or vertically (`v`). - - -============================================================================== -OUTLINE *doom_nvim_configuration_layout_outline* - -Symbols-Outline is a plugin that can show the tags and structure of the opened -file, ordered by its scope. For this function, Doom Nvim makes use of -`simrat39/symbols-outline.nvim`. It can be toggled by performing the following -commands: - -os for `Symbols-Outline` - for `Symbols-Outline` - -See https://github.com/simrat39/symbols-outline.nvim for more information. - - -============================================================================== -MINIMAP *doom_nvim_configuration_layout_minimap* - -Doom Nvim uses `wfxr/minimap.vim` plugin as its minimap. -It can be toggled by performing the following commands: -om for `Minimap` - for `Minimap` - - -============================================================================== -TERMINAL *doom_nvim_configuration_layout_terminal* - -The terminal is placed like in others editors, e.g. Visual Studio Code. The -buffer of the terminal is automatically set to `INSERT` mode. The only way to -close it is to enter `exit` to close the shell session, or if you just want to -toggle it, you can enter in `NORMAL` mode: - -ot for `Terminal` - for `Terminal` - - -============================================================================== -MODULES *doom_nvim_configuration_modules* - -Doom Nvim consists of around 5 modules. A Doom Nvim Module is a -bundle of plugins, configuration and commands, organized into a unit that can -be toggled easily. - -To give a quick summary, the modules are as follows: - - UI, everything related to UI - - Doom, neorg and built-in plugins - - Editor, everything related to editing, e.g. tree explorer, git signs, lsp - - Langs, languages support for Doom and language servers - - Utilities, some utility plugins like neogit - -You can see in a more detailed view the modules and its plugins at -https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/modules.md - - -============================================================================== -TWEAKING MODULES *doom_nvim_configuration_modules_tweaking* - -For tweaking a module (enable / disable its plugins) you will only need to -comment or uncomment the desired plugin, e.g. for disabling the tree explorer -you will only need to comment it. - -`-- Right now the Tree explorer is enabled` -`'explorer',` - -`-- Now the Tree explorer is disabled` -`-- 'explorer',` - -NOTE: after doing changes to your modules you will only need to restart Neovim -and Doom Nvim will automatically handle your changes on here. - - -============================================================================== -CUSTOM PLUGINS *doom_nvim_configuration_custom_plugins* - -To use your own plugins in Doom Nvim you can use the `doom_userplugins.lua` -file located in the Doom Nvim root directory. - -NOTE: if you are familiar with `packer.nvim` (the plugins manager used by Doom -Nvim) then you can see the `doom_userplugins.lua` file as a wrapper for it. - -To add plugins without extra configurations (e.g., if a plugin does not depend -on other plugins), you can simply set it as follow: - -` return {` -` 'andweeb/presence.nvim'` -` }` - -Otherwise, if your plugin depends on other or you do not want to enable it, -then you can do it as follow: - -` return {` -` {` -` 'andweeb/presence.nvim',` -` requires = { 'john/foo', 'doe/bar' },` -` }` -` }` - -As you can see, the second way depends on a structure to work. -All the fields for declaring plugins can be found at -https://github.com/wbthomason/packer.nvim#specifying-plugins - - -============================================================================== -LSP *doom_nvim_configuration_lsp* - -To easily install language servers and without having to do it system-wide or -having to manually configure servers, Doom Nvim makes use of -`kabouzeid/nvim-lspinstall`. - -To enable the language server for a certain programming language and -automatically install it, just append a `+lsp` flag at the end of the language -field in your `doom_modules.lua`, e.g. for enabling Rust support in Doom and -install `rust-analyzer`: - -` local doom = {` -` langs = {` -` 'rust +lsp', -- Let's get rusty!` -` }` -` }` - -NOTE: You can see a list of currently supported languages at -https://github.com/kabouzeid/nvim-lspinstall#bundled-installers - - -============================================================================== -COMMANDS *doom_nvim_commands* - -Doom Nvim have its own commands, to make your life easier when developing. - -| `:DoomUpdate` | Update Doom Nvim if there are updates. -| `:DoomRollback` | Rollback Doom Nvim to a previous version. - -Doom Nvim also uses `WhichKey` as a commands manager, inspired by -emacs's guide-key. To open it, press and wait for the popup to show, -it should not take much time. Each section has a label and is mnemonic. -e.g: - - `Open Terminal` > ot - -There are multiple sections for Doom Nvim's commands. Those sections create a -path in the decision tree that identifies any command. - -Let's say you want to go to the next buffer you are working on. You will need -to perform the following keystrokes: - -b - -in order to open the `Buffer` section. There we want to go to the `n`ext -buffer. - -bn - -Finally, we changed our current buffer to the next buffer in our workspace. -You can see more keybindings in |doom_nvim_commands_keybindings| - - -============================================================================== -KEYBINDINGS *doom_nvim_commands_keybindings* - -In Doom Nvim, we make use of the keystroke as the map leader. - -| <,> | Switch buffer -| <.> | Browse files -| | Search -| <:> | Command history -| <`> | Switch buffer -| | Find file - -| uffer -| | <[> Previous buffer -| | <]> Next buffer -| | Switch to other buffer -| | Close buffer -| | Format buffer -| | Goto buffer -| | Next buffer -| |

Previous buffer -| ode -| | Compile project -| | Compile and run project -| | Run rest client on the line that the cursor is -| | Start a REPL -| | Run current file -| | +lsp -| oom -| | Edit your Doom Nvim configuration -| | Open Doom Nvim documentation -| | Create crash reports, useful for debugging -| | Rollback Doom Nvim version -| | Change colorscheme -| | Check Doom Nvim updates -| ile -| | Edit Neovim configuration -| | Find files -| | New unnamed buffer -| | Re-open an unreadable file with sudo permissions -| | Recently opened files -| | Help tags -| | Write an unwritable file with sudo permissions -| it -| | Branches -| | Blame line -| | Commits -| | Preview hunk -| | Reset buffer -| | Reset hunk -| | Open LazyGit -| | Pull -| |

Push -| | Stage hunk -| | Status -| | Undo stage hunk -| sp -| | Code actions -| | Show type definition -| | Lsp info -| | Show line diagnostics -| | Diagnostics into location list -| pen -| | Start screen -| | Tree explorer -| | Minimap -| | LSP Symbols -| | Terminal -|

lugin -| | Clean unused plugins -| | Compile your plugins changes -| | Install missing plugins -| |

Profile the time taken loading your plugins -| | Sync plugins (Clean and Update) -| | Plugins status -| uit / -| sessions -| | Session switcher -| | Quit -| | Restore previously saved session -| | Save current session -| | Save and quit -| earch -| | Buffer -| | Grep -| | Command history -| | Jump to mark -| | Goto symbol -| indow -| | <-> Split window below -| | <2> Layout double columns -| | <=> Balance window -| | <|> Split window right -| | Delete window -| | Expand window left -| | Window left -| | Expand window below -| | Window below -| | Expand window up -| | Window up -| | Expand window right -| | Window right -| | Split window below -| | Split window right -| | Other window - -But there is still more, Doom Nvim knows that you love to use the keyboard but -you do not like to be typing so much so it has more keybindings that will make -your life easier! - -| | Cycle buffers (next buffer) -| | Cycle buffers (prev buffer) -| | Search highlighting off -| | Toggle Symbols-Outline -| | Toggle Tree Explorer -| | Toggle Terminal -| | Toggle Minimap -| | Toggle Zen mode -| | Run rest client -| | Fast exit from Doom Nvim -| | Fast exit from `INSERT` mode -| | Comment current line (`NORMAL` mode) -| | Comment selected block (`VISUAL` mode) -| | Select window left -| | Select window below -| | Select window up -| | Select window right -| | Resize window up -| | Resize window below -| | Resize window left -| | Resize window right - -You can modify the default keybindings by modifying the following files: - - `lua/doom/core/keybindings/init.lua` - General keybindings - - `lua/doom/modules/config` - Lua plugins keybindings - -You can also make your own keybindings by editing your `doom_config.lua` file. - - -============================================================================== -USAGE *doom_nvim_usage* - -Start Doom Nvim by typing `nvim` in a terminal emulator or by executing your -preferred Neovim GUI. - -By default, if no files were opened, Doom Nvim will show the start menu -`dashboard-nvim` where you can select files to edit or if you have a saved -session in the current workspace, Doom will load it automatically if you -want to. - - -============================================================================== -MOVING AROUND *doom_nvim_usage_moving_around* - -Doom Nvim uses the default Vim keybindings to move around: `h` `j` `k` `l` -and the cursor keys. -Use `h` go to left, `j` to go down, `k` to go up, `l` to go right. - - ^ - k - - - - j - v - -See `Tutor` to know how to use Vim and its keybindings. - -To move around buffers execute b to select the `buffers` section -and then press the key to select a buffer or press `` to cycle buffers. - - -============================================================================== -KNOWN ISSUES *doom_nvim_issues* - -- If you are facing an undocummented issue, feel free to open an issue at Doom - Nvim's repository on GitHub and we will try to fix it. - https://github.com/NTBBloodbath/doom-nvim/issues/new - - -============================================================================== -FAQ *doom_nvim_faq* - -- General - - Who is Doom Nvim intended for? - -Doom Nvim is intended for anyone who wants a stable and efficient -development environment without spending a lot of time setting everything up. - - - Why does Doom Nvim only support Neovim 0.5.0 (and beyond)? - -Doom Nvim relies on lua for the configuration and use of many plugins. Since -lua is not available in neovim 0.4.4 and below, it is not possible to use Doom -Nvim with a neovim version lower than 0.5.0. However, the Doom Nvim installer -automatically installs Neovim 0.5.0 for you! - -============================================================================== -HACKING DOOM NVIM *doom_nvim_hacking* - -Doom Nvim aims to be hackable to suit everyone's needs. Therefore - -This is the structure of Doom Nvim: - -. # Doom Nvim root -├── autoload # Files loaded at launch -│ └── health # Doom Nvim health add-ons for `:checkhealth` -├── colors # Pre-installed colorschemes directory -│ └── doom-one.vim # doom-one colorscheme ported to Nvim (`default one`) -├── doc # Doom Nvim documentation to be used inside Nvim -│ └── doom_nvim.txt # Doom Nvim help file -├── docs # Doom Nvim docs meant to be readed on GitHub -├── doom_config.lua # Doom Nvim user configurations file -├── doom_modules.lua # Doom Nvim user module selection -├── doom_userplugins.lua # Doom Nvim user plugins -├── init.lua # init.lua file -├── install.sh # Doom Nvim installer -├── LICENSE # Doom Nvim License -├── lua # Location of Doom Nvim Lua files -│ ├── doom # Doom Nvim Lua core -│ │ ├── core # Doom Nvim core functionality -│ │ │ ├── autocmds # Doom Nvim autocommands -│ │ │ ├── config # Doom Nvim configuration files -│ │ │ ├── default # Doom Nvim default Neovim settings -│ │ │ ├── functions # Doom Nvim functions -│ │ │ ├── health # Doom Nvim health checking -│ │ │ ├── keybindings # Doom Nvim keybindings -│ │ │ ├── logging # Doom Nvim logging system -│ │ │ └── system # Doom Nvim system utilities (early stage) -│ │ └── utils # Doom Nvim utilities -│ └── modules # Location of Doom Nvim plugins -│ ├── configs # Plugins configurations -│ ├── built-in # Doom Nvim built-in plugins -│ └── init.lua # packer.nvim setup -└── sessions # Location of Neovim workspaces - -Doom Nvim also sets default configurations for the `doom_config.lua` and the -`doom_modules.lua` files, which serves as the user configuration file -if it is not present on the system. It allows a fine control over the core -functions of Doom Nvim. - - -============================================================================== -HACKING LUA CORE *doom_nvim_hacking_lua_core* - -The `lua/doom` directory content is loaded by Neovim on_start. It is the -location of the Doom Nvim plugin which is loaded everytime nvim starts. - -The `doom/default/init.lua` file contains most of the global variables used by -Doom Nvim and executes the init functions of Doom Nvim. - -The files inside the `doom/` directory have core functions for Doom Nvim. - - - autocmds/ : Autocommands - - config/ : Manages the BFC - - functions/ : Utility functions - - health/ : Used to check the health of installation - - logging/ : Logging handler - - system/ : Cross-platform support (WIP) - - utils/ : Utility Lua functions - - -============================================================================== -ACKNOWLEDGEMENTS *doom_nvim_acknowledgements* - -Doom Nvim would not have been possible had it not been for - - - hlissner : Creator of Doom Emacs - - romgrk : Ported doom-one colorscheme from Doom Emacs to Vim - - All our contributors - - -============================================================================== -LICENSE *doom_nvim_license* - -Doom Nvim is distributed under GPLv2 license. - - -============================================================================== -CONTRIBUTING *doom_nvim_contributing* - -- I really love pull requests and bug reports - (please see the Contributing Guidelines on GitHub before contributing) - -- Don't hesitate to tell me my Lua coding style sucks, but please tell me why. - - -============================================================================== -CHANGELOG *doom_nvim_changelog* - -Please see `$HOME/.config/doom-nvim/CHANGELOG.md` for a full and detailed -changelog. diff --git a/doc/tags b/doc/tags index 82f38189a..89298c7b1 100644 --- a/doc/tags +++ b/doc/tags @@ -1,29 +1,26 @@ -doom_nvim doom_nvim.txt /*doom_nvim* -doom_nvim.txt doom_nvim.txt /*doom_nvim.txt* -doom_nvim_acknowledgements doom_nvim.txt /*doom_nvim_acknowledgements* -doom_nvim_autocomplete doom_nvim.txt /*doom_nvim_autocomplete* -doom_nvim_changelog doom_nvim.txt /*doom_nvim_changelog* -doom_nvim_colorscheme doom_nvim.txt /*doom_nvim_colorscheme* -doom_nvim_commands doom_nvim.txt /*doom_nvim_commands* -doom_nvim_commands_keybindings doom_nvim.txt /*doom_nvim_commands_keybindings* -doom_nvim_configuration doom_nvim.txt /*doom_nvim_configuration* -doom_nvim_configuration_custom_plugins doom_nvim.txt /*doom_nvim_configuration_custom_plugins* -doom_nvim_configuration_layout doom_nvim.txt /*doom_nvim_configuration_layout* -doom_nvim_configuration_layout_explorer doom_nvim.txt /*doom_nvim_configuration_layout_explorer* -doom_nvim_configuration_layout_mainbuffer doom_nvim.txt /*doom_nvim_configuration_layout_mainbuffer* -doom_nvim_configuration_layout_minimap doom_nvim.txt /*doom_nvim_configuration_layout_minimap* -doom_nvim_configuration_layout_outline doom_nvim.txt /*doom_nvim_configuration_layout_outline* -doom_nvim_configuration_layout_terminal doom_nvim.txt /*doom_nvim_configuration_layout_terminal* -doom_nvim_configuration_lsp doom_nvim.txt /*doom_nvim_configuration_lsp* -doom_nvim_configuration_modules doom_nvim.txt /*doom_nvim_configuration_modules* -doom_nvim_configuration_modules_tweaking doom_nvim.txt /*doom_nvim_configuration_modules_tweaking* -doom_nvim_contents doom_nvim.txt /*doom_nvim_contents* -doom_nvim_contributing doom_nvim.txt /*doom_nvim_contributing* -doom_nvim_faq doom_nvim.txt /*doom_nvim_faq* -doom_nvim_hacking doom_nvim.txt /*doom_nvim_hacking* -doom_nvim_hacking_lua_core doom_nvim.txt /*doom_nvim_hacking_lua_core* -doom_nvim_intro doom_nvim.txt /*doom_nvim_intro* -doom_nvim_issues doom_nvim.txt /*doom_nvim_issues* -doom_nvim_license doom_nvim.txt /*doom_nvim_license* -doom_nvim_usage doom_nvim.txt /*doom_nvim_usage* -doom_nvim_usage_moving_around doom_nvim.txt /*doom_nvim_usage_moving_around* +doom doom_nvim.norg /* Table of Contents +doom-intro doom_nvim.norg /* Introduction +doom-daily-usage doom_nvim.norg /* Using Doom Nvim as your daily setup +doom-moving-around doom_nvim.norg / ** Moving around +doom-configuration doom_nvim.norg / ** Configuration +doom-modules doom_nvim.norg / *** Modules +doom-tweaking-modules doom_nvim.norg / **** Tweaking modules +doom-custom-plugins doom_nvim.norg / *** Custom plugins +doom-lsp doom_nvim.norg / *** Language Server Protocols +doom-autocompletion doom_nvim.norg / ** Autocompletion +doom-colorscheme doom_nvim.norg / ** Colorscheme +doom-layout doom_nvim.norg / ** Layout +doom-explorer doom_nvim.norg / *** File Explorer +doom-buffer doom_nvim.norg / *** Main Buffer +doom-terminal doom_nvim.norg / *** Terminal +doom-minimap doom_nvim.norg / *** Minimap +doom-outline doom_nvim.norg / *** Outline +doom-commands doom_nvim.norg / ** Commands +doom-keybindings doom_nvim.norg / ** Keybindings +doom-hacking doom_nvim.norg / ** Hacking Doom Nvim +doom-issues doom_nvim.norg /* Known issues +doom-faq doom_nvim.norg /* FAQ +doom-faq-general doom_nvim.norg / ** General +doom-acknowledgements doom_nvim.norg /* Acknowledgements +doom-contributing doom_nvim.norg /* Contributing +doom-license doom_nvim.norg /* License diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index cbfdb25de..c4762691d 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -156,6 +156,40 @@ M.check_updates = function() end end +-- Open Doom Nvim user manual and set extra options to buffer +M.open_docs = function() + -- NOTE: we aren't using the default Neovim way with ':h doom' because of some bugs + -- with the tags and Neovim overriding the filetype, causing some highlighting issues + + -- Get the documentation path + local docs_path + if utils.file_exists(string.format("%s/doc/doom_nvim.norg", system.doom_root)) then + docs_path = string.format("%s/doc/doom_nvim.norg", system.doom_root) + else + docs_path = string.format("%s/doc/doom_nvim.norg", system.doom_configs_root) + end + + -- Open the documentation in a split window + vim.cmd(string.format("split %s", docs_path)) + -- Move cursor to table of contents section + vim.api.nvim_buf_call(vim.fn.bufnr("doom_nvim.norg"), function() + vim.fn.cursor(12, 1) + end) + -- Set local documentation options + vim.opt_local.modified = false + vim.opt_local.modifiable = false + vim.opt_local.signcolumn = "no" + vim.opt_local.number = false + vim.opt_local.relativenumber = false + vim.opt_local.colorcolumn = "0" + vim.opt_local.shiftwidth = 2 + vim.opt_local.tabstop = 2 + vim.opt_local.conceallevel = 2 + vim.opt_local.concealcursor = "n" + vim.opt_local.textwidth = 100 + vim.opt_local.rightleft = false +end + -- create_report creates a markdown report. It's meant to be used when a bug -- occurs, useful for debugging issues. M.create_report = function() diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index fc3083c18..13cabae6a 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -148,6 +148,9 @@ M.custom_options = function() -- Set a custom command to rollback Doom Nvim version -- can be called by using :DoomRollback vim.cmd('command! DoomRollback lua require("doom.core.functions").rollback_doom()') + -- Set a custom command to open Doom Nvim user manual + -- can be called by using :DoomManual + vim.cmd('command! DoomManual lua require("doom.core.functions").open_docs()') -- Load user-defined settings from the Neovim field in the doom_config.lua file functions.load_custom_settings(config.nvim.autocmds, "autocmds") diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 2c9f37594..6cde2edcf 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -168,11 +168,11 @@ utils.map( utils.map( "n", "dd", - "help doom_nvim", + "lua require('doom.core.functions').open_docs()", opts, "Doom", "help_doom", - "Open Doom help pages" + "Open Doom user manual" ) utils.map("n", "du", "DoomUpdate", opts, "Doom", "update_doom", "Update Doom Nvim") utils.map( diff --git a/lua/doom/modules/config/doom-dashboard.lua b/lua/doom/modules/config/doom-dashboard.lua index 5e57931d5..d885dc951 100644 --- a/lua/doom/modules/config/doom-dashboard.lua +++ b/lua/doom/modules/config/doom-dashboard.lua @@ -31,7 +31,7 @@ return function() }, g = { description = { " Open Documentation SPC d d" }, - command = "h doom_nvim", + command = 'lua require("doom.core.functions").open_docs()', }, } From 149130f5c748605a97601b42d77e62076a4e828e Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 7 Sep 2021 20:21:33 -0400 Subject: [PATCH 030/290] feat: add more Doom commands, e.g. `:DoomReport` - Use Doom commands in keybindings instead of the Lua chunks - Create a separated function for Doom commands in `settings` module - Update internal documentation --- doc/doom_nvim.norg | 22 +++++++++++++++------- lua/doom/core/init.lua | 2 ++ lua/doom/core/settings/init.lua | 16 ++++++++++++++-- lua/doom/extras/keybindings/leader.lua | 8 ++++---- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index b79c6e39d..73af4a976 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -244,13 +244,21 @@ ** Commands Doom Nvim has its own commands, to make your life easier when developing on it. - ┌─────────────┬──────────────────────────────────────────┐ - │Command │ Description │ - ├─────────────┼──────────────────────────────────────────┤ - │DoomUpdate │ Update Doom Nvim if there are updates │ - ├─────────────┼──────────────────────────────────────────┤ - │DoomRollback │ Rollback Doom Nvim to a previous version │ - └─────────────┴──────────────────────────────────────────┘ + ┌──────────────────┬────────────────────────────────────────────┐ + │Command │ Description │ + ├──────────────────┼────────────────────────────────────────────┤ + │DoomUpdate │ Update Doom Nvim if there are updates │ + ├──────────────────┼────────────────────────────────────────────┤ + │DoomRollback │ Rollback Doom Nvim to a previous version │ + ├──────────────────┼────────────────────────────────────────────┤ + │DoomManual │ Open Doom Nvim User Manual │ + ├──────────────────┼────────────────────────────────────────────┤ + │DoomConfigs │ Open a selection menu to edit Doom configs │ + ├──────────────────┼────────────────────────────────────────────┤ + │DoomConfigsReload │ Reload user-defined keybindings, etc │ + ├──────────────────┼────────────────────────────────────────────┤ + │DoomReport │ Create a Doom Nvim markdown crash report │ + └──────────────────┴────────────────────────────────────────────┘ Doom Nvim also uses [which-key.nvim](https://github.com/folke/which-key.nvim) as a commands manager, inspired by emacs' guide-key. To open it, press `SPC` and wait for the popup to show, it should not take much time. diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index 4e6abd6fa..d7c63cd84 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -13,6 +13,8 @@ for i = 1, #core_modules, 1 do require("doom.core.settings").load_default_options() -- User-defined settings (global variables, mappings, ect) require("doom.core.settings").custom_options() + -- Doom Nvim custom commands + require("doom.core.settings").doom_commands() elseif core_modules[i] == "config" then -- Automatically install language servers require("doom.core.config").install_servers(require("doom.core.config.modules").modules.langs) diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index 13cabae6a..230445c71 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -140,8 +140,8 @@ M.load_default_options = function() vim.opt.conceallevel = config.doom.conceallevel end --- Custom Doom Nvim commands -M.custom_options = function() +-- Doom Nvim commands +M.doom_commands = function() -- Set a custom command to update Doom Nvim -- can be called by using :DoomUpdate vim.cmd('command! DoomUpdate lua require("doom.core.functions").update_doom()') @@ -151,7 +151,19 @@ M.custom_options = function() -- Set a custom command to open Doom Nvim user manual -- can be called by using :DoomManual vim.cmd('command! DoomManual lua require("doom.core.functions").open_docs()') + -- Set a custom command to edit Doom Nvim private configurations + -- can be called by using :DoomConfigs + vim.cmd('command! DoomConfigs lua require("doom.core.functions").edit_config()') + -- Set a custom command to reload Doom Nvim custom mappings, autocommands, etc + -- can be called by using :DoomConfigsReload + vim.cmd('command! DoomConfigsReload lua require("doom.core.functions").reload_custom_settings()') + -- Set a custom command to create a crash report + -- can be called by using :DoomReport + vim.cmd('command! DoomReport lua require("doom.core.functions").create_report()') +end +-- Custom Doom Nvim options +M.custom_options = function() -- Load user-defined settings from the Neovim field in the doom_config.lua file functions.load_custom_settings(config.nvim.autocmds, "autocmds") functions.load_custom_settings(config.nvim.commands, "commands") diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 6cde2edcf..671e533e5 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -159,7 +159,7 @@ utils.map( utils.map( "n", "dc", - 'lua require("doom.core.functions").edit_config()', + 'DoomConfigs', opts, "Doom", "edit_doom_config", @@ -168,7 +168,7 @@ utils.map( utils.map( "n", "dd", - "lua require('doom.core.functions').open_docs()", + "DoomManual", opts, "Doom", "help_doom", @@ -187,7 +187,7 @@ utils.map( utils.map( "n", "dR", - 'lua require("doom.core.functions").create_report()', + 'DoomReport', opts, "Doom", "create_crash_report", @@ -214,7 +214,7 @@ utils.map( utils.map( "n", "dl", - "lua require('doom.core.functions').reload_custom_settings()", + "DoomConfigsReload", opts, "Doom", "reload_user_settings", From 642905aa731629cf7f60b51d2e6c6418901627b1 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 7 Sep 2021 20:22:54 -0400 Subject: [PATCH 031/290] feat(modules): add `~/.config/nvim/doc` to Neorg workspaces --- lua/doom/modules/config/doom-neorg.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index b308e1068..ed16e989e 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -1,4 +1,6 @@ return function() + local doom_root = require("doom.core.system").doom_root + -- Default setup for Neorg require("neorg").setup({ -- Tell Neorg what modules to load @@ -15,6 +17,7 @@ return function() config = { workspaces = { default_workspace = "~/neorg", + doom_docs = string.format("%s/doc", doom_root), }, }, }, From 5be9bbb8090e8db27f6df32d7248fe1062a5b24b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Sep 2021 02:14:51 +0000 Subject: [PATCH 032/290] chore: format source code --- lua/doom/extras/keybindings/leader.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 671e533e5..e736ea1f5 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -159,7 +159,7 @@ utils.map( utils.map( "n", "dc", - 'DoomConfigs', + "DoomConfigs", opts, "Doom", "edit_doom_config", @@ -187,7 +187,7 @@ utils.map( utils.map( "n", "dR", - 'DoomReport', + "DoomReport", opts, "Doom", "create_crash_report", From 212bcecfda4d73b193d442d69d05bc1ef74a8dd9 Mon Sep 17 00:00:00 2001 From: Binx <68950943+Binx-Codes@users.noreply.github.com> Date: Wed, 8 Sep 2021 11:37:16 +0400 Subject: [PATCH 033/290] fix: replace deprecated values for dap-ui (#114) --- lua/doom/modules/config/doom-dap-ui.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/config/doom-dap-ui.lua b/lua/doom/modules/config/doom-dap-ui.lua index b913b2955..41c93d6b4 100644 --- a/lua/doom/modules/config/doom-dap-ui.lua +++ b/lua/doom/modules/config/doom-dap-ui.lua @@ -21,7 +21,7 @@ return function() "stacks", "watches", }, - width = 40, + size = 40, position = "left", -- Can be "left" or "right" }, tray = { @@ -29,7 +29,7 @@ return function() elements = { "repl", }, - height = 10, + size = 10, position = "bottom", -- Can be "bottom" or "top" }, floating = { From a02872d648116d8021574057d6b8f816f95183fa Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 8 Sep 2021 16:21:17 -0400 Subject: [PATCH 034/290] feat(doom_config): add extra field to custom functions to choose if the function should be ran on startup or if should be a global function - Re-organize stuff in settings module so we can use the custom global functions in commands, autocommands, etc --- doom_config.lua | 11 ++++++++--- lua/doom/core/functions/init.lua | 29 ++++++++++++++++++++--------- lua/doom/core/settings/init.lua | 2 +- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 9dff109d7..c115bbce2 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -382,9 +382,14 @@ M.config = { -- @default = {} -- example: -- { - -- hello_custom_func = function() - -- print("Hello, custom functions!") - -- end + -- { + -- hello_custom_func = function() + -- print("Hello, custom functions!") + -- end, + -- -- If the function should be ran on neovim launch or if it should + -- -- be a global function accesible from anywhere + -- run_on_start = false, + -- }, -- } functions = {}, diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index c4762691d..4754a93d8 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -50,21 +50,32 @@ M.load_custom_settings = function(settings_tbl, scope) -- If the provided settings table is not empty if next(settings_tbl) ~= nil then log.debug("Loading custom " .. scope .. " ...") - if scope == "autocmds" then - utils.create_augroups(settings_tbl) - elseif scope == "commands" then - for _, cmd in ipairs(settings_tbl) do - vim.cmd(cmd) - end - elseif scope == "functions" then - for _, func_body in pairs(settings_tbl) do - func_body() + if scope == "functions" then + for _, func in ipairs(settings_tbl) do + -- Copy the function table so we can modify it safely + local func_tbl = func + -- Remove the additional table parameters + func_tbl.run_on_start = nil + local func_name = vim.tbl_keys(func_tbl)[1] + + -- If we should run the function on launch or set it as a global function + if func.run_on_start then + func_tbl[func_name]() + else + _G[func_name] = func_tbl[func_name] + end end elseif scope == "mappings" then for _, map in ipairs(settings_tbl) do -- scope, lhs, rhs, options vim.api.nvim_set_keymap(map[1], map[2], map[3], map[4] and map[4] or {}) end + elseif scope == "autocmds" then + utils.create_augroups(settings_tbl) + elseif scope == "commands" then + for _, cmd in ipairs(settings_tbl) do + vim.cmd(cmd) + end elseif scope == "variables" then for var, val in pairs(settings_tbl) do vim.g[var] = val diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index 230445c71..6938c872b 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -165,9 +165,9 @@ end -- Custom Doom Nvim options M.custom_options = function() -- Load user-defined settings from the Neovim field in the doom_config.lua file + functions.load_custom_settings(config.nvim.functions, "functions") functions.load_custom_settings(config.nvim.autocmds, "autocmds") functions.load_custom_settings(config.nvim.commands, "commands") - functions.load_custom_settings(config.nvim.functions, "functions") functions.load_custom_settings(config.nvim.mappings, "mappings") functions.load_custom_settings(config.nvim.global_variables, "variables") functions.load_custom_settings(config.nvim.options, "options") From 7bd32f84633402ceb449225429fd7ce210546153 Mon Sep 17 00:00:00 2001 From: Binx <68950943+Binx-Codes@users.noreply.github.com> Date: Thu, 9 Sep 2021 00:39:56 +0400 Subject: [PATCH 035/290] neorg now has an org, replaced links for them (#115) --- lua/doom/modules/config/doom-treesitter.lua | 2 +- lua/doom/modules/init.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 0d1769249..7ccba05d3 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -29,7 +29,7 @@ return function() local parser_configs = require("nvim-treesitter.parsers").get_parser_configs() parser_configs.norg = { install_info = { - url = "https://github.com/vhyrro/tree-sitter-norg", + url = "https://github.com/nvim-neorg/tree-sitter-norg", files = { "src/parser.c", "src/scanner.cc" }, branch = "main", }, diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index f6b4ec8c0..30bd1edb6 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -71,7 +71,7 @@ packer.startup(function(use) -- Neorg local disabled_neorg = is_plugin_disabled("neorg") use({ - "vhyrro/neorg", + "nvim-neorg/neorg", branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, From 7bbb3acd136fa6b56cf884bb6c8a6cecbd4ce1db Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 8 Sep 2021 17:25:18 -0400 Subject: [PATCH 036/290] fix(modules): update some plugins links --- lua/doom/modules/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 30bd1edb6..0a1775b19 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -151,7 +151,7 @@ packer.startup(function(use) -- can be disabled to use your own tabline local disabled_tabline = is_plugin_disabled("tabline") use({ - "akinsho/nvim-bufferline.lua", + "akinsho/bufferline.nvim", config = require("doom.modules.config.doom-bufferline"), disable = disabled_tabline, event = "ColorScheme", @@ -161,7 +161,7 @@ packer.startup(function(use) -- can be disabled to use your own terminal plugin local disabled_terminal = is_plugin_disabled("terminal") use({ - "akinsho/nvim-toggleterm.lua", + "akinsho/toggleterm.nvim", config = require("doom.modules.config.doom-toggleterm"), disable = disabled_terminal, module = { "toggleterm", "toggleterm.terminal" }, From 3ecb7648a3da7b52f5747d6937466d22d905abb8 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 9 Sep 2021 02:29:03 -0400 Subject: [PATCH 037/290] feat(modules): migrate from nvim-compe to nvim-cmp (wip) NOTE: snippets expansion is not working properly, should be fixed asap --- lua/doom/modules/config/doom-cmp.lua | 117 ++++++++++++++++++ lua/doom/modules/config/doom-compe.lua | 71 ----------- .../modules/config/doom-lsp-signature.lua | 9 +- lua/doom/modules/config/doom-lspconfig.lua | 14 +-- lua/doom/modules/config/doom-lspinstall.lua | 12 +- lua/doom/modules/init.lua | 33 +++-- 6 files changed, 166 insertions(+), 90 deletions(-) create mode 100644 lua/doom/modules/config/doom-cmp.lua delete mode 100644 lua/doom/modules/config/doom-compe.lua diff --git a/lua/doom/modules/config/doom-cmp.lua b/lua/doom/modules/config/doom-cmp.lua new file mode 100644 index 000000000..e32c1c9d1 --- /dev/null +++ b/lua/doom/modules/config/doom-cmp.lua @@ -0,0 +1,117 @@ +return function() + local cmp = require("cmp") + local luasnip = require("luasnip") + + local kind_icons = { + Text = "  ", + Method = "  ", + Function = "  ", + Constructor = "  ", + Field = " ﴲ ", + Variable = "  ", + Class = "  ", + Interface = " ﰮ ", + Module = "  ", + Property = " ﰠ ", + Unit = "  ", + Value = "  ", + Enum = " 練", + Keyword = "  ", + Snippet = "  ", + Color = "  ", + File = "  ", + Reference = "  ", + Folder = "  ", + EnumMember = "  ", + Constant = " ﲀ ", + Struct = " ﳤ ", + Event = "  ", + Operator = "  ", + TypeParameter = "  ", + } + local function get_kind(kind_type) + return kind_icons[kind_type] + end + + local function t(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) + end + local function check_backspace() + local col = vim.fn.col "." - 1 + if col == 0 or vim.fn.getline("."):sub(col, col):match "%s" then + return true + else + return false + end + end + + cmp.setup({ + completion = { + completeopt = "menu,menuone,preview,noinsert", + }, + formatting = { + format = function(entry, item) + item.kind = string.format("%s %s", get_kind(item.kind), item.kind) + item.menu = ({ + nvim_lsp = "[LSP]", + luasnip = "[Snp]", + buffer = "[Buf]", + nvim_lua = "[Lua]", + path = "[Path]", + })[entry.source.name] + + return item + end, + }, + mappings = { + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping(function(fallback) + if vim.fn.pumvisible() == 1 then + vim.fn.feedkeys(t(""), "n") + elseif luasnip.expand_or_jumpable() then + vim.fn.feedkeys(t("luasnip-expand-or-jump"), "") + elseif check_backspace() then + vim.fn.feedkeys(t(""), "n") + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if vim.fn.pumvisible() == 1 then + vim.fn.feedkeys(t(""), "n") + elseif luasnip.jumpable(-1) then + vim.fn.feedkeys(t("luasnip-jump-prev"), "") + else + fallback() + end + end, { + "i", + "s", + }), + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + sources = { + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + { name = "buffer" }, + }, + }) +end diff --git a/lua/doom/modules/config/doom-compe.lua b/lua/doom/modules/config/doom-compe.lua deleted file mode 100644 index 18c4c7c4a..000000000 --- a/lua/doom/modules/config/doom-compe.lua +++ /dev/null @@ -1,71 +0,0 @@ ---- nvim-compe configuration --- https://github.com/hrsh7th/nvim-compe#lua-config -return function() - require("compe").setup({ - enabled = true, - autocomplete = true, - debug = false, - min_length = 4, - preselect = "enable", - throttle_time = 80, - source_timeout = 200, - incomplete_delay = 400, - max_abbr_width = 100, - max_kind_width = 100, - max_menu_width = 100, - documentation = true, - - source = { - path = true, - buffer = true, - calc = false, - vsnip = false, - nvim_lsp = true, - nvim_lua = true, - luasnip = true, - spell = false, - tags = true, - neorg = true, - snippets_nvim = false, - treesitter = true, - }, - }) - local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) - end - - local check_back_space = function() - local col = vim.fn.col(".") - 1 - if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then - return true - else - return false - end - end - - -- Use (s-)tab to: - --- move to prev/next item in completion menuone - --- jump to prev/next snippet's placeholder - _G.tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t("") - elseif check_back_space() then - return t("") - else - return vim.fn["compe#complete"]() - end - end - - _G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t("") - else - return t("") - end - end - - vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", { expr = true }) - vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", { expr = true }) - vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", { expr = true }) - vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", { expr = true }) -end diff --git a/lua/doom/modules/config/doom-lsp-signature.lua b/lua/doom/modules/config/doom-lsp-signature.lua index 5bcf762e2..eb0a5ab18 100644 --- a/lua/doom/modules/config/doom-lsp-signature.lua +++ b/lua/doom/modules/config/doom-lsp-signature.lua @@ -1,4 +1,11 @@ return function() -- Signature help - require("lsp_signature").on_attach() + require("lsp_signature").setup({ + bind = true, + floating_window = true, + floating_window_above_cur_line = true, + handler_opts = { + border = "single", + }, + }) end diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index 1ef7a1376..f0cd2a897 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -3,10 +3,6 @@ return function() local lsp = vim.lsp local config = require("doom.core.config").config - -- Snippets support - local capabilities = lsp.protocol.make_client_capabilities() - capabilities.textDocument.completion.completionItem.snippetSupport = true - -- Lsp Symbols fn.sign_define("LspDiagnosticsSignError", { texthl = "LspDiagnosticsSignError", @@ -40,18 +36,18 @@ return function() "  (Text) ", "  (Method)", "  (Function)", - "  (Constructor)", + "  (Constructor)", " ﴲ (Field)", - "[] (Variable)", + "  (Variable)", "  (Class)", " ﰮ (Interface)", "  (Module)", - " 襁 (Property)", + " ﰠ (Property)", "  (Unit)", "  (Value)", " 練 (Enum)", "  (Keyword)", - "  (Snippet)", + "  (Snippet)", "  (Color)", "  (File)", "  (Reference)", @@ -60,7 +56,7 @@ return function() " ﲀ (Constant)", " ﳤ (Struct)", "  (Event)", - "  (Operator)", + "  (Operator)", "  (TypeParameter)", } diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 0d50ac7e5..7b62ef1ac 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -1,5 +1,11 @@ return function() local nvim_lsp = require("lspconfig") + + -- Snippets support + local capabilities = vim.lsp.protocol.make_client_capabilities() + -- capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities) + capabilities.textDocument.completion.completionItem.snippetSupport = true + local lua_lsp = require("lua-dev").setup({ lspconfig = { settings = { @@ -9,6 +15,7 @@ return function() }, }, }, + capabilities = capabilities, }, }) @@ -16,6 +23,7 @@ return function() local function setup_servers() -- Provide the missing :LspInstall require("lspinstall").setup() + local servers = require("lspinstall").installed_servers() for _, server in pairs(servers) do -- Configure sumneko for neovim lua development @@ -23,7 +31,9 @@ return function() nvim_lsp.lua.setup(lua_lsp) else -- Use default settings for all the other language servers - nvim_lsp[server].setup({}) + nvim_lsp[server].setup({ + capabilities = capabilities, + }) end end end diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 0a1775b19..222de69a0 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -312,17 +312,35 @@ packer.startup(function(use) -- Completion plugin -- can be disabled to use your own completion plugin use({ - "hrsh7th/nvim-compe", + "hrsh7th/nvim-cmp", requires = { - { - "ray-x/lsp_signature.nvim", - config = require("doom.modules.config.doom-lsp-signature"), - }, + "ray-x/lsp_signature.nvim", + config = require("doom.modules.config.doom-lsp-signature"), }, - config = require("doom.modules.config.doom-compe"), + config = require("doom.modules.config.doom-cmp"), disable = disabled_lsp, + event = "BufWinEnter", opt = true, - after = "nvim-lspconfig", + }) + use({ + "hrsh7th/cmp-nvim-lua", + after = "nvim-cmp", + }) + use({ + "hrsh7th/cmp-nvim-lsp", + after = "nvim-cmp", + }) + use({ + "hrsh7th/cmp-path", + after = "nvim-cmp", + }) + use({ + "hrsh7th/cmp-buffer", + after = "nvim-cmp", + }) + use({ + "saadparwaiz1/cmp_luasnip", + after = "nvim-cmp", }) -- Snippets @@ -332,7 +350,6 @@ packer.startup(function(use) config = require("doom.modules.config.doom-luasnip"), disable = disabled_snippets, requires = { "rafamadriz/friendly-snippets" }, - event = "BufWinEnter", }) -- provides the missing `:LspInstall` for `nvim-lspconfig`. From 71650db5c189db6755a1fa1535008c2f1f2b3800 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 9 Sep 2021 02:30:22 -0400 Subject: [PATCH 038/290] fix(keybindings): correct check for luasnip existence --- lua/doom/extras/keybindings/completion.lua | 193 ++++++++------------- 1 file changed, 72 insertions(+), 121 deletions(-) diff --git a/lua/doom/extras/keybindings/completion.lua b/lua/doom/extras/keybindings/completion.lua index ca67e9b8a..57ce06abc 100644 --- a/lua/doom/extras/keybindings/completion.lua +++ b/lua/doom/extras/keybindings/completion.lua @@ -8,130 +8,81 @@ local check_plugin = require("doom.core.functions").check_plugin local opts = { silent = true } local lsp_opts = vim.tbl_extend("force", opts, { expr = true }) --- If the LSP is not disabled and compe is installed then set its mappings. -if check_plugin("nvim-compe", "opt") then - -- https://github.com/hrsh7th/nvim-compe#mappings - utils.map( - "i", - "", - "compe#complete()", - lsp_opts, - "Completion", - "compe_complete", - "Complete" - ) - utils.map( - "i", - "", - 'compe#confirm("")', - lsp_opts, - "Completion", - "compe_confirm", - "Confirm completion" - ) - utils.map( - "i", - "", - 'compe#close("")', - lsp_opts, - "Completion", - "compe_close", - "Close compe menu" - ) - utils.map( - "i", - "", - 'compe#scroll({ "delta": +4 })', - lsp_opts, - "Completion", - "compe_indent", - "Indent current line" - ) - utils.map( - "i", - "", - 'compe#scroll({ "delta": -4 })', - lsp_opts, - "Completion", - "compe_dedent", - "Dedent current line" - ) - -- gd: jump to definition - utils.map( - "n", - "gd", - ":lua vim.lsp.buf.definition()", - opts, - "LSP", - "jump_to_definition", - "Jump to definition" - ) - -- gr: go to reference - utils.map( - "n", - "gr", - ":lua vim.lsp.buf.references()", - opts, - "LSP", - "goto_reference", - "Goto reference" - ) - -- gi: buf implementation - utils.map( - "n", - "gi", - ":lua vim.lsp.buf.implementation()", - opts, - "LSP", - "goto_implementation", - "List implementations" - ) - -- ca: code actions - utils.map( - "n", - "ca", - ":lua vim.lsp.buf.code_action()", - opts, - "LSP", - "code_action", - "Code action" - ) - -- K: hover doc - utils.map( - "n", - "K", - ":lua vim.lsp.buf.hover()", - opts, - "LSP", - "hover_doc", - "Hover documentation" - ) - -- Control+p: Jump to previous diagnostic - utils.map( - "n", - "", - ":lua vim.lsp.diagnostic.goto_prev()", - opts, - "LSP", - "prev_diagnostic", - "Jump to previous diagnostic" - ) - -- Control+n: Jump to next diagnostic - utils.map( - "n", - "", - ":lua vim.lsp.diagnostic.goto_next()", - opts, - "LSP", - "next_diagnostic", - "Jump to next diagnostic" - ) +-- gd: jump to definition +utils.map( + "n", + "gd", + ":lua vim.lsp.buf.definition()", + opts, + "LSP", + "jump_to_definition", + "Jump to definition" +) +-- gr: go to reference +utils.map( + "n", + "gr", + ":lua vim.lsp.buf.references()", + opts, + "LSP", + "goto_reference", + "Goto reference" +) +-- gi: buf implementation +utils.map( + "n", + "gi", + ":lua vim.lsp.buf.implementation()", + opts, + "LSP", + "goto_implementation", + "List implementations" +) +-- ca: code actions +utils.map( + "n", + "ca", + ":lua vim.lsp.buf.code_action()", + opts, + "LSP", + "code_action", + "Code action" +) +-- K: hover doc +utils.map( + "n", + "K", + ":lua vim.lsp.buf.hover()", + opts, + "LSP", + "hover_doc", + "Hover documentation" +) +-- Control+p: Jump to previous diagnostic +utils.map( + "n", + "", + ":lua vim.lsp.diagnostic.goto_prev()", + opts, + "LSP", + "prev_diagnostic", + "Jump to previous diagnostic" +) +-- Control+n: Jump to next diagnostic +utils.map( + "n", + "", + ":lua vim.lsp.diagnostic.goto_next()", + opts, + "LSP", + "next_diagnostic", + "Jump to next diagnostic" +) - vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') -end +vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') -- LuaSnip mappings -if check_plugin("LuaSnip", "opt") then +if check_plugin("LuaSnip", "start") then utils.map( "n", "", From cb82fe097c7e25ccaf4274892e83845ae8f9c372 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 Sep 2021 06:30:44 +0000 Subject: [PATCH 039/290] chore: format source code --- lua/doom/extras/keybindings/completion.lua | 10 +--------- lua/doom/modules/config/doom-cmp.lua | 6 +++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lua/doom/extras/keybindings/completion.lua b/lua/doom/extras/keybindings/completion.lua index 57ce06abc..890076d7f 100644 --- a/lua/doom/extras/keybindings/completion.lua +++ b/lua/doom/extras/keybindings/completion.lua @@ -49,15 +49,7 @@ utils.map( "Code action" ) -- K: hover doc -utils.map( - "n", - "K", - ":lua vim.lsp.buf.hover()", - opts, - "LSP", - "hover_doc", - "Hover documentation" -) +utils.map("n", "K", ":lua vim.lsp.buf.hover()", opts, "LSP", "hover_doc", "Hover documentation") -- Control+p: Jump to previous diagnostic utils.map( "n", diff --git a/lua/doom/modules/config/doom-cmp.lua b/lua/doom/modules/config/doom-cmp.lua index e32c1c9d1..2fc91f562 100644 --- a/lua/doom/modules/config/doom-cmp.lua +++ b/lua/doom/modules/config/doom-cmp.lua @@ -37,8 +37,8 @@ return function() return vim.api.nvim_replace_termcodes(str, true, true, true) end local function check_backspace() - local col = vim.fn.col "." - 1 - if col == 0 or vim.fn.getline("."):sub(col, col):match "%s" then + local col = vim.fn.col(".") - 1 + if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then return true else return false @@ -66,7 +66,7 @@ return function() mappings = { [""] = cmp.mapping.complete(), [""] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, + behavior = cmp.ConfirmBehavior.Replace, select = true, }), [""] = cmp.mapping.close(), From 9fb4d325d8d71f09c0b24bd6dd94c2d174dc0521 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Thu, 16 Sep 2021 20:23:53 +0430 Subject: [PATCH 040/290] fix(gitsigns): `use_internal_diff` has been replaced with `diff_opts.internal` (#118) --- lua/doom/modules/config/doom-gitsigns.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-gitsigns.lua b/lua/doom/modules/config/doom-gitsigns.lua index 40890f821..9c24857ed 100644 --- a/lua/doom/modules/config/doom-gitsigns.lua +++ b/lua/doom/modules/config/doom-gitsigns.lua @@ -67,6 +67,8 @@ return function() sign_priority = 6, update_debounce = 100, status_formatter = nil, -- Use default - use_internal_diff = true, -- If luajit is present + diff_opts = { + internal = true, -- If luajit is present + }, }) end From 827d0e61cddc890f3c88e8ff0a5bc21199a9d63a Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Thu, 16 Sep 2021 22:21:39 +0430 Subject: [PATCH 041/290] [Refactor]: use nvim-cmp instead of compe (#119) also lazyload everything and fix lsp_signature --- lua/doom/modules/config/doom-cmp.lua | 28 ++++++----- .../modules/config/doom-lsp-signature.lua | 28 +++++++++-- lua/doom/modules/config/doom-lspinstall.lua | 27 +++++++++- lua/doom/modules/config/doom-luasnip.lua | 26 +++++++++- lua/doom/utils/init.lua | 49 +++++++++++++++++++ 5 files changed, 140 insertions(+), 18 deletions(-) diff --git a/lua/doom/modules/config/doom-cmp.lua b/lua/doom/modules/config/doom-cmp.lua index 2fc91f562..c267775d8 100644 --- a/lua/doom/modules/config/doom-cmp.lua +++ b/lua/doom/modules/config/doom-cmp.lua @@ -38,17 +38,16 @@ return function() end local function check_backspace() local col = vim.fn.col(".") - 1 - if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then - return true - else - return false - end + return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") end cmp.setup({ completion = { completeopt = "menu,menuone,preview,noinsert", }, + documentation = { + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + }, formatting = { format = function(entry, item) item.kind = string.format("%s %s", get_kind(item.kind), item.kind) @@ -59,21 +58,26 @@ return function() nvim_lua = "[Lua]", path = "[Path]", })[entry.source.name] - + item.dup = ({ + buffer = 1, + path = 1, + nvim_lsp = 0, + })[entry.source.name] or 0 return item end, }, - mappings = { + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + -- [""] = cmp.mapping.close(), [""] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true, }), - [""] = cmp.mapping.close(), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping(function(fallback) if vim.fn.pumvisible() == 1 then vim.fn.feedkeys(t(""), "n") diff --git a/lua/doom/modules/config/doom-lsp-signature.lua b/lua/doom/modules/config/doom-lsp-signature.lua index eb0a5ab18..64c17e6ac 100644 --- a/lua/doom/modules/config/doom-lsp-signature.lua +++ b/lua/doom/modules/config/doom-lsp-signature.lua @@ -1,11 +1,31 @@ return function() -- Signature help - require("lsp_signature").setup({ + local cfg = { bind = true, - floating_window = true, + doc_lines = 10, + floating_window = false, -- show hint in a floating window, set to false for virtual text only mode floating_window_above_cur_line = true, + fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters + hint_enable = true, -- virtual hint enable + -- hint_prefix = "🐼 ", -- Panda for parameter + hint_prefix = " ", + hint_scheme = "String", + -- use_lspsaga = false, -- set to true if you want to use lspsaga popup + hi_parameter = "Search", -- how your parameter will be highlight + max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down + -- to view the hiding contents + max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width handler_opts = { - border = "single", + border = "single", -- double, single, shadow, none }, - }) + -- transpancy = 80, + extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} + zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom + debug = false, -- set to true to enable debug logging + log_path = "debug_log_file_path", -- debug log path + padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc + shadow_blend = 36, -- if you using shadow as border use this set the opacity + shadow_guibg = "Black", -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' + } + require("lsp_signature").setup(cfg) end diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 7b62ef1ac..cd21c97cb 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -3,8 +3,33 @@ return function() -- Snippets support local capabilities = vim.lsp.protocol.make_client_capabilities() - -- capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities) + capabilities.textDocument.completion.completionItem.preselectSupport = true + capabilities.textDocument.completion.completionItem.insertReplaceSupport = true + capabilities.textDocument.completion.completionItem.labelDetailsSupport = true + capabilities.textDocument.completion.completionItem.deprecatedSupport = true + capabilities.textDocument.completion.completionItem.commitCharactersSupport = true + capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } capabilities.textDocument.completion.completionItem.snippetSupport = true + capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { "documentation", "detail", "additionalTextEdits" }, + } + capabilities.textDocument.codeAction = { + dynamicRegistration = false, + codeActionLiteralSupport = { + codeActionKind = { + valueSet = { + "", + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports", + }, + }, + }, + } local lua_lsp = require("lua-dev").setup({ lspconfig = { diff --git a/lua/doom/modules/config/doom-luasnip.lua b/lua/doom/modules/config/doom-luasnip.lua index a572ed6c4..20e179169 100644 --- a/lua/doom/modules/config/doom-luasnip.lua +++ b/lua/doom/modules/config/doom-luasnip.lua @@ -1,3 +1,27 @@ return function() - require("luasnip.loaders.from_vscode").lazy_load() + local util = require("doom.utils") + local luasnip = require("luasnip") + + luasnip.config.set_config({ + history = true, + -- Update more often, :h events for more info. + updateevents = "TextChanged,TextChangedI", + }) + + require("luasnip/loaders/from_vscode").load() + + --- to jump to next snippet's placeholder + local function on_tab() + return luasnip.jump(1) and "" or util.t("") + end + + --- to jump to next snippet's placeholder + local function on_s_tab() + return luasnip.jump(-1) and "" or util.t("") + end + + util.imap("", on_tab, { expr = true }) + util.smap("", on_tab, { expr = true }) + util.imap("", on_s_tab, { expr = true }) + util.smap("", on_s_tab, { expr = true }) end diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 74c584044..957f58bfc 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -148,6 +148,55 @@ M.write_file = function(path, content, mode) end) end +-- keep functions that we want to call +M.functions = {} + +-- execute the given lua functions +-- @tparam int index of the function in M.functions +function M.execute(id) + local func = M.functions[id] + if not func then + error("Function doest not exist: " .. id) + end + return func() +end + +-- map keybindings to functions and cmds +local key_map = function(mode, key, cmd, opts, defaults) + opts = vim.tbl_deep_extend("force", { silent = true }, defaults or {}, opts or {}) + + if type(cmd) == "function" then + table.insert(M.functions, cmd) + if opts.expr then + cmd = ([[luaeval('require("doom.utils").execute(%d)')]]):format(#M.functions) + else + cmd = ("lua require('doom.utils').execute(%d)"):format(#M.functions) + end + end + if opts.buffer ~= nil then + local buffer = opts.buffer + opts.buffer = nil + return vim.api.nvim_buf_set_keymap(buffer, mode, key, cmd, opts) + else + return vim.api.nvim_set_keymap(mode, key, cmd, opts) + end +end + +-- map termcode keybindings +function M.t(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end + +-- insert mode keybinding +function M.imap(key, cmd, opts) + return key_map("i", key, cmd, opts) +end + +-- substitute mode keybinding +function M.smap(key, cmd, opts) + return key_map("s", key, cmd, opts) +end + M.load_modules = function(module_path, modules) for i = 1, #modules, 1 do local ok, err = xpcall( From b0f4572c7159197727c209e9802c025274c4609a Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Thu, 16 Sep 2021 23:22:42 +0430 Subject: [PATCH 042/290] [Bugfix] make sure plugins are loaded in a correct order (#120) --- lua/doom/modules/init.lua | 53 +++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 222de69a0..88e23cfba 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -309,17 +309,37 @@ packer.startup(function(use) event = "ColorScheme", }) + -- Snippets + local disabled_snippets = is_plugin_disabled("snippets") + + -- Autopairs + -- can be disabled to use your own autopairs + local disabled_autopairs = is_plugin_disabled("autopairs") + -- Completion plugin -- can be disabled to use your own completion plugin use({ "hrsh7th/nvim-cmp", + wants = { "LuaSnip" }, requires = { - "ray-x/lsp_signature.nvim", - config = require("doom.modules.config.doom-lsp-signature"), + { + "L3MON4D3/LuaSnip", + event = "BufReadPre", + wants = "friendly-snippets", + config = require("doom.modules.config.doom-luasnip"), + disable = disabled_snippets, + requires = { "rafamadriz/friendly-snippets" }, + }, + { + "windwp/nvim-autopairs", + config = require("doom.modules.config.doom-autopairs"), + disable = disabled_autopairs, + event = "BufReadPre", + }, }, config = require("doom.modules.config.doom-cmp"), disable = disabled_lsp, - event = "BufWinEnter", + event = "InsertEnter", opt = true, }) use({ @@ -343,15 +363,6 @@ packer.startup(function(use) after = "nvim-cmp", }) - -- Snippets - local disabled_snippets = is_plugin_disabled("snippets") - use({ - "L3MON4D3/LuaSnip", - config = require("doom.modules.config.doom-luasnip"), - disable = disabled_snippets, - requires = { "rafamadriz/friendly-snippets" }, - }) - -- provides the missing `:LspInstall` for `nvim-lspconfig`. use({ "kabouzeid/nvim-lspinstall", @@ -360,6 +371,14 @@ packer.startup(function(use) after = "nvim-lspconfig", }) + -- Show function signature when you type + use({ + "ray-x/lsp_signature.nvim", + config = require("doom.modules.config.doom-lsp-signature"), + after = "nvim-lspconfig", + event = "InsertEnter", + }) + -- Setup for Lua development in Neovim use({ "folke/lua-dev.nvim", @@ -421,16 +440,6 @@ packer.startup(function(use) event = "BufWinEnter", }) - -- Autopairs - -- can be disabled to use your own autopairs - local disabled_autopairs = is_plugin_disabled("autopairs") - use({ - "windwp/nvim-autopairs", - config = require("doom.modules.config.doom-autopairs"), - disable = disabled_autopairs, - event = "InsertEnter", - }) - -- Indent Lines local disabled_indent_lines = is_plugin_disabled("indentlines") use({ From 8b566931874f0950ec02811f3527dead76823e32 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 17 Sep 2021 07:34:18 -0400 Subject: [PATCH 043/290] refact(modules): use NTBBloodbath's galaxyline fork --- .../modules/config/doom-eviline-palettes.lua | 93 ------------- lua/doom/modules/config/doom-eviline.lua | 126 +++++++++--------- lua/doom/modules/init.lua | 11 +- 3 files changed, 72 insertions(+), 158 deletions(-) delete mode 100644 lua/doom/modules/config/doom-eviline-palettes.lua diff --git a/lua/doom/modules/config/doom-eviline-palettes.lua b/lua/doom/modules/config/doom-eviline-palettes.lua deleted file mode 100644 index 7ea5b547e..000000000 --- a/lua/doom/modules/config/doom-eviline-palettes.lua +++ /dev/null @@ -1,93 +0,0 @@ -local M = {} - --- Dynamically change statusline colors, --- defaults to doom-one dark variant colors. --- --- @tparam string name The color name to be returned --- @return string -M.get_color = function(name) - return function() - local colors = { - bg = "#23272e", - fg = "#bbc2cf", - section_bg = "#5B6268", - yellow = "#ECBE7B", - cyan = "#46D9FF", - green = "#98be65", - orange = "#da8548", - magenta = "#c678dd", - blue = "#51afef", - red = "#ff6c6b", - } - - if vim.g.colors_name == "doom-one" and vim.opt.background:get() == "light" then - colors = { - bg = "#c6c7c7", - fg = "#383a42", - fg_alt = "#9ca0a4", - yellow = "#986801", - cyan = "#0184bc", - green = "#50a14f", - orange = "#da8548", - magenta = "#a626a4", - blue = "#4078f2", - red = "#e45649", - } - elseif vim.g.colors_name:find("gruvbox") then - colors = { - bg = "#32302f", - fg = "#d4be98", - fg_alt = "#ddc7a1", - yellow = "#d8a657", - cyan = "#89b482", - green = "#a9b665", - orange = "#e78a4e", - magenta = "#d3869b", - blue = "#7daea3", - red = "#ea6962", - } - elseif vim.g.colors_name:find("nord") then - colors = { - bg = "#3B4252", - fg = "#ECEFF4", - fg_alt = "#D8DEE9", - yellow = "#EBCB8B", - cyan = "#88C0D0", - green = "#A3BE8C", - orange = "#D08770", - magenta = "#B48EAD", - blue = "#5E81AC", - red = "#BF616A", - } - elseif vim.g.colors_name:find("tokyonight") then - colors = { - bg = "#292e42", - fg = "#c0caf5", - fg_alt = "#a9b1d6", - yellow = "#e0af68", - cyan = "#1abc9c", - green = "#9ece6a", - orange = "#ff9e64", - magenta = "#bb9af7", - blue = "#2ac3de", - red = "#f7768e", - } - elseif vim.g.colors_name:find("dracula") then - colors = { - bg = "#21222C", - fg = "#F8F8F2", - fg_alt = "#ABB2BF", - yellow = "#F1FA8C", - cyan = "#8BE9FD", - green = "#50FA7B", - orange = "#FFB86C", - magenta = "#BD93F9", - blue = "#A4FFFF", - red = "#FF5555", - } - end - return colors[name] - end -end - -return M diff --git a/lua/doom/modules/config/doom-eviline.lua b/lua/doom/modules/config/doom-eviline.lua index 0372d91f3..06f86c806 100644 --- a/lua/doom/modules/config/doom-eviline.lua +++ b/lua/doom/modules/config/doom-eviline.lua @@ -1,12 +1,12 @@ return function() local utils = require("doom.utils") local config = require("doom.core.config").config - local get_color = require("doom.modules.config.doom-eviline-palettes").get_color + local colors = require("galaxyline.themes.colors").get_color local bo = vim.bo local gl = require("galaxyline") - local lsp = require("galaxyline.provider_lsp") - local buffer = require("galaxyline.provider_buffer") + local lsp = require("galaxyline.providers.lsp") + local buffer = require("galaxyline.providers.buffer") local condition = require("galaxyline.condition") local gls = gl.section @@ -19,6 +19,10 @@ return function() "toggleterm", } + if not config.doom.dashboard_statline then + table.insert(gl.exclude_filetypes, "dashboard") + end + -- {{{ Utility functions local function is_dashboard() local buftype = buffer.get_buffer_filetype() @@ -41,7 +45,7 @@ return function() provider = function() return "▊ " end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } gls.left[2] = { @@ -50,31 +54,31 @@ return function() -- auto change color according the vim mode -- TODO: find a less dirty way to set ViMode colors local mode_color = { - n = get_color("red")(), - i = get_color("green")(), - v = get_color("blue")(), - [""] = get_color("blue")(), - V = get_color("blue")(), - c = get_color("magenta")(), - no = get_color("red")(), - s = get_color("orange")(), - S = get_color("orange")(), - [""] = get_color("orange")(), - ic = get_color("yellow")(), - R = get_color("magenta")(), - Rv = get_color("magenta")(), - cv = get_color("red")(), - ce = get_color("red")(), - r = get_color("cyan")(), - rm = get_color("cyan")(), - ["r?"] = get_color("cyan")(), - ["!"] = get_color("red")(), - t = get_color("red")(), + n = colors("red"), + i = colors("green"), + v = colors("blue"), + [""] = colors("blue"), + V = colors("blue"), + c = colors("magenta"), + no = colors("red"), + s = colors("orange"), + S = colors("orange"), + [""] = colors("orange"), + ic = colors("yellow"), + R = colors("magenta"), + Rv = colors("magenta"), + cv = colors("red"), + ce = colors("red"), + r = colors("cyan"), + rm = colors("cyan"), + ["r?"] = colors("cyan"), + ["!"] = colors("red"), + t = colors("red"), } - vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()]) + vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()]()) return " " end, - highlight = { get_color("red"), get_color("bg"), "bold" }, + highlight = { colors("red"), colors("bg"), "bold" }, }, } gls.left[3] = { @@ -82,11 +86,11 @@ return function() provider = "FileSize", condition = condition.buffer_not_empty and is_not_dashboard, highlight = { - get_color("fg"), - get_color("bg"), + colors("fg"), + colors("bg"), }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.left[4] = { @@ -94,18 +98,18 @@ return function() provider = "FileIcon", condition = condition.buffer_not_empty and is_not_dashboard, highlight = { - require("galaxyline.provider_fileinfo").get_file_icon_color, - get_color("bg"), + require("galaxyline.providers.fileinfo").get_file_icon_color, + colors("bg"), }, }, } gls.left[5] = { FileName = { - provider = "FileName", + provider = config.doom.statusline_show_file_path and "FilePath" or "FileName", condition = condition.buffer_not_empty and is_not_dashboard, - highlight = { get_color("fg"), get_color("bg"), "bold" }, + highlight = { colors("fg"), colors("bg"), "bold" }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.left[6] = { @@ -116,16 +120,16 @@ return function() return string.format("%3d : %2d ", line, column) end, condition = is_not_dashboard, - highlight = { get_color("fg_alt"), get_color("bg") }, + highlight = { colors("fg_alt"), colors("bg") }, }, } gls.left[7] = { LinePercent = { provider = "LinePercent", condition = is_not_dashboard, - highlight = { get_color("fg_alt"), get_color("bg") }, + highlight = { colors("fg_alt"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.left[8] = { @@ -133,7 +137,7 @@ return function() provider = "DiagnosticError", condition = is_not_dashboard, icon = config.doom.lsp_error .. " ", - highlight = { get_color("red"), get_color("bg") }, + highlight = { colors("red"), colors("bg") }, }, } gls.left[9] = { @@ -141,7 +145,7 @@ return function() provider = "DiagnosticWarn", condition = is_not_dashboard, icon = config.doom.lsp_warning .. " ", - highlight = { get_color("orange"), get_color("bg") }, + highlight = { colors("orange"), colors("bg") }, }, } gls.left[10] = { @@ -149,7 +153,7 @@ return function() provider = "DiagnosticInfo", condition = is_not_dashboard, icon = config.doom.lsp_hint .. " ", - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } @@ -159,18 +163,18 @@ return function() FileFormat = { provider = "FileFormat", condition = condition.hide_in_width and is_not_dashboard, - highlight = { get_color("fg"), get_color("bg") }, + highlight = { colors("fg"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.right[2] = { FileEncode = { provider = "FileEncode", condition = condition.hide_in_width and is_not_dashboard, - highlight = { get_color("fg"), get_color("bg") }, + highlight = { colors("fg"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.right[3] = { @@ -192,9 +196,9 @@ return function() end return true end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.right[4] = { @@ -203,16 +207,16 @@ return function() return "  " end, condition = condition.check_git_workspace, - highlight = { get_color("red"), get_color("bg") }, + highlight = { colors("red"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.right[5] = { GitBranch = { provider = "GitBranch", condition = condition.check_git_workspace, - highlight = { get_color("green"), get_color("bg"), "bold" }, + highlight = { colors("green"), colors("bg"), "bold" }, }, } gls.right[6] = { @@ -221,7 +225,7 @@ return function() return " " end, condition = is_not_dashboard, - highlight = { get_color("bg"), get_color("bg") }, + highlight = { colors("bg"), colors("bg") }, }, } gls.right[7] = { @@ -229,7 +233,7 @@ return function() provider = "DiffAdd", condition = condition.hide_in_width and is_not_dashboard, icon = " ", - highlight = { get_color("green"), get_color("bg") }, + highlight = { colors("green"), colors("bg") }, }, } gls.right[8] = { @@ -237,7 +241,7 @@ return function() provider = "DiffModified", condition = condition.hide_in_width and is_not_dashboard, icon = " ", - highlight = { get_color("orange"), get_color("bg") }, + highlight = { colors("orange"), colors("bg") }, }, } gls.right[9] = { @@ -245,7 +249,7 @@ return function() provider = "DiffRemove", condition = condition.hide_in_width and is_not_dashboard, icon = " ", - highlight = { get_color("red"), get_color("bg") }, + highlight = { colors("red"), colors("bg") }, }, } @@ -257,11 +261,11 @@ return function() return "DOOM v" .. utils.doom_version .. " " end, condition = is_dashboard, - highlight = { get_color("blue"), get_color("bg"), "bold" }, + highlight = { colors("blue"), colors("bg"), "bold" }, separator = " ", separator_highlight = { - get_color("bg"), - get_color("bg"), + colors("bg"), + colors("bg"), }, }, } @@ -271,7 +275,7 @@ return function() provider = function() return " ▊" end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } @@ -281,14 +285,14 @@ return function() provider = function() return "▊ " end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } gls.short_line_left[2] = { BufferType = { provider = "FileTypeName", condition = is_not_dashboard, - highlight = { get_color("fg"), get_color("bg") }, + highlight = { colors("fg"), colors("bg") }, }, } @@ -296,7 +300,7 @@ return function() BufferIcon = { provider = "BufferIcon", condition = is_not_dashboard, - highlight = { get_color("yellow"), get_color("bg") }, + highlight = { colors("yellow"), colors("bg") }, }, } gls.short_line_right[2] = { @@ -304,7 +308,7 @@ return function() provider = function() return " ▊" end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } end diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 222de69a0..d481ac2b5 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -141,10 +141,9 @@ packer.startup(function(use) -- can be disabled to use your own statusline local disabled_statusline = is_plugin_disabled("statusline") use({ - "glepnir/galaxyline.nvim", + "NTBBloodbath/galaxyline.nvim", config = require("doom.modules.config.doom-eviline"), disable = disabled_statusline, - event = "ColorScheme", }) -- Tabline @@ -319,27 +318,31 @@ packer.startup(function(use) }, config = require("doom.modules.config.doom-cmp"), disable = disabled_lsp, - event = "BufWinEnter", - opt = true, + event = "InsertEnter", }) use({ "hrsh7th/cmp-nvim-lua", + disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-nvim-lsp", + disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-path", + disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-buffer", + disable = disabled_lsp, after = "nvim-cmp", }) use({ "saadparwaiz1/cmp_luasnip", + disable = disabled_lsp, after = "nvim-cmp", }) From 6d95252974baacaa027584ca82605c06bc4e08b8 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 17 Sep 2021 07:38:42 -0400 Subject: [PATCH 044/290] feat(doom_config): add `statusline_show_file_path` option - Handle dashboard statusline in galaxyline configs --- doom_config.lua | 5 +++++ lua/doom/core/config/init.lua | 20 ++++++++++++++++++++ lua/doom/modules/config/doom-dashboard.lua | 4 ---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index c115bbce2..c53970e4d 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -190,6 +190,11 @@ M.config = { -- @default = true dashboard_statline = true, + -- Show the editing file path in your status line + -- false : show only file name on status line + -- true : show file name and the updir in status line + statusline_show_file_path = true, + -- Set the keybindings modules that you want to use -- false : disables keybindings module -- true : enables keybindings module diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index bc37e352c..f9f9f6da9 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -210,6 +210,26 @@ M.config = { -- @default = true dashboard_statline = true, + -- Show the editing file path in your status line + -- false : show only file name on status line + -- true : show file name and the updir in status line + statusline_show_file_path = true, + + -- Set the keybindings modules that you want to use + -- false : disables keybindings module + -- true : enables keybindings module + keybinds_modules = { + -- Core doom keybindings + core = true, + -- Movement keybindings, jump between your windows, buffers and code + movement = true, + -- Leader keybindings, a bunch of useful keybindings managed by space key + -- WARNING: disabling this will break which-key plugin if the plugin is enabled + leader = true, + -- Completion and snippets keybindings + completion = true, + }, + -- Default indent size -- @default = 4 indent = 4, diff --git a/lua/doom/modules/config/doom-dashboard.lua b/lua/doom/modules/config/doom-dashboard.lua index d885dc951..882c28fe3 100644 --- a/lua/doom/modules/config/doom-dashboard.lua +++ b/lua/doom/modules/config/doom-dashboard.lua @@ -42,10 +42,6 @@ return function() ) .. " seconds.", } - if not config.doom.dashboard_statline then - vim.g.dashboard_disable_statusline = 1 - end - vim.g.dashboard_custom_header = vim.tbl_isempty(config.doom.dashboard_custom_header) and { " ", From d5e39fbe38307ea2924255ff4b51faeacaebaf61 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 17 Sep 2021 07:39:24 -0400 Subject: [PATCH 045/290] feat(bufferline): initial groups support --- lua/doom/modules/config/doom-bufferline.lua | 31 +++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lua/doom/modules/config/doom-bufferline.lua b/lua/doom/modules/config/doom-bufferline.lua index 0635279cc..f33f26272 100644 --- a/lua/doom/modules/config/doom-bufferline.lua +++ b/lua/doom/modules/config/doom-bufferline.lua @@ -28,6 +28,37 @@ return function() return true end end, + groups = { + options = { + toggle_hidden_on_enter = true -- when you re-enter a hidden group this options re-opens that group so the buffer is visible + }, + items = { + { + name = "Tests", + auto_close = true, + matcher = function(buf) + return buf.filename:match('%_test') or buf.filename:match('%_spec') + end, + }, + { + name = "Docs", + auto_close = true, + matcher = function(buf) + return buf.filename:match('%.md') or buf.filename:match('%.txt') + end, + }, + { + name = "Doom", + auto_close = true, + matcher = function(buf) + if buf.filename:find("doom_") or buf.filename:find("doom-", 1, true) then + return true + end + return false + end, + }, + } + }, offsets = { { filetype = "NvimTree", From 60098215fdf2e8dd85a6cb174336bc4e025b7c6e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 17 Sep 2021 11:42:18 +0000 Subject: [PATCH 046/290] chore: format source code --- lua/doom/modules/config/doom-bufferline.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/config/doom-bufferline.lua b/lua/doom/modules/config/doom-bufferline.lua index f33f26272..488b1125d 100644 --- a/lua/doom/modules/config/doom-bufferline.lua +++ b/lua/doom/modules/config/doom-bufferline.lua @@ -30,21 +30,21 @@ return function() end, groups = { options = { - toggle_hidden_on_enter = true -- when you re-enter a hidden group this options re-opens that group so the buffer is visible + toggle_hidden_on_enter = true, -- when you re-enter a hidden group this options re-opens that group so the buffer is visible }, items = { { name = "Tests", auto_close = true, matcher = function(buf) - return buf.filename:match('%_test') or buf.filename:match('%_spec') + return buf.filename:match("%_test") or buf.filename:match("%_spec") end, }, { name = "Docs", auto_close = true, matcher = function(buf) - return buf.filename:match('%.md') or buf.filename:match('%.txt') + return buf.filename:match("%.md") or buf.filename:match("%.txt") end, }, { @@ -57,7 +57,7 @@ return function() return false end, }, - } + }, }, offsets = { { From 35b0f8297df5abb6973c42f4721149e9b3eb12d9 Mon Sep 17 00:00:00 2001 From: Cristiioan <67168425+cristiioan@users.noreply.github.com> Date: Sun, 26 Sep 2021 23:07:56 +0300 Subject: [PATCH 047/290] fix(dapui): open_on_start deprecated (#137) --- lua/doom/modules/config/doom-dap-ui.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/config/doom-dap-ui.lua b/lua/doom/modules/config/doom-dap-ui.lua index 41c93d6b4..7b6b3f1ff 100644 --- a/lua/doom/modules/config/doom-dap-ui.lua +++ b/lua/doom/modules/config/doom-dap-ui.lua @@ -1,5 +1,9 @@ return function() - require("dapui").setup({ + local dap, dapui = require('dap'), require('dapui') + dap.listeners.after.event_initialized['dapui_config'] = function() dapui.open() end + dap.listeners.before.event_terminated['dapui_config'] = function() dapui.close() end + dap.listeners.before.event_exited['dapui_config'] = function() dapui.close() end + dapui.setup({ icons = { expanded = "▾", collapsed = "▸", @@ -13,7 +17,6 @@ return function() repl = "r", }, sidebar = { - open_on_start = true, elements = { -- You can change the order of elements in the sidebar "scopes", From a7c24d800dd33641f7dd0b6cb71a26f64e33453b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 26 Sep 2021 20:08:15 +0000 Subject: [PATCH 048/290] chore: format source code --- lua/doom/modules/config/doom-dap-ui.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/config/doom-dap-ui.lua b/lua/doom/modules/config/doom-dap-ui.lua index 7b6b3f1ff..d94dc7935 100644 --- a/lua/doom/modules/config/doom-dap-ui.lua +++ b/lua/doom/modules/config/doom-dap-ui.lua @@ -1,8 +1,14 @@ return function() - local dap, dapui = require('dap'), require('dapui') - dap.listeners.after.event_initialized['dapui_config'] = function() dapui.open() end - dap.listeners.before.event_terminated['dapui_config'] = function() dapui.close() end - dap.listeners.before.event_exited['dapui_config'] = function() dapui.close() end + local dap, dapui = require("dap"), require("dapui") + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() + end dapui.setup({ icons = { expanded = "▾", From 33074ae1c58db0d895ba2005260734da748ab5c7 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 26 Sep 2021 16:33:14 -0400 Subject: [PATCH 049/290] fix(init): remove non-needed `bufdo e`, fixes #127 --- init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/init.lua b/init.lua index 70bea7106..610ed27c1 100644 --- a/init.lua +++ b/init.lua @@ -67,7 +67,6 @@ vim.defer_fn(function() load_modules("doom.extras", { "keybindings" }) vim.cmd([[ PackerLoad which-key.nvim - silent! bufdo e ]]) end, 20) end, 0) From 4f8791801685c76e7c621920634f9e93fc10d641 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 26 Sep 2021 16:36:11 -0400 Subject: [PATCH 050/290] fix(init): don't try to load which-key.nvim if not installed, fixes #124 --- init.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 610ed27c1..c93000bf2 100644 --- a/init.lua +++ b/init.lua @@ -65,8 +65,10 @@ vim.defer_fn(function() -- Load keybindings module at the end because the keybindings module cost is high vim.defer_fn(function() load_modules("doom.extras", { "keybindings" }) - vim.cmd([[ - PackerLoad which-key.nvim - ]]) + if not require("doom.core.functions").is_plugin_disabled("which-key") then + vim.cmd([[ + PackerLoad which-key.nvim + ]]) + end end, 20) end, 0) From da020e5e3f4c5bf43f44a3d2b51c7a49f52e3a97 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 26 Sep 2021 16:43:06 -0400 Subject: [PATCH 051/290] fix(dapui): remove `open_on_start` in tray --- lua/doom/modules/config/doom-dap-ui.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/doom/modules/config/doom-dap-ui.lua b/lua/doom/modules/config/doom-dap-ui.lua index d94dc7935..480228df9 100644 --- a/lua/doom/modules/config/doom-dap-ui.lua +++ b/lua/doom/modules/config/doom-dap-ui.lua @@ -34,7 +34,6 @@ return function() position = "left", -- Can be "left" or "right" }, tray = { - open_on_start = true, elements = { "repl", }, From a1eff7d8231fb12e613f4ce7398aef4d5617eed8 Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Sun, 26 Sep 2021 16:46:51 +0900 Subject: [PATCH 052/290] Drop a line from DOOM logo Signed-off-by: Osamu Aoki --- lua/doom/modules/config/doom-dashboard.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/doom/modules/config/doom-dashboard.lua b/lua/doom/modules/config/doom-dashboard.lua index 882c28fe3..430ea3ff5 100644 --- a/lua/doom/modules/config/doom-dashboard.lua +++ b/lua/doom/modules/config/doom-dashboard.lua @@ -64,7 +64,6 @@ return function() "==' _-' N E O V I M \\/ `==", "\\ _-' `-_ /", " `'' ``' ", - " ", } or config.doom.dashboard_custom_header -- Header color From 0eacf06c55897071359bb9293f5704e4dfd1491d Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Sun, 26 Sep 2021 16:58:12 +0900 Subject: [PATCH 053/290] modeline by nvim 0.5 is as secure Vim's modeline was known to be security risk. Arbitrary code execution issue was initially addressed by Vim upstream using sandbox approach. Nvim developer found security bug in this sandboxing code. This history made Nvim to disable this feature. Vim distributors such as Debian also disable this feature in its default install, too. Considering the recent change[*] to use more restrictive whitelist approach, use of modeline became as secure as external packages such as securemodelines written in vimL. [*] https://github.com/neovim/neovim/issues/2865 Signed-off-by: Osamu Aoki --- doom_config.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/doom_config.lua b/doom_config.lua index c53970e4d..9ae318e95 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -349,7 +349,16 @@ M.config = { -- Set custom Neovim global variables -- @default = {} -- example: - -- { ['sonokai_style'] = 'andromeda' } + -- { + -- ['sonokai_style'] = 'andromeda', + -- ['modelineexpr'] = true, + -- } + -- + -- modeline feature was turned off to reduce security exploit surfaces. + -- Since modeline now uses whitelist approach since nvim 0.4 /vim 8.1, + -- enabling this is as safe as external packages such as securemodelines. + -- See https://github.com/neovim/neovim/issues/2865 + -- global_variables = {}, -- Set custom autocommands From 9bb5e9e89aac82879b7e8ceb8e4a61afe1d5c930 Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Tue, 28 Sep 2021 04:45:34 +0900 Subject: [PATCH 054/290] feat(gitignore): ignore editor artifacts (#141) --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 3d027bec6..fdcf8fa8d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ tags # Backup files .doom_releases .doom_backup_hash +# editor artifacts +*~ +*.swp From b3310c125faf8b123e6240a2f9392b1f36133278 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Mon, 27 Sep 2021 18:28:19 -0400 Subject: [PATCH 055/290] feat(eviline): small improvements for small windows --- lua/doom/modules/config/doom-eviline.lua | 25 +++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/lua/doom/modules/config/doom-eviline.lua b/lua/doom/modules/config/doom-eviline.lua index 06f86c806..15943883b 100644 --- a/lua/doom/modules/config/doom-eviline.lua +++ b/lua/doom/modules/config/doom-eviline.lua @@ -26,16 +26,12 @@ return function() -- {{{ Utility functions local function is_dashboard() local buftype = buffer.get_buffer_filetype() - if buftype == "DASHBOARD" then - return true - end + return buftype == "DASHBOARD" end local function is_not_dashboard() local buftype = buffer.get_buffer_filetype() - if buftype ~= "DASHBOARD" then - return true - end + return buftype ~= "DASHBOARD" end -- }}} @@ -84,7 +80,7 @@ return function() gls.left[3] = { FileSize = { provider = "FileSize", - condition = condition.buffer_not_empty and is_not_dashboard, + condition = condition.buffer_not_empty and condition.hide_in_width, highlight = { colors("fg"), colors("bg"), @@ -168,7 +164,8 @@ return function() separator_highlight = { colors("bg"), colors("bg") }, }, } - gls.right[2] = { + + gls.right[2] ={ FileEncode = { provider = "FileEncode", condition = condition.hide_in_width and is_not_dashboard, @@ -204,7 +201,7 @@ return function() gls.right[4] = { GitIcon = { provider = function() - return "  " + return " " end, condition = condition.check_git_workspace, highlight = { colors("red"), colors("bg") }, @@ -222,16 +219,16 @@ return function() gls.right[6] = { DiffSeparator = { provider = function() - return " " + return " " end, - condition = is_not_dashboard, + condition = condition.hide_in_width, highlight = { colors("bg"), colors("bg") }, }, } gls.right[7] = { DiffAdd = { provider = "DiffAdd", - condition = condition.hide_in_width and is_not_dashboard, + condition = condition.hide_in_width, icon = " ", highlight = { colors("green"), colors("bg") }, }, @@ -239,7 +236,7 @@ return function() gls.right[8] = { DiffModified = { provider = "DiffModified", - condition = condition.hide_in_width and is_not_dashboard, + condition = condition.hide_in_width, icon = " ", highlight = { colors("orange"), colors("bg") }, }, @@ -247,7 +244,7 @@ return function() gls.right[9] = { DiffRemove = { provider = "DiffRemove", - condition = condition.hide_in_width and is_not_dashboard, + condition = condition.hide_in_width, icon = " ", highlight = { colors("red"), colors("bg") }, }, From 25e9f20e7128ba0d159997d3e3e8b7d067dbefc1 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Mon, 27 Sep 2021 19:02:58 -0400 Subject: [PATCH 056/290] feat(modules): add new built-in plugin \(`info`\), show an useful informational dashboard - Add `:DoomInfo` command - Add `di` keybind - Exclude `DoomInfo` filetype in blankline plugin - Update docs --- doc/doom_nvim.norg | 4 + lua/doom/core/settings/init.lua | 3 + lua/doom/extras/keybindings/leader.lua | 9 + lua/doom/modules/built-in/info/init.lua | 532 +++++++++++++++++++++ lua/doom/modules/config/doom-blankline.lua | 2 +- lua/doom/modules/config/doom-whichkey.lua | 1 + 6 files changed, 550 insertions(+), 1 deletion(-) create mode 100644 lua/doom/modules/built-in/info/init.lua diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index 73af4a976..12a22627d 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -258,6 +258,8 @@ │DoomConfigsReload │ Reload user-defined keybindings, etc │ ├──────────────────┼────────────────────────────────────────────┤ │DoomReport │ Create a Doom Nvim markdown crash report │ + ├──────────────────┼────────────────────────────────────────────┤ + │DoomInfo │ Open Doom Nivm information dashboard │ └──────────────────┴────────────────────────────────────────────┘ Doom Nvim also uses [which-key.nvim](https://github.com/folke/which-key.nvim) as a commands manager, inspired by emacs' guide-key. @@ -353,6 +355,8 @@ ├─────────────────────┼────────────────────────────────────────────────────┤ │ d - d │ Open Doom Nvim documentation │ ├─────────────────────┼────────────────────────────────────────────────────┤ + │ d - i │ Open Doom Nivm information dashboard │ + ├─────────────────────┼────────────────────────────────────────────────────┤ │ d - R │ Create crash reports, useful for debugging issues │ ├─────────────────────┼────────────────────────────────────────────────────┤ │ d - r │ Rollback Doom Nvim version │ diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index 6938c872b..870635d05 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -160,6 +160,9 @@ M.doom_commands = function() -- Set a custom command to create a crash report -- can be called by using :DoomReport vim.cmd('command! DoomReport lua require("doom.core.functions").create_report()') + -- Set a custom command to display an information dashboard + -- can be called by using :DoomInfo + vim.cmd('command! DoomInfo lua require("doom.modules.built-in.info").toggle()') end -- Custom Doom Nvim options diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index e736ea1f5..562f85af2 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -220,6 +220,15 @@ utils.map( "reload_user_settings", "Reload user custom settings" ) +utils.map( + "n", + "di", + "DoomInfo", + opts, + "Doom", + "display_info_dashboard", + "Display information dashboard" +) -- Plugins utils.map( diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua new file mode 100644 index 000000000..1e0231206 --- /dev/null +++ b/lua/doom/modules/built-in/info/init.lua @@ -0,0 +1,532 @@ +local utils = require("doom.utils") +local system = require("doom.core.system") + +--- @class Info +local info = {} + +--- Info buffer namespace +local info_ns = vim.api.nvim_create_namespace("doom_info_ns") +--- Info buffer ID +local info_buffer +--- Current buffer ID, meant to be used for getting buffer information like treesitter parser +local curr_buffer = vim.api.nvim_win_get_buf(0) + +--- Doom Nvim banner +local doom_banner = { + " ", + "================= =============== =============== ======== ========", + "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //", + "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||", + "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||", + "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||", + "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||", + "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||", + "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||", + "||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||", + "|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||", + "|| `' || || `' || || `' || || | \\ / | ||", + "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||", + "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||", + "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||", + "|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||", + "||.==' _-' `' | /==.||", + "==' _-' N E O V I M \\/ `==", + "\\ _-' `-_ /", + " `'' ``' ", + " ", +} + +--- System-wide commands required by Doom (some of them are optional) +local additional_executables = { "rg", "fd", "git", "npm", "node", "tree-sitter" } + +--- Gets padding with N length +--- @param n number +--- @return string +local function get_padding(n) + return (" "):rep(n) +end + +--- Padding levels +local padding_level = { + get_padding(2), + get_padding(4), + get_padding(6), +} + +--- Aligns text to center +--- @param text_lines table +--- @param align_mode string +--- @return table +local function align_text(text_lines, align_mode) + local aligned_text = {} + local padding_amount + local window_width = vim.api.nvim_win_get_width(0) + + for _, line in ipairs(text_lines) do + if align_mode == "left" then + padding_amount = 2 + elseif align_mode == "center" then + padding_amount = math.floor(window_width / 2) - math.floor(line:len() / 2) + end + local padding = get_padding(padding_amount) + table.insert(aligned_text, padding .. line) + end + + return aligned_text +end + +--- Checks if a system command exists +--- @param command string +--- @return boolean +local function command_exists(command) + return vim.fn.executable(command) == 1 +end + +--- Extract the basename of given filepath, suffix is not trimed. +local function basename(path) + return string.match(path, string.format(".*%s(.*)", system.sep)) +end + +--- Get the active language servers, extracted from my galaxyline fork +--- @return string +local get_lsp_clients = function(bufnr) + local msg = "No Active Lsp" + local clients = vim.lsp.buf_get_clients(bufnr) + if next(clients) == nil then + return msg + end + + local client_names = "" + for _, client in pairs(clients) do + if string.len(client_names) < 1 then + client_names = client_names .. client.name + else + client_names = client_names .. ", " .. client.name + end + end + return string.len(client_names) > 0 and client_names or msg +end + +local function get_doom_info() + local doom_info = {} + + ----- DOOM INFORMATION ------------------------ + ----------------------------------------------- + -- Doom version + local doom_version = utils.doom_version + -- Doom branch + local git_branch_handler = io.popen( + require("doom.core.system").git_workspace .. " branch --show-current" + ) + local doom_branch = git_branch_handler:read("*a"):gsub("[\r\n]", "") + git_branch_handler:close() + -- Configurations path + local config_path = require("doom.core.config").source + local modules_path = require("doom.core.config.modules").source + local userplugins_path = require("doom.core.config.userplugins").source + + ----- NVIM INFORMATION ------------------------ + ----------------------------------------------- + local nvim_dev_version = false + -- Neovim version + local version = vim.version() + if version.minor == 6 then + nvim_dev_version = true + end + local nvim_version = string.format( + "%s.%s.%s %s", + version.major, + version.minor, + version.patch, + nvim_dev_version and "(prerelease)" or "" + ) + + -- Local commit and last update date + local last_update_handler = io.popen(system.git_workspace .. " show -s --format=%cD") + local last_update_date = last_update_handler:read("*a"):gsub("[\r\n]", "") + last_update_handler:close() + vim.list_extend(doom_info, { + "Doom Nvim Information", + string.format("%s• Neovim version: %s%s", padding_level[1], padding_level[1], nvim_version), + string.format( + "%s• Doom version: %s%s (%s branch)", + padding_level[1], + padding_level[2], + doom_version, + doom_branch + ), + string.format("%s• Last update date: %s", padding_level[1], last_update_date), + }) + if doom_branch == "develop" then + local commit_handler = io.popen(system.git_workspace .. " rev-parse HEAD") + local current_commit = commit_handler:read("*a"):gsub("[\r\n]", "") + commit_handler:close() + vim.list_extend(doom_info, { + string.format( + "%s• Current commit: %s%s", + padding_level[1], + padding_level[1], + current_commit:sub(current_commit:len() - 6, current_commit:len()) + ), + }) + end + vim.list_extend(doom_info, { + string.format( + "%s• Doom root:%s%s", + padding_level[1], + padding_level[2]:rep(2), + system.doom_root + ), + "", + string.format("%s▶ Doom configurations paths", padding_level[1]), + string.format("%s- %s", padding_level[2], config_path), + string.format("%s- %s", padding_level[2], modules_path), + string.format("%s- %s", padding_level[2], userplugins_path), + }) + + ----- TREESITTER INFORMATION ------------------ + ----------------------------------------------- + vim.list_extend(doom_info, { + "", + string.format("%s▶ Installed treesitter parsers", padding_level[1]), + }) + for _, parser in ipairs(require("nvim-treesitter.info").installed_parsers()) do + table.insert(doom_info, string.format("%s- %s", padding_level[2], parser)) + end + + ----- LSP INFORMATION ------------------------- + ----------------------------------------------- + if + not require("doom.core.functions").is_plugin_disabled("lsp") + and packer_plugins["nvim-lspinstall"] + then + vim.list_extend(doom_info, { + "", + string.format("%s▶ Installed language servers", padding_level[1]), + }) + for _, server in ipairs(require("lspinstall").installed_servers()) do + -- Get the real name for the language server because lspinstall names them like the filetype + local server_path = require("lspconfig")[server].cmd[1] + local real_server_name = basename(server_path) + if not real_server_name then + -- If we were unable to get the server executable name then fallback to default server name (filetype) + real_server_name = server + else + -- Fix some server names that are "incorrect" + real_server_name = real_server_name + :gsub("%-language%-server", "") + :gsub("%-langserver", "") + :gsub("typescript", "tsserver") + :gsub("sumneko%-lua", "sumneko_lua") + end + table.insert(doom_info, string.format("%s- %s", padding_level[2], real_server_name)) + end + end + return doom_info +end + +-- TODO: add treesitter and LSP information like LunarVim +local function get_buffer_info() + local buffer_info = {} + local buffer_ft = vim.api.nvim_buf_get_option(curr_buffer, "filetype") + + vim.list_extend(buffer_info, { + "Buffer Information", + string.format( + "%s• %s%s%s", + padding_level[1], + "Is read-only?", + padding_level[3], + vim.api.nvim_buf_get_option(curr_buffer, "readonly") and "yes" or "no" + ), + string.format("%s• %s: %s", padding_level[1], "Detected filetype", buffer_ft), + "", + string.format("%s▶ Buffer settings", padding_level[1]), + string.format( + "%s• %s: %s", + padding_level[2], + "Indentation width", + vim.api.nvim_buf_get_option(curr_buffer, "tabstop") + ), + string.format( + "%s• %s: %s%s", + padding_level[2], + "File format", + padding_level[3], + vim.api.nvim_buf_get_option(curr_buffer, "fileformat"):upper() + ), + string.format( + "%s• %s: %s%s", + padding_level[2], + "File encoding", + padding_level[2], + vim.api.nvim_buf_get_option(curr_buffer, "fileencoding"):upper() + ), + "", + ----- TREESITTER INFORMATION ------------------ + ----------------------------------------------- + string.format("%s▶ TreeSitter", padding_level[1]), + string.format( + "%s• %s%s", + padding_level[2], + "Is parser installed?" .. padding_level[2]:rep(3), + utils.has_value(require("nvim-treesitter.info").installed_parsers(), buffer_ft) + and "yes" + or "no" + ), + string.format( + "%s• %s %s", + padding_level[2], + "Is indentation enabled?" .. padding_level[2]:rep(2), + require("nvim-treesitter.configs").is_enabled("indent", buffer_ft) and "yes" or "no" + ), + string.format( + "%s• %s %s", + padding_level[2], + "Is syntax highlighting enabled?", + require("nvim-treesitter.configs").is_enabled("highlight", buffer_ft) and "yes" or "no" + ), + }) + + ----- LSP INFORMATION ------------------------- + ----------------------------------------------- + if + not require("doom.core.functions").is_plugin_disabled("lsp") + and packer_plugins["nvim-lspinstall"] + then + vim.list_extend(buffer_info, { + "", + string.format("%s▶ Language Servers", padding_level[1]), + string.format( + "%s• %s %s", + padding_level[2], + "Is language server installed?", + utils.has_value(require("lspinstall").installed_servers(), buffer_ft) and "yes" or "no" + ), + string.format( + "%s• %s:%s%s", + padding_level[2], + "Active language servers", + padding_level[3], + get_lsp_clients(curr_buffer) + ), + }) + end + + return buffer_info +end + +local function get_system_info() + local sys_info = {} + + ----- OS -------------------------------------- + ----------------------------------------------- + -- Get the current OS and if the user is running Linux then get also the + -- distribution name, e.g. Manjaro + local sysname = vim.loop.os_uname().sysname + local distro_name + -- If the user is running Linux then get the distribution name + if sysname == "Linux" then + distro_name = vim.trim( + -- PRETTY_NAME="Distribution (Additional info)", e.g. + -- PRETTY_NAME="Fedora 34 (KDE Plasma)" + vim.fn.system( + 'cat /etc/os-release | grep "^PRETTY_NAME" | sed ' + .. "'s/^PRETTY_NAME=\"//' | sed " + .. "'s/\"//'" + ) + ) + end + vim.list_extend(sys_info, { + "System Information", + string.format( + "%s• %s: %s%s", + padding_level[1], + "OS", + (padding_level[1] .. padding_level[2]:rep(2)), + sysname + ), + }) + if distro_name then + vim.list_extend(sys_info, { + string.format( + "%s• %s: %s%s", + padding_level[1], + "Distro", + (padding_level[1] .. padding_level[2]:rep(1)), + distro_name + ), + }) + end + vim.list_extend(sys_info, { + string.format("%s• %s: %s", padding_level[1], "Architecture", vim.loop.os_uname().machine), + }) + + ----- PROGRAMS -------------------------------- + ----------------------------------------------- + vim.list_extend(sys_info, { + "", + string.format("%s▶ Programs", padding_level[1]), + }) + for _, program in ipairs(additional_executables) do + local opt_message, extra_padding = "", "" + + -- We add an extra whitespace to 'no' so we can have an uniform format + local is_installed = command_exists(program) and "yes" or "no" + if (program == "node" or program == "npm") and (not command_exists(program)) then + opt_message = "(Optional, required by some language servers)" + elseif program == "fd" and (not command_exists(program)) then + opt_message = "(Optional, improves performance for many file indexing commands)" + elseif program == "rg" and (not command_exists(program)) then + opt_message = "(Optional, improves performance for many file indexing commands)" + elseif program == "tree-sitter" and (not command_exists(program)) then + opt_message = "(Optional, only needed for :TSInstallFromGrammar, not required for :TSInstall)" + end + + -- Add padding after the question, e.g. Found fd? yes/no + -- ^^ + -- padding + if program:len() ~= 11 then + extra_padding = get_padding(11 - program:len()) + end + table.insert( + sys_info, + string.format( + "%s• Found %s? %s%s%s", + padding_level[2], + program, + extra_padding, + -- Add extra whitespace to "no" + is_installed == "yes" and is_installed or is_installed .. " ", + opt_message:len() < 1 and opt_message or " " .. opt_message + ) + ) + end + + return sys_info +end + +--- Set buffer contents +--- @param buffer_id number +local function set_buffer_content(buffer_id) + local content = {} + + -- Doom banner + for _, banner_line in ipairs(align_text(doom_banner, "center")) do + table.insert(content, banner_line) + end + + -- Doom Nvim information + local doom_info = get_doom_info() + local buffer_info = get_buffer_info() + local system_info = get_system_info() + + for _, info_section in ipairs({ doom_info, { "", "" }, buffer_info, { "", "" }, system_info }) do + local aligned_info = align_text(info_section, "left") + vim.list_extend(content, aligned_info) + end + vim.api.nvim_buf_set_lines(buffer_id, 0, info_ns, false, content) +end + +local function set_syntax_highlighting(buffer_id) + for lnum, line in ipairs(vim.api.nvim_buf_get_lines(buffer_id, 0, vim.fn.line("$"), true)) do + if lnum < #doom_banner then + vim.api.nvim_buf_add_highlight(buffer_id, -1, "Comment", lnum, 0, -1) + else + local hl = "NONE" + local endl = -1 + if line:find("Information") then + -- Information headers + hl = "Title" -- "Structure" + elseif line:find("▶") then + -- Information headers level 2 (subheaders) + hl = "VariableBuiltin" + elseif line:find(": ") or line:find("? ") then + -- Information fields + hl = "Bold" + if #vim.split(line, "?") < 2 then + -- Highlight only the field name, e.g. 'Version' + endl = vim.split(line, ":")[1]:len() + else + -- Highlight the field name and the '?' character + endl = vim.split(line, "?")[1]:len() + 1 + end + end + vim.api.nvim_buf_add_highlight(buffer_id, -1, hl, lnum - 1, 0, endl) + end + end + + -- Extra highlights that we can't manually set with nvim_buf_add_highlight + vim.cmd([[ + call matchadd("TextSuccessBold", "yes") + call matchadd("TextErrorBold", '\(no\s\)\|\(no$\)\|\(No Active Lsp\)') + call matchadd("Boolean", '\(true\)\|\(false\)') + call matchadd("Operator", '\(\s\+-\s\)') + call matchadd("SpecialComment", '\(\s[a-f0-9]\{7}$\)') + call matchadd("Number", '\s[0-9]\+$') + call matchadd("String", "•") + call matchadd("CommentBold", '\(:[A-Za-z]\+\)') + ]]) +end + +--- Open Doom information floating window +info.open = function() + -- Create a new scratch buffer + info_buffer = vim.api.nvim_create_buf(false, true) + vim.api.nvim_buf_set_option(info_buffer, "bufhidden", "wipe") + vim.api.nvim_buf_set_option(info_buffer, "filetype", "DoomInfo") + + -- Get terminal dimensions + local width = vim.api.nvim_get_option("columns") + local height = vim.api.nvim_get_option("lines") + -- Floating window dimensions and start position + local win_height = math.ceil(height * 0.9 - 2) + local win_width = math.ceil(width * 0.9) + local row = math.ceil((height - win_height) / 2 - 1) + local col = math.ceil((width - win_width) / 2) + -- Set our floating window options + local win_opts = { + style = "minimal", -- Disable most UI options + border = "single", -- Single whitespace padding + relative = "editor", -- Relative to global editor grid + width = win_width, -- Width + height = win_height, -- Height + row = row, -- Row position + col = col, -- Column position + } + + -- Create our window with attached buffer + vim.api.nvim_open_win(info_buffer, true, win_opts) + + -- Set the buffer contents + set_buffer_content(info_buffer) + + -- Set the buffer options + vim.api.nvim_buf_set_option(info_buffer, "modifiable", false) + vim.opt_local.foldtext = + [[substitute(substitute(getline(v:foldstart), '?\s\+', '? ', 'g'),'\\t',repeat('\ ',&tabstop),'g').' ... ' . '(' . (v:foldend - v:foldstart + 1) . ' fields)']] + vim.opt_local.shiftwidth = 6 + vim.opt_local.foldignore = [[=\\\|]] + vim.opt_local.foldmethod = "indent" + vim.opt_local.fillchars = { + eob = " ", -- suppress ~ at EndOfBuffer + fold = " ", -- supress dots between folds info + } + + -- Set the buffer syntax + set_syntax_highlighting(info_buffer) +end + +info.close = function() + vim.api.nvim_buf_delete(info_buffer, {}) +end + +info.toggle = function() + if info_buffer and vim.fn.bufexists(info_buffer) == 1 then + info.close() + else + info.open() + end +end + +return info diff --git a/lua/doom/modules/config/doom-blankline.lua b/lua/doom/modules/config/doom-blankline.lua index 793035354..9ecf39aa8 100644 --- a/lua/doom/modules/config/doom-blankline.lua +++ b/lua/doom/modules/config/doom-blankline.lua @@ -9,7 +9,7 @@ return function() and true or false, show_first_indent_level = false, - filetype_exclude = { "help", "dashboard", "packer", "norg" }, + filetype_exclude = { "help", "dashboard", "packer", "norg", "DoomInfo" }, buftype_exclude = { "terminal" }, }) end diff --git a/lua/doom/modules/config/doom-whichkey.lua b/lua/doom/modules/config/doom-whichkey.lua index 8f5492e70..08ae26870 100644 --- a/lua/doom/modules/config/doom-whichkey.lua +++ b/lua/doom/modules/config/doom-whichkey.lua @@ -114,6 +114,7 @@ return function() ["b"] = { "Show Doom keybindings" }, ["c"] = { "Edit your Doom Nvim configuration" }, ["d"] = { "Open Doom Nvim documentation" }, + ["i"] = { "Open Doom Nvim information dashboard" }, ["u"] = { "Update Doom Nvim" }, ["r"] = { "Rollback Doom Nvim version" }, ["R"] = { "Create crash report" }, From bb6eb2c0f1a8a0f45707b6e18e9c7c0f1f75b502 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 27 Sep 2021 23:07:56 +0000 Subject: [PATCH 057/290] chore: format source code --- lua/doom/modules/config/doom-eviline.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-eviline.lua b/lua/doom/modules/config/doom-eviline.lua index 15943883b..6d5f550c5 100644 --- a/lua/doom/modules/config/doom-eviline.lua +++ b/lua/doom/modules/config/doom-eviline.lua @@ -165,7 +165,7 @@ return function() }, } - gls.right[2] ={ + gls.right[2] = { FileEncode = { provider = "FileEncode", condition = condition.hide_in_width and is_not_dashboard, From 0b72cf0a37554c953bde82ee1986ec0243e93fe0 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Mon, 27 Sep 2021 19:47:55 -0400 Subject: [PATCH 058/290] fix(system): add extra whitespace in `git_workspace` --- lua/doom/core/system/init.lua | 2 +- lua/doom/modules/built-in/info/init.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/doom/core/system/init.lua b/lua/doom/core/system/init.lua index 7bf9050ba..58f8d77d1 100644 --- a/lua/doom/core/system/init.lua +++ b/lua/doom/core/system/init.lua @@ -26,6 +26,6 @@ M.doom_logs = table.concat({ stdpath("data"), "doom.log" }, M.sep) -- The doom-nvim bug report file path M.doom_report = table.concat({ stdpath("data"), "doom_report.md" }, M.sep) -- The git workspace for doom-nvim, e.g. 'git -C /home/JohnDoe/.config/nvim' -M.git_workspace = string.format("git -C %s", stdpath("config")) +M.git_workspace = string.format("git -C %s ", stdpath("config")) return M diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 1e0231206..d6d257d92 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -116,7 +116,7 @@ local function get_doom_info() local doom_version = utils.doom_version -- Doom branch local git_branch_handler = io.popen( - require("doom.core.system").git_workspace .. " branch --show-current" + require("doom.core.system").git_workspace .. "branch --show-current" ) local doom_branch = git_branch_handler:read("*a"):gsub("[\r\n]", "") git_branch_handler:close() @@ -142,7 +142,7 @@ local function get_doom_info() ) -- Local commit and last update date - local last_update_handler = io.popen(system.git_workspace .. " show -s --format=%cD") + local last_update_handler = io.popen(system.git_workspace .. "show -s --format=%cD") local last_update_date = last_update_handler:read("*a"):gsub("[\r\n]", "") last_update_handler:close() vim.list_extend(doom_info, { @@ -158,7 +158,7 @@ local function get_doom_info() string.format("%s• Last update date: %s", padding_level[1], last_update_date), }) if doom_branch == "develop" then - local commit_handler = io.popen(system.git_workspace .. " rev-parse HEAD") + local commit_handler = io.popen(system.git_workspace .. "rev-parse HEAD") local current_commit = commit_handler:read("*a"):gsub("[\r\n]", "") commit_handler:close() vim.list_extend(doom_info, { From 099ac906d911b8ba7033d7fa1b17acc4de278979 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Mon, 27 Sep 2021 21:36:10 -0400 Subject: [PATCH 059/290] refact(info): get last update date with current commit for a more accurated date - Document matchadd highlighting - Do not highlight `?` with Bold, use Operator group instead - Add fallback highlighting groups for colorschemes that does not have the same as doom-one - Better padding level handling in some fields --- lua/doom/modules/built-in/info/init.lua | 39 ++++++++++++++++--------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index d6d257d92..f4a9478ed 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -51,6 +51,7 @@ local padding_level = { get_padding(2), get_padding(4), get_padding(6), + get_padding(10), } --- Aligns text to center @@ -142,9 +143,13 @@ local function get_doom_info() ) -- Local commit and last update date - local last_update_handler = io.popen(system.git_workspace .. "show -s --format=%cD") + local commit_handler = io.popen(system.git_workspace .. "rev-parse HEAD") + local current_commit = commit_handler:read("*a"):gsub("[\r\n]", "") + commit_handler:close() + local last_update_handler = io.popen(string.format("%s%s %s", system.git_workspace, "show -s --format=%cD", current_commit)) local last_update_date = last_update_handler:read("*a"):gsub("[\r\n]", "") last_update_handler:close() + vim.list_extend(doom_info, { "Doom Nvim Information", string.format("%s• Neovim version: %s%s", padding_level[1], padding_level[1], nvim_version), @@ -158,9 +163,6 @@ local function get_doom_info() string.format("%s• Last update date: %s", padding_level[1], last_update_date), }) if doom_branch == "develop" then - local commit_handler = io.popen(system.git_workspace .. "rev-parse HEAD") - local current_commit = commit_handler:read("*a"):gsub("[\r\n]", "") - commit_handler:close() vim.list_extend(doom_info, { string.format( "%s• Current commit: %s%s", @@ -343,7 +345,7 @@ local function get_system_info() "%s• %s: %s%s", padding_level[1], "OS", - (padding_level[1] .. padding_level[2]:rep(2)), + padding_level[4], sysname ), }) @@ -353,7 +355,7 @@ local function get_system_info() "%s• %s: %s%s", padding_level[1], "Distro", - (padding_level[1] .. padding_level[2]:rep(1)), + padding_level[3], distro_name ), }) @@ -448,8 +450,8 @@ local function set_syntax_highlighting(buffer_id) -- Highlight only the field name, e.g. 'Version' endl = vim.split(line, ":")[1]:len() else - -- Highlight the field name and the '?' character - endl = vim.split(line, "?")[1]:len() + 1 + -- Highlight only the field name + endl = vim.split(line, "?")[1]:len() end end vim.api.nvim_buf_add_highlight(buffer_id, -1, hl, lnum - 1, 0, endl) @@ -458,14 +460,23 @@ local function set_syntax_highlighting(buffer_id) -- Extra highlights that we can't manually set with nvim_buf_add_highlight vim.cmd([[ - call matchadd("TextSuccessBold", "yes") - call matchadd("TextErrorBold", '\(no\s\)\|\(no$\)\|\(No Active Lsp\)') - call matchadd("Boolean", '\(true\)\|\(false\)') - call matchadd("Operator", '\(\s\+-\s\)') - call matchadd("SpecialComment", '\(\s[a-f0-9]\{7}$\)') + " True / False + " NOTE: Use String and ErrorMsg as a fallback if TextXBold does not exists in the current colorscheme + call matchadd(match(execute("hi TextSuccessBold"), "cleared") =~ -1 ? "TextSuccessBold" : "String", "yes") + call matchadd(match(execute("hi TextErrorBold"), "cleared") =~ -1 ? "TextErrorBold" : "ErrorMsg", '\(no\s\)\|\(no$\)\|\(No Active Lsp\)') + " Lists and delimiters + call matchadd("Operator", '\(\s\+-\s\)\|:\s\+\|?') + " Release type and branches + call matchadd("Constant", '\(prerelease\)\|\(develop\|main\)\sbranch') + " Commit SHA + call matchadd("Constant", '\(\s[a-f0-9]\{7}$\)') + " Numbers call matchadd("Number", '\s[0-9]\+$') + " Fields call matchadd("String", "•") - call matchadd("CommentBold", '\(:[A-Za-z]\+\)') + " Neovim commands + " NOTE: Use Comment as a fallback if CommentBold does not exists in the current colorscheme + call matchadd(match(execute("hi CommentBold"), "cleared") =~ -1 ? "CommentBold" : "Comment", '\(:[A-Za-z]\+\)') ]]) end From 9647ec9d624b0d827c8dacd33a3657b5ba31e5d5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 01:36:38 +0000 Subject: [PATCH 060/290] chore: format source code --- lua/doom/modules/built-in/info/init.lua | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index f4a9478ed..6b7f6cbc8 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -146,7 +146,9 @@ local function get_doom_info() local commit_handler = io.popen(system.git_workspace .. "rev-parse HEAD") local current_commit = commit_handler:read("*a"):gsub("[\r\n]", "") commit_handler:close() - local last_update_handler = io.popen(string.format("%s%s %s", system.git_workspace, "show -s --format=%cD", current_commit)) + local last_update_handler = io.popen( + string.format("%s%s %s", system.git_workspace, "show -s --format=%cD", current_commit) + ) local last_update_date = last_update_handler:read("*a"):gsub("[\r\n]", "") last_update_handler:close() @@ -341,23 +343,11 @@ local function get_system_info() end vim.list_extend(sys_info, { "System Information", - string.format( - "%s• %s: %s%s", - padding_level[1], - "OS", - padding_level[4], - sysname - ), + string.format("%s• %s: %s%s", padding_level[1], "OS", padding_level[4], sysname), }) if distro_name then vim.list_extend(sys_info, { - string.format( - "%s• %s: %s%s", - padding_level[1], - "Distro", - padding_level[3], - distro_name - ), + string.format("%s• %s: %s%s", padding_level[1], "Distro", padding_level[3], distro_name), }) end vim.list_extend(sys_info, { From 68e1b007686564aa25403c54baf9240dd6993578 Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Sun, 26 Sep 2021 00:25:37 +0900 Subject: [PATCH 061/290] fix(gitsigns) match new variable name Signed-off-by: Osamu Aoki --- lua/doom/modules/config/doom-gitsigns.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-gitsigns.lua b/lua/doom/modules/config/doom-gitsigns.lua index 9c24857ed..ac3f9374f 100644 --- a/lua/doom/modules/config/doom-gitsigns.lua +++ b/lua/doom/modules/config/doom-gitsigns.lua @@ -59,7 +59,7 @@ return function() ["o ih"] = ':lua require"gitsigns".select_hunk()', ["x ih"] = ':lua require"gitsigns".select_hunk()', }, - watch_index = { interval = 1000, follow_files = true }, + watch_gitdir = { interval = 1000, follow_files = true }, current_line_blame_opts = { delay = 1000, position = "eol", From 452e7be5651ec985cd083613fe53193be5034aa5 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 28 Sep 2021 16:09:13 -0400 Subject: [PATCH 062/290] feat(modules): add `vim-illuminate` plugin Highlight other uses of the word under the cursor like VSC --- doom_modules.lua | 1 + lua/doom/modules/config/doom-lspinstall.lua | 15 +++++++++++++++ lua/doom/modules/init.lua | 12 ++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doom_modules.lua b/doom_modules.lua index 977770ab2..d0c614fa2 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -23,6 +23,7 @@ M.modules = { "tabline", -- Tabline, shows your buffers list at top "which-key", -- Keybindings popup menu like Emacs' guide-key -- "zen", -- Distraction free environment + -- "illuminated", -- Highlight other uses of the word under the cursor like VSC }, doom = { -- "compiler", -- Compile (and run) your code with just pressing three keys! diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index cd21c97cb..1bbd32e2b 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -1,5 +1,6 @@ return function() local nvim_lsp = require("lspconfig") + local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled -- Snippets support local capabilities = vim.lsp.protocol.make_client_capabilities() @@ -31,6 +32,18 @@ return function() }, } + --- Intelligent highlighting of word under cursor + local on_attach + if not is_plugin_disabled("illuminated") and packer_plugins["vim-illuminate"] then + on_attach = function(client) + require("illuminate").on_attach(client) + -- Set underline highlighting for Lsp references + vim.cmd("hi! LspReferenceText cterm=underline gui=underline") + vim.cmd("hi! LspReferenceWrite cterm=underline gui=underline") + vim.cmd("hi! LspReferenceRead cterm=underline gui=underline") + end + end + local lua_lsp = require("lua-dev").setup({ lspconfig = { settings = { @@ -41,6 +54,7 @@ return function() }, }, capabilities = capabilities, + on_attach = on_attach, }, }) @@ -58,6 +72,7 @@ return function() -- Use default settings for all the other language servers nvim_lsp[server].setup({ capabilities = capabilities, + on_attach = on_attach, }) end end diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 63aa5ae2b..a04ce0612 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -222,6 +222,14 @@ packer.startup(function(use) event = "BufWinEnter", }) + use({ + "RRethy/vim-illuminate", + setup = function() + vim.g.Illuminate_ftblacklist = { "help", "dashboard", "packer", "norg", "DoomInfo", "NvimTree", "Outline", "toggleterm" } + end, + event = "BufRead", + }) + -----[[--------------]]----- --- Fuzzy Search --- -----]]--------------[[----- @@ -305,7 +313,6 @@ packer.startup(function(use) "neovim/nvim-lspconfig", config = require("doom.modules.config.doom-lspconfig"), disable = disabled_lsp, - event = "ColorScheme", }) -- Snippets @@ -371,7 +378,7 @@ packer.startup(function(use) "kabouzeid/nvim-lspinstall", config = require("doom.modules.config.doom-lspinstall"), disable = disabled_lsp, - after = "nvim-lspconfig", + event = "VimEnter", }) -- Show function signature when you type @@ -534,6 +541,7 @@ packer.startup(function(use) requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), disable = disabled_todo, + event = "ColorScheme", }) local disabled_trouble = is_plugin_disabled("trouble") From 0a9e6b427e5e311ddca3533406286258e7888d66 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 20:09:32 +0000 Subject: [PATCH 063/290] chore: format source code --- lua/doom/modules/init.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index a04ce0612..c6de54cac 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -225,7 +225,16 @@ packer.startup(function(use) use({ "RRethy/vim-illuminate", setup = function() - vim.g.Illuminate_ftblacklist = { "help", "dashboard", "packer", "norg", "DoomInfo", "NvimTree", "Outline", "toggleterm" } + vim.g.Illuminate_ftblacklist = { + "help", + "dashboard", + "packer", + "norg", + "DoomInfo", + "NvimTree", + "Outline", + "toggleterm", + } end, event = "BufRead", }) From d1208dd6a7fcf213efbf6743b736f6f7f98b6294 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 28 Sep 2021 16:12:14 -0400 Subject: [PATCH 064/290] feat(doom-one): pull upstream changes --- lua/colors/doom-one/init.lua | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua index 29bc67c15..6a9841e48 100644 --- a/lua/colors/doom-one/init.lua +++ b/lua/colors/doom-one/init.lua @@ -90,6 +90,7 @@ local dark_blue = '#2257A0' local magenta = '#c678dd' local light_magenta = utils.Lighten(magenta, 0.4) local violet = '#a9a1e1' +local dark_violet = '#4e4f67' local cyan = '#46D9FF' local white = '#efefef' @@ -115,6 +116,19 @@ local diff_add_fg0 = utils.Mix(green, fg, 0.4) local diff_add_bg0 = utils.Mix('#506d5b', bg, 0.6) local diff_add_bg1 = utils.Mix('#acf2bd', bg, 0.8) +local ng_add_fg = '#799850' +local ng_add_fg_hl = green +local ng_add_bg = '#333a38' +local ng_add_bg_hl = '#3e493d' + +local ng_delete_fg = '#cc5655' +local ng_delete_fg_hl = red +local ng_delete_bg = '#392d34' +local ng_delete_bg_hl = '#3f343a' + +local ng_header_bg = dark_violet +local ng_header_bg_hl = violet + local gh_danger_fg = red local gh_danger_fg0 = utils.Mix(red, fg, 0.6) local gh_danger_bg0 = utils.Mix('#ffdce0', bg, 0.6) @@ -144,6 +158,7 @@ if current_bg == 'light' then magenta = '#a626a4' light_magenta = utils.Darken(magenta, 0.36) violet = '#b751b6' + dark_violet = '#e5c7e5' cyan = '#0184bc' white = '#efefef' @@ -168,6 +183,19 @@ if current_bg == 'light' then diff_add_bg0 = utils.Mix('#506d5b', bg, 0.4) diff_add_bg1 = utils.Mix('#acf2bd', bg, 0.8) + ng_add_fg = '#40803f' + ng_add_fg_hl = green + ng_add_bg = '#e9f1e8' + ng_add_bg_hl = '#d8e8d7' + + ng_delete_fg = '#cc5655' + ng_delete_fg_hl = red + ng_delete_bg = '#f7e9e8' + ng_delete_bg_hl = '#f5d9d6' + + ng_header_bg = dark_violet + ng_header_bg_hl = violet + gh_danger_fg = red gh_danger_fg0 = utils.Mix(red, fg, 0.6) gh_danger_bg0 = utils.Mix('#ffdce0', bg, 0.8) @@ -611,6 +639,28 @@ end -- }}} +-- Neogit {{{ + +local neogit = { + NeogitDiffAdd = { fg = ng_add_fg, bg = ng_add_bg}, + NeogitDiffAddHighlight = { fg = ng_add_fg_hl, bg = ng_add_bg_hl, gui = 'bold' }, + NeogitDiffDelete = { fg = ng_delete_fg, bg = ng_delete_bg }, + NeogitDiffDeleteHighlight = { fg = ng_delete_fg_hl, bg = ng_delete_bg_hl, gui = 'bold' }, + NeogitDiffContext = { fg = fg_alt, bg = bg }, + NeogitDiffContextHighlight = { fg = fg, bg = bg_alt }, + NeogitHunkHeader = { fg = bg, bg = ng_header_bg }, + NeogitHunkHeaderHighlight = { fg = bg_alt, bg = ng_header_bg_hl, gui = 'bold' }, + NeogitStagedChanges = { fg = blue, gui = 'bold' }, + NeogitStagedChangesRegion = { bg = bg_highlight }, + NeogitStashes = { fg = blue, gui = 'bold' }, + NeogitUnstagedChanges = { fg = blue, gui = 'bold' }, + NeogitUntrackedfiles = { fg = blue, gui = 'bold' }, +} + +apply_highlight(neogit) + +-- }}} + -- NvimTree {{{ local nvim_tree = { @@ -710,6 +760,15 @@ apply_highlight(indent_blankline) -- }}} +local illuminated = { + illuminatedWord = { + cterm = 'underline', + gui = 'underline', + }, +} + +apply_highlight(illuminated) + -- }}} -- LSP {{{ @@ -742,6 +801,26 @@ high_link('LspDiagnosticsSignError', 'ErrorMsg') high_link('LspDiagnosticsSignWarning', 'WarningMsg') high_link('LspDiagnosticsSignInformation', 'MoreMsg') high_link('LspDiagnosticsSignHint', 'Msg') +high_link('DiagnosticFloatingError', 'ErrorMsg') +high_link('DiagnosticFloatingWarn', 'Warning') +high_link('DiagnosticFloatingInfo', 'MoreMsg') +high_link('DiagnosticFloatingHint', 'Msg') +high_link('DiagnosticDefaultError', 'ErrorMsg') +high_link('DiagnosticDefaultWarn', 'WarningMsg') +high_link('DiagnosticDefaultInfo', 'MoreMsg') +high_link('DiagnosticDefaultHint', 'Msg') +high_link('DiagnosticVirtualTextError', 'ErrorMsg') +high_link('DiagnosticVirtualTextWarn', 'WarningMsg') +high_link('DiagnosticVirtualTextInfo', 'MoreMsg') +high_link('DiagnosticVirtualTextHint', 'Msg') +high_link('DiagnosticUnderlineError', 'ErrorMsgUnderline') +high_link('DiagnosticUnderlineWarn', 'WarningMsgUnderline') +high_link('DiagnosticUnderlineInfo', 'MoreMsgUnderline') +high_link('DiagnosticUnderlineHint', 'MsgUnderline') +high_link('DiagnosticSignError', 'ErrorMsg') +high_link('DiagnosticSignWarning', 'WarningMsg') +high_link('DiagnosticSignInformation', 'MoreMsg') +high_link('DiagnosticSignHint', 'Msg') high_link('LspReferenceText', 'Bold') high_link('LspReferenceRead', 'Bold') high_link('LspReferenceWrite', 'Bold') From 8cf26d8a74062fa94ffb916c1e90ebbddb91f340 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 28 Sep 2021 16:16:41 -0400 Subject: [PATCH 065/290] fix(modules): add missing disabled condition for `vim-illuminate` --- lua/doom/modules/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index c6de54cac..f8d79fee6 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -222,6 +222,8 @@ packer.startup(function(use) event = "BufWinEnter", }) + -- Highlight other uses of the word under the cursor like VSC + local disabled_illuminate = is_plugin_disabled("illuminated") use({ "RRethy/vim-illuminate", setup = function() @@ -236,6 +238,7 @@ packer.startup(function(use) "toggleterm", } end, + disable = disabled_illuminate, event = "BufRead", }) From f2841c2b5a825b3c4f7101fb0e2ce9a3f6332c00 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 28 Sep 2021 18:31:15 -0400 Subject: [PATCH 066/290] refact(info): move all related git operations handling to `get_git_output` function - Add concealing for inline markdown code - Improved syntax highlighting - Improved showed commits metadata --- lua/doom/modules/built-in/info/init.lua | 100 ++++++++++++++++++------ 1 file changed, 74 insertions(+), 26 deletions(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 6b7f6cbc8..56530f9e7 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -108,6 +108,19 @@ local get_lsp_clients = function(bufnr) return string.len(client_names) > 0 and client_names or msg end +--- Executes a git command and gets the output +--- @param command string +--- @return string +local function get_git_output(command) + local git_command_handler = io.popen(system.git_workspace .. command) + -- Read the command output and remove newlines + local command_output = git_command_handler:read("*a"):gsub("[\r\n]", "") + -- Close child process + git_command_handler:close() + + return command_output +end + local function get_doom_info() local doom_info = {} @@ -116,11 +129,7 @@ local function get_doom_info() -- Doom version local doom_version = utils.doom_version -- Doom branch - local git_branch_handler = io.popen( - require("doom.core.system").git_workspace .. "branch --show-current" - ) - local doom_branch = git_branch_handler:read("*a"):gsub("[\r\n]", "") - git_branch_handler:close() + local doom_branch = get_git_output("branch --show-current") -- Configurations path local config_path = require("doom.core.config").source local modules_path = require("doom.core.config.modules").source @@ -143,14 +152,8 @@ local function get_doom_info() ) -- Local commit and last update date - local commit_handler = io.popen(system.git_workspace .. "rev-parse HEAD") - local current_commit = commit_handler:read("*a"):gsub("[\r\n]", "") - commit_handler:close() - local last_update_handler = io.popen( - string.format("%s%s %s", system.git_workspace, "show -s --format=%cD", current_commit) - ) - local last_update_date = last_update_handler:read("*a"):gsub("[\r\n]", "") - last_update_handler:close() + local current_commit = get_git_output("rev-parse HEAD") + local last_update_date = get_git_output("show -s --format=%cD " .. current_commit) vim.list_extend(doom_info, { "Doom Nvim Information", @@ -162,25 +165,41 @@ local function get_doom_info() doom_version, doom_branch ), + string.format( + "%s• Doom root:%s%s", + padding_level[1], + padding_level[2]:rep(2), + system.doom_root + ), string.format("%s• Last update date: %s", padding_level[1], last_update_date), }) if doom_branch == "develop" then + -- Current commit relevant information + local current_commit_message = get_git_output("show -s --format=%s " .. current_commit) + local current_commit_author = get_git_output('show -s --format="%cN <%cE>" ' .. current_commit) vim.list_extend(doom_info, { + "", + string.format("%s▶ Doom current commit", padding_level[1]), + string.format( + "%s• Commit author: %s%s", + padding_level[2], + padding_level[2], + current_commit_author + ), string.format( - "%s• Current commit: %s%s", - padding_level[1], - padding_level[1], + "%s• Commit message:%s%s", + padding_level[2], + padding_level[2], + current_commit_message + ), + string.format( + "%s• Commit short hash: %s", + padding_level[2], current_commit:sub(current_commit:len() - 6, current_commit:len()) ), }) end vim.list_extend(doom_info, { - string.format( - "%s• Doom root:%s%s", - padding_level[1], - padding_level[2]:rep(2), - system.doom_root - ), "", string.format("%s▶ Doom configurations paths", padding_level[1]), string.format("%s- %s", padding_level[2], config_path), @@ -384,7 +403,7 @@ local function get_system_info() table.insert( sys_info, string.format( - "%s• Found %s? %s%s%s", + "%s• Found `%s`? %s%s%s", padding_level[2], program, extra_padding, @@ -449,24 +468,49 @@ local function set_syntax_highlighting(buffer_id) end -- Extra highlights that we can't manually set with nvim_buf_add_highlight + -- NOTE: these extra newlines are for improving code readability, don't remove! vim.cmd([[ " True / False " NOTE: Use String and ErrorMsg as a fallback if TextXBold does not exists in the current colorscheme call matchadd(match(execute("hi TextSuccessBold"), "cleared") =~ -1 ? "TextSuccessBold" : "String", "yes") call matchadd(match(execute("hi TextErrorBold"), "cleared") =~ -1 ? "TextErrorBold" : "ErrorMsg", '\(no\s\)\|\(no$\)\|\(No Active Lsp\)') - " Lists and delimiters - call matchadd("Operator", '\(\s\+-\s\)\|:\s\+\|?') + " Release type and branches call matchadd("Constant", '\(prerelease\)\|\(develop\|main\)\sbranch') + + " Commit author email + call matchadd("Bold", '\([-a-zA-Z0-9_]\+@[-a-zA-Z0-9_]\+\.\w\+\)') + " Commit SHA call matchadd("Constant", '\(\s[a-f0-9]\{7}$\)') + + " Commits scopes + call matchadd("Msg", '\(hotfix\)\|\(fix\)') + call matchadd("MoreMsg", "feat") + call matchadd("WarningMsg", "refact") + call matchadd("SpecialComment", "docs") + call matchadd("Comment", "chore") + call matchadd("Constant", "release") + " Numbers call matchadd("Number", '\s[0-9]\+$') + " Fields call matchadd("String", "•") + + " Lists and delimiters + call matchadd("Operator", '\(\s\+-\s\)\|:\s\+\|<\|>\|@') + " Neovim commands " NOTE: Use Comment as a fallback if CommentBold does not exists in the current colorscheme call matchadd(match(execute("hi CommentBold"), "cleared") =~ -1 ? "CommentBold" : "Comment", '\(:[A-Za-z]\+\)') + + " Inline code like markdown + call matchadd(match(execute("hi CommentBold"), "cleared") =~ -1 ? "CommentBold" : "Comment", '\(`[-a-zA-Z0-9_]\+`\)') + " Conceal start ` + call matchadd("Conceal", '\(`[-a-zA-Z0-9_]\+`\)\@=', 10, -1, {"conceal": ""}) + " Conceal ending ` + call matchadd("Conceal", '\(\(`?\)\|\(`$\)\|\(`\s\)\)\@=', 10, -1, {"conceal": ""}) ]]) end @@ -504,8 +548,12 @@ info.open = function() -- Set the buffer options vim.api.nvim_buf_set_option(info_buffer, "modifiable", false) + -- Concealing for inline code + vim.opt_local.conceallevel = 2 + vim.opt_local.concealcursor = "nc" + -- Folding vim.opt_local.foldtext = - [[substitute(substitute(getline(v:foldstart), '?\s\+', '? ', 'g'),'\\t',repeat('\ ',&tabstop),'g').' ... ' . '(' . (v:foldend - v:foldstart + 1) . ' fields)']] + [[substitute(substitute(substitute(getline(v:foldstart), '?\s\+', '? ', 'g'), ':\s\+', ': ', 'g'), '\\t', repeat('\ ',&tabstop), 'g') . ' ... ' . '(' . (v:foldend - v:foldstart + 1) . ' fields)']] vim.opt_local.shiftwidth = 6 vim.opt_local.foldignore = [[=\\\|]] vim.opt_local.foldmethod = "indent" From 1d8c2cad759e43be6bc1ff7fa3af03afdec0c206 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 28 Sep 2021 20:40:58 -0400 Subject: [PATCH 067/290] feat(info): add the commit body if it's not empty - Add highlighting for strings - Add indentation style in buffer settings - Add highlighting for commits scopes `(foo)` - Update some syntax highlighting groups - Remove redundant Buffer in buffer settings section name --- lua/doom/modules/built-in/info/init.lua | 95 ++++++++++++++++++------- 1 file changed, 68 insertions(+), 27 deletions(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 56530f9e7..5d1c173e5 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -110,11 +110,15 @@ end --- Executes a git command and gets the output --- @param command string +--- @param remove_newlines boolean --- @return string -local function get_git_output(command) +local function get_git_output(command, remove_newlines) local git_command_handler = io.popen(system.git_workspace .. command) - -- Read the command output and remove newlines - local command_output = git_command_handler:read("*a"):gsub("[\r\n]", "") + -- Read the command output and remove newlines if wanted + local command_output = git_command_handler:read("*a") + if remove_newlines then + command_output = command_output:gsub("[\r\n]", "") + end -- Close child process git_command_handler:close() @@ -129,7 +133,7 @@ local function get_doom_info() -- Doom version local doom_version = utils.doom_version -- Doom branch - local doom_branch = get_git_output("branch --show-current") + local doom_branch = get_git_output("branch --show-current", true) -- Configurations path local config_path = require("doom.core.config").source local modules_path = require("doom.core.config.modules").source @@ -152,8 +156,8 @@ local function get_doom_info() ) -- Local commit and last update date - local current_commit = get_git_output("rev-parse HEAD") - local last_update_date = get_git_output("show -s --format=%cD " .. current_commit) + local current_commit = get_git_output("rev-parse HEAD", true) + local last_update_date = get_git_output("show -s --format=%cD " .. current_commit, true) vim.list_extend(doom_info, { "Doom Nvim Information", @@ -175,11 +179,21 @@ local function get_doom_info() }) if doom_branch == "develop" then -- Current commit relevant information - local current_commit_message = get_git_output("show -s --format=%s " .. current_commit) - local current_commit_author = get_git_output('show -s --format="%cN <%cE>" ' .. current_commit) + local current_commit_author = get_git_output( + 'show -s --format="%cN <%cE>" ' .. current_commit, + true + ) + local current_commit_message = get_git_output("show -s --format=%s " .. current_commit, true) + local current_commit_body = get_git_output("show -s --format=%b " .. current_commit, false) + vim.list_extend(doom_info, { "", string.format("%s▶ Doom current commit", padding_level[1]), + string.format( + "%s• Commit short hash: %s", + padding_level[2], + current_commit:sub(current_commit:len() - 6, current_commit:len()) + ), string.format( "%s• Commit author: %s%s", padding_level[2], @@ -187,17 +201,31 @@ local function get_doom_info() current_commit_author ), string.format( - "%s• Commit message:%s%s", + "%s• Commit subject:%s%s", padding_level[2], padding_level[2], current_commit_message ), - string.format( - "%s• Commit short hash: %s", - padding_level[2], - current_commit:sub(current_commit:len() - 6, current_commit:len()) - ), }) + if current_commit_body:len() > 0 then + vim.list_extend(doom_info, { + "", + string.format("%s○ Commit body", padding_level[2]), + }) + -- Add each line separately because Neovim does not like newlines + for _, body_part in ipairs(vim.split(current_commit_body, "\n")) do + if body_part:len() > 0 then + vim.list_extend(doom_info, { + string.format( + "%s", + body_part + :gsub("^%s+", string.format("%s", padding_level[3])) + :gsub("^%s+%-", string.format("%s-", padding_level[3])) + ), + }) + end + end + end end vim.list_extend(doom_info, { "", @@ -248,7 +276,6 @@ local function get_doom_info() return doom_info end --- TODO: add treesitter and LSP information like LunarVim local function get_buffer_info() local buffer_info = {} local buffer_ft = vim.api.nvim_buf_get_option(curr_buffer, "filetype") @@ -264,13 +291,7 @@ local function get_buffer_info() ), string.format("%s• %s: %s", padding_level[1], "Detected filetype", buffer_ft), "", - string.format("%s▶ Buffer settings", padding_level[1]), - string.format( - "%s• %s: %s", - padding_level[2], - "Indentation width", - vim.api.nvim_buf_get_option(curr_buffer, "tabstop") - ), + string.format("%s▶ Settings", padding_level[1]), string.format( "%s• %s: %s%s", padding_level[2], @@ -285,6 +306,18 @@ local function get_buffer_info() padding_level[2], vim.api.nvim_buf_get_option(curr_buffer, "fileencoding"):upper() ), + string.format( + "%s• %s: %s", + padding_level[2], + "Indentation width", + vim.api.nvim_buf_get_option(curr_buffer, "tabstop") + ), + string.format( + "%s• %s: %s", + padding_level[2], + "Indentation style", + vim.api.nvim_buf_get_option(curr_buffer, "expandtab") and "Tabs" or "Spaces" + ), "", ----- TREESITTER INFORMATION ------------------ ----------------------------------------------- @@ -450,8 +483,11 @@ local function set_syntax_highlighting(buffer_id) -- Information headers hl = "Title" -- "Structure" elseif line:find("▶") then - -- Information headers level 2 (subheaders) + -- Information subheaders (level 2) hl = "VariableBuiltin" + elseif line:find("○") then + -- Information subheaders (level 3) + hl = "FunctionBuiltin" elseif line:find(": ") or line:find("? ") then -- Information fields hl = "Bold" @@ -475,9 +511,6 @@ local function set_syntax_highlighting(buffer_id) call matchadd(match(execute("hi TextSuccessBold"), "cleared") =~ -1 ? "TextSuccessBold" : "String", "yes") call matchadd(match(execute("hi TextErrorBold"), "cleared") =~ -1 ? "TextErrorBold" : "ErrorMsg", '\(no\s\)\|\(no$\)\|\(No Active Lsp\)') - " Release type and branches - call matchadd("Constant", '\(prerelease\)\|\(develop\|main\)\sbranch') - " Commit author email call matchadd("Bold", '\([-a-zA-Z0-9_]\+@[-a-zA-Z0-9_]\+\.\w\+\)') @@ -488,9 +521,17 @@ local function set_syntax_highlighting(buffer_id) call matchadd("Msg", '\(hotfix\)\|\(fix\)') call matchadd("MoreMsg", "feat") call matchadd("WarningMsg", "refact") + call matchadd("ErrorMsg", '\(refact\!\)\|\(BREAKING CHANGE\)') call matchadd("SpecialComment", "docs") call matchadd("Comment", "chore") call matchadd("Constant", "release") + call matchadd("SpecialComment", '\(([-a-zA-Z0-9_]\+):\)\@>') + + " Release type and branches + call matchadd("Bold", '\(prerelease\)\|\(develop\|main\)\sbranch') + + " Strings + call matchadd("String", '".*"') " Numbers call matchadd("Number", '\s[0-9]\+$') @@ -499,7 +540,7 @@ local function set_syntax_highlighting(buffer_id) call matchadd("String", "•") " Lists and delimiters - call matchadd("Operator", '\(\s\+-\s\)\|:\s\+\|<\|>\|@') + call matchadd("Operator", '\(\s\+-\s\)\|:\s\+\|<\|>\|@\|(\|)') " Neovim commands " NOTE: Use Comment as a fallback if CommentBold does not exists in the current colorscheme From 873cc4e03dbd526f91d173c7b65746eead1ccdac Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 28 Sep 2021 20:59:59 -0400 Subject: [PATCH 068/290] feat(modules): update `nvim-tree.lua` configurations --- lua/doom/modules/config/doom-tree.lua | 166 ++++++++++++++++---------- 1 file changed, 104 insertions(+), 62 deletions(-) diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index 68f353f63..44a6f041d 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -4,94 +4,55 @@ return function() local tree_cb = require("nvim-tree.config").nvim_tree_callback + ----- GLOBAL VARIABLES ------------------------ + ----------------------------------------------- -- Empty by default vim.g.nvim_tree_ignore = { ".git", "node_modules", ".cache", "__pycache__" } - -- False by default, opens the tree when typing `vim $DIR` or `vim` - vim.g.nvim_tree_auto_open = 0 - - -- False by default, closes the tree when it is the last window - vim.g.nvim_tree_auto_close = 0 - - -- False by default, closes the tree when you open a file - vim.g.nvim_tree_quit_on_open = 1 - - -- False by default, this option allows the cursor to be updated when entering a buffer - vim.g.nvim_tree_follow = 1 - - -- False by default, will update the path of the current dir if the file is not inside the tree. - vim.g.nvim_tree_follow_update_path = 1 - -- False by default, this option shows indent markers when folders are open vim.g.nvim_tree_indent_markers = 1 -- Show hidden files vim.g.nvim_tree_hide_dotfiles = config.doom.show_hidden - -- Set tree width - vim.g.nvim_tree_width = config.doom.sidebar_width - -- False by default, will enable file highlight for git attributes (can be used without the icons). vim.g.nvim_tree_git_hl = 1 + -- False by default + vim.g.nvim_tree_gitignore = 1 + -- This is the default. See :help filename-modifiers for more options vim.g.nvim_tree_root_folder_modifier = ":~" - -- False by default, will open the tree when entering a new tab and the tree was previously open - vim.g.nvim_tree_tab_open = 1 - - -- False by default, will not resize the tree when opening a file - vim.g.nvim_tree_width_allow_resize = 1 - -- False by default, append a trailing slash to folder names vim.g.nvim_tree_add_trailing = 1 -- False by default, compact folders that only contain a single folder into one node in the file tree vim.g.nvim_tree_group_empty = 1 - -- False by default, will show lsp diagnostics in the signcolumn. See :help nvim_tree_lsp_diagnostics - vim.g.nvim_tree_lsp_diagnostics = is_plugin_disabled("lsp") and 0 or 1 + -- 1000 by default, control how often the tree can be refreshed, + -- 1000 means the tree can be refresh once per 1000ms. + vim.g.nvim_tree_refresh_wait = 500 + + -- Ignored filetypes and buffers when window picker is enabled + vim.g.nvim_tree_window_picker_exclude = { + filetype = { + "notify", + "packer", + "qf", + }, + buftype = { + "terminal", + }, + } + + -- List of filenames that gets highlighted with NvimTreeSpecialFile + vim.g.nvim_tree_special_files = { ["README.md"] = 1, Makefile = 1, MAKEFILE = 1 } -- If false, do not show the icons for one of 'git' 'folder' and 'files' -- true by default, notice that if 'files' is 1, it will only display -- if nvim-web-devicons is installed and on your runtimepath vim.g.nvim_tree_show_icons = { git = 1, folders = 1, files = 1, folder_arrows = 0 } - if config.doom.explorer_right then - vim.g.nvim_tree_side = "right" - end - - --- Tree keybindings - -- You can edit keybindings be defining this variable - -- You don't have to define all keys. - -- NOTE: the 'edit' key will wrap/unwrap a folder and open a file - vim.g.nvim_tree_bindings = { - -- default mappings - { key = "o", cb = tree_cb("edit") }, - { key = "<2-LeftMouse>", cb = tree_cb("edit") }, - { key = "", cb = tree_cb("cd") }, - { key = "<2-RightMouse>", cb = tree_cb("cd") }, - { key = "", cb = tree_cb("cd") }, - { key = "", cb = tree_cb("vsplit") }, - { key = "", cb = tree_cb("split") }, - { key = "", cb = tree_cb("tabnew") }, - { key = "", cb = tree_cb("close_node") }, - { key = "", cb = tree_cb("close_node") }, - { key = "", cb = tree_cb("preview") }, - { key = "I", cb = tree_cb("toggle_ignored") }, - { key = "H", cb = tree_cb("toggle_dotfiles") }, - { key = "R", cb = tree_cb("refresh") }, - { key = "a", cb = tree_cb("create") }, - { key = "d", cb = tree_cb("remove") }, - { key = "r", cb = tree_cb("rename") }, - { key = "", cb = tree_cb("full_rename") }, - { key = "x", cb = tree_cb("cut") }, - { key = "c", cb = tree_cb("copy") }, - { key = "p", cb = tree_cb("paste") }, - { key = "[c", cb = tree_cb("prev_git_item") }, - { key = "]c", cb = tree_cb("next_git_item") }, - { key = "-", cb = tree_cb("dir_up") }, - { key = "q", cb = tree_cb("close") }, - } --- Tree icons -- default will show icon by default if no icon is provided @@ -126,6 +87,87 @@ return function() }, } + ----- SETUP CONFIGURATION --------------------- + ----------------------------------------------- + require("nvim-tree").setup({ + -- Completely disable netrw + disable_netrw = false, + -- Hijack netrw window on startup + hijack_netrw = true, + -- open the tree when running this setup function + open_on_setup = false, + -- will not open on setup if the filetype is in this list + ignore_ft_on_setup = {}, + -- closes neovim automatically when the tree is the last **WINDOW** in the view + auto_close = false, + -- opens the tree when changing/opening a new tab if the tree wasn't previously opened + open_on_tab = true, + -- hijack the cursor in the tree to put it at the start of the filename + hijack_cursor = true, + -- updates the root directory of the tree on `DirChanged` (when your run `:cd` usually) + update_cwd = true, + -- show lsp diagnostics in the signcolumn + lsp_diagnostics = is_plugin_disabled("lsp") and false or true, + -- update the focused file on `BufEnter`, un-collapses the folders recursively until it finds the file + update_focused_file = { + -- enables the feature + enable = true, + -- update the root directory of the tree to the one of the folder containing the file if the file is not under the current root directory + -- only relevant when `update_focused_file.enable` is true + update_cwd = true, + -- list of buffer names / filetypes that will not update the cwd if the file isn't found under the current root directory + -- only relevant when `update_focused_file.update_cwd` is true and `update_focused_file.enable` is true + ignore_list = {}, + }, + -- configuration options for the system open command (`s` in the tree by default) + system_open = { + -- the command to run this, leaving nil should work in most cases + cmd = nil, + -- the command arguments as a list + args = {}, + }, + + view = { + -- width of the window, can be either a number (columns) or a string in `%` + width = config.doom.sidebar_width, + -- side of the tree, can be one of 'left' | 'right' | 'top' | 'bottom' + side = config.doom.explorer_right and "right" or "left", + -- if true the tree will resize itself after opening a file + auto_resize = true, + mappings = { + -- custom only false will merge the list with the default mappings + -- if true, it will only use your list to set the mappings + custom_only = false, + -- list of mappings to set on the tree manually + list = { + { key = { "o", "<2-LeftMouse>" }, cb = tree_cb("edit") }, + { key = { "", "<2-RightMouse>", "" }, cb = tree_cb("cd") }, + { key = "", cb = tree_cb("vsplit") }, + { key = "", cb = tree_cb("split") }, + { key = "", cb = tree_cb("tabnew") }, + { key = "", cb = tree_cb("close_node") }, + { key = "", cb = tree_cb("close_node") }, + { key = "", cb = tree_cb("preview") }, + { key = "I", cb = tree_cb("toggle_ignored") }, + { key = "H", cb = tree_cb("toggle_dotfiles") }, + { key = "R", cb = tree_cb("refresh") }, + { key = "a", cb = tree_cb("create") }, + { key = "d", cb = tree_cb("remove") }, + { key = "r", cb = tree_cb("rename") }, + { key = "", cb = tree_cb("full_rename") }, + { key = "x", cb = tree_cb("cut") }, + { key = "c", cb = tree_cb("copy") }, + { key = "p", cb = tree_cb("paste") }, + { key = "[c", cb = tree_cb("prev_git_item") }, + { key = "]c", cb = tree_cb("next_git_item") }, + { key = "-", cb = tree_cb("dir_up") }, + { key = "q", cb = tree_cb("close") }, + { key = "g?", cb = tree_cb("toggle_help") }, + }, + }, + }, + }) + -- Make sure nvim-tree loads itself when lazy loaded vim.defer_fn(require("nvim-tree").refresh, 25) end From d98648eb3a329675f3c99ef2f0b4d56e011d1ff0 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 28 Sep 2021 21:00:06 -0400 Subject: [PATCH 069/290] fix(info): properly check if commit body is empty --- lua/doom/modules/built-in/info/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 5d1c173e5..a1ab3432c 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -207,7 +207,8 @@ local function get_doom_info() current_commit_message ), }) - if current_commit_body:len() > 0 then + -- Check if the commit body is empty before trying to add it + if current_commit_body:gsub("[\r\n]", ""):len() > 0 then vim.list_extend(doom_info, { "", string.format("%s○ Commit body", padding_level[2]), From e8b682b2880df1b918d05bbca2387bf35daf0630 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 00:49:10 -0400 Subject: [PATCH 070/290] fix(ci): remove unused variable in nvim-tree setup --- lua/doom/modules/config/doom-tree.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index 44a6f041d..0bc384863 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -1,7 +1,5 @@ return function() local config = require("doom.core.config").config - local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled - local tree_cb = require("nvim-tree.config").nvim_tree_callback ----- GLOBAL VARIABLES ------------------------ From 29f9262c371fcd7954bc8ec427d064e1a3d965b1 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 00:54:16 -0400 Subject: [PATCH 071/290] refact(modules): lazy-load lspinstall --- lua/doom/modules/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index f8d79fee6..0de710e07 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -390,7 +390,8 @@ packer.startup(function(use) "kabouzeid/nvim-lspinstall", config = require("doom.modules.config.doom-lspinstall"), disable = disabled_lsp, - event = "VimEnter", + module = "lspinstall", + cmd = { "LspInstall", "LspUninstall" }, }) -- Show function signature when you type From 0fc35a40a35d38db61e850c205614daef9bd5df9 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:01:02 -0400 Subject: [PATCH 072/290] fix(modules): bufferline was not being loadedd sometimes --- lua/doom/modules/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 0de710e07..e80aa6f18 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -153,7 +153,7 @@ packer.startup(function(use) "akinsho/bufferline.nvim", config = require("doom.modules.config.doom-bufferline"), disable = disabled_tabline, - event = "ColorScheme", + event = "BufWinEnter", }) -- Better terminal From 6c1dc123bff3275e0a63e38eca9262bcebb148b5 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:06:23 -0400 Subject: [PATCH 073/290] refact(core): invert modules loading order, in that way we will load Neovim configurations first - Move custom whichkey background logic to `ui` module - Remove colorscheme and background logic from settings module - Convert doom-one options into a table to have a cleaner code --- lua/doom/core/config/ui.lua | 20 ++++++++++++++------ lua/doom/core/init.lua | 2 +- lua/doom/core/settings/init.lua | 5 ----- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua index d2bfebef7..d8118c3e0 100644 --- a/lua/doom/core/config/ui.lua +++ b/lua/doom/core/config/ui.lua @@ -35,10 +35,18 @@ if config.doom.enable_guicolors then end end +-- Set custom WhichKey background +vim.cmd("highlight WhichKeyFloat guibg=" .. config.doom.whichkey_bg) + -- Set doom-one colorscheme settings -vim.g.doom_one_cursor_coloring = config.doom.doom_one.cursor_coloring -vim.g.doom_one_enable_treesitter = config.doom.doom_one.enable_treesitter -vim.g.doom_one_italic_comments = config.doom.doom_one.italic_comments -vim.g.doom_one_telescope_highlights = config.doom.doom_one.telescope_highlights -vim.g.doom_one_terminal_colors = config.doom.doom_one.terminal_colors -vim.g.doom_one_transparent_background = config.doom.doom_one.transparent_background +local doom_one_options = { + "cursor_coloring", + "enable_treesitter", + "italic_comments", + "telescope_highlights", + "terminal_colors", + "transparent_background", +} +for _, option in ipairs(doom_one_options) do + vim.g["doom_one_" .. option] = config.doom.doom_one[option] +end diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index d7c63cd84..b4892d9d0 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -4,7 +4,7 @@ local log = require("doom.extras.logging") -local core_modules = { "config", "config.ui", "settings" } +local core_modules = { "settings", "config.ui", "config" } for i = 1, #core_modules, 1 do local ok, err = xpcall(require, debug.traceback, ("doom.core.%s"):format(core_modules[i])) if ok then diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index 870635d05..5921e33da 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -15,11 +15,6 @@ log.debug("Loading Doom defaults module ...") -- load_default_options sets and loads default Neovim options based on doom_config.lua values M.load_default_options = function() ----- Default Neovim configurations - -- Set colorscheme - vim.cmd("colorscheme " .. config.doom.colorscheme) - vim.opt.background = config.doom.colorscheme_bg - vim.cmd("highlight WhichKeyFloat guibg=" .. config.doom.whichkey_bg) - -- Global options vim.opt.hidden = true vim.opt.updatetime = 200 From 974ee4a97c29079a9bb2ca51bcac887a85836bc1 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:21:06 -0400 Subject: [PATCH 074/290] revert: "refact(modules): lazy-load lspinstall" This reverts commit 29f9262c371fcd7954bc8ec427d064e1a3d965b1. --- lua/doom/modules/init.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index e80aa6f18..6fcaa8414 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -390,8 +390,7 @@ packer.startup(function(use) "kabouzeid/nvim-lspinstall", config = require("doom.modules.config.doom-lspinstall"), disable = disabled_lsp, - module = "lspinstall", - cmd = { "LspInstall", "LspUninstall" }, + event = "VimEnter", }) -- Show function signature when you type From 0da14a38a1b298387cc3929e47768e2d84f7961a Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:22:49 -0400 Subject: [PATCH 075/290] refact(modules): load lspinstall on BufWinEnter --- lua/doom/modules/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 6fcaa8414..f1b32e4b8 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -390,7 +390,7 @@ packer.startup(function(use) "kabouzeid/nvim-lspinstall", config = require("doom.modules.config.doom-lspinstall"), disable = disabled_lsp, - event = "VimEnter", + event = "BufWinEnter", }) -- Show function signature when you type From bc744f5170eb3b2e6e4fa3aa22ac6753a46e5c8f Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:23:25 -0400 Subject: [PATCH 076/290] feat(extras): add init file to load autocommands and keybindings --- lua/doom/extras/init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lua/doom/extras/init.lua diff --git a/lua/doom/extras/init.lua b/lua/doom/extras/init.lua new file mode 100644 index 000000000..a495dcc53 --- /dev/null +++ b/lua/doom/extras/init.lua @@ -0,0 +1,10 @@ +--- Main Doom extras file +--- This file loads all doom extra components +--- (autocommands, keybindings) + +require("doom.extras.logging").debug("Loading Doom extras ...") + +require("doom.utils").load_modules("doom.extras", { + "autocmds", + "keybindings", +}) From 55ad383df087d87cb403ded96afc11531eeb732e Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:23:47 -0400 Subject: [PATCH 077/290] feat(core): improve debugging messages --- lua/doom/core/config/init.lua | 2 +- lua/doom/core/init.lua | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index f9f9f6da9..05b28d344 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -10,7 +10,7 @@ local log = require("doom.extras.logging") local utils = require("doom.utils") local system = require("doom.core.system") -log.debug("Loading Doom core config module ...") +log.debug("Loading Doom config module ...") -- Check if running Neovim or Vim and fails if: -- 1. Running Vim instead of Neovim diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index b4892d9d0..759e57c4c 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -4,6 +4,8 @@ local log = require("doom.extras.logging") +log.debug("Loading Doom core ...") + local core_modules = { "settings", "config.ui", "config" } for i = 1, #core_modules, 1 do local ok, err = xpcall(require, debug.traceback, ("doom.core.%s"):format(core_modules[i])) @@ -23,6 +25,7 @@ for i = 1, #core_modules, 1 do require("doom.core.config.modules").modules.langs ) end + log.debug(string.format("Successfully loaded 'doom.core.%s' module", core_modules[i])) else log.error( string.format( From eeccaf089d2c298a072dce82e98b40ecf88a8908 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:24:11 -0400 Subject: [PATCH 078/290] feat(utils): improve debugging messages in `load_modules` --- lua/doom/utils/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 957f58bfc..7b22c0d47 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -213,6 +213,14 @@ M.load_modules = function(module_path, modules) err ) ) + else + require("doom.extras.logging").debug( + string.format( + "Successfully loaded '%s.%s' module", + module_path, + modules[i] + ) + ) end end end From 57ab1c2ea7868b63d9d15fab2cb891b7202955bd Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:29:33 -0400 Subject: [PATCH 079/290] refact(init): do not disable syntax highlighting on launch, closes #131 - Remove some built-in Neovim plugins loading logic to allow them to be used - Remove shada logic, we do not really need to temporarily disable it - Add better error catching for Dashboard loading - Run `BufEnter` autocommand after loading treesitter, should fix concealing issues on Neorg --- init.lua | 68 +++++++++++++++++--------------------------------------- 1 file changed, 21 insertions(+), 47 deletions(-) diff --git a/init.lua b/init.lua index c93000bf2..8cce9aa9e 100644 --- a/init.lua +++ b/init.lua @@ -8,67 +8,41 @@ ------------------------------------------------- -- Store startup time in seconds vim.g.start_time = vim.fn.reltime() +-- Lua modules loader, when loading our modules with this +-- we avoid breaking all the configuration if something fails +local load_modules = require("doom.utils").load_modules --- Disable these for very fast startup time -vim.cmd([[ - syntax off - filetype off - filetype plugin indent off -]]) - --- Temporarily disable shada file to improve performance -vim.opt.shadafile = "NONE" -- Disable some unused built-in Neovim plugins vim.g.loaded_gzip = false -vim.g.loaded_netrwPlugin = false vim.g.loaded_tarPlugin = false vim.g.loaded_zipPlugin = false vim.g.loaded_2html_plugin = false -vim.g.loaded_remote_plugins = false ---- Doom Configurations ------------------------ ------------------------------------------------- -vim.defer_fn(function() - local load_modules = require("doom.utils").load_modules - - -- Load Doom stuff (core, modules, extras) - load_modules("doom", { "core", "modules", "extras.autocmds" }) +-- Load Doom core and UI related stuff (colorscheme, background) +load_modules("doom", { "core" }) - -- If the dashboard plugin is already installed and the packer_compiled.lua - -- file exists so we can make sure that the dashboard have been loaded. - local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep - local compiled_plugins_path = string.format( - "%s%splugin%spacker_compiled.lua", - doom_root, - sep, - sep - ) - if require("doom.utils").file_exists(compiled_plugins_path) then - -- If the current buffer name is empty then trigger Dashboard. - -- NOTE: this is done to avoid some weird issues with Dashboard and - -- number / signcolumn when Dashboard gets triggered automatically - if (vim.api.nvim_buf_get_name(0):len() == 0) and packer_plugins["dashboard-nvim"] then - vim.cmd("Dashboard") - end +vim.defer_fn(function() + -- Load Doom extra stuff and plugins (modules, extras) + load_modules("doom", { "modules", "extras" }) + + -- If the current buffer name is empty then trigger Dashboard. + -- NOTE: this is done to avoid some weird issues with Dashboard and + -- number / signcolumn when Dashboard gets triggered automatically + if (vim.api.nvim_buf_get_name(0):len() == 0) and (packer_plugins and packer_plugins["dashboard-nvim"]) then + vim.cmd("Dashboard") end - vim.opt.shadafile = "" vim.cmd([[ - rshada! - doautocmd BufRead - syntax on - filetype on - filetype plugin indent on PackerLoad nvim-treesitter + " This BufEnter call should fix some issues with concealing in neorg + doautocmd BufEnter ]]) - -- Load keybindings module at the end because the keybindings module cost is high - vim.defer_fn(function() - load_modules("doom.extras", { "keybindings" }) - if not require("doom.core.functions").is_plugin_disabled("which-key") then - vim.cmd([[ - PackerLoad which-key.nvim - ]]) - end - end, 20) + if not require("doom.core.functions").is_plugin_disabled("which-key") then + vim.cmd([[ + PackerLoad which-key.nvim + ]]) + end end, 0) From a3b0750d3b136e4e08ab9882db835d154b97938f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 29 Sep 2021 05:29:56 +0000 Subject: [PATCH 080/290] chore: format source code --- init.lua | 5 ++++- lua/doom/utils/init.lua | 6 +----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 8cce9aa9e..69e575adc 100644 --- a/init.lua +++ b/init.lua @@ -30,7 +30,10 @@ vim.defer_fn(function() -- If the current buffer name is empty then trigger Dashboard. -- NOTE: this is done to avoid some weird issues with Dashboard and -- number / signcolumn when Dashboard gets triggered automatically - if (vim.api.nvim_buf_get_name(0):len() == 0) and (packer_plugins and packer_plugins["dashboard-nvim"]) then + if + (vim.api.nvim_buf_get_name(0):len() == 0) + and (packer_plugins and packer_plugins["dashboard-nvim"]) + then vim.cmd("Dashboard") end diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 7b22c0d47..5e1dbbc2a 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -215,11 +215,7 @@ M.load_modules = function(module_path, modules) ) else require("doom.extras.logging").debug( - string.format( - "Successfully loaded '%s.%s' module", - module_path, - modules[i] - ) + string.format("Successfully loaded '%s.%s' module", module_path, modules[i]) ) end end From 47554000a5944ef1dcefcbce728e2ee15df4bde4 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:39:21 -0400 Subject: [PATCH 081/290] fix(modules): proper conditional for nvim-tree lsp --- lua/doom/modules/config/doom-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index 0bc384863..740daf031 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -105,7 +105,7 @@ return function() -- updates the root directory of the tree on `DirChanged` (when your run `:cd` usually) update_cwd = true, -- show lsp diagnostics in the signcolumn - lsp_diagnostics = is_plugin_disabled("lsp") and false or true, + lsp_diagnostics = require("doom.core.functions").is_plugin_disabled("lsp") and false or true, -- update the focused file on `BufEnter`, un-collapses the folders recursively until it finds the file update_focused_file = { -- enables the feature From 44f7a0f4d0f065e0e7c003493b580ea8b5a93b67 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 01:43:27 -0400 Subject: [PATCH 082/290] refact(info): show commit SHA like github (first seven characters) instead of showing last seven characters --- lua/doom/modules/built-in/info/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index a1ab3432c..cb9d091b9 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -192,7 +192,7 @@ local function get_doom_info() string.format( "%s• Commit short hash: %s", padding_level[2], - current_commit:sub(current_commit:len() - 6, current_commit:len()) + current_commit:sub(1, 7) ), string.format( "%s• Commit author: %s%s", From 6f2e7bfbd0b9b31d0e427f54b9518972e2313380 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 29 Sep 2021 05:43:50 +0000 Subject: [PATCH 083/290] chore: format source code --- lua/doom/modules/built-in/info/init.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index cb9d091b9..e9018d9e8 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -189,11 +189,7 @@ local function get_doom_info() vim.list_extend(doom_info, { "", string.format("%s▶ Doom current commit", padding_level[1]), - string.format( - "%s• Commit short hash: %s", - padding_level[2], - current_commit:sub(1, 7) - ), + string.format("%s• Commit short hash: %s", padding_level[2], current_commit:sub(1, 7)), string.format( "%s• Commit author: %s%s", padding_level[2], From a0ca0e00008bc386227a8d068091b2c5c2c114c2 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 12:25:28 -0400 Subject: [PATCH 084/290] refact(modules): use `,o` as neorg leader instead of `o`, see #110 --- lua/doom/modules/config/doom-neorg.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index ed16e989e..10d4a864c 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -9,7 +9,7 @@ return function() ["core.keybinds"] = { -- Configure core.keybinds config = { default_keybinds = true, -- Generate the default keybinds - neorg_leader = "o", -- This is the default if unspecified + neorg_leader = ",o", -- This is the default if unspecified }, }, ["core.norg.concealer"] = {}, -- Allows for use of icons From e59e0fa033ddf23cdc125af689bc74fe6a16a4b5 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 12:32:17 -0400 Subject: [PATCH 085/290] feat(info): improve inline markdown code detection --- lua/doom/modules/built-in/info/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index e9018d9e8..d39a2ad9a 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -544,11 +544,11 @@ local function set_syntax_highlighting(buffer_id) call matchadd(match(execute("hi CommentBold"), "cleared") =~ -1 ? "CommentBold" : "Comment", '\(:[A-Za-z]\+\)') " Inline code like markdown - call matchadd(match(execute("hi CommentBold"), "cleared") =~ -1 ? "CommentBold" : "Comment", '\(`[-a-zA-Z0-9_]\+`\)') + call matchadd(match(execute("hi CommentBold"), "cleared") =~ -1 ? "CommentBold" : "Comment", '\(`[-a-zA-Z0-9_,\.\<\>@\$#+\!]\+`\)') " Conceal start ` - call matchadd("Conceal", '\(`[-a-zA-Z0-9_]\+`\)\@=', 10, -1, {"conceal": ""}) + call matchadd("Conceal", '\(`[-a-zA-Z0-9_,\.\<\>@\$#+\!]\+`\)\@=', 10, -1, {"conceal": ""}) " Conceal ending ` - call matchadd("Conceal", '\(\(`?\)\|\(`$\)\|\(`\s\)\)\@=', 10, -1, {"conceal": ""}) + call matchadd("Conceal", '\(\(`?\)\|\(`$\)\|\(`\s\)\|\(`,\s\)\)\@=', 10, -1, {"conceal": ""}) ]]) end From b1bfa6c95a1b85ca9536417f278590bdb4684a3d Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 29 Sep 2021 18:49:48 -0400 Subject: [PATCH 086/290] chore: remove non-needed sessions dir --- sessions/.init | 1 - 1 file changed, 1 deletion(-) delete mode 100644 sessions/.init diff --git a/sessions/.init b/sessions/.init deleted file mode 100644 index b1b716105..000000000 --- a/sessions/.init +++ /dev/null @@ -1 +0,0 @@ -init From 2f45e7365fbf725d410de69c6fa31668bfa6a7a0 Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Tue, 28 Sep 2021 09:55:37 +0900 Subject: [PATCH 087/290] vertical_split and tweak * New window can open vertical split for editing and help page * Add t? for tweaking editor behaviors * b: background (dark/light) * g: signcolumn (auto/off) -- for gitsigs, ale * i: indent (ts, sts, sw, et) * n: number (nu, rnu, 4 combinations) * p: autopairs (on/off/not available) * s: spell * x: syntax/treesetter Signed-off-by: Osamu Aoki --- doc/doom_nvim.norg | 18 ++- lua/doom/core/functions/init.lua | 130 +++++++++++++++++++++- lua/doom/extras/keybindings/init.lua | 22 ++-- lua/doom/extras/keybindings/leader.lua | 112 ++++++++++++++++--- lua/doom/modules/config/doom-whichkey.lua | 16 ++- 5 files changed, 270 insertions(+), 28 deletions(-) diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index 12a22627d..4d9003d69 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -451,6 +451,22 @@ ├─────────────────────┼────────────────────────────────────────────────────┤ │ s - s │ Goto symbol │ ├─────────────────────┼────────────────────────────────────────────────────┤ + │ t - - │ Tweak Neovim behavior │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ t - b │ Toggle background light/dark │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ t - g │ Turn on and off signcolumn for gitsigns, ... │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ t - i │ Set tabstop and indent steps to any integer │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ t - n │ Change line number display (4 types) │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ t - p │ Turn on and off autopairs if available │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ t - s │ Spell check on/off │ + ├─────────────────────┼────────────────────────────────────────────────────┤ + │ t - x │ Syntax/treesetter on/off │ + ├─────────────────────┼────────────────────────────────────────────────────┤ │ w - - │ Split window below │ ├─────────────────────┼────────────────────────────────────────────────────┤ │ w - = │ Balance windows size │ @@ -535,7 +551,7 @@ │ Control + Right │ Resize window right │ └─────────────────────┴────────────────────────────────────────────────────┘ - You can modify the default keybindings my modifying the following files: + You can modify the default keybindings by modifying the following files: - General keybindings: `lua/doom/extras/keybindings/init.lua` - Plugins keybindings: `lua/doom/modules/config` - which-key keybindings: `lua/doom/modules/config/doom-whichkey.lua` diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 4754a93d8..5bf5b97a7 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -494,17 +494,141 @@ M.edit_config = function() "2. doom_modules.lua", "3. doom_userplugins.lua", })) + local direction = config.doom.vertical_split and "vert " or "" local open_command = config.doom.new_file_split and "split" or "edit" if selected_config == 1 then - vim.cmd(("%s %s"):format(open_command, require("doom.core.config").source)) + vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config").source)) elseif selected_config == 2 then - vim.cmd(("%s %s"):format(open_command, require("doom.core.config.modules").source)) + vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source)) elseif selected_config == 3 then - vim.cmd(("%s %s"):format(open_command, require("doom.core.config.userplugins").source)) + vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.userplugins").source)) elseif selected_config ~= 0 then log.error("Invalid option selected.") end end +-- followings are called from lua/doom/extras/keybindings/leader.lua +-- +-- toggle_background() -- tb -- toggle background light/dark +M.toggle_background = function() + local background = vim.go.background + if background == "light" then + vim.go.background = "dark" + print("background=dark") + else + vim.go.background = "light" + print("background=light") + end +end + +-- toggle_signcolumn() -- tg -- signcolumn auto/no +M.toggle_signcolumn = function() + local signcolumn = vim.o.signcolumn + if signcolumn == "no" then + vim.o.signcolumn = "auto" + print("signcolumn=auto") + else + vim.o.signcolumn = "no" + print("signcolumn=no") + end +end + +-- set_indent() -- ti -- set the indent and tab related numbers +M.set_indent = function() + local indent = tonumber(vim.fn.input("Set all tab related options to a specified number and set expandtab\n(0 to reset to vim defaults, ? to print current settings): ")) + if (indent == nil) or (indent < 0) then + vim.cmd("set softtabstop? tabstop? shiftwidth? expandtab?") + elseif indent > 0 then + vim.o.tabstop = indent + vim.o.softtabstop = indent + vim.o.shiftwidth = indent + vim.o.expandtab = true + print(("\nindent=%i, expandtab"):format(indent)) + else -- indent == 0 + vim.o.tabstop = 8 + vim.o.softtabstop = 0 + vim.o.shiftwidth = 8 + vim.o.expandtab = false + print("\nindent=8, noexpandtab") + end +end + +-- change_number() -- tn -- change the number display modes +M.change_number = function() + local number = vim.o.number + local relativenumber = vim.o.relativenumber + if (number == false) and (relativenumber == false) then + vim.o.number = true + vim.o.relativenumber = false + print("number on, relativenumber off") + elseif (number == true) and (relativenumber == false) then + vim.o.number = false + vim.o.relativenumber = true + print("number off, relativenumber on") + elseif (number == false) and (relativenumber == true) then + vim.o.number = true + vim.o.relativenumber = true + print("number on, relativenumber on") + else -- (number == true) and (relativenumber == true) then + vim.o.number = false + vim.o.relativenumber = false + print("number off, relativenumber off") + end +end + +-- toggle_autopairs() -- tp -- toggle autopairs +M.toggle_autopairs = function() + local ok, autopairs = pcall(require, "nvim-autopairs") + if ok then + if autopairs.state.disabled then + autopairs.enable() + print("autopairs on") + else + autopairs.disable() + print("autopairs off") + end + else + print("autopairs not available") + end +end + +-- toggle_spell() -- ts -- toggle spell +M.toggle_spell = function() + if vim.o.spell then + vim.o.spell = false + print("spell off") + else + if vim.o.spelllang == nil then + vim.o.spelllang = "en_us" + end + vim.o.spell = true + print(("spell on, lang %s"):format(vim.o.spelllang)) + end +end + +-- change_syntax() -- tx -- toggle syntax/treesetter +M.change_syntax = function() + local parsers = require("nvim-treesitter.parsers") + if parsers and parsers.has_parser() then + if vim.o.syntax then + vim.cmd("TSBufDisable highlight") + vim.cmd("syntax off") + print("syntax off, treesetter off") + else + vim.cmd("TSBufEnable highlight") + vim.cmd("syntax on") + print("syntax on, treesetter on") + end + else + if vim.o.syntax then + vim.cmd("syntax off") + print("syntax off") + else + vim.cmd("syntax on") + print("syntax on") + end + end +end + return M diff --git a/lua/doom/extras/keybindings/init.lua b/lua/doom/extras/keybindings/init.lua index 1d5340976..11b2e0670 100644 --- a/lua/doom/extras/keybindings/init.lua +++ b/lua/doom/extras/keybindings/init.lua @@ -14,14 +14,20 @@ log.debug("Loading Doom keybindings module ...") ---[[---------------------------------]]--- -- Custom Key mappings -- -- -- --- b = Buffer Menu -- --- f = File Menu -- --- g = Git Menu -- --- p = Plugin Menu -- --- r = Runner Menu -- --- s = Session Menu -- --- o = Open Menu -- --- w = Window Menu -- +-- b = +buffers -- +-- c = +code -- +-- d = +debug -- +-- l = +lsp -- +-- d = +doom -- +-- f = +file -- +-- g = +git -- +-- p = +plugins -- +-- q = +quit/sessions -- +-- s = +search -- +-- t = +tweak -- +-- w = +windows -- +-- o = +open -- +-- j = +jumps -- -- -- -- TAB = Cycle buffers -- -- ESC = Search highlight off -- diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 562f85af2..e3d32446f 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -4,6 +4,7 @@ local utils = require("doom.utils") local config = require("doom.core.config").config +local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled -- Additional options for mappings local opts = { silent = true } @@ -13,15 +14,27 @@ utils.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichK vim.g.mapleader = " " if config.doom.new_file_split then - utils.map( - "n", - "fn", - ":new", - opts, - "Editor", - "new_buffer", - "Open a new unnamed buffer" - ) + if config.doom.vertical_split then + utils.map( + "n", + "fn", + ":vert new", + opts, + "Editor", + "new_buffer_split_vertical", + "Open a new unnamed buffer in a vertical split window" + ) + else + utils.map( + "n", + "fn", + ":new", + opts, + "Editor", + "new_buffer_split", + "Open a new unnamed buffer in a split window" + ) + end else utils.map( "n", @@ -29,8 +42,8 @@ else ":enew", opts, "Editor", - "new_buffer_split", - "Open a new unnamed buffer in a split window" + "new_buffer", + "Open a new unnamed buffer" ) end @@ -81,7 +94,7 @@ utils.map( "Command history" ) --- Buffers +-- buffers utils.map( "n", "bc", @@ -155,7 +168,7 @@ utils.map( "Format buffer" ) --- Doom +-- doom utils.map( "n", "dc", @@ -230,7 +243,7 @@ utils.map( "Display information dashboard" ) --- Plugins +-- plugins utils.map( "n", "ps", @@ -390,6 +403,75 @@ utils.map( "Jump to mark" ) +-- tweak +utils.map( + "n", + "tb", + 'lua require("doom.core.functions").toggle_background()', + opts, + "Tweak", + "toggle_background", + "Toggle background" +) +-- "tc" is reserved for completion on/off +-- "g" as gutter, git, ... (but this tweak is applicable for linter like ALE, too) +utils.map( + "n", + "tg", + 'lua require("doom.core.functions").toggle_signcolumn()', + opts, + "Tweak", + "toggle_signcolumn", + "Toggle signcolumn" +) +utils.map( + "n", + "ti", + 'lua require("doom.core.functions").set_indent()', + opts, + "Tweak", + "set_indent", + "Set tab and indent" +) +utils.map( + "n", + "tn", + 'lua require("doom.core.functions").change_number()', + opts, + "Tweak", + "change_number", + "Change number" +) +if not is_plugin_disabled("autopairs") then + utils.map( + "n", + "tp", + 'lua require("doom.core.functions").toggle_autopairs()', + opts, + "Tweak", + "toggle_autopairs", + "Toggle autopairs" + ) +end +utils.map( + "n", + "ts", + 'lua require("doom.core.functions").toggle_spell()', + opts, + "Tweak", + "toggle_spell", + "Toggle spell" +) +utils.map( + "n", + "tx", + 'lua require("doom.core.functions").change_syntax()', + opts, + "Tweak", + "change_syntax", + "Change syntax" +) + -- windows utils.map("n", "ww", "p", opts, "Window", "other_window", "Goto other window") utils.map("n", "wd", "c", opts, "Window", "close_window", "Close current window") @@ -461,7 +543,7 @@ utils.map( "Restore previously saved session" ) --- toggle +-- open utils.map( "n", "ob", diff --git a/lua/doom/modules/config/doom-whichkey.lua b/lua/doom/modules/config/doom-whichkey.lua index 08ae26870..e622a8a07 100644 --- a/lua/doom/modules/config/doom-whichkey.lua +++ b/lua/doom/modules/config/doom-whichkey.lua @@ -169,6 +169,17 @@ return function() ["h"] = { "Command history" }, ["m"] = { "Jump to mark" }, }, + ["t"] = { + name = "+tweak", + ["b"] = { "background" }, + -- ["c"] = { "completion" }, -- to be implemented XXX FIXME XXX + ["g"] = { "signcolumn" }, -- "g" for gitsigs (also for ale) + ["i"] = { "indent" }, + ["n"] = { "number" }, + -- ["p"] = { "autopairs" }, -- moved below as conditional + ["s"] = { "spell" }, + ["x"] = { "syntax/treesetter" }, + }, ["w"] = { name = "+windows", ["w"] = { "Other window" }, @@ -207,6 +218,9 @@ return function() ["t"] = { "jump to tag" }, }, } - + local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled + if not is_plugin_disabled("autopairs") then + mappings["t"]["p"] = { "autopairs" } + end wk.register(mappings, { prefix = "" }) end From 6f30ad2de66d65190d8df292a01de97aa463e3d1 Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Wed, 29 Sep 2021 16:48:15 +0900 Subject: [PATCH 088/290] tweak: syntax/treesetter Ensure treesetter is available. Signed-off-by: Osamu Aoki --- lua/doom/core/functions/init.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 5bf5b97a7..4e5439234 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -609,24 +609,24 @@ end -- change_syntax() -- tx -- toggle syntax/treesetter M.change_syntax = function() - local parsers = require("nvim-treesitter.parsers") - if parsers and parsers.has_parser() then + local ok, parsers = pcall(require, "nvim-treesitter.parsers") + if ok and parsers and parsers.has_parser() then if vim.o.syntax then vim.cmd("TSBufDisable highlight") vim.cmd("syntax off") - print("syntax off, treesetter off") + print("syntax off, treesetter off") else vim.cmd("TSBufEnable highlight") vim.cmd("syntax on") - print("syntax on, treesetter on") + print("syntax on, treesetter on") end else if vim.o.syntax then vim.cmd("syntax off") - print("syntax off") + print("syntax off") else vim.cmd("syntax on") - print("syntax on") + print("syntax on") end end end From 507f5595a7ff8661526ecd518154fe9e1bbdfa6c Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Wed, 29 Sep 2021 17:37:39 +0900 Subject: [PATCH 089/290] tweak: completion Signed-off-by: Osamu Aoki --- doc/doom_nvim.norg | 2 ++ lua/doom/core/functions/init.lua | 29 +++++++++++++++++++++++ lua/doom/extras/keybindings/leader.lua | 10 +++++++- lua/doom/modules/config/doom-whichkey.lua | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index 4d9003d69..0c0d23fef 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -455,6 +455,8 @@ ├─────────────────────┼────────────────────────────────────────────────────┤ │ t - b │ Toggle background light/dark │ ├─────────────────────┼────────────────────────────────────────────────────┤ + │ t - c │ Turn on and off completion if available │ + ├─────────────────────┼────────────────────────────────────────────────────┤ │ t - g │ Turn on and off signcolumn for gitsigns, ... │ ├─────────────────────┼────────────────────────────────────────────────────┤ │ t - i │ Set tabstop and indent steps to any integer │ diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 4e5439234..a57184252 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -522,6 +522,35 @@ M.toggle_background = function() end end +-- toggle_completion() -- tc -- toggle completion +vim.g.cmp_toggle_flag = true -- initialize +local normal_buftype = function() + return vim.api.nvim_buf_get_option(0, 'buftype') ~= 'prompt' +end +M.toggle_completion = function() + local ok, cmp = pcall(require, "cmp") + if ok then + local next_cmp_toggle_flag = not vim.g.cmp_toggle_flag + if next_cmp_toggle_flag then + print("completion on") + else + print("completion off") + end + cmp.setup { + enabled = function() + vim.g.cmp_toggle_flag = next_cmp_toggle_flag + if next_cmp_toggle_flag then + return normal_buftype + else + return next_cmp_toggle_flag + end + end + } + else + print("completion not available") + end +end + -- toggle_signcolumn() -- tg -- signcolumn auto/no M.toggle_signcolumn = function() local signcolumn = vim.o.signcolumn diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index e3d32446f..90f462f18 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -413,7 +413,15 @@ utils.map( "toggle_background", "Toggle background" ) --- "tc" is reserved for completion on/off +utils.map( + "n", + "tc", + 'lua require("doom.core.functions").toggle_completion()', + opts, + "Tweak", + "toggle_completion", + "Toggle completion" +) -- "g" as gutter, git, ... (but this tweak is applicable for linter like ALE, too) utils.map( "n", diff --git a/lua/doom/modules/config/doom-whichkey.lua b/lua/doom/modules/config/doom-whichkey.lua index e622a8a07..0d260b45c 100644 --- a/lua/doom/modules/config/doom-whichkey.lua +++ b/lua/doom/modules/config/doom-whichkey.lua @@ -172,7 +172,7 @@ return function() ["t"] = { name = "+tweak", ["b"] = { "background" }, - -- ["c"] = { "completion" }, -- to be implemented XXX FIXME XXX + ["c"] = { "completion" }, ["g"] = { "signcolumn" }, -- "g" for gitsigs (also for ale) ["i"] = { "indent" }, ["n"] = { "number" }, From 7ca9451ec55192b335ca57286f76003b470a8138 Mon Sep 17 00:00:00 2001 From: Osamu Aoki Date: Thu, 30 Sep 2021 01:13:28 +0900 Subject: [PATCH 090/290] doc: more in doom_nvim.norg Let's be clear on some shortcomings while being positive. Signed-off-by: Osamu Aoki --- doc/doom_nvim.norg | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index 0c0d23fef..1b6bc804a 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -56,6 +56,7 @@ ** Moving around Doom Nvim uses the default Neovim keybindings to move around: `k, j, k, l` and the cursor keys. + If you are in the insert mode, you must type `Esc`-key first to change into the normal mode. Use `h` to go left, `j` to go down, `k` to go up and `l` to go right. See `:Tutor` to know how to use Neovim and its keybindings. @@ -64,6 +65,11 @@ the key `g` to select a buffer or press `TAB` to cycle buffers. ** Configuration + Doom Nvim offers easy access to the dynamic reconfiguration of some key editor featurs, such as + console background to be dark or light, auto-completion to be on or off, autopairs to be on or + off, indentation step width, line number display style, spell checker to be on or off, and more. + For these, press `SPC - t` and select the desired configuration item by another key stroke. + The Doom Nvim configuration files resides under the `$HOME/.config/nvim` directory by default. See [Hacking Doom Nvim](**Hacking Doom Nvim) for more information. @@ -82,9 +88,9 @@ You can see in a more detailed view the modules and its plugins at [modules.md](https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/modules.md). **** Tweaking modules - For tweaking a module (enable / disable its plugins) you will only need to - comment or uncomment the desired plugin, e.g. for disabling the tree explorer - you will only need to comment it. + For persistently tweaking a module (enable / disable its plugins) you will only need to + comment or uncomment the desired plugin, e.g. for disabling the tree explorer you will only + need to comment it. @code lua -- Right now the Tree explorer is enabled @@ -559,7 +565,8 @@ - which-key keybindings: `lua/doom/modules/config/doom-whichkey.lua` *NOTE*: You can also make your own keybindings or override the default ones - by editing your `doom_config.lua` file. + by editing your `doom_config.lua` file. If you override, you need to update which-key + keybindings to make it work properly. This is known issue. ** Hacking Doom Nvim Doom Nvim aims to be hackable to suit everyone's needs. Therefore this is the structure of Doom Nvim: @@ -611,6 +618,13 @@ lua is not available in neovim 0.4.4 and below, it is not possible to use Doom Nvim with a neovim version lower than 0.5.0. + ** Workaround + *** Missing nvim help documentation + Since Doom Nvim extensively uses delayed loading of packages, their help documentation may not + show up under `LOCAL ADDITIONS:`. If this happens and you still wish to see them, you need to + make copies or symlinks of the help documentation of the affected packages in `doc/` of Doom + Nvim and update help tags file manually with `:helptags ALL` . + * Acknowledgements Doom Nvim would not have been possible had it not been for - hlissner, creator of Doom Emacs From 7c123b065dd323017a67c14d8cf693c8141ee766 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 30 Sep 2021 21:10:26 +0000 Subject: [PATCH 091/290] chore: format source code --- lua/doom/core/functions/init.lua | 32 +++++++++++++++----------- lua/doom/extras/keybindings/leader.lua | 14 +++++------ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index a57184252..fcaca0ac9 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -502,7 +502,9 @@ M.edit_config = function() elseif selected_config == 2 then vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source)) elseif selected_config == 3 then - vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.userplugins").source)) + vim.cmd( + ("%s%s %s"):format(direction, open_command, require("doom.core.config.userplugins").source) + ) elseif selected_config ~= 0 then log.error("Invalid option selected.") end @@ -513,7 +515,7 @@ end -- toggle_background() -- tb -- toggle background light/dark M.toggle_background = function() local background = vim.go.background - if background == "light" then + if background == "light" then vim.go.background = "dark" print("background=dark") else @@ -525,7 +527,7 @@ end -- toggle_completion() -- tc -- toggle completion vim.g.cmp_toggle_flag = true -- initialize local normal_buftype = function() - return vim.api.nvim_buf_get_option(0, 'buftype') ~= 'prompt' + return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt" end M.toggle_completion = function() local ok, cmp = pcall(require, "cmp") @@ -536,16 +538,16 @@ M.toggle_completion = function() else print("completion off") end - cmp.setup { + cmp.setup({ enabled = function() - vim.g.cmp_toggle_flag = next_cmp_toggle_flag + vim.g.cmp_toggle_flag = next_cmp_toggle_flag if next_cmp_toggle_flag then - return normal_buftype - else - return next_cmp_toggle_flag - end - end - } + return normal_buftype + else + return next_cmp_toggle_flag + end + end, + }) else print("completion not available") end @@ -554,7 +556,7 @@ end -- toggle_signcolumn() -- tg -- signcolumn auto/no M.toggle_signcolumn = function() local signcolumn = vim.o.signcolumn - if signcolumn == "no" then + if signcolumn == "no" then vim.o.signcolumn = "auto" print("signcolumn=auto") else @@ -565,7 +567,11 @@ end -- set_indent() -- ti -- set the indent and tab related numbers M.set_indent = function() - local indent = tonumber(vim.fn.input("Set all tab related options to a specified number and set expandtab\n(0 to reset to vim defaults, ? to print current settings): ")) + local indent = tonumber( + vim.fn.input( + "Set all tab related options to a specified number and set expandtab\n(0 to reset to vim defaults, ? to print current settings): " + ) + ) if (indent == nil) or (indent < 0) then vim.cmd("set softtabstop? tabstop? shiftwidth? expandtab?") elseif indent > 0 then diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 90f462f18..afa95cd2d 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -452,13 +452,13 @@ utils.map( ) if not is_plugin_disabled("autopairs") then utils.map( - "n", - "tp", - 'lua require("doom.core.functions").toggle_autopairs()', - opts, - "Tweak", - "toggle_autopairs", - "Toggle autopairs" + "n", + "tp", + 'lua require("doom.core.functions").toggle_autopairs()', + opts, + "Tweak", + "toggle_autopairs", + "Toggle autopairs" ) end utils.map( From 0b234713ba88954c8f2a9fffa6f0b92d995b4148 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 17:19:33 -0400 Subject: [PATCH 092/290] fix(info): do not display file encoding on special buffers like dashboard --- lua/doom/modules/built-in/info/init.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index d39a2ad9a..0bb15930b 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -296,13 +296,19 @@ local function get_buffer_info() padding_level[3], vim.api.nvim_buf_get_option(curr_buffer, "fileformat"):upper() ), - string.format( - "%s• %s: %s%s", - padding_level[2], - "File encoding", - padding_level[2], - vim.api.nvim_buf_get_option(curr_buffer, "fileencoding"):upper() - ), + }) + if vim.api.nvim_buf_get_option(curr_buffer, "fileencoding"):len() > 0 then + vim.list_extend(buffer_info, { + string.format( + "%s• %s: %s%s", + padding_level[2], + "File encoding", + padding_level[2], + vim.api.nvim_buf_get_option(curr_buffer, "fileencoding"):upper() + ), + }) + end + vim.list_extend(buffer_info, { string.format( "%s• %s: %s", padding_level[2], From d07ba2778b8a0205de0ce9b13864525c7d489bca Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 18:42:00 -0400 Subject: [PATCH 093/290] feat(doom-one): pull upstream changes --- lua/colors/doom-one/init.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua index 6a9841e48..a440252d3 100644 --- a/lua/colors/doom-one/init.lua +++ b/lua/colors/doom-one/init.lua @@ -774,15 +774,15 @@ apply_highlight(illuminated) -- LSP {{{ local msg_underline = { - ErrorMsgUnderline = { fg = red, gui = 'undercurl' }, - WarningMsgUnderline = { fg = yellow, gui = 'undercurl' }, - MoreMsgUnderline = { fg = blue, gui = 'undercurl' }, - MsgUnderline = { fg = green, gui = 'undercurl' }, + ErrorMsgUnderline = { fg = red, gui = 'underline' }, + WarningMsgUnderline = { fg = yellow, gui = 'underline' }, + MoreMsgUnderline = { fg = blue, gui = 'underline' }, + MsgUnderline = { fg = green, gui = 'underline' }, } apply_highlight(msg_underline) high_link('LspDiagnosticsFloatingError', 'ErrorMsg') -high_link('LspDiagnosticsFloatingWarning', 'Warning') +high_link('LspDiagnosticsFloatingWarning', 'WarningMsg') high_link('LspDiagnosticsFloatingInformation', 'MoreMsg') high_link('LspDiagnosticsFloatingHint', 'Msg') high_link('LspDiagnosticsDefaultError', 'ErrorMsg') @@ -802,7 +802,7 @@ high_link('LspDiagnosticsSignWarning', 'WarningMsg') high_link('LspDiagnosticsSignInformation', 'MoreMsg') high_link('LspDiagnosticsSignHint', 'Msg') high_link('DiagnosticFloatingError', 'ErrorMsg') -high_link('DiagnosticFloatingWarn', 'Warning') +high_link('DiagnosticFloatingWarn', 'WarningMsg') high_link('DiagnosticFloatingInfo', 'MoreMsg') high_link('DiagnosticFloatingHint', 'Msg') high_link('DiagnosticDefaultError', 'ErrorMsg') @@ -851,8 +851,8 @@ high_link('ProviderTruncateLine', 'Normal') high_link('LspSagaFinderSelection', 'Search') high_link('DiagnosticTruncateLine', 'Normal') high_link('DiagnosticError', 'LspDiagnosticsDefaultError') -high_link('DiagnosticWarning', 'LspDiagnosticsDefaultWarning') -high_link('DiagnosticInformation', 'LspDiagnosticsDefaultInformation') +high_link('DiagnosticWarn', 'LspDiagnosticsDefaultWarning') +high_link('DiagnosticInfo', 'LspDiagnosticsDefaultInformation') high_link('DiagnosticHint', 'LspDiagnosticsDefaultHint') high_link('DefinitionPreviewTitle', 'Title') high_link('LspSagaShTruncateLine', 'Normal') @@ -919,8 +919,8 @@ if vim.g.doom_one_enable_treesitter then high_link('TSTagDelimiter', 'Delimiter') high_link('TSStrong', 'Bold') high_link('TSURI', 'URL') - high_link('TSWarning', 'Warning') - high_link('TSDanger', 'Error') + high_link('TSWarning', 'WarningMsg') + high_link('TSDanger', 'ErrorMsg') high_link('TSType', 'Type') high_link('TSTypeBuiltin', 'TypeBuiltin') high_link('TSVariable', 'None') From ee6a6f0a5cf4307ddbf22836ae84562d567aa95e Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 19:10:32 -0400 Subject: [PATCH 094/290] fix(ui): properly fallback to doom-one, better log message --- lua/doom/core/config/ui.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua index d8118c3e0..b80d7a350 100644 --- a/lua/doom/core/config/ui.lua +++ b/lua/doom/core/config/ui.lua @@ -18,8 +18,8 @@ if not utils.is_empty(config.doom.colorscheme) then end) if not loaded_colorscheme then - log.error("Colorscheme not found, falling to doom-one") - vim.api.nvim_command("colorscheme " .. config.doom.colorscheme) + log.warn("Colorscheme '" .. config.doom.colorscheme .. "' not found, falling to doom-one") + vim.api.nvim_command("colorscheme doom-one") end else log.warn("Forced default Doom colorscheme") From 5bf3a29bcd1861793212bfd252666b0ee7bbc26a Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 19:34:01 -0400 Subject: [PATCH 095/290] feat(modules): do not lazy-load `nvim-mapper`, closes #145 - Update `nvim-mapper` configurations, execute keybind on enter - Lazy-load aniseed --- lua/doom/modules/init.lua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index f1b32e4b8..d48a33ca3 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -56,7 +56,6 @@ packer.startup(function(use) }) use({ "JoosepAlviste/nvim-ts-context-commentstring", - requires = { "Olical/aniseed" }, after = "nvim-treesitter", }) use({ @@ -68,6 +67,12 @@ packer.startup(function(use) after = "nvim-treesitter", }) + -- Aniseed, required by some treesitter modules + use({ + "Olical/aniseed", + module_pattern = "aniseed", + }) + -- Neorg local disabled_neorg = is_plugin_disabled("neorg") use({ @@ -272,12 +277,17 @@ packer.startup(function(use) local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep require("nvim-mapper").setup({ -- do not assign the default keymap (MM) - no_map = false, - -- default config search path is ~/.config/nvim/lua + no_map = true, + -- where should ripgrep look for your keybinds definitions. + -- Default config search path is ~/.config/nvim/lua search_path = string.format("%s%slua", doom_root, sep), + -- what should be done with the selected keybind when pressing enter. + -- Available actions: + -- * "definition" - Go to keybind definition (default) + -- * "execute" - Execute the keybind command + action_on_enter = "execute", }) end, - module = "nvim-mapper", disable = disabled_telescope, }) From 3075cbef5bc4bb0fcad251d46e4b1ff79a29c0be Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 19:35:41 -0400 Subject: [PATCH 096/290] chore: bump doom version to `3.2.0-beta2` --- lua/doom/utils/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 5e1dbbc2a..c879894d9 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -9,7 +9,7 @@ local system = require("doom.core.system") -------------------- HELPERS -------------------- -- Doom Nvim version -M.doom_version = "3.2.0-beta1" +M.doom_version = "3.2.0-beta2" -- file_exists checks if the given file exists -- @tparam string path The path to the file From eeae618e339dffc0b5a633678f6a4148de5c3589 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 20:14:16 -0400 Subject: [PATCH 097/290] feat: fragment utilities module - `fs`, filesystem utilities - `mappings`, mappings utilities - `modules`, Lua modules utilities NOTE: core utilities like `has_value` and `create_augroups` are still in main utils module --- init.lua | 2 +- lua/doom/core/functions/init.lua | 28 +-- lua/doom/extras/init.lua | 2 +- lua/doom/extras/keybindings/completion.lua | 30 +-- lua/doom/extras/keybindings/core.lua | 30 +-- lua/doom/extras/keybindings/leader.lua | 208 ++++++++++---------- lua/doom/extras/keybindings/movement.lua | 40 ++-- lua/doom/modules/config/doom-luasnip.lua | 14 +- lua/doom/utils/fs.lua | 50 +++++ lua/doom/utils/init.lua | 210 ++------------------- lua/doom/utils/mappings.lua | 112 +++++++++++ lua/doom/utils/modules.lua | 55 ++++++ 12 files changed, 413 insertions(+), 368 deletions(-) create mode 100644 lua/doom/utils/fs.lua create mode 100644 lua/doom/utils/mappings.lua create mode 100644 lua/doom/utils/modules.lua diff --git a/init.lua b/init.lua index 69e575adc..40cef49d1 100644 --- a/init.lua +++ b/init.lua @@ -10,7 +10,7 @@ vim.g.start_time = vim.fn.reltime() -- Lua modules loader, when loading our modules with this -- we avoid breaking all the configuration if something fails -local load_modules = require("doom.utils").load_modules +local load_modules = require("doom.utils.modules").load_modules -- Disable some unused built-in Neovim plugins vim.g.loaded_gzip = false diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index fcaca0ac9..39f70ac87 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -5,7 +5,7 @@ ---[[---------------------------------------]]--- local log = require("doom.extras.logging") -local utils = require("doom.utils") +local utils, fs = require("doom.utils"), require("doom.utils.fs") local system = require("doom.core.system") local config = require("doom.core.config").config @@ -111,23 +111,23 @@ M.change_colors_and_bg = function() local doom_config_path = require("doom.core.config").source if target_colorscheme ~= config.doom.colorscheme then - local doom_config = utils.read_file(doom_config_path) + local doom_config = fs.read_file(doom_config_path) doom_config = string.gsub( doom_config, string.format('"%s"', config.doom.colorscheme:gsub("[%-]", "%%%1")), string.format('"%s"', target_colorscheme:gsub("[%-]", "%%%1")) ) - utils.write_file(doom_config_path, doom_config, "w+") + fs.write_file(doom_config_path, doom_config, "w+") log.debug("Colorscheme successfully changed to " .. target_colorscheme) end if target_background ~= config.doom.colorscheme_bg then - local doom_config = utils.read_file(doom_config_path) + local doom_config = fs.read_file(doom_config_path) doom_config = string.gsub( doom_config, string.format('"%s"', config.doom.colorscheme_bg), string.format('"%s"', target_background) ) - utils.write_file(doom_config_path, doom_config, "w+") + fs.write_file(doom_config_path, doom_config, "w+") log.debug("Background successfully changed to " .. target_background) end end) @@ -174,7 +174,7 @@ M.open_docs = function() -- Get the documentation path local docs_path - if utils.file_exists(string.format("%s/doc/doom_nvim.norg", system.doom_root)) then + if fs.file_exists(string.format("%s/doc/doom_nvim.norg", system.doom_root)) then docs_path = string.format("%s/doc/doom_nvim.norg", system.doom_root) else docs_path = string.format("%s/doc/doom_nvim.norg", system.doom_configs_root) @@ -210,7 +210,7 @@ M.create_report = function() local created_report, err = pcall(function() -- Get and save only the warning and error logs from today local today_logs = {} - local doom_logs = vim.split(utils.read_file(system.doom_logs), "\n") + local doom_logs = vim.split(fs.read_file(system.doom_logs), "\n") for _, doom_log in ipairs(doom_logs) do if string.find(doom_log, "ERROR " .. log_date_format) @@ -276,7 +276,7 @@ M.create_report = function() system.doom_configs_root, table.concat(today_logs, "\n") ) - utils.write_file(system.doom_report, report, "w+") + fs.write_file(system.doom_report, report, "w+") log.info("Report created at " .. system.doom_report) end) @@ -320,23 +320,23 @@ local function save_backup_hashes() -- -- If the database does not exist yet then we will create it if vim.fn.filereadable(releases_database_path) == 1 then - local current_releases = utils.read_file(releases_database_path) + local current_releases = fs.read_file(releases_database_path) if current_releases ~= doom_releases then -- Write the first release in the list with 'w+' so the -- actual content will be overwritten by this one - utils.write_file(releases_database_path, sorted_releases[1] .. "\n", "w+") + fs.write_file(releases_database_path, sorted_releases[1] .. "\n", "w+") -- Write the rest of the releases for idx, release in ipairs(sorted_releases) do -- Exclude the first release because we have already -- written it in the database file if idx ~= 1 then - utils.write_file(releases_database_path, release .. "\n", "a+") + fs.write_file(releases_database_path, release .. "\n", "a+") end end end else for _, release in ipairs(sorted_releases) do - utils.write_file(releases_database_path, release .. "\n", "a+") + fs.write_file(releases_database_path, release .. "\n", "a+") end end end) @@ -393,7 +393,7 @@ M.rollback_doom = function() -- Check if there's a rollback file and sets the rollback type if vim.fn.filereadable(releases_database_path) == 1 then -- Get the releases database and split it into a table - local doom_releases = utils.read_file(releases_database_path) + local doom_releases = fs.read_file(releases_database_path) -- Put all the releases into a table so we can sort them later local releases = {} @@ -468,7 +468,7 @@ M.rollback_doom = function() .. "), please restart" ) elseif vim.fn.filereadable(rolling_backup) == 1 then - local backup_commit = utils.read_file(rolling_backup):gsub("[\r\n]+", "") + local backup_commit = fs.read_file(rolling_backup):gsub("[\r\n]+", "") log.info("Reverting back to commit " .. backup_commit .. " ...") local rolled_back, rolled_err = pcall(function() os.execute(system.git_workspace .. "checkout " .. backup_commit) diff --git a/lua/doom/extras/init.lua b/lua/doom/extras/init.lua index a495dcc53..34a65189e 100644 --- a/lua/doom/extras/init.lua +++ b/lua/doom/extras/init.lua @@ -4,7 +4,7 @@ require("doom.extras.logging").debug("Loading Doom extras ...") -require("doom.utils").load_modules("doom.extras", { +require("doom.utils.modules").load_modules("doom.extras", { "autocmds", "keybindings", }) diff --git a/lua/doom/extras/keybindings/completion.lua b/lua/doom/extras/keybindings/completion.lua index 890076d7f..fa9268a37 100644 --- a/lua/doom/extras/keybindings/completion.lua +++ b/lua/doom/extras/keybindings/completion.lua @@ -2,14 +2,14 @@ -- LSP Keybindings -- ---]]-----------------[[--- -local utils = require("doom.utils") +local mappings = require("doom.utils.mappings") local check_plugin = require("doom.core.functions").check_plugin local opts = { silent = true } local lsp_opts = vim.tbl_extend("force", opts, { expr = true }) -- gd: jump to definition -utils.map( +mappings.map( "n", "gd", ":lua vim.lsp.buf.definition()", @@ -19,7 +19,7 @@ utils.map( "Jump to definition" ) -- gr: go to reference -utils.map( +mappings.map( "n", "gr", ":lua vim.lsp.buf.references()", @@ -29,7 +29,7 @@ utils.map( "Goto reference" ) -- gi: buf implementation -utils.map( +mappings.map( "n", "gi", ":lua vim.lsp.buf.implementation()", @@ -39,7 +39,7 @@ utils.map( "List implementations" ) -- ca: code actions -utils.map( +mappings.map( "n", "ca", ":lua vim.lsp.buf.code_action()", @@ -49,9 +49,9 @@ utils.map( "Code action" ) -- K: hover doc -utils.map("n", "K", ":lua vim.lsp.buf.hover()", opts, "LSP", "hover_doc", "Hover documentation") +mappings.map("n", "K", ":lua vim.lsp.buf.hover()", opts, "LSP", "hover_doc", "Hover documentation") -- Control+p: Jump to previous diagnostic -utils.map( +mappings.map( "n", "", ":lua vim.lsp.diagnostic.goto_prev()", @@ -61,7 +61,7 @@ utils.map( "Jump to previous diagnostic" ) -- Control+n: Jump to next diagnostic -utils.map( +mappings.map( "n", "", ":lua vim.lsp.diagnostic.goto_next()", @@ -74,8 +74,8 @@ utils.map( vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') -- LuaSnip mappings -if check_plugin("LuaSnip", "start") then - utils.map( +if check_plugin("LuaSnip", "opt") then + mappings.map( "n", "", 'luasnip#expand_or_jumpable() ? "luasnip-expand-or-jump" : ""', @@ -84,7 +84,7 @@ if check_plugin("LuaSnip", "start") then "luasnip_expand", "Expand snippet" ) - utils.map( + mappings.map( "i", "", 'lua require("luasnip").jump(-1)', @@ -94,7 +94,7 @@ if check_plugin("LuaSnip", "start") then "Previous snippet" ) - utils.map( + mappings.map( "s", "", 'lua require("luasnip").jump(1)', @@ -103,7 +103,7 @@ if check_plugin("LuaSnip", "start") then "luasnip_next_sel", "Next snippet" ) - utils.map( + mappings.map( "s", "", 'lua require("luasnip").jump(-1)', @@ -113,7 +113,7 @@ if check_plugin("LuaSnip", "start") then "Previous snippet (Select mode)" ) - utils.map( + mappings.map( "i", "", 'luasnip#choice_active() ? "luasnip-next-choice" : ""', @@ -122,7 +122,7 @@ if check_plugin("LuaSnip", "start") then "luasnip_next_choice", "Next snippets field" ) - utils.map( + mappings.map( "s", "", 'luasnip#choice_active() ? "luasnip-next-choice" : ""', diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua index 3975352a1..c61d18db7 100644 --- a/lua/doom/extras/keybindings/core.lua +++ b/lua/doom/extras/keybindings/core.lua @@ -1,4 +1,4 @@ -local utils = require("doom.utils") +local mappings = require("doom.utils.mappings") local config = require("doom.core.config").config local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled @@ -6,7 +6,7 @@ local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled local opts = { silent = true } -- Fast exit from Doom Nvim -utils.map( +mappings.map( "n", "ZZ", 'lua require("doom.core.functions").quit_doom(true, true)', @@ -17,41 +17,41 @@ utils.map( ) -- ESC to turn off search highlighting -utils.map("n", "", ":noh", opts, "Editor", "no_highlight", "Turn off search highlighting") +mappings.map("n", "", ":noh", opts, "Editor", "no_highlight", "Turn off search highlighting") ---[[-----------------]]--- -- Disable keys -- ---]]-----------------[[--- -- Disable accidentally pressing ctrl-z and suspending -utils.map("n", "", "", opts, "Editor", "disable_suspending", "Disable suspending") +mappings.map("n", "", "", opts, "Editor", "disable_suspending", "Disable suspending") -- Disable ex mode -utils.map("n", "Q", "", opts, "Editor", "disable_ex", "Disable ex mode") +mappings.map("n", "Q", "", opts, "Editor", "disable_ex", "Disable ex mode") -- Disable recording macros if config.doom.disable_macros then - utils.map("n", "q", "", opts, "Editor", "disable_macros", "Disable macros") + mappings.map("n", "q", "", opts, "Editor", "disable_macros", "Disable macros") end ---[[-----------------]]--- -- Escape Remaps -- ---]]-----------------[[--- -utils.map("i", "jk", "", opts, "Editor", "exit_insert", "Exit insert mode") -utils.map("i", "kj", "", opts, "Editor", "exit_insert_alt", "Exit insert mode") +mappings.map("i", "jk", "", opts, "Editor", "exit_insert", "Exit insert mode") +mappings.map("i", "kj", "", opts, "Editor", "exit_insert_alt", "Exit insert mode") ---[[-----------------]]--- -- Make inclusive -- ---]]-----------------[[--- -- BUG: my nvim freezes from this when which key shows up -- NOTE: IMO inclusive is better --- utils.map("o", "T", "vT", opts, "Editor", "occurence_backw_inclusive", "Backwards occurence inclusive") --- utils.map("o", "F", "vF", opts, "Editor", "occurence_backw_till_inclusive", "Backwards occurence till inclusive") +-- mappings.map("o", "T", "vT", opts, "Editor", "occurence_backw_inclusive", "Backwards occurence inclusive") +-- mappings.map("o", "F", "vF", opts, "Editor", "occurence_backw_till_inclusive", "Backwards occurence till inclusive") ---[[------------------]]--- -- F keybindings -- ---]]------------------[[--- if not is_plugin_disabled("symbols") then - utils.map( + mappings.map( "n", "", ":SymbolsOutline", @@ -62,10 +62,10 @@ if not is_plugin_disabled("symbols") then ) end if not is_plugin_disabled("explorer") then - utils.map("n", "", ":NvimTreeToggle", opts, "Editor", "open_tree", "Toggle file explorer") + mappings.map("n", "", ":NvimTreeToggle", opts, "Editor", "open_tree", "Toggle file explorer") end if not is_plugin_disabled("minimap") then - utils.map( + mappings.map( "n", "", ":MinimapToggle", @@ -76,10 +76,10 @@ if not is_plugin_disabled("minimap") then ) end if not is_plugin_disabled("zen") then - utils.map("n", "", ":TZAtaraxis", opts, "Editor", "open_zen", "Toggle Zen mode") + mappings.map("n", "", ":TZAtaraxis", opts, "Editor", "open_zen", "Toggle Zen mode") end if not is_plugin_disabled("restclient") then - utils.map( + mappings.map( "n", "", ":RestNvim", diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index afa95cd2d..4fa0fc300 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -2,7 +2,7 @@ -- WhichKey binds -- ---]]-----------------[[--- -local utils = require("doom.utils") +local mappings = require("doom.utils.mappings") local config = require("doom.core.config").config local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled @@ -10,12 +10,12 @@ local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled local opts = { silent = true } -- Set Space key as leader -utils.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu") +mappings.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu") vim.g.mapleader = " " if config.doom.new_file_split then if config.doom.vertical_split then - utils.map( + mappings.map( "n", "fn", ":vert new", @@ -25,7 +25,7 @@ if config.doom.new_file_split then "Open a new unnamed buffer in a vertical split window" ) else - utils.map( + mappings.map( "n", "fn", ":new", @@ -36,7 +36,7 @@ if config.doom.new_file_split then ) end else - utils.map( + mappings.map( "n", "fn", ":enew", @@ -48,7 +48,7 @@ else end -- Misc -utils.map( +mappings.map( "n", "`", "Telescope find_files", @@ -57,7 +57,7 @@ utils.map( "find_files", "Find file" ) -utils.map( +mappings.map( "n", ".", "Telescope file_browser", @@ -66,7 +66,7 @@ utils.map( "file_browser", "Browse files" ) -utils.map( +mappings.map( "n", ",", "Telescope buffers show_all_buffers=true", @@ -75,7 +75,7 @@ utils.map( "switch_buffers", "Switch buffers" ) -utils.map( +mappings.map( "n", "/", "Telescope live_grep", @@ -84,7 +84,7 @@ utils.map( "live_grep", "Search a word" ) -utils.map( +mappings.map( "n", ":", "Telescope command_history", @@ -95,7 +95,7 @@ utils.map( ) -- buffers -utils.map( +mappings.map( "n", "bc", 'lua require("bufferline").handle_close_buffer(vim.fn.bufnr("%"))', @@ -104,7 +104,7 @@ utils.map( "close_current_buffer", "Close current buffer" ) -utils.map( +mappings.map( "n", "bb", "e #", @@ -113,7 +113,7 @@ utils.map( "switch_buffer", "Switch to other buffer" ) -utils.map( +mappings.map( "n", "b]", 'lua require("bufferline").cycle(1)', @@ -122,7 +122,7 @@ utils.map( "next_buffer_alt", "Goto next buffer" ) -utils.map( +mappings.map( "n", "bn", 'lua require("bufferline").cycle(1)', @@ -131,7 +131,7 @@ utils.map( "next_buffer", "Goto next buffer" ) -utils.map( +mappings.map( "n", "bg", 'lua require("bufferline").pick_buffer()', @@ -140,7 +140,7 @@ utils.map( "goto_buffer", "Goto buffer" ) -utils.map( +mappings.map( "n", "b[", 'lua require("bufferline").cycle(-1)', @@ -149,7 +149,7 @@ utils.map( "prev_buffer_alt", "Goto previous buffer" ) -utils.map( +mappings.map( "n", "bp", 'lua require("bufferline").cycle(-1)', @@ -158,7 +158,7 @@ utils.map( "prev_buffer", "Goto previous buffer" ) -utils.map( +mappings.map( "n", "bf", "FormatWrite", @@ -169,7 +169,7 @@ utils.map( ) -- doom -utils.map( +mappings.map( "n", "dc", "DoomConfigs", @@ -178,7 +178,7 @@ utils.map( "edit_doom_config", "Edit Doom configuration" ) -utils.map( +mappings.map( "n", "dd", "DoomManual", @@ -187,8 +187,8 @@ utils.map( "help_doom", "Open Doom user manual" ) -utils.map("n", "du", "DoomUpdate", opts, "Doom", "update_doom", "Update Doom Nvim") -utils.map( +mappings.map("n", "du", "DoomUpdate", opts, "Doom", "update_doom", "Update Doom Nvim") +mappings.map( "n", "dr", "DoomRollback", @@ -197,7 +197,7 @@ utils.map( "rollback_doom", "Rollback Doom Nvim version" ) -utils.map( +mappings.map( "n", "dR", "DoomReport", @@ -206,7 +206,7 @@ utils.map( "create_crash_report", "Create crash report" ) -utils.map( +mappings.map( "n", "ds", "lua require('telescope.builtin.internal').colorscheme({enable_preview = true})", @@ -215,7 +215,7 @@ utils.map( "change_colorscheme", "Change colorscheme" ) -utils.map( +mappings.map( "n", "db", "Telescope mapper", @@ -224,7 +224,7 @@ utils.map( "show_keybindings", "Show Doom keybindings" ) -utils.map( +mappings.map( "n", "dl", "DoomConfigsReload", @@ -233,7 +233,7 @@ utils.map( "reload_user_settings", "Reload user custom settings" ) -utils.map( +mappings.map( "n", "di", "DoomInfo", @@ -244,7 +244,7 @@ utils.map( ) -- plugins -utils.map( +mappings.map( "n", "ps", "PackerSync", @@ -253,7 +253,7 @@ utils.map( "packer_sync", "Synchronize your plugins" ) -utils.map( +mappings.map( "n", "pi", "PackerInstall", @@ -262,7 +262,7 @@ utils.map( "packer_install", "Install missing plugins" ) -utils.map( +mappings.map( "n", "pc", "PackerClean", @@ -271,7 +271,7 @@ utils.map( "packer_clean", "Clean unused plugins" ) -utils.map( +mappings.map( "n", "pC", "PackerCompile", @@ -280,7 +280,7 @@ utils.map( "packer_compile", "Compile your plugins changes" ) -utils.map( +mappings.map( "n", "pS", "PackerStatus", @@ -289,7 +289,7 @@ utils.map( "packer_status", "Plugins status" ) -utils.map( +mappings.map( "n", "pp", "PackerProfile", @@ -300,7 +300,7 @@ utils.map( ) -- files -utils.map( +mappings.map( "n", "fc", "e $MYVIMRC", @@ -309,7 +309,7 @@ utils.map( "edit_vimrc", "Edit your Neovim rc" ) -utils.map( +mappings.map( "n", "ff", "Telescope find_files", @@ -319,7 +319,7 @@ utils.map( "Find files" ) -utils.map( +mappings.map( "n", "fr", "Telescope oldfiles", @@ -328,7 +328,7 @@ utils.map( "recent_files", "Recently opened files" ) -utils.map( +mappings.map( "n", "ft", "Telescope help_tags", @@ -337,7 +337,7 @@ utils.map( "help_tags", "Help tags" ) -utils.map( +mappings.map( "n", "fR", "SudaRead", @@ -346,7 +346,7 @@ utils.map( "read_sudo", "Re-open file with sudo permissions" ) -utils.map( +mappings.map( "n", "fw", "SudaWrite", @@ -357,7 +357,7 @@ utils.map( ) -- search -utils.map( +mappings.map( "n", "sg", "Telescope live_grep", @@ -366,7 +366,7 @@ utils.map( "live_grep_alt", "Search a word" ) -utils.map( +mappings.map( "n", "sb", "Telescope current_buffer_fuzzy_find", @@ -375,7 +375,7 @@ utils.map( "fzf", "Search in buffer" ) -utils.map( +mappings.map( "n", "ss", "Telescope lsp_document_symbols", @@ -384,7 +384,7 @@ utils.map( "lsp_symbols", "Goto symbol" ) -utils.map( +mappings.map( "n", "sh", "Telescope command_history", @@ -393,7 +393,7 @@ utils.map( "command_history_alt", "Command history" ) -utils.map( +mappings.map( "n", "sm", "Telescope marks", @@ -404,7 +404,7 @@ utils.map( ) -- tweak -utils.map( +mappings.map( "n", "tb", 'lua require("doom.core.functions").toggle_background()', @@ -413,7 +413,7 @@ utils.map( "toggle_background", "Toggle background" ) -utils.map( +mappings.map( "n", "tc", 'lua require("doom.core.functions").toggle_completion()', @@ -423,7 +423,7 @@ utils.map( "Toggle completion" ) -- "g" as gutter, git, ... (but this tweak is applicable for linter like ALE, too) -utils.map( +mappings.map( "n", "tg", 'lua require("doom.core.functions").toggle_signcolumn()', @@ -432,7 +432,7 @@ utils.map( "toggle_signcolumn", "Toggle signcolumn" ) -utils.map( +mappings.map( "n", "ti", 'lua require("doom.core.functions").set_indent()', @@ -441,7 +441,7 @@ utils.map( "set_indent", "Set tab and indent" ) -utils.map( +mappings.map( "n", "tn", 'lua require("doom.core.functions").change_number()', @@ -451,7 +451,7 @@ utils.map( "Change number" ) if not is_plugin_disabled("autopairs") then - utils.map( + mappings.map( "n", "tp", 'lua require("doom.core.functions").toggle_autopairs()', @@ -461,7 +461,7 @@ if not is_plugin_disabled("autopairs") then "Toggle autopairs" ) end -utils.map( +mappings.map( "n", "ts", 'lua require("doom.core.functions").toggle_spell()', @@ -470,7 +470,7 @@ utils.map( "toggle_spell", "Toggle spell" ) -utils.map( +mappings.map( "n", "tx", 'lua require("doom.core.functions").change_syntax()', @@ -481,17 +481,17 @@ utils.map( ) -- windows -utils.map("n", "ww", "p", opts, "Window", "other_window", "Goto other window") -utils.map("n", "wd", "c", opts, "Window", "close_window", "Close current window") -utils.map("n", "w-", "s", opts, "Window", "split_below", "Split window below") -utils.map("n", "w|", "v", opts, "Window", "split_right", "Split window right") -utils.map("n", "w2", "v", opts, "Window", "double_layout", "Layout double columns") -utils.map("n", "wh", "h", opts, "Window", "window_left", "Window left") -utils.map("n", "wj", "j", opts, "Window", "window_below", "Window below") -utils.map("n", "wl", "l", opts, "Window", "window_right", "Window right") -utils.map("n", "wk", "k", opts, "Window", "window_up", "Window up") -utils.map("n", "wH", "5<", opts, "Window", "expand_window_left", "Expand window left") -utils.map( +mappings.map("n", "ww", "p", opts, "Window", "other_window", "Goto other window") +mappings.map("n", "wd", "c", opts, "Window", "close_window", "Close current window") +mappings.map("n", "w-", "s", opts, "Window", "split_below", "Split window below") +mappings.map("n", "w|", "v", opts, "Window", "split_right", "Split window right") +mappings.map("n", "w2", "v", opts, "Window", "double_layout", "Layout double columns") +mappings.map("n", "wh", "h", opts, "Window", "window_left", "Window left") +mappings.map("n", "wj", "j", opts, "Window", "window_below", "Window below") +mappings.map("n", "wl", "l", opts, "Window", "window_right", "Window right") +mappings.map("n", "wk", "k", opts, "Window", "window_up", "Window up") +mappings.map("n", "wH", "5<", opts, "Window", "expand_window_left", "Expand window left") +mappings.map( "n", "wJ", "resize +5", @@ -500,7 +500,7 @@ utils.map( "expand_window_below", "Expand window below" ) -utils.map( +mappings.map( "n", "wL", "5>", @@ -509,7 +509,7 @@ utils.map( "expand_window_right", "Expand window right" ) -utils.map( +mappings.map( "n", "wK", "resize -5", @@ -518,12 +518,12 @@ utils.map( "expand_window_up", "Expand window up" ) -utils.map("n", "w=", "=", opts, "Window", "balance_window", "Balance window") -utils.map("n", "ws", "s", opts, "Window", "split_below_alt", "Split window below") -utils.map("n", "wv", "v", opts, "Window", "split_right_alt", "Split window right") +mappings.map("n", "w=", "=", opts, "Window", "balance_window", "Balance window") +mappings.map("n", "ws", "s", opts, "Window", "split_below_alt", "Split window below") +mappings.map("n", "wv", "v", opts, "Window", "split_right_alt", "Split window right") -- quit / sessions -utils.map( +mappings.map( "n", "qq", 'lua require("doom.core.functions").quit_doom()', @@ -532,7 +532,7 @@ utils.map( "save_nvim", "Exit Neovim" ) -utils.map( +mappings.map( "n", "qw", 'lua require("doom.core.functions").quit_doom(true, true)', @@ -541,7 +541,7 @@ utils.map( "save_exit_nvim", "Save and exit Neovim" ) -utils.map( +mappings.map( "n", "qr", "lua require('persistence').load({ last = true })", @@ -552,7 +552,7 @@ utils.map( ) -- open -utils.map( +mappings.map( "n", "ob", "lua require('dapui').toggle()", @@ -561,7 +561,7 @@ utils.map( "open_dapui", "Open debugging UI" ) -utils.map( +mappings.map( "n", "od", "Dashboard", @@ -570,7 +570,7 @@ utils.map( "open_dashboard", "Open start screen" ) -utils.map( +mappings.map( "n", "oe", "NvimTreeToggle", @@ -579,7 +579,7 @@ utils.map( "open_tree_alt", "Toggle file explorer" ) -utils.map( +mappings.map( "n", "om", "MinimapToggle", @@ -588,7 +588,7 @@ utils.map( "open_minimap_alt", "Toggle code minimap" ) -utils.map( +mappings.map( "n", "or", "Ranger", @@ -597,7 +597,7 @@ utils.map( "open_ranger_browser", "Toggle Ranger File Browser" ) -utils.map( +mappings.map( "n", "os", "SymbolsOutline", @@ -606,7 +606,7 @@ utils.map( "open_symbols_alt", "Toggle SymbolsOutline (LSP symbols)" ) -utils.map( +mappings.map( "n", "ot", "ToggleTerm", @@ -617,8 +617,8 @@ utils.map( ) -- git -utils.map("n", "go", "LazyGit", opts, "Git", "lazygit", "Open LazyGit") -utils.map( +mappings.map("n", "go", "LazyGit", opts, "Git", "lazygit", "Open LazyGit") +mappings.map( "n", "gl", 'TermExec cmd="git pull"', @@ -627,7 +627,7 @@ utils.map( "git_pull", "Pull remote changes" ) -utils.map( +mappings.map( "n", "gp", 'TermExec cmd="git push"', @@ -636,7 +636,7 @@ utils.map( "git_push", "Push git changes" ) -utils.map( +mappings.map( "n", "gs", "Telescope git_status", @@ -645,7 +645,7 @@ utils.map( "git_status", "Browse git status" ) -utils.map( +mappings.map( "n", "gB", "Telescope git_branches", @@ -654,7 +654,7 @@ utils.map( "git_branches", "Browse git branches" ) -utils.map( +mappings.map( "n", "gc", "Telescope git_commits", @@ -665,7 +665,7 @@ utils.map( ) -- code -utils.map( +mappings.map( "n", "ch", "RestNvim", @@ -674,7 +674,7 @@ utils.map( "exec_http_alt", "Execute http client under cursor" ) -utils.map( +mappings.map( "n", "ci", 'lua require("doom.modules.built-in.runner").start_repl()', @@ -683,7 +683,7 @@ utils.map( "start_repl", "Start a REPL" ) -utils.map( +mappings.map( "n", "cr", 'lua require("doom.modules.built-in.runner").run_code()', @@ -692,7 +692,7 @@ utils.map( "run_file", "Run the current file" ) -utils.map( +mappings.map( "n", "cb", 'lua require("doom.modules.built-in.compiler").compile()', @@ -701,7 +701,7 @@ utils.map( "compile", "Compile project" ) -utils.map( +mappings.map( "n", "cc", 'lua require("doom.modules.built-in.compiler").compile_and_run()', @@ -712,7 +712,7 @@ utils.map( ) -- debugging -utils.map( +mappings.map( "n", "cde", "lua require('dapui').eval()", @@ -721,7 +721,7 @@ utils.map( "dap_eval", "Evaluate word under cursor" ) -utils.map( +mappings.map( "v", "cds", "lua require('dapui').eval()", @@ -732,8 +732,8 @@ utils.map( ) -- lsp -utils.map("n", "cli", "LspInfo", opts, "LSP", "lsp_info", "LSP Information") -utils.map( +mappings.map("n", "cli", "LspInfo", opts, "LSP", "lsp_info", "LSP Information") +mappings.map( "n", "cla", "lua vim.lsp.buf.code_action()", @@ -742,7 +742,7 @@ utils.map( "code_action_alt", "Code actions" ) -utils.map( +mappings.map( "n", "cld", "lua vim.lsp.buf.type_definition()", @@ -751,7 +751,7 @@ utils.map( "type_definition", "Show type definition" ) -utils.map( +mappings.map( "n", "cll", "lua vim.lsp.diagnostic.show_line_diagnostics()", @@ -760,7 +760,7 @@ utils.map( "line_diagnostic", "Show line diagnostics" ) -utils.map( +mappings.map( "n", "clq", "lua vim.lsp.diagnostic.set_loclist()", @@ -771,11 +771,11 @@ utils.map( ) -- jumps -utils.map("n", "ja", "", opts, "Jumps", "jump_alternate_file", "Alternate file") -utils.map("n", "jj", "", opts, "Jumps", "jump_older", "Jump to older pos") -utils.map("n", "jk", "", opts, "Jumps", "jump_newer", "Jump to newer pos") -utils.map("n", "jp", ":pop", opts, "Jumps", "jump_pop_tag", "Pop from tag stack") -utils.map( +mappings.map("n", "ja", "", opts, "Jumps", "jump_alternate_file", "Alternate file") +mappings.map("n", "jj", "", opts, "Jumps", "jump_older", "Jump to older pos") +mappings.map("n", "jk", "", opts, "Jumps", "jump_newer", "Jump to newer pos") +mappings.map("n", "jp", ":pop", opts, "Jumps", "jump_pop_tag", "Pop from tag stack") +mappings.map( "n", "jt", ":tag", @@ -785,8 +785,8 @@ utils.map( "Follow tag / add to stack" ) -- save -utils.map("n", "v", "w", opts, "Save", "save_left", "Save v") -utils.map("n", "m", "w", opts, "Save", "save_right", "Save m") +mappings.map("n", "v", "w", opts, "Save", "save_left", "Save v") +mappings.map("n", "m", "w", opts, "Save", "save_right", "Save m") -- man pages -utils.map("n", "h", ":Man ", { silent = false }, "Man page", "man_page", "Man page") +mappings.map("n", "h", ":Man ", { silent = false }, "Man page", "man_page", "Man page") diff --git a/lua/doom/extras/keybindings/movement.lua b/lua/doom/extras/keybindings/movement.lua index 826c54ec1..556faf677 100644 --- a/lua/doom/extras/keybindings/movement.lua +++ b/lua/doom/extras/keybindings/movement.lua @@ -1,11 +1,11 @@ -local utils = require("doom.utils") +local mappings = require("doom.utils.mappings") -- Additional options for mappings local opts = { silent = true } -- TAB to cycle buffers too, why not? -utils.map("n", "", ":bnext", opts, "Movement", "cycle_next_buffer", "Goto next buffer") -utils.map( +mappings.map("n", "", ":bnext", opts, "Movement", "cycle_next_buffer", "Goto next buffer") +mappings.map( "n", "", ":bprevious", @@ -18,15 +18,15 @@ utils.map( ---[[-------------------------]]--- -- Window Movements keys -- ---]]-------------------------]]--- -utils.map("n", "", "h", opts, "Movement", "left_window", "Goto left window") -utils.map("n", "", "j", opts, "Movement", "down_window", "Goto down window") -utils.map("n", "", "k", opts, "Movement", "up_window", "Goto upper window") -utils.map("n", "", "l", opts, "Movement", "right_window", "Goto right window") +mappings.map("n", "", "h", opts, "Movement", "left_window", "Goto left window") +mappings.map("n", "", "j", opts, "Movement", "down_window", "Goto down window") +mappings.map("n", "", "k", opts, "Movement", "up_window", "Goto upper window") +mappings.map("n", "", "l", opts, "Movement", "right_window", "Goto right window") ---[[-----------------]]--- -- Move Lines -- ---]]-----------------[[--- -utils.map( +mappings.map( "n", "", ":m .+1==", @@ -35,7 +35,7 @@ utils.map( "normal_move_line_down", "Normal Move line down" ) -utils.map( +mappings.map( "n", "", ":m .-2==", @@ -44,7 +44,7 @@ utils.map( "normal_move_line_up", "Normal Move line up" ) -utils.map( +mappings.map( "i", "", ":m .+1==gi", @@ -53,7 +53,7 @@ utils.map( "instert_move_line_down", "Insert Move line down" ) -utils.map( +mappings.map( "i", "", ":m .-2==gi", @@ -62,7 +62,7 @@ utils.map( "instert_move_line_up", "Insert Move line up" ) -utils.map( +mappings.map( "v", "", ":m '>+1gv=gv", @@ -71,7 +71,7 @@ utils.map( "visual_move_line_down", "Visual Move line down" ) -utils.map( +mappings.map( "v", "", ":m '<-2gv=gv", @@ -84,11 +84,11 @@ utils.map( ---[[-----------------]]--- -- Select Movement -- ---]]-----------------[[--- -utils.map("x", "K", ":move '<-2gv-gv", opts, "Editor", "select_right", "Move selection right") -utils.map("x", "J", ":move '>+1gv-gv", opts, "Editor", "select_left", "Move selection left") +mappings.map("x", "K", ":move '<-2gv-gv", opts, "Editor", "select_right", "Move selection right") +mappings.map("x", "J", ":move '>+1gv-gv", opts, "Editor", "select_left", "Move selection left") -- get out of terminal insert mode into normal mode with Esc -utils.map( +mappings.map( "t", "", "", @@ -101,7 +101,7 @@ utils.map( ---[[-----------------]]--- -- Resizing Splits -- ---]]-----------------[[--- -utils.map( +mappings.map( "n", "", ":resize +2", @@ -110,7 +110,7 @@ utils.map( "resize_up", "Resize window (increase width)" ) -utils.map( +mappings.map( "n", "", ":resize -2", @@ -119,7 +119,7 @@ utils.map( "resize_down", "Resize window (decrease width)" ) -utils.map( +mappings.map( "n", "", ":vertical resize -2", @@ -128,7 +128,7 @@ utils.map( "resize_right", "Resize window (decrease height)" ) -utils.map( +mappings.map( "n", "", ":vertical resize +2", diff --git a/lua/doom/modules/config/doom-luasnip.lua b/lua/doom/modules/config/doom-luasnip.lua index 20e179169..6b4b6a3ae 100644 --- a/lua/doom/modules/config/doom-luasnip.lua +++ b/lua/doom/modules/config/doom-luasnip.lua @@ -1,5 +1,5 @@ return function() - local util = require("doom.utils") + local mappings = require("doom.utils.mappings") local luasnip = require("luasnip") luasnip.config.set_config({ @@ -12,16 +12,16 @@ return function() --- to jump to next snippet's placeholder local function on_tab() - return luasnip.jump(1) and "" or util.t("") + return luasnip.jump(1) and "" or mappings.t("") end --- to jump to next snippet's placeholder local function on_s_tab() - return luasnip.jump(-1) and "" or util.t("") + return luasnip.jump(-1) and "" or mappings.t("") end - util.imap("", on_tab, { expr = true }) - util.smap("", on_tab, { expr = true }) - util.imap("", on_s_tab, { expr = true }) - util.smap("", on_s_tab, { expr = true }) + mappings.imap("", on_tab, { expr = true }) + mappings.smap("", on_tab, { expr = true }) + mappings.imap("", on_s_tab, { expr = true }) + mappings.smap("", on_s_tab, { expr = true }) end diff --git a/lua/doom/utils/fs.lua b/lua/doom/utils/fs.lua new file mode 100644 index 000000000..325e7111a --- /dev/null +++ b/lua/doom/utils/fs.lua @@ -0,0 +1,50 @@ +---[[---------------------------------------]]--- +-- fs utils - Doom Nvim fs utilities -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------]]--- + +local fs = {} + +--- Check if the given file exists +--- @param path string The path of the file +--- @return boolean +fs.file_exists = function(path) + local fd = vim.loop.fs_open(path, "r", 438) + if fd then + vim.loop.fs_close(fd) + return true + end + + return false +end + +--- Returns the content of the given file +--- @param path string The path of the file +--- @return string +fs.read_file = function(path) + local fd = vim.loop.fs_open(path, "r", 438) + local stat = vim.loop.fs_fstat(fd) + local data = vim.loop.fs_read(fd, stat.size, 0) + vim.loop.fs_close(fd) + + return data +end + +--- write_file writes the given string into given file +--- @param path string The path of the file +--- @param content string The content to be written in the file +--- @param mode string The mode for opening the file, e.g. 'w+' +fs.write_file = function(path, content, mode) + -- 644 sets read and write permissions for the owner, and it sets read-only + -- mode for the group and others. + vim.loop.fs_open(path, mode, tonumber("644", 8), function(err, fd) + if not err then + local fpipe = vim.loop.new_pipe(false) + vim.loop.pipe_open(fpipe, fd) + vim.loop.write(fpipe, content) + end + end) +end + +return fs diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index c879894d9..ceb4e96a6 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -4,93 +4,18 @@ -- License: GPLv2 -- ---[[---------------------------------------]]--- -local M = {} -local system = require("doom.core.system") +--- @class utils +local utils = {} -------------------- HELPERS -------------------- --- Doom Nvim version -M.doom_version = "3.2.0-beta2" --- file_exists checks if the given file exists --- @tparam string path The path to the file --- @return boolean -M.file_exists = function(path) - local fd = vim.loop.fs_open(path, "r", 438) - if fd then - vim.loop.fs_close(fd) - return true - end - - return false -end +--- Doom Nvim version +utils.doom_version = "3.2.0-beta2" --- Mappings wrapper, extracted from --- https://github.com/ojroques/dotfiles/blob/master/nvim/init.lua#L8-L12 --- https://github.com/lazytanuki/nvim-mapper#prevent-issues-when-module-is-not-installed -local function is_module_available(name) - if package.loaded[name] then - return true - else - for _, searcher in ipairs(package.searchers or package.loaders) do - local loader = searcher(name) - if type(loader) == "function" then - package.preload[name] = loader - return true - end - end - return false - end -end - -if is_module_available("nvim-mapper") then - local mapper = require("nvim-mapper") - - M.map = function(mode, lhs, rhs, opts, category, unique_identifier, description) - mapper.map(mode, lhs, rhs, opts, category, unique_identifier, description) - end - M.map_buf = function(bufnr, mode, lhs, rhs, opts, category, unique_identifier, description) - mapper.map_buf(bufnr, mode, lhs, rhs, opts, category, unique_identifier, description) - end - M.map_virtual = function(mode, lhs, rhs, opts, category, unique_identifier, description) - mapper.map_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) - end - M.map_buf_virtual = function(mode, lhs, rhs, opts, category, unique_identifier, description) - mapper.map_buf_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) - end -else - -- Manually load the doom_config.lua file to avoid circular dependencies - local config = {} - local ok, ret = pcall(require, "doom_config") - if ok then - config = ret.config - else - ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_config.lua") - if ok then - config = ret.config - end - end - - M.map = function(mode, lhs, rhs, opts, _, _, _) - local options = config.doom.allow_default_keymaps_overriding and {} or { noremap = true } - if opts then - options = vim.tbl_extend("force", options, opts) - end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) - end - M.map_buf = function(mode, lhs, rhs, opts, _, _, _) - vim.api.nvim_buf_set_keymap(mode, lhs, rhs, opts) - end - M.map_virtual = function(_, _, _, _, _, _, _) - return - end - M.map_buf_virtual = function(_, _, _, _, _, _, _) - return - end -end - --- For autocommands, extracted from --- https://github.com/norcalli/nvim_utils -M.create_augroups = function(definitions) +--- For autocommands, extracted from +--- https://github.com/norcalli/nvim_utils +--- +utils.create_augroups = function(definitions) for group_name, definition in pairs(definitions) do vim.api.nvim_command("augroup " .. group_name) vim.api.nvim_command("autocmd!") @@ -102,15 +27,19 @@ M.create_augroups = function(definitions) end end --- Check if string is empty or if it's nil --- @return boolean -M.is_empty = function(str) +--- Check if string is empty or if it's nil +--- @param str string The string to be checked +--- @return boolean +utils.is_empty = function(str) return str == "" or str == nil end --- Search if a table have the value we are looking for, --- useful for plugins management -M.has_value = function(tabl, val) +--- Search if a table have the value we are looking for, +--- useful for plugins management +--- @param tabl table +--- @param val any +--- @return boolean +utils.has_value = function(tabl, val) for _, value in ipairs(tabl) do if value == val then return true @@ -120,105 +49,4 @@ M.has_value = function(tabl, val) return false end --- read_file returns the content of the given file --- @tparam string path The path of the file --- @return string -M.read_file = function(path) - local fd = vim.loop.fs_open(path, "r", 438) - local stat = vim.loop.fs_fstat(fd) - local data = vim.loop.fs_read(fd, stat.size, 0) - vim.loop.fs_close(fd) - - return data -end - --- write_file writes the given string into given file --- @tparam string path The path of the file --- @tparam string content The content to be written in the file --- @tparam string mode The mode for opening the file, e.g. 'w+' -M.write_file = function(path, content, mode) - -- 644 sets read and write permissions for the owner, and it sets read-only - -- mode for the group and others. - vim.loop.fs_open(path, mode, tonumber("644", 8), function(err, fd) - if not err then - local fpipe = vim.loop.new_pipe(false) - vim.loop.pipe_open(fpipe, fd) - vim.loop.write(fpipe, content) - end - end) -end - --- keep functions that we want to call -M.functions = {} - --- execute the given lua functions --- @tparam int index of the function in M.functions -function M.execute(id) - local func = M.functions[id] - if not func then - error("Function doest not exist: " .. id) - end - return func() -end - --- map keybindings to functions and cmds -local key_map = function(mode, key, cmd, opts, defaults) - opts = vim.tbl_deep_extend("force", { silent = true }, defaults or {}, opts or {}) - - if type(cmd) == "function" then - table.insert(M.functions, cmd) - if opts.expr then - cmd = ([[luaeval('require("doom.utils").execute(%d)')]]):format(#M.functions) - else - cmd = ("lua require('doom.utils').execute(%d)"):format(#M.functions) - end - end - if opts.buffer ~= nil then - local buffer = opts.buffer - opts.buffer = nil - return vim.api.nvim_buf_set_keymap(buffer, mode, key, cmd, opts) - else - return vim.api.nvim_set_keymap(mode, key, cmd, opts) - end -end - --- map termcode keybindings -function M.t(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) -end - --- insert mode keybinding -function M.imap(key, cmd, opts) - return key_map("i", key, cmd, opts) -end - --- substitute mode keybinding -function M.smap(key, cmd, opts) - return key_map("s", key, cmd, opts) -end - -M.load_modules = function(module_path, modules) - for i = 1, #modules, 1 do - local ok, err = xpcall( - require, - debug.traceback, - string.format("%s.%s", module_path, modules[i]) - ) - if not ok then - require("doom.extras.logging").error( - string.format( - "There was an error loading the module '%s.%s'. Traceback:\n%s", - module_path, - modules[i], - err - ) - ) - else - require("doom.extras.logging").debug( - string.format("Successfully loaded '%s.%s' module", module_path, modules[i]) - ) - end - end -end - -return M +return utils diff --git a/lua/doom/utils/mappings.lua b/lua/doom/utils/mappings.lua new file mode 100644 index 000000000..5c25b4313 --- /dev/null +++ b/lua/doom/utils/mappings.lua @@ -0,0 +1,112 @@ +---[[---------------------------------------]]--- +-- utils - Doom Nvim utilities -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------]]--- + +--- @class mappings +local mappings = {} + +local mod_utils = require("doom.utils.modules") +local system = require("doom.core.system") + +--- Mappings wrapper, extracted from +--- https://github.com/ojroques/dotfiles/blob/master/nvim/init.lua#L8-L12 +--- https://github.com/lazytanuki/nvim-mapper#prevent-issues-when-module-is-not-installed +if mod_utils.is_module_available("nvim-mapper") then + local mapper = require("nvim-mapper") + + mappings.map = function(mode, lhs, rhs, opts, category, unique_identifier, description) + mapper.map(mode, lhs, rhs, opts, category, unique_identifier, description) + end + mappings.map_buf = function(bufnr, mode, lhs, rhs, opts, category, unique_identifier, description) + mapper.map_buf(bufnr, mode, lhs, rhs, opts, category, unique_identifier, description) + end + mappings.map_virtual = function(mode, lhs, rhs, opts, category, unique_identifier, description) + mapper.map_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) + end + mappings.map_buf_virtual = function(mode, lhs, rhs, opts, category, unique_identifier, description) + mapper.map_buf_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) + end +else + local config = require("doom.core.config").config + + mappings.map = function(mode, lhs, rhs, opts, _, _, _) + local options = config.doom.allow_default_keymaps_overriding and {} or { noremap = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) + end + mappings.map_buf = function(mode, lhs, rhs, opts, _, _, _) + vim.api.nvim_buf_set_keymap(mode, lhs, rhs, opts) + end + mappings.map_virtual = function(_, _, _, _, _, _, _) + return + end + mappings.map_buf_virtual = function(_, _, _, _, _, _, _) + return + end +end + +--- keep functions that we want to call +--- @class functions +mappings.functions = {} + +--- Execute the given lua functions +--- @param id number Index of the function in mappings.functions +mappings.execute = function(id) + local func = mappings.functions[id] + if not func then + require("doom.extras.logging").error( + "Function doest not exist: " .. id + ) + end + return func() +end + +-- map keybindings to functions and cmds +local function key_map(mode, key, cmd, opts, defaults) + opts = vim.tbl_deep_extend("force", { silent = true }, defaults or {}, opts or {}) + + if type(cmd) == "function" then + table.insert(mappings.functions, cmd) + if opts.expr then + cmd = ([[luaeval('require("doom.utils").execute(%d)')]]):format(#mappings.functions) + else + cmd = ("lua require('doom.utils').execute(%d)"):format(#mappings.functions) + end + end + if opts.buffer ~= nil then + local buffer = opts.buffer + opts.buffer = nil + return vim.api.nvim_buf_set_keymap(buffer, mode, key, cmd, opts) + else + return vim.api.nvim_set_keymap(mode, key, cmd, opts) + end +end + +--- Map termcode keybindings +--- @param str string +--- @return string +mappings.t = function(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end + +--- insert mode keybinding +--- @param key string +--- @param cmd string +--- @param opts table +mappings.imap = function(key, cmd, opts) + return key_map("i", key, cmd, opts) +end + +--- substitute mode keybinding +--- @param key string +--- @param cmd string +--- @param opts table +mappings.smap = function(key, cmd, opts) + return key_map("s", key, cmd, opts) +end + +return mappings diff --git a/lua/doom/utils/modules.lua b/lua/doom/utils/modules.lua new file mode 100644 index 000000000..255c46426 --- /dev/null +++ b/lua/doom/utils/modules.lua @@ -0,0 +1,55 @@ +---[[---------------------------------------]]--- +-- utils - Doom Nvim utilities -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------]]--- + +--- @class modules +local modules = {} + +--- Check if a Lua module exists +--- @param mod string The module name, e.g. nvim-treesitter +--- @return boolean +modules.is_module_available = function(mod) + if package.loaded[mod] then + return true + else + for _, searcher in ipairs(package.searchers or package.loaders) do + local loader = searcher(mod) + if type(loader) == "function" then + package.preload[mod] = loader + return true + end + end + return false + end +end + +--- Load the specified Lua modules +--- @param module_path string The path to Lua modules, e.g. 'doom' → 'lua/doom' +--- @param modules table The modules that we want to load +modules.load_modules = function(module_path, modules) + for i = 1, #modules, 1 do + local ok, err = xpcall( + require, + debug.traceback, + string.format("%s.%s", module_path, modules[i]) + ) + if not ok then + require("doom.extras.logging").error( + string.format( + "There was an error loading the module '%s.%s'. Traceback:\n%s", + module_path, + modules[i], + err + ) + ) + else + require("doom.extras.logging").debug( + string.format("Successfully loaded '%s.%s' module", module_path, modules[i]) + ) + end + end +end + +return modules From fc4573ffde30ddc38cd82fd9d3470daabb701ec1 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 20:15:55 -0400 Subject: [PATCH 098/290] fix(info): add padding to commit bodies that does not have padding --- lua/doom/modules/built-in/info/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 0bb15930b..46fd4c376 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -216,6 +216,7 @@ local function get_doom_info() string.format( "%s", body_part + :gsub("^", string.format("%s", padding_level[3])) :gsub("^%s+", string.format("%s", padding_level[3])) :gsub("^%s+%-", string.format("%s-", padding_level[3])) ), From e14359c0717936c13945ba3b04f9f84ed0527a78 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 1 Oct 2021 01:09:02 +0000 Subject: [PATCH 099/290] chore: format source code --- lua/doom/extras/keybindings/completion.lua | 10 +++++++++- lua/doom/extras/keybindings/core.lua | 20 ++++++++++++++++++-- lua/doom/extras/keybindings/leader.lua | 20 ++++++++++++++++++-- lua/doom/extras/keybindings/movement.lua | 10 +++++++++- lua/doom/utils/mappings.lua | 11 +++++------ 5 files changed, 59 insertions(+), 12 deletions(-) diff --git a/lua/doom/extras/keybindings/completion.lua b/lua/doom/extras/keybindings/completion.lua index fa9268a37..3eef8246a 100644 --- a/lua/doom/extras/keybindings/completion.lua +++ b/lua/doom/extras/keybindings/completion.lua @@ -49,7 +49,15 @@ mappings.map( "Code action" ) -- K: hover doc -mappings.map("n", "K", ":lua vim.lsp.buf.hover()", opts, "LSP", "hover_doc", "Hover documentation") +mappings.map( + "n", + "K", + ":lua vim.lsp.buf.hover()", + opts, + "LSP", + "hover_doc", + "Hover documentation" +) -- Control+p: Jump to previous diagnostic mappings.map( "n", diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua index c61d18db7..d499e4db1 100644 --- a/lua/doom/extras/keybindings/core.lua +++ b/lua/doom/extras/keybindings/core.lua @@ -17,7 +17,15 @@ mappings.map( ) -- ESC to turn off search highlighting -mappings.map("n", "", ":noh", opts, "Editor", "no_highlight", "Turn off search highlighting") +mappings.map( + "n", + "", + ":noh", + opts, + "Editor", + "no_highlight", + "Turn off search highlighting" +) ---[[-----------------]]--- -- Disable keys -- @@ -62,7 +70,15 @@ if not is_plugin_disabled("symbols") then ) end if not is_plugin_disabled("explorer") then - mappings.map("n", "", ":NvimTreeToggle", opts, "Editor", "open_tree", "Toggle file explorer") + mappings.map( + "n", + "", + ":NvimTreeToggle", + opts, + "Editor", + "open_tree", + "Toggle file explorer" + ) end if not is_plugin_disabled("minimap") then mappings.map( diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 4fa0fc300..92cf1f25e 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -187,7 +187,15 @@ mappings.map( "help_doom", "Open Doom user manual" ) -mappings.map("n", "du", "DoomUpdate", opts, "Doom", "update_doom", "Update Doom Nvim") +mappings.map( + "n", + "du", + "DoomUpdate", + opts, + "Doom", + "update_doom", + "Update Doom Nvim" +) mappings.map( "n", "dr", @@ -490,7 +498,15 @@ mappings.map("n", "wh", "h", opts, "Window", "window_left", "Window mappings.map("n", "wj", "j", opts, "Window", "window_below", "Window below") mappings.map("n", "wl", "l", opts, "Window", "window_right", "Window right") mappings.map("n", "wk", "k", opts, "Window", "window_up", "Window up") -mappings.map("n", "wH", "5<", opts, "Window", "expand_window_left", "Expand window left") +mappings.map( + "n", + "wH", + "5<", + opts, + "Window", + "expand_window_left", + "Expand window left" +) mappings.map( "n", "wJ", diff --git a/lua/doom/extras/keybindings/movement.lua b/lua/doom/extras/keybindings/movement.lua index 556faf677..82f041a82 100644 --- a/lua/doom/extras/keybindings/movement.lua +++ b/lua/doom/extras/keybindings/movement.lua @@ -84,7 +84,15 @@ mappings.map( ---[[-----------------]]--- -- Select Movement -- ---]]-----------------[[--- -mappings.map("x", "K", ":move '<-2gv-gv", opts, "Editor", "select_right", "Move selection right") +mappings.map( + "x", + "K", + ":move '<-2gv-gv", + opts, + "Editor", + "select_right", + "Move selection right" +) mappings.map("x", "J", ":move '>+1gv-gv", opts, "Editor", "select_left", "Move selection left") -- get out of terminal insert mode into normal mode with Esc diff --git a/lua/doom/utils/mappings.lua b/lua/doom/utils/mappings.lua index 5c25b4313..22d2548c9 100644 --- a/lua/doom/utils/mappings.lua +++ b/lua/doom/utils/mappings.lua @@ -25,9 +25,10 @@ if mod_utils.is_module_available("nvim-mapper") then mappings.map_virtual = function(mode, lhs, rhs, opts, category, unique_identifier, description) mapper.map_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) end - mappings.map_buf_virtual = function(mode, lhs, rhs, opts, category, unique_identifier, description) - mapper.map_buf_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) - end + mappings.map_buf_virtual = + function(mode, lhs, rhs, opts, category, unique_identifier, description) + mapper.map_buf_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) + end else local config = require("doom.core.config").config @@ -58,9 +59,7 @@ mappings.functions = {} mappings.execute = function(id) local func = mappings.functions[id] if not func then - require("doom.extras.logging").error( - "Function doest not exist: " .. id - ) + require("doom.extras.logging").error("Function doest not exist: " .. id) end return func() end From 365ea141959e3e39a8681cb12c30cf7fa4b71063 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 22:46:23 -0400 Subject: [PATCH 100/290] feat(modules): hot reload plugins configurations, closes #96 --- lua/doom/extras/autocmds/init.lua | 8 +++++- lua/doom/modules/built-in/reloader/init.lua | 27 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 lua/doom/modules/built-in/reloader/init.lua diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 37529637e..362431d0f 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -19,12 +19,18 @@ local autocmds = { "*/doom-*.lua,doom_modules.lua,doom_userplugins.lua", "PackerCompile profile=true", }, - -- Reload user-defined settings when 'doom_config.lua' file was modified + -- Live-reload user-defined settings when 'doom_config.lua' file was modified { "BufWritePost", "doom_config.lua", "lua require('doom.core.functions').reload_custom_settings()", }, + -- Live-reload plugins configuration files + { + "BufWritePost", + "*/doom-*.lua", + "lua require('doom.modules.built-in.reloader').reload_plugin_config(vim.fn.expand('%:p'))", + }, -- Automatically change colorscheme and background on exit { "VimLeavePre", diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua new file mode 100644 index 000000000..ad6a2a2c2 --- /dev/null +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -0,0 +1,27 @@ +--- @class Reloader +local reloader = {} + +--- Reload a plugin configuration module +--- @param mod_path string The configuration module path +reloader.reload_plugin_config = function(mod_path) + -- Remove the Neovim config dir and the file extension from the path, + -- also replace '/' with '.' so we can access the modules by using package table + -- e.g. doom.modules.config.doom-neorg + mod_path = mod_path:gsub(vim.fn.stdpath("config") .. "/lua/", ""):gsub("/", "."):gsub(".lua", "") + -- Get the module from package table + local mod = package.loaded[mod_path] + + if type(mod) == "function" then + -- Unload the module and load it again + package.loaded[mod_path] = nil + require(mod_path) + -- Call the loaded module function so the reloading will take effect as expected + package.loaded[mod_path]() + + require("doom.extras.logging").info(string.format("Successfully reloaded '%s' module", mod_path)) + else + require("doom.extras.logging").error(string.format("Failed to reload '%s' module", mod_path)) + end +end + +return reloader From fa3238b6022fde6e501796dc528c1fda3c86a4dd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 1 Oct 2021 02:46:50 +0000 Subject: [PATCH 101/290] chore: format source code --- lua/doom/modules/built-in/reloader/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index ad6a2a2c2..6bc6302ef 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -18,7 +18,9 @@ reloader.reload_plugin_config = function(mod_path) -- Call the loaded module function so the reloading will take effect as expected package.loaded[mod_path]() - require("doom.extras.logging").info(string.format("Successfully reloaded '%s' module", mod_path)) + require("doom.extras.logging").info( + string.format("Successfully reloaded '%s' module", mod_path) + ) else require("doom.extras.logging").error(string.format("Failed to reload '%s' module", mod_path)) end From bc8b935f46fe600af4a3f8803326950c0c0403a6 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 22:51:16 -0400 Subject: [PATCH 102/290] chore(mappings): remove unused system variable --- lua/doom/utils/mappings.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/doom/utils/mappings.lua b/lua/doom/utils/mappings.lua index 22d2548c9..0194f3344 100644 --- a/lua/doom/utils/mappings.lua +++ b/lua/doom/utils/mappings.lua @@ -8,7 +8,6 @@ local mappings = {} local mod_utils = require("doom.utils.modules") -local system = require("doom.core.system") --- Mappings wrapper, extracted from --- https://github.com/ojroques/dotfiles/blob/master/nvim/init.lua#L8-L12 From a46e290eab548ad33f5babe91560b1da6d93ad52 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 30 Sep 2021 22:55:29 -0400 Subject: [PATCH 103/290] fix(utils): stop shadowing upvalue --- lua/doom/utils/modules.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/doom/utils/modules.lua b/lua/doom/utils/modules.lua index 255c46426..cd0d9da7e 100644 --- a/lua/doom/utils/modules.lua +++ b/lua/doom/utils/modules.lua @@ -27,26 +27,26 @@ end --- Load the specified Lua modules --- @param module_path string The path to Lua modules, e.g. 'doom' → 'lua/doom' ---- @param modules table The modules that we want to load -modules.load_modules = function(module_path, modules) - for i = 1, #modules, 1 do +--- @param mods table The modules that we want to load +modules.load_modules = function(module_path, mods) + for i = 1, #mods, 1 do local ok, err = xpcall( require, debug.traceback, - string.format("%s.%s", module_path, modules[i]) + string.format("%s.%s", module_path, mods[i]) ) if not ok then require("doom.extras.logging").error( string.format( "There was an error loading the module '%s.%s'. Traceback:\n%s", module_path, - modules[i], + mods[i], err ) ) else require("doom.extras.logging").debug( - string.format("Successfully loaded '%s.%s' module", module_path, modules[i]) + string.format("Successfully loaded '%s.%s' module", module_path, mods[i]) ) end end From 19c79076db3eddb9b0fe6e8db230535d1d51b070 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 1 Oct 2021 02:55:54 +0000 Subject: [PATCH 104/290] chore: format source code --- lua/doom/utils/modules.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lua/doom/utils/modules.lua b/lua/doom/utils/modules.lua index cd0d9da7e..d121a33f4 100644 --- a/lua/doom/utils/modules.lua +++ b/lua/doom/utils/modules.lua @@ -30,11 +30,7 @@ end --- @param mods table The modules that we want to load modules.load_modules = function(module_path, mods) for i = 1, #mods, 1 do - local ok, err = xpcall( - require, - debug.traceback, - string.format("%s.%s", module_path, mods[i]) - ) + local ok, err = xpcall(require, debug.traceback, string.format("%s.%s", module_path, mods[i])) if not ok then require("doom.extras.logging").error( string.format( From 46b6050f5142251974712f21881a493202de933f Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 1 Oct 2021 02:02:08 -0400 Subject: [PATCH 105/290] fix(autocmds): better detection for plugins config files --- lua/doom/extras/autocmds/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 362431d0f..2eeb5eb71 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -16,7 +16,7 @@ local autocmds = { -- Compile new plugins changes at save { "BufWritePost", - "*/doom-*.lua,doom_modules.lua,doom_userplugins.lua", + "*/config/doom-*.lua,doom_modules.lua,doom_userplugins.lua", "PackerCompile profile=true", }, -- Live-reload user-defined settings when 'doom_config.lua' file was modified @@ -28,7 +28,7 @@ local autocmds = { -- Live-reload plugins configuration files { "BufWritePost", - "*/doom-*.lua", + "*/config/doom-*.lua", "lua require('doom.modules.built-in.reloader').reload_plugin_config(vim.fn.expand('%:p'))", }, -- Automatically change colorscheme and background on exit From d6d6d12beea7c41cd95cf6c060c06823d7d8dd36 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 11:35:33 +1000 Subject: [PATCH 106/290] Fixed LSP auto install --- lua/doom/core/config/init.lua | 30 ----------------- lua/doom/core/init.lua | 2 -- lua/doom/modules/config/doom-lspinstall.lua | 36 +++++++++++++++++++++ 3 files changed, 36 insertions(+), 32 deletions(-) diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 05b28d344..50f0f167d 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -440,36 +440,6 @@ else end end --- install_servers will install the language servers for the languages with --- the +lsp flag. --- --- @param langs The list of languages in the doom_modules.lua -M.install_servers = function(langs) - if packer_plugins and packer_plugins["lspinstall"] and packer_plugins["lspinstall"].loaded then - local lspinstall = require("lspinstall") - local installed_servers = lspinstall.installed_servers() - local available_servers = lspinstall.available_servers() - - for _, lang in ipairs(langs) do - local lang_str = lang - lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") - - -- If the +lsp flag exists and the language server is not installed yet - if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lang)) then - -- Try to install the server only if there is a server available for - -- the language, oterwise raise a warning - if utils.has_value(available_servers, lang) then - lspinstall.install_server(lang) - else - log.warn( - "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' - ) - end - end - end - end -end - -- install_dap_clients will install the DAP clients for the languages with -- the +debug flag. -- diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index 759e57c4c..3c37e5285 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -18,8 +18,6 @@ for i = 1, #core_modules, 1 do -- Doom Nvim custom commands require("doom.core.settings").doom_commands() elseif core_modules[i] == "config" then - -- Automatically install language servers - require("doom.core.config").install_servers(require("doom.core.config.modules").modules.langs) -- Automatically install language DAP clients require("doom.core.config").install_dap_clients( require("doom.core.config.modules").modules.langs diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 1bbd32e2b..50bd76062 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -1,4 +1,6 @@ return function() + local log = require("doom.extras.logging") + local utils = require("doom.utils") local nvim_lsp = require("lspconfig") local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled @@ -32,6 +34,40 @@ return function() }, } + -- Load langs from doom_modules and install servers with +lsp + local function install_servers() + local lspinstall = require("lspinstall") + lspinstall.setup() + + local installed_servers = lspinstall.installed_servers() + local available_servers = lspinstall.available_servers() + + local modules = require("doom.core.config.modules").modules + local langs = modules.langs; + + for _, lang in ipairs(langs) do + local lang_str = lang + lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + + -- If the +lsp flag exists and the language server is not installed yet + if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lang)) then + -- Try to install the server only if there is a server available for + -- the language, oterwise raise a warning + if utils.has_value(available_servers, lang) then + lspinstall.install_server(lang) + else + log.warn( + "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' + ) + end + end + end + end + + install_servers() + + + --- Intelligent highlighting of word under cursor local on_attach if not is_plugin_disabled("illuminated") and packer_plugins["vim-illuminate"] then From d2dc0cae8a26aa3844c96cb0306fdd41e6d7f9c1 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 11:37:55 +1000 Subject: [PATCH 107/290] Cleanup --- lua/doom/modules/config/doom-lspinstall.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 50bd76062..c2bacf7e9 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -34,7 +34,7 @@ return function() }, } - -- Load langs from doom_modules and install servers with +lsp + -- Load langs from doom_modules and install servers with +lsp flag local function install_servers() local lspinstall = require("lspinstall") lspinstall.setup() @@ -66,8 +66,6 @@ return function() install_servers() - - --- Intelligent highlighting of word under cursor local on_attach if not is_plugin_disabled("illuminated") and packer_plugins["vim-illuminate"] then From 2039e0a80280f59ff588101a59bfd044e3e61f9d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 2 Oct 2021 01:45:44 +0000 Subject: [PATCH 108/290] chore: format source code --- lua/doom/modules/config/doom-lspinstall.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index c2bacf7e9..8e0d5913f 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -43,7 +43,7 @@ return function() local available_servers = lspinstall.available_servers() local modules = require("doom.core.config.modules").modules - local langs = modules.langs; + local langs = modules.langs for _, lang in ipairs(langs) do local lang_str = lang From c9a2cdeff728d4ffd1960ff05a41af8ad109cf6c Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 1 Oct 2021 22:08:59 -0400 Subject: [PATCH 109/290] chore: release `v3.1.2`, see release notes --- CHANGELOG.md | 36 +++++++++++++++++++++++++++++++++++- lua/doom/utils/init.lua | 1 - 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30a0c5d6c..1a00de69e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.1.2] - 2021-10-01 + +### Changed + +- Updated `dap-ui` plugin configurations to match recent breaking changes. + See [#114](https://github.com/NTBBloodbath/doom-nvim/pull/114) and [#137](https://github.com/NTBBloodbath/doom-nvim/pull/137) +- Updated `gitsigns` plugin configurations to match recent breaking changes. See [#115](https://github.com/NTBBloodbath/doom-nvim/pull/122) +- Updated `nvim-tree.lua` plugin configurations +- Updated Neorg URL, neorg is now under `nvim-neorg` organization. See [#115](https://github.com/NTBBloodbath/doom-nvim/pull/115) +- Updated some other plugins URLs +- Use `,o` instead of `o` as Neorg leader. Fixes [#110](https://github.com/NTBBloodbath/doom-nvim/issues/110) + +### Fixed + +- Proper conditional for triggering dashboard-nvim plugin (re-apply) +- Correct description for splits in documentation. See [#128](https://github.com/NTBBloodbath/doom-nvim/pull/128) +- Do not try to load which-key.nvim if not installed. Fixes [#124](https://github.com/NTBBloodbath/doom-nvim/issues/124) +- Language servers not being installed with `+lsp` flag in `doomrc`. + Fixes [#87](https://github.com/NTBBloodbath/doom-nvim/issues/87), see [#149](https://github.com/NTBBloodbath/doom-nvim/pull/149) + +### Removed + +- Non-needed `bufdo e`, this was causing issues with `nvim -d file1 file2`. Fixes [#127](https://github.com/NTBBloodbath/doom-nvim/issues/127) + +## [3.1.1] - 2021-09-02 + +### Fixed + +- Updated bufferline configs to match the new breaking changes +- Updated Neorg treesttier parser files to be able to successfully compile it +- Properly require logging on utils module + ## [3.1.0] - 2021-08-26 ### Added @@ -525,7 +557,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial stable release -[unreleased]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.0...develop +[unreleased]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.2...develop +[3.1.2]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.1...v3.1.2 +[3.1.1]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.0...v3.1.1 [3.1.0]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.0.13...v3.1.0 [3.0.13]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.0.12...v3.0.13 [3.0.12]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.0.11...v3.0.12 diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index ceb4e96a6..f0833140d 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -8,7 +8,6 @@ local utils = {} -------------------- HELPERS -------------------- - --- Doom Nvim version utils.doom_version = "3.2.0-beta2" From a67d96e3e7b0001766ae6dc085768afb50f95524 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 12:11:54 +1000 Subject: [PATCH 110/290] Override LSP using `+lsp(LSP_NAME)` syntax --- docs/getting_started.md | 3 ++ lua/doom/modules/config/doom-lspinstall.lua | 32 ++++++++++++++++----- lua/doom/modules/config/doom-treesitter.lua | 2 +- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 61ee5ce1e..4b87b57ed 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -510,6 +510,9 @@ To enable the language server for a certain programming language and automatical install it, just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`, e.g. for enabling Rust support in Doom and install `rust-analyzer`: +If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)`. +Where `OVERRIDE_LSP_NAME` is a different option in [kabouzeid/nvim-lspinstall's Bundled Installers](https://github.com/kabouzeid/nvim-lspinstall). + ```lua local doom = { langs = { diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 8e0d5913f..8d2c5ddfd 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -47,18 +47,36 @@ return function() for _, lang in ipairs(langs) do local lang_str = lang - lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + lang = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + local lsp_name = lang + + -- Allow overriding of LSP using `+lsp(OVERRIDE_LSP_NAME)` syntax + local lsp_override = lang_str:match("+lsp%((%a+)%)") + if lsp_override ~= nil then + lsp_name = lsp_override + + -- Uninstall the default LSP to avoid conflicts + if (utils.has_value(installed_servers, lang)) then + lspinstall.uninstall_server(lang) + end + end -- If the +lsp flag exists and the language server is not installed yet - if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lang)) then + if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lsp_name)) then -- Try to install the server only if there is a server available for -- the language, oterwise raise a warning - if utils.has_value(available_servers, lang) then - lspinstall.install_server(lang) + if utils.has_value(available_servers, lsp_name) then + lspinstall.install_server(lsp_name) else - log.warn( - "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' - ) + if lsp_override == nil then + log.warn( + "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' + ) + else + log.warn( + "The LSP override supplied in \"" .. lang_str .. "\" does not exist, please remove \"("..lsp_name.. ")\"" + ) + end end end end diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 7ccba05d3..c5fd6d789 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -13,7 +13,7 @@ return function() table.insert(langs, "yaml") table.insert(langs, "toml") else - lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + lang = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") table.insert(langs, lang) end end From 8035133b810e4fd5cabc4d66817d577f6d17ac14 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 1 Oct 2021 22:21:15 -0400 Subject: [PATCH 111/290] docs: update contributing.md --- docs/contributing.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index acb2008ca..22ef49d78 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -37,7 +37,7 @@ not work as expected otherwise. Eg. you will see 'Dashboard' text on vim load in ### Acquire a backtrace from errors All the errors ocurred in Doom Nvim are saved into a `doom.log` file inside the -`~/.local/share/nvim/` directory. If the logs are very long, please paste it +`~/.local/share/nvim/` directory. If the logs are very long, please paste them using a [gist]. ### Create a step-by-step reproduction guide @@ -73,7 +73,8 @@ Doom Nvim follows some code style rules like ones the mentioned below: - Double quotes over single quotes. - Spaces over tabs. -- Variable names in `snake_case`, except in the BASH installation script. +- Two spaces indentation. +- Variable names in `snake_case`. - Function names in `snake_case`. - [stylua] is used to format lua files with the following configuration: @@ -85,13 +86,21 @@ indent_width = 2 quote_style = "AutoPreferDouble" ``` -> **NOTE:** use `--config-path /path/to/doom/nvim/stylua.toml` to use doom's +> **NOTE:** use `--config-path /path/to/doom/nvim/.stylua.toml` to use doom's > stylua configuration. +- [luacheck] is a static analyzer and a linter for Lua. Luacheck detects various issues such as usage + of undefined global variables, unused variables and values, accessing uninitialized variables, + unreachable code and more. + +> **NOTE:** use `luacheck .` in doom's root dir and luacheck will automatically +> detect the `.luacheckrc` file. + #### Commits & PRs - Target `develop` instead of `main`. - The only exception are hotfixes! + The only exception are hotfixes (plugins breaking changes, Doom bugs) + and documentation improvements! #### Keybind conventions @@ -106,3 +115,4 @@ your pull request :) [gist]: https://gist.github.com/ [stylua]: https://github.com/JohnnyMorganz/StyLua +[luacheck]:https://github.com/luarocks/luacheck From d079c4b6b589682f5643990935ca0fc2a94cb300 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 12:22:48 +1000 Subject: [PATCH 112/290] Added a warning when installing an override LSP --- lua/doom/modules/config/doom-lspinstall.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 8d2c5ddfd..deb87c248 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -57,6 +57,9 @@ return function() -- Uninstall the default LSP to avoid conflicts if (utils.has_value(installed_servers, lang)) then + log.warn( + "Uninstalling " .. lang .. " LSP due to " .. lsp_override .. " LSP being supplied in config. If you want to revert back to " .. lang .. " LSP you will have to manually uninstall " .. lsp_override .."." + ) lspinstall.uninstall_server(lang) end end From 5f599008e3128667bf6665d5ffcef23de83d7f87 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 12:28:48 +1000 Subject: [PATCH 113/290] Moved documentation on new syntax --- docs/getting_started.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 4b87b57ed..05b76e6c4 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -510,9 +510,6 @@ To enable the language server for a certain programming language and automatical install it, just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`, e.g. for enabling Rust support in Doom and install `rust-analyzer`: -If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)`. -Where `OVERRIDE_LSP_NAME` is a different option in [kabouzeid/nvim-lspinstall's Bundled Installers](https://github.com/kabouzeid/nvim-lspinstall). - ```lua local doom = { langs = { @@ -523,6 +520,9 @@ local doom = { > **NOTE**: You can see a list of currently supported languages at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall#bundled-installers). +> **NOTE**: If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)`. +Where `OVERRIDE_LSP_NAME` is a different option in [kabouzeid/nvim-lspinstall's Bundled Installers](https://github.com/kabouzeid/nvim-lspinstall). + ### Binding keys You can modify the default keybindings by modifying the following files: From 5661cd2dc89d7eddd48f2604b428e5b1d60db144 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 12:31:06 +1000 Subject: [PATCH 114/290] Made documentation on LSP override consistent --- docs/getting_started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 05b76e6c4..40ddd1602 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -520,8 +520,8 @@ local doom = { > **NOTE**: You can see a list of currently supported languages at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall#bundled-installers). -> **NOTE**: If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)`. -Where `OVERRIDE_LSP_NAME` is a different option in [kabouzeid/nvim-lspinstall's Bundled Installers](https://github.com/kabouzeid/nvim-lspinstall). +> **NOTE**: If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)` +Where `OVERRIDE_LSP_NAME` is a different option at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall). ### Binding keys From c9d89caa735f2d154d33d946791f218709be4a43 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 13:21:43 +1000 Subject: [PATCH 115/290] Fixed dap auto install --- lua/doom/core/config/init.lua | 37 -------------------- lua/doom/core/init.lua | 5 --- lua/doom/modules/config/doom-dap-install.lua | 31 ++++++++++++++++ lua/doom/modules/init.lua | 3 +- 4 files changed, 33 insertions(+), 43 deletions(-) create mode 100644 lua/doom/modules/config/doom-dap-install.lua diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 50f0f167d..a6c36c4b3 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -440,43 +440,6 @@ else end end --- install_dap_clients will install the DAP clients for the languages with --- the +debug flag. --- --- @param langs The list of languages in the doom_modules.lua -M.install_dap_clients = function(langs) - if - packer_plugins - and packer_plugins["DAPInstall.nvim"] - and packer_plugins["DAPInstall.nvim"].loaded - then - local installed_clients = require("dap-install.api.debuggers").get_installed_debuggers() - -- NOTE: not all the clients follows the 'language_dbg' standard and this - -- can give some problems to us (maybe?) - local available_clients = vim.tbl_keys(require("dap-install.api.debuggers").get_debuggers()) - - for _, lang in ipairs(langs) do - local lang_str = lang - lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") - - -- If the +debug flag exists and the language client is not installed yet - if lang_str:find("%+debug") and (not utils.has_value(installed_clients, lang .. "_dbg")) then - -- Try to install the client only if there is a client available for - -- the language, oterwise raise a warning - if utils.has_value(available_clients, lang .. "_dbg") then - require("dap-install.tools.tool_install").install_debugger(lang .. "_dbg") - else - log.warn( - "The language " - .. lang - .. ' does not have a DAP client, please remove the "+debug" flag' - ) - end - end - end - end -end - -- Check plugins updates on start if enabled if M.config.doom.check_updates then require("doom.core.functions").check_updates() diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index 3c37e5285..5cc5bb696 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -17,11 +17,6 @@ for i = 1, #core_modules, 1 do require("doom.core.settings").custom_options() -- Doom Nvim custom commands require("doom.core.settings").doom_commands() - elseif core_modules[i] == "config" then - -- Automatically install language DAP clients - require("doom.core.config").install_dap_clients( - require("doom.core.config.modules").modules.langs - ) end log.debug(string.format("Successfully loaded 'doom.core.%s' module", core_modules[i])) else diff --git a/lua/doom/modules/config/doom-dap-install.lua b/lua/doom/modules/config/doom-dap-install.lua new file mode 100644 index 000000000..700f33a0e --- /dev/null +++ b/lua/doom/modules/config/doom-dap-install.lua @@ -0,0 +1,31 @@ +return function() + local log = require("doom.extras.logging") + local utils = require("doom.utils") + local installed_clients = require("dap-install.api.debuggers").get_installed_debuggers() + -- NOTE: not all the clients follows the 'language_dbg' standard and this + -- can give some problems to us (maybe?) + local available_clients = vim.tbl_keys(require("dap-install.api.debuggers").get_debuggers()) + + local modules = require("doom.core.config.modules").modules + local langs = modules.langs + + for _, lang in ipairs(langs) do + local lang_str = lang + lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + + -- If the +debug flag exists and the language client is not installed yet + if lang_str:find("%+debug") and (not utils.has_value(installed_clients, lang .. "_dbg")) then + -- Try to install the client only if there is a client available for + -- the language, oterwise raise a warning + if utils.has_value(available_clients, lang .. "_dbg") then + require("dap-install.tools.tool_install").install_debugger(lang .. "_dbg") + else + log.warn( + "The language " + .. lang + .. ' does not have a DAP client, please remove the "+debug" flag' + ) + end + end + end +end diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index d48a33ca3..e0d098e92 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -425,7 +425,7 @@ packer.startup(function(use) use({ "mfussenegger/nvim-dap", disable = disabled_dap, - event = "ColorScheme", + event = "BufWinEnter", }) use({ @@ -437,6 +437,7 @@ packer.startup(function(use) use({ "Pocco81/DAPInstall.nvim", + config = require("doom.modules.config.doom-dap-install"), disable = disabled_dap, after = "nvim-dap", }) From 24f99b5334ef66d09adcc68a44b7811b2430efe7 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 13:43:29 +1000 Subject: [PATCH 116/290] Fixed changed DAPInstall API --- lua/doom/modules/config/doom-dap-install.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lua/doom/modules/config/doom-dap-install.lua b/lua/doom/modules/config/doom-dap-install.lua index 700f33a0e..bed1fa5c0 100644 --- a/lua/doom/modules/config/doom-dap-install.lua +++ b/lua/doom/modules/config/doom-dap-install.lua @@ -1,4 +1,11 @@ return function() + -- Init dap-install + local dap_install = require("dap-install") + dap_install.setup({ + verbosely_call_debuggers = true, + installation_path = vim.fn.stdpath("data") .. "/dapinstall/", + }) + local log = require("doom.extras.logging") local utils = require("doom.utils") local installed_clients = require("dap-install.api.debuggers").get_installed_debuggers() @@ -14,11 +21,11 @@ return function() lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") -- If the +debug flag exists and the language client is not installed yet - if lang_str:find("%+debug") and (not utils.has_value(installed_clients, lang .. "_dbg")) then + if lang_str:find("%+debug") and (not utils.has_value(installed_clients, lang)) then -- Try to install the client only if there is a client available for -- the language, oterwise raise a warning - if utils.has_value(available_clients, lang .. "_dbg") then - require("dap-install.tools.tool_install").install_debugger(lang .. "_dbg") + if utils.has_value(available_clients, lang) then + require('dap-install.core.install').install_debugger(lang) else log.warn( "The language " From c90e466add58ec5312d048e724c8ea6409adf176 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 14:36:33 +1000 Subject: [PATCH 117/290] Added a lookup table for DAP clients --- lua/doom/core/config/init.lua | 1 - lua/doom/modules/config/doom-dap-install.lua | 76 +++++++++++++------- 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index a6c36c4b3..b55f7a4df 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -7,7 +7,6 @@ local M = {} local log = require("doom.extras.logging") -local utils = require("doom.utils") local system = require("doom.core.system") log.debug("Loading Doom config module ...") diff --git a/lua/doom/modules/config/doom-dap-install.lua b/lua/doom/modules/config/doom-dap-install.lua index bed1fa5c0..487713976 100644 --- a/lua/doom/modules/config/doom-dap-install.lua +++ b/lua/doom/modules/config/doom-dap-install.lua @@ -1,4 +1,6 @@ return function() + local log = require("doom.extras.logging") + local utils = require("doom.utils") -- Init dap-install local dap_install = require("dap-install") dap_install.setup({ @@ -6,33 +8,57 @@ return function() installation_path = vim.fn.stdpath("data") .. "/dapinstall/", }) - local log = require("doom.extras.logging") - local utils = require("doom.utils") - local installed_clients = require("dap-install.api.debuggers").get_installed_debuggers() - -- NOTE: not all the clients follows the 'language_dbg' standard and this - -- can give some problems to us (maybe?) - local available_clients = vim.tbl_keys(require("dap-install.api.debuggers").get_debuggers()) - - local modules = require("doom.core.config.modules").modules - local langs = modules.langs - - for _, lang in ipairs(langs) do - local lang_str = lang - lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") - - -- If the +debug flag exists and the language client is not installed yet - if lang_str:find("%+debug") and (not utils.has_value(installed_clients, lang)) then - -- Try to install the client only if there is a client available for - -- the language, oterwise raise a warning - if utils.has_value(available_clients, lang) then - require('dap-install.core.install').install_debugger(lang) + local dap_lang_lookup = { + cpp = {'ccppr_vsc'}, + c = {'ccppr_vsc'}, + rust = {'ccppr_vsc'}, + go = {'go_delve'}, + javascript = { 'chrome', 'jsnode' }, + typescript = { 'chrome', 'jsnode' }, + ruby = {'ruby_vsc'} + } + + -- Iterates through langs and installs clients where possible + local install_dap_clients = function() + local installed_clients = require("dap-install.api.debuggers").get_installed_debuggers() + -- NOTE: not all the clients follows the 'language_dbg' standard and this + -- can give some problems to us (maybe?) + local available_clients = vim.tbl_keys(require("dap-install.api.debuggers").get_debuggers()) + + local modules = require("doom.core.config.modules").modules + local langs = modules.langs + + for _, lang in ipairs(langs) do + local lang_str = lang + lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + + -- DAPInstall.nvim has different names for the DAPs so sometimes we need to lookup the correct DAP to install + if utils.has_value(dap_lang_lookup, lang) then + lang = dap_lang_lookup[lang] else - log.warn( - "The language " - .. lang - .. ' does not have a DAP client, please remove the "+debug" flag' - ) + lang = { lang } + end + + -- Iterate over DAPs installing them one by one + for _, dap_name in ipairs(lang) do + -- If the +debug flag exists and the language client is not installed yet + if lang_str:find("%+debug") and (not utils.has_value(installed_clients, dap_name)) then + + -- Try to install the client only if there is a client available for + -- the language, oterwise raise a warning + if utils.has_value(available_clients, dap_name) then + require('dap-install.core.install').install_debugger(dap_name) + else + log.warn( + "The language " + .. dap_name + .. ' does not have a DAP client, please remove the "+debug" flag' + ) + end + end end end end + + install_dap_clients() end From 8bf5e7ed7eb8bdca0b4a60aa8f58b5f72d4ede6e Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 15:21:08 +1000 Subject: [PATCH 118/290] Fixed duplicate dap client installation --- lua/doom/modules/config/doom-dap-install.lua | 23 +++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lua/doom/modules/config/doom-dap-install.lua b/lua/doom/modules/config/doom-dap-install.lua index 487713976..dabcef9ce 100644 --- a/lua/doom/modules/config/doom-dap-install.lua +++ b/lua/doom/modules/config/doom-dap-install.lua @@ -20,20 +20,23 @@ return function() -- Iterates through langs and installs clients where possible local install_dap_clients = function() + local modules = require("doom.core.config.modules").modules + local langs = modules.langs + local installed_clients = require("dap-install.api.debuggers").get_installed_debuggers() - -- NOTE: not all the clients follows the 'language_dbg' standard and this - -- can give some problems to us (maybe?) local available_clients = vim.tbl_keys(require("dap-install.api.debuggers").get_debuggers()) - local modules = require("doom.core.config.modules").modules - local langs = modules.langs + local daps_to_install = {} + -- Iterate over each lang, get the required daps and push it to daps_to_install (to avoid duplicates) for _, lang in ipairs(langs) do local lang_str = lang lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + log.info(string.format('Checking DAP for %s , has override? ', lang, dap_lang_lookup[lang] ~= nil )) -- DAPInstall.nvim has different names for the DAPs so sometimes we need to lookup the correct DAP to install - if utils.has_value(dap_lang_lookup, lang) then + if dap_lang_lookup[lang] ~= nil then + log.info('Overwritting ' .. lang .. ' with ' .. string.format('%s', dap_lang_lookup[lang])) lang = dap_lang_lookup[lang] else lang = { lang } @@ -47,7 +50,10 @@ return function() -- Try to install the client only if there is a client available for -- the language, oterwise raise a warning if utils.has_value(available_clients, dap_name) then - require('dap-install.core.install').install_debugger(dap_name) + -- Avoid installing duplicate daps + if (not utils.has_value(daps_to_install, dap_name)) then + table.insert(daps_to_install, dap_name) + end else log.warn( "The language " @@ -58,6 +64,11 @@ return function() end end end + + -- Install the daps one by one + for _, dap_name in ipairs(daps_to_install) do + require('dap-install.core.install').install_debugger(dap_name) + end end install_dap_clients() From c29174bb9f59366a03669d1e242b8004aaa18960 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 16:10:34 +1000 Subject: [PATCH 119/290] Cleanup --- lua/doom/modules/config/doom-dap-install.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/doom/modules/config/doom-dap-install.lua b/lua/doom/modules/config/doom-dap-install.lua index dabcef9ce..c43bc655b 100644 --- a/lua/doom/modules/config/doom-dap-install.lua +++ b/lua/doom/modules/config/doom-dap-install.lua @@ -33,10 +33,8 @@ return function() local lang_str = lang lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") - log.info(string.format('Checking DAP for %s , has override? ', lang, dap_lang_lookup[lang] ~= nil )) -- DAPInstall.nvim has different names for the DAPs so sometimes we need to lookup the correct DAP to install if dap_lang_lookup[lang] ~= nil then - log.info('Overwritting ' .. lang .. ' with ' .. string.format('%s', dap_lang_lookup[lang])) lang = dap_lang_lookup[lang] else lang = { lang } From 93fa6fc83fd522bf6c535378b19f381421a6e60b Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 21:14:42 +1000 Subject: [PATCH 120/290] Tidied up doo-dap-install --- lua/doom/modules/config/doom-dap-install.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/doom/modules/config/doom-dap-install.lua b/lua/doom/modules/config/doom-dap-install.lua index c43bc655b..eec540749 100644 --- a/lua/doom/modules/config/doom-dap-install.lua +++ b/lua/doom/modules/config/doom-dap-install.lua @@ -4,7 +4,6 @@ return function() -- Init dap-install local dap_install = require("dap-install") dap_install.setup({ - verbosely_call_debuggers = true, installation_path = vim.fn.stdpath("data") .. "/dapinstall/", }) From b9adaad24f1c18a8dcadf23f2cd481b49561d77f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 3 Oct 2021 03:02:10 +0000 Subject: [PATCH 121/290] chore: format source code --- lua/doom/modules/config/doom-dap-install.lua | 23 ++++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lua/doom/modules/config/doom-dap-install.lua b/lua/doom/modules/config/doom-dap-install.lua index eec540749..bae5aef06 100644 --- a/lua/doom/modules/config/doom-dap-install.lua +++ b/lua/doom/modules/config/doom-dap-install.lua @@ -4,17 +4,17 @@ return function() -- Init dap-install local dap_install = require("dap-install") dap_install.setup({ - installation_path = vim.fn.stdpath("data") .. "/dapinstall/", + installation_path = vim.fn.stdpath("data") .. "/dapinstall/", }) local dap_lang_lookup = { - cpp = {'ccppr_vsc'}, - c = {'ccppr_vsc'}, - rust = {'ccppr_vsc'}, - go = {'go_delve'}, - javascript = { 'chrome', 'jsnode' }, - typescript = { 'chrome', 'jsnode' }, - ruby = {'ruby_vsc'} + cpp = { "ccppr_vsc" }, + c = { "ccppr_vsc" }, + rust = { "ccppr_vsc" }, + go = { "go_delve" }, + javascript = { "chrome", "jsnode" }, + typescript = { "chrome", "jsnode" }, + ruby = { "ruby_vsc" }, } -- Iterates through langs and installs clients where possible @@ -43,12 +43,11 @@ return function() for _, dap_name in ipairs(lang) do -- If the +debug flag exists and the language client is not installed yet if lang_str:find("%+debug") and (not utils.has_value(installed_clients, dap_name)) then - -- Try to install the client only if there is a client available for -- the language, oterwise raise a warning if utils.has_value(available_clients, dap_name) then - -- Avoid installing duplicate daps - if (not utils.has_value(daps_to_install, dap_name)) then + -- Avoid installing duplicate daps + if not utils.has_value(daps_to_install, dap_name) then table.insert(daps_to_install, dap_name) end else @@ -64,7 +63,7 @@ return function() -- Install the daps one by one for _, dap_name in ipairs(daps_to_install) do - require('dap-install.core.install').install_debugger(dap_name) + require("dap-install.core.install").install_debugger(dap_name) end end From a72a188d08f27c90a312b27da19e4ddbeca41a22 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 12:11:54 +1000 Subject: [PATCH 122/290] Override LSP using `+lsp(LSP_NAME)` syntax --- docs/getting_started.md | 3 ++ lua/doom/modules/config/doom-lspinstall.lua | 32 ++++++++++++++++----- lua/doom/modules/config/doom-treesitter.lua | 2 +- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 61ee5ce1e..4b87b57ed 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -510,6 +510,9 @@ To enable the language server for a certain programming language and automatical install it, just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`, e.g. for enabling Rust support in Doom and install `rust-analyzer`: +If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)`. +Where `OVERRIDE_LSP_NAME` is a different option in [kabouzeid/nvim-lspinstall's Bundled Installers](https://github.com/kabouzeid/nvim-lspinstall). + ```lua local doom = { langs = { diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 8e0d5913f..8d2c5ddfd 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -47,18 +47,36 @@ return function() for _, lang in ipairs(langs) do local lang_str = lang - lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + lang = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + local lsp_name = lang + + -- Allow overriding of LSP using `+lsp(OVERRIDE_LSP_NAME)` syntax + local lsp_override = lang_str:match("+lsp%((%a+)%)") + if lsp_override ~= nil then + lsp_name = lsp_override + + -- Uninstall the default LSP to avoid conflicts + if (utils.has_value(installed_servers, lang)) then + lspinstall.uninstall_server(lang) + end + end -- If the +lsp flag exists and the language server is not installed yet - if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lang)) then + if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lsp_name)) then -- Try to install the server only if there is a server available for -- the language, oterwise raise a warning - if utils.has_value(available_servers, lang) then - lspinstall.install_server(lang) + if utils.has_value(available_servers, lsp_name) then + lspinstall.install_server(lsp_name) else - log.warn( - "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' - ) + if lsp_override == nil then + log.warn( + "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' + ) + else + log.warn( + "The LSP override supplied in \"" .. lang_str .. "\" does not exist, please remove \"("..lsp_name.. ")\"" + ) + end end end end diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 7ccba05d3..c5fd6d789 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -13,7 +13,7 @@ return function() table.insert(langs, "yaml") table.insert(langs, "toml") else - lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + lang = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") table.insert(langs, lang) end end From 6a0c92a5cccf3fb980d07476e8c6776f79cb9c17 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 12:22:48 +1000 Subject: [PATCH 123/290] Added a warning when installing an override LSP --- lua/doom/modules/config/doom-lspinstall.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 8d2c5ddfd..deb87c248 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -57,6 +57,9 @@ return function() -- Uninstall the default LSP to avoid conflicts if (utils.has_value(installed_servers, lang)) then + log.warn( + "Uninstalling " .. lang .. " LSP due to " .. lsp_override .. " LSP being supplied in config. If you want to revert back to " .. lang .. " LSP you will have to manually uninstall " .. lsp_override .."." + ) lspinstall.uninstall_server(lang) end end From 932aab377ab1feea35ae86d966709156daee0c46 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 12:28:48 +1000 Subject: [PATCH 124/290] Moved documentation on new syntax --- docs/getting_started.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 4b87b57ed..05b76e6c4 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -510,9 +510,6 @@ To enable the language server for a certain programming language and automatical install it, just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`, e.g. for enabling Rust support in Doom and install `rust-analyzer`: -If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)`. -Where `OVERRIDE_LSP_NAME` is a different option in [kabouzeid/nvim-lspinstall's Bundled Installers](https://github.com/kabouzeid/nvim-lspinstall). - ```lua local doom = { langs = { @@ -523,6 +520,9 @@ local doom = { > **NOTE**: You can see a list of currently supported languages at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall#bundled-installers). +> **NOTE**: If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)`. +Where `OVERRIDE_LSP_NAME` is a different option in [kabouzeid/nvim-lspinstall's Bundled Installers](https://github.com/kabouzeid/nvim-lspinstall). + ### Binding keys You can modify the default keybindings by modifying the following files: From de4134a4a0342a5a68df4c521c58d38ba24be825 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 2 Oct 2021 12:31:06 +1000 Subject: [PATCH 125/290] Made documentation on LSP override consistent --- docs/getting_started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 05b76e6c4..40ddd1602 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -520,8 +520,8 @@ local doom = { > **NOTE**: You can see a list of currently supported languages at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall#bundled-installers). -> **NOTE**: If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)`. -Where `OVERRIDE_LSP_NAME` is a different option in [kabouzeid/nvim-lspinstall's Bundled Installers](https://github.com/kabouzeid/nvim-lspinstall). +> **NOTE**: If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)` +Where `OVERRIDE_LSP_NAME` is a different option at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall). ### Binding keys From a7ab7aab47813193dd625453623b0601daa9517d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 4 Oct 2021 03:41:47 +0000 Subject: [PATCH 126/290] chore: format source code --- lua/doom/modules/config/doom-lspinstall.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index deb87c248..910dcab56 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -56,9 +56,17 @@ return function() lsp_name = lsp_override -- Uninstall the default LSP to avoid conflicts - if (utils.has_value(installed_servers, lang)) then + if utils.has_value(installed_servers, lang) then log.warn( - "Uninstalling " .. lang .. " LSP due to " .. lsp_override .. " LSP being supplied in config. If you want to revert back to " .. lang .. " LSP you will have to manually uninstall " .. lsp_override .."." + "Uninstalling " + .. lang + .. " LSP due to " + .. lsp_override + .. " LSP being supplied in config. If you want to revert back to " + .. lang + .. " LSP you will have to manually uninstall " + .. lsp_override + .. "." ) lspinstall.uninstall_server(lang) end @@ -77,7 +85,11 @@ return function() ) else log.warn( - "The LSP override supplied in \"" .. lang_str .. "\" does not exist, please remove \"("..lsp_name.. ")\"" + 'The LSP override supplied in "' + .. lang_str + .. '" does not exist, please remove "(' + .. lsp_name + .. ')"' ) end end From b9078548873fa201d9c2d60e6a567526231823e9 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 5 Oct 2021 16:16:43 -0400 Subject: [PATCH 127/290] refact: use `xpcall` instead of `pcall` to load configuration files, this should allow us to send a better traceback if something goes wrong --- lua/doom/core/config/init.lua | 2 +- lua/doom/core/config/modules.lua | 2 +- lua/doom/core/config/userplugins.lua | 2 +- lua/doom/extras/logging/init.lua | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index b55f7a4df..a4132814e 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -430,7 +430,7 @@ if ok then M.config = ret.config M.source = ret.source else - ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_config.lua") + ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_config.lua") if ok then M.config = ret.config M.source = ret.source diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua index a4634955f..a10cc5826 100644 --- a/lua/doom/core/config/modules.lua +++ b/lua/doom/core/config/modules.lua @@ -93,7 +93,7 @@ if ok then M.modules = ret.modules M.source = ret.source else - ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_modules.lua") + ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_modules.lua") if ok then M.modules = ret.modules M.source = ret.source diff --git a/lua/doom/core/config/userplugins.lua b/lua/doom/core/config/userplugins.lua index ba3227d37..7ba66e314 100644 --- a/lua/doom/core/config/userplugins.lua +++ b/lua/doom/core/config/userplugins.lua @@ -23,7 +23,7 @@ if ok then M.plugins = ret.plugins M.source = ret.source else - ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_userplugins.lua") + ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_userplugins.lua") if ok then M.plugins = ret.plugins M.source = ret.source diff --git a/lua/doom/extras/logging/init.lua b/lua/doom/extras/logging/init.lua index 53f2f7d1e..8765bde24 100644 --- a/lua/doom/extras/logging/init.lua +++ b/lua/doom/extras/logging/init.lua @@ -18,7 +18,7 @@ local ok, ret = pcall(require, "doom_config") if ok then logging_level = ret.config.doom.logging or logging_level else - ok, ret = pcall(dofile, system.doom_configs_root .. "/doom_config.lua") + ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_config.lua") if ok then logging_level = ret.config.doom.logging or logging_level end From 86076ecc5c1b0ecd8c84799472613a24f23ba76f Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 5 Oct 2021 16:57:15 -0400 Subject: [PATCH 128/290] refact(functions): use `vim.ui` module for edit config prompt --- lua/doom/core/functions/init.lua | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 39f70ac87..de9dded57 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -488,26 +488,26 @@ end -- edit_config creates a prompt to modify a doom configuration file M.edit_config = function() - local selected_config = tonumber(vim.fn.inputlist({ - "Select a configuration file to edit:", - "1. doom_config.lua", - "2. doom_modules.lua", - "3. doom_userplugins.lua", - })) - local direction = config.doom.vertical_split and "vert " or "" - local open_command = config.doom.new_file_split and "split" or "edit" - - if selected_config == 1 then - vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config").source)) - elseif selected_config == 2 then - vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source)) - elseif selected_config == 3 then - vim.cmd( - ("%s%s %s"):format(direction, open_command, require("doom.core.config.userplugins").source) - ) - elseif selected_config ~= 0 then - log.error("Invalid option selected.") - end + vim.ui.select( + { "doom_config.lua", "doom_modules.lua", "doom_userplugins.lua" }, + { prompt = "Select a configuration file to edit:" }, + function(_, selected_config_idx) + local direction = config.doom.vertical_split and "vert " or "" + local open_command = config.doom.new_file_split and "split" or "edit" + + if selected_config_idx == 1 then + vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config").source)) + elseif selected_config_idx == 2 then + vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source)) + elseif selected_config_idx == 3 then + vim.cmd( + ("%s%s %s"):format(direction, open_command, require("doom.core.config.userplugins").source) + ) + elseif selected_config_idx == nil then + log.error("Invalid option selected") + end + end + ) end -- followings are called from lua/doom/extras/keybindings/leader.lua From ef24ce1520fe931e280d486c26ddc36d5d45dc46 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 5 Oct 2021 16:59:12 -0400 Subject: [PATCH 129/290] feat(extras): allow to disable Doom autocommands module --- doom_config.lua | 8 ++++++++ lua/doom/extras/init.lua | 12 ++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 9ae318e95..716c75536 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -210,6 +210,14 @@ M.config = { completion = true, }, + -- Disable or enable Doom autocommands, this can break some configuration options (they will stop working) + -- e.g. preserve_edit_pos or autosave + -- + -- false : enable autocommands module + -- true : disable autocommands module + -- @default = false + disable_autocommands = false, + -- Default indent size -- @default = 4 indent = 4, diff --git a/lua/doom/extras/init.lua b/lua/doom/extras/init.lua index 34a65189e..c3fc659d8 100644 --- a/lua/doom/extras/init.lua +++ b/lua/doom/extras/init.lua @@ -4,7 +4,11 @@ require("doom.extras.logging").debug("Loading Doom extras ...") -require("doom.utils.modules").load_modules("doom.extras", { - "autocmds", - "keybindings", -}) +local extra_modules = { "keybindings" } + +local disabled_autocommands = require("doom.core.config").config.doom.disable_autocommands +if not disabled_autocommands then + vim.list_extend(extra_modules, { "autocmds" }) +end + +require("doom.utils.modules").load_modules("doom.extras", extra_modules) From dda59af1fd9ecb0c7c03ba545397b620ccea9ed4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 5 Oct 2021 20:59:31 +0000 Subject: [PATCH 130/290] chore: format source code --- lua/doom/core/functions/init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index de9dded57..7e822a0c4 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -498,10 +498,16 @@ M.edit_config = function() if selected_config_idx == 1 then vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config").source)) elseif selected_config_idx == 2 then - vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source)) + vim.cmd( + ("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source) + ) elseif selected_config_idx == 3 then vim.cmd( - ("%s%s %s"):format(direction, open_command, require("doom.core.config.userplugins").source) + ("%s%s %s"):format( + direction, + open_command, + require("doom.core.config.userplugins").source + ) ) elseif selected_config_idx == nil then log.error("Invalid option selected") From b0485b26aa4f76e3a4a27634e487398b6c8274ce Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 5 Oct 2021 18:51:24 -0400 Subject: [PATCH 131/290] feat(doom-one): pull upstream changes --- lua/colors/doom-one/config/init.lua | 51 ++++ lua/colors/doom-one/init.lua | 427 +++++++++++++++------------- lua/colors/doom-one/utils/init.lua | 109 +++++++ lua/doom/core/config/ui.lua | 37 ++- 4 files changed, 411 insertions(+), 213 deletions(-) create mode 100644 lua/colors/doom-one/config/init.lua create mode 100644 lua/colors/doom-one/utils/init.lua diff --git a/lua/colors/doom-one/config/init.lua b/lua/colors/doom-one/config/init.lua new file mode 100644 index 000000000..d668c6492 --- /dev/null +++ b/lua/colors/doom-one/config/init.lua @@ -0,0 +1,51 @@ +--- @class config +local config = {} + +local configuration = { + cursor_coloring = false, + terminal_colors = false, + italic_comments = false, + enable_treesitter = true, + transparent_background = false, + pumblend = { + enable = true, + transparency_amount = 20, + }, + plugins_integrations = { + barbar = true, + bufferline = false, + gitgutter = false, + gitsigns = true, + telescope = false, + neogit = true, + nvim_tree = true, + dashboard = true, + startify = true, + whichkey = true, + indent_blankline = true, + vim_illuminate = true, + lspsaga = false, + } +} + +--- Get a configuration value +--- @param opt string +--- @return any +config.get = function(opt) + if opt then + return configuration[opt] + end + return configuration +end + +--- Set user-defined configurations +--- @param user_configs table +--- @return table +config.set = function(user_configs) + vim.validate({ user_configs = { user_configs, "table" } }) + + configuration = vim.tbl_deep_extend("force", configuration, user_configs) + return configuration +end + +return config diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua index a440252d3..89e65d5e3 100644 --- a/lua/colors/doom-one/init.lua +++ b/lua/colors/doom-one/init.lua @@ -7,33 +7,33 @@ -- Helpers {{{ +local doom_one = {} + local utils = require('colors.utils') +local config = require('colors.doom-one.config') -- }}} -- Customization variables {{{ --- Set default values for doom_one variables if they don't exists -if vim.g.doom_one_cursor_coloring == nil then - vim.g.doom_one_cursor_coloring = false -end -if vim.g.doom_one_terminal_colors == nil then - vim.g.doom_one_terminal_colors = false -end -if vim.g.doom_one_enable_treesitter == nil then - vim.g.doom_one_enable_treesitter = true -end -if vim.g.doom_one_transparent_background == nil then - vim.g.doom_one_transparent_background = false -end -if vim.g.doom_one_italic_comments == nil then - vim.g.doom_one_italic_comments = false +local configuration = config.get() + +--- Establish the user configurations +--- @param user_configs table +doom_one.setup = function(user_configs) + configuration = config.set(user_configs or {}) end -if vim.g.doom_one_telescope_highlights == nil then - vim.g.doom_one_telescope_highlights = true + +local transparent_bg = configuration.transparent_background + +if configuration.cursor_coloring then + vim.opt.guicursor = + 'n-v-c:block-Cursor,i-ci-ve:ver25-Cursor,r-cr-o:hor25-Cursor' end -local transparent_bg = vim.g.doom_one_transparent_background +if configuration.pumblend.enable then + vim.opt.pumblend = configuration.pumblend.transparency_amount +end -- }}} @@ -202,11 +202,6 @@ if current_bg == 'light' then gh_danger_bg1 = utils.Mix('#ffdce0', bg, 0.9) end -if vim.g.doom_one_cursor_coloring then - vim.opt.guicursor = - 'n-v-c:block-Cursor,i-ci-ve:ver25-Cursor,r-cr-o:hor25-Cursor' -end - -- }}} -- General UI {{{ @@ -365,7 +360,7 @@ local main_syntax = { Comment = { fg = fg_alt, - gui = vim.g.doom_one_italic_comments and 'italic' or 'NONE', + gui = configuration.italic_comments and 'italic' or 'NONE', }, CommentBold = { fg = fg_alt, gui = 'bold' }, SpecialComment = { fg = base7, gui = 'bold' }, @@ -482,42 +477,44 @@ apply_highlight(markdown) -- barbar.nvim {{{ -local barbar = { - BufferCurrent = { fg = base9, bg = bg }, - BufferCurrentIndex = { fg = base6, bg = bg }, - BufferCurrentMod = { fg = yellow, bg = bg }, - BufferCurrentSign = { fg = blue, bg = bg }, - BufferCurrentTarget = { fg = red, bg = bg, gui = 'bold' }, - - BufferVisible = { fg = base7, bg = bg }, - BufferVisibleIndex = { fg = base9, bg = bg }, - BufferVisibleMod = { fg = yellow, bg = bg }, - BufferVisibleSign = { fg = base4, bg = bg }, - BufferVisibleTarget = { fg = red, bg = bg, gui = 'bold' }, - - BufferInactive = { fg = base6, bg = base1 }, - BufferInactiveIndex = { fg = base6, bg = base1 }, - BufferInactiveMod = { fg = yellow, bg = base1 }, - BufferInactiveSign = { fg = base4, bg = base1 }, - BufferInactiveTarget = { fg = red, bg = base1, gui = 'bold' }, - - BufferTabpages = { fg = blue, bg = bg_statusline, gui = 'bold' }, - BufferTabpageFill = { fg = base4, bg = base1, gui = 'bold' }, - - BufferPart = { fg = diff_info_fg, bg = diff_info_bg0, gui = 'bold' }, -} +if configuration.plugins_integrations.barbar then + local barbar = { + BufferCurrent = { fg = base9, bg = bg }, + BufferCurrentIndex = { fg = base6, bg = bg }, + BufferCurrentMod = { fg = yellow, bg = bg }, + BufferCurrentSign = { fg = blue, bg = bg }, + BufferCurrentTarget = { fg = red, bg = bg, gui = 'bold' }, + + BufferVisible = { fg = base7, bg = bg }, + BufferVisibleIndex = { fg = base9, bg = bg }, + BufferVisibleMod = { fg = yellow, bg = bg }, + BufferVisibleSign = { fg = base4, bg = bg }, + BufferVisibleTarget = { fg = red, bg = bg, gui = 'bold' }, + + BufferInactive = { fg = base6, bg = base1 }, + BufferInactiveIndex = { fg = base6, bg = base1 }, + BufferInactiveMod = { fg = yellow, bg = base1 }, + BufferInactiveSign = { fg = base4, bg = base1 }, + BufferInactiveTarget = { fg = red, bg = base1, gui = 'bold' }, + + BufferTabpages = { fg = blue, bg = bg_statusline, gui = 'bold' }, + BufferTabpageFill = { fg = base4, bg = base1, gui = 'bold' }, + + BufferPart = { fg = diff_info_fg, bg = diff_info_bg0, gui = 'bold' }, + } -apply_highlight(barbar) + apply_highlight(barbar) +end -- }}} -- BufferLine {{{ --- NOTE: this is a temporal workaround for using bufferline with a transparent --- background and having highlighting, please refer to --- https://github.com/NTBBloodbath/doom-one.nvim/issues/8#issuecomment-883737667 --- for more information about this -if transparent_bg then +if configuration.plugins_integrations.bufferline and transparent_bg then + -- NOTE: this is a temporal workaround for using bufferline with a transparent + -- background and having highlighting, please refer to + -- https://github.com/NTBBloodbath/doom-one.nvim/issues/8#issuecomment-883737667 + -- for more information about this local bufferline = { BufferLineTab = { fg = fg, bg = bg }, BufferLineTabClose = { fg = fg, bg = bg, gui = 'bold' }, @@ -596,30 +593,34 @@ end -- Gitgutter {{{ -high_link('GitGutterAdd', 'DiffAddedGutter') -high_link('GitGutterChange', 'DiffModifiedGutter') -high_link('GitGutterDelete', 'DiffRemovedGutter') -high_link('GitGutterChangeDelete', 'DiffModifiedGutter') +if configuration.plugins_integrations.gitgutter then + high_link('GitGutterAdd', 'DiffAddedGutter') + high_link('GitGutterChange', 'DiffModifiedGutter') + high_link('GitGutterDelete', 'DiffRemovedGutter') + high_link('GitGutterChangeDelete', 'DiffModifiedGutter') -high_link('GitGutterAddLineNr', 'DiffAddedGutterLineNr') -high_link('GitGutterChangeLineNr', 'DiffModifiedGutterLineNr') -high_link('GitGutterDeleteLineNr', 'DiffRemovedGutterLineNr') -high_link('GitGutterChangeDeleteLineNr', 'DiffModifiedGutterLineNr') + high_link('GitGutterAddLineNr', 'DiffAddedGutterLineNr') + high_link('GitGutterChangeLineNr', 'DiffModifiedGutterLineNr') + high_link('GitGutterDeleteLineNr', 'DiffRemovedGutterLineNr') + high_link('GitGutterChangeDeleteLineNr', 'DiffModifiedGutterLineNr') +end -- }}} -- Gitsigns {{{ -high_link('GitSignsAdd', 'DiffAddedGutter') -high_link('GitSignsChange', 'DiffModifiedGutter') -high_link('GitSignsDelete', 'DiffRemovedGutter') -high_link('GitSignsChangeDelete', 'DiffModifiedGutter') +if configuration.plugins_integrations.gitsigns then + high_link('GitSignsAdd', 'DiffAddedGutter') + high_link('GitSignsChange', 'DiffModifiedGutter') + high_link('GitSignsDelete', 'DiffRemovedGutter') + high_link('GitSignsChangeDelete', 'DiffModifiedGutter') +end -- }}} -- Telescope {{{ -if vim.g.doom_one_telescope_highlights then +if configuration.plugins_integrations.telescope then local telescope = { TelescopeSelection = { fg = yellow, gui = 'bold' }, TelescopeSelectionCaret = { fg = light_bg and orange or blue }, @@ -641,133 +642,195 @@ end -- Neogit {{{ -local neogit = { - NeogitDiffAdd = { fg = ng_add_fg, bg = ng_add_bg}, - NeogitDiffAddHighlight = { fg = ng_add_fg_hl, bg = ng_add_bg_hl, gui = 'bold' }, - NeogitDiffDelete = { fg = ng_delete_fg, bg = ng_delete_bg }, - NeogitDiffDeleteHighlight = { fg = ng_delete_fg_hl, bg = ng_delete_bg_hl, gui = 'bold' }, - NeogitDiffContext = { fg = fg_alt, bg = bg }, - NeogitDiffContextHighlight = { fg = fg, bg = bg_alt }, - NeogitHunkHeader = { fg = bg, bg = ng_header_bg }, - NeogitHunkHeaderHighlight = { fg = bg_alt, bg = ng_header_bg_hl, gui = 'bold' }, - NeogitStagedChanges = { fg = blue, gui = 'bold' }, - NeogitStagedChangesRegion = { bg = bg_highlight }, - NeogitStashes = { fg = blue, gui = 'bold' }, - NeogitUnstagedChanges = { fg = blue, gui = 'bold' }, - NeogitUntrackedfiles = { fg = blue, gui = 'bold' }, -} +if configuration.plugins_integrations.neogit then + local neogit = { + NeogitDiffAdd = { fg = ng_add_fg, bg = ng_add_bg}, + NeogitDiffAddHighlight = { fg = ng_add_fg_hl, bg = ng_add_bg_hl, gui = 'bold' }, + NeogitDiffDelete = { fg = ng_delete_fg, bg = ng_delete_bg }, + NeogitDiffDeleteHighlight = { fg = ng_delete_fg_hl, bg = ng_delete_bg_hl, gui = 'bold' }, + NeogitDiffContext = { fg = fg_alt, bg = bg }, + NeogitDiffContextHighlight = { fg = fg, bg = bg_alt }, + NeogitHunkHeader = { fg = bg, bg = ng_header_bg }, + NeogitHunkHeaderHighlight = { fg = bg_alt, bg = ng_header_bg_hl, gui = 'bold' }, + NeogitStagedChanges = { fg = blue, gui = 'bold' }, + NeogitStagedChangesRegion = { bg = bg_highlight }, + NeogitStashes = { fg = blue, gui = 'bold' }, + NeogitUnstagedChanges = { fg = blue, gui = 'bold' }, + NeogitUntrackedfiles = { fg = blue, gui = 'bold' }, + } -apply_highlight(neogit) + apply_highlight(neogit) +end -- }}} -- NvimTree {{{ -local nvim_tree = { - NvimTreeFolderName = { fg = light_bg and base9 or blue, gui = 'bold' }, - NvimTreeRootFolder = { fg = green }, - NvimTreeEmptyFolderName = { fg = fg_alt, gui = 'bold' }, - NvimTreeSymlink = { fg = fg, gui = 'underline' }, - NvimTreeExecFile = { fg = green, gui = 'bold' }, - NvimTreeImageFile = { fg = light_bg and orange or blue }, - NvimTreeOpenedFile = { fg = fg_alt }, - NvimTreeSpecialFile = { fg = fg, gui = 'underline' }, - NvimTreeMarkdownFile = { fg = fg, gui = 'underline' }, -} +if configuration.plugins_integrations.nvim_tree then + local nvim_tree = { + NvimTreeFolderName = { fg = light_bg and base9 or blue, gui = 'bold' }, + NvimTreeRootFolder = { fg = green }, + NvimTreeEmptyFolderName = { fg = fg_alt, gui = 'bold' }, + NvimTreeSymlink = { fg = fg, gui = 'underline' }, + NvimTreeExecFile = { fg = green, gui = 'bold' }, + NvimTreeImageFile = { fg = light_bg and orange or blue }, + NvimTreeOpenedFile = { fg = fg_alt }, + NvimTreeSpecialFile = { fg = fg, gui = 'underline' }, + NvimTreeMarkdownFile = { fg = fg, gui = 'underline' }, + } -apply_highlight(nvim_tree) -high_link('NvimTreeGitDirty', 'DiffModifiedGutter') -high_link('NvimTreeGitStaged', 'DiffModifiedGutter') -high_link('NvimTreeGitMerge', 'DiffModifiedGutter') -high_link('NvimTreeGitRenamed', 'DiffModifiedGutter') -high_link('NvimTreeGitNew', 'DiffAddedGutter') -high_link('NvimTreeGitDeleted', 'DiffRemovedGutter') + apply_highlight(nvim_tree) + high_link('NvimTreeGitDirty', 'DiffModifiedGutter') + high_link('NvimTreeGitStaged', 'DiffModifiedGutter') + high_link('NvimTreeGitMerge', 'DiffModifiedGutter') + high_link('NvimTreeGitRenamed', 'DiffModifiedGutter') + high_link('NvimTreeGitNew', 'DiffAddedGutter') + high_link('NvimTreeGitDeleted', 'DiffRemovedGutter') -high_link('NvimTreeIndentMarker', 'IndentGuide') -high_link('NvimTreeOpenedFolderName', 'NvimTreeFolderName') + high_link('NvimTreeIndentMarker', 'IndentGuide') + high_link('NvimTreeOpenedFolderName', 'NvimTreeFolderName') +end -- }}} -- Dashboard {{{ -local dashboard = { - dashboardHeader = { fg = '#586268' }, - dashboardCenter = { fg = light_bg and orange or blue }, - dashboardShortcut = { fg = '#9788b9' }, -} +if configuration.plugins_integrations.dashboard then + local dashboard = { + dashboardHeader = { fg = '#586268' }, + dashboardCenter = { fg = light_bg and orange or blue }, + dashboardShortcut = { fg = '#9788b9' }, + } -apply_highlight(dashboard) -high_link('dashboardFooter', 'dashboardHeader') + apply_highlight(dashboard) + high_link('dashboardFooter', 'dashboardHeader') +end -- }}} -- Startify {{{ -local startify = { - StartifyHeader = { fg = bg_popup }, - StartifyBracket = { fg = bg_popup }, - StartifyNumber = { fg = blue }, - StartifyPath = { fg = violet }, - StartifySlash = { fg = violet }, - StartifyFile = { fg = green }, -} +if configuration.plugins_integrations.startify then + local startify = { + StartifyHeader = { fg = bg_popup }, + StartifyBracket = { fg = bg_popup }, + StartifyNumber = { fg = blue }, + StartifyPath = { fg = violet }, + StartifySlash = { fg = violet }, + StartifyFile = { fg = green }, + } -apply_highlight(startify) + apply_highlight(startify) +end -- }}} -- WhichKey {{{ -local whichkey = { - WhichKey = { fg = light_bg and orange or blue }, - WhichKeyGroup = { fg = magenta }, - WhichKeyDesc = { fg = magenta }, - WhichKeySeparator = { fg = base5 }, - WhichKeyFloat = { bg = base2 }, - WhichKeyValue = { fg = grey }, -} +if configuration.plugins_integrations.whichkey then + local whichkey = { + WhichKey = { fg = light_bg and orange or blue }, + WhichKeyGroup = { fg = magenta }, + WhichKeyDesc = { fg = magenta }, + WhichKeySeparator = { fg = base5 }, + WhichKeyFloat = { bg = base2 }, + WhichKeyValue = { fg = grey }, + } -apply_highlight(whichkey) + apply_highlight(whichkey) +end -- }}} -- indent-blankline {{{ -local indent_blankline = { - IndentBlanklineChar = { - fg = base4, - cterm = 'nocombine', - gui = 'nocombine', - }, - IndentBlanklineContextChar = { - fg = blue, - cterm = 'nocombine', - gui = 'nocombine', - }, - IndentBlanklineSpaceChar = { - fg = base4, - cterm = 'nocombine', - gui = 'nocombine', - }, - IndentBlanklineSpaceCharBlankline = { - fg = base4, - cterm = 'nocombine', - gui = 'nocombine', - }, -} +if configuration.plugins_integrations.indent_blankline then + local indent_blankline = { + IndentBlanklineChar = { + fg = base4, + cterm = 'nocombine', + gui = 'nocombine', + }, + IndentBlanklineContextChar = { + fg = blue, + cterm = 'nocombine', + gui = 'nocombine', + }, + IndentBlanklineSpaceChar = { + fg = base4, + cterm = 'nocombine', + gui = 'nocombine', + }, + IndentBlanklineSpaceCharBlankline = { + fg = base4, + cterm = 'nocombine', + gui = 'nocombine', + }, + } -apply_highlight(indent_blankline) + apply_highlight(indent_blankline) +end -- }}} -local illuminated = { - illuminatedWord = { - cterm = 'underline', - gui = 'underline', - }, -} +-- vim-illuminate {{{ + +if configuration.plugins_integrations.vim_illuminate then + local illuminated = { + illuminatedWord = { + cterm = 'underline', + gui = 'underline', + }, + } + + apply_highlight(illuminated) +end -apply_highlight(illuminated) +-- }}} + +-- LspSaga {{{ + +if configuration.plugins_integrations.lspsaga then + local lspsaga = { + SagaShadow = { bg = bg }, + LspSagaDiagnosticHeader = { fg = red }, + } + + apply_highlight(lspsaga) + high_link('LspSagaDiagnosticBorder', 'Normal') + high_link('LspSagaDiagnosticTruncateLine', 'Normal') + high_link('LspFloatWinBorder', 'Normal') + high_link('LspSagaBorderTitle', 'Title') + high_link('TargetWord', 'Error') + high_link('ReferencesCount', 'Title') + high_link('ReferencesIcon', 'Special') + high_link('DefinitionCount', 'Title') + high_link('TargetFileName', 'Comment') + high_link('DefinitionIcon', 'Special') + high_link('ProviderTruncateLine', 'Normal') + high_link('LspSagaFinderSelection', 'Search') + high_link('DiagnosticTruncateLine', 'Normal') + high_link('DiagnosticError', 'LspDiagnosticsDefaultError') + high_link('DiagnosticWarn', 'LspDiagnosticsDefaultWarning') + high_link('DiagnosticInfo', 'LspDiagnosticsDefaultInformation') + high_link('DiagnosticHint', 'LspDiagnosticsDefaultHint') + high_link('DefinitionPreviewTitle', 'Title') + high_link('LspSagaShTruncateLine', 'Normal') + high_link('LspSagaDocTruncateLine', 'Normal') + high_link('LineDiagTuncateLine', 'Normal') + high_link('LspSagaCodeActionTitle', 'Title') + high_link('LspSagaCodeActionTruncateLine', 'Normal') + high_link('LspSagaCodeActionContent', 'Normal') + high_link('LspSagaRenamePromptPrefix', 'Normal') + high_link('LspSagaRenameBorder', 'Bold') + high_link('LspSagaHoverBorder', 'Bold') + high_link('LspSagaSignatureHelpBorder', 'Bold') + high_link('LspSagaCodeActionBorder', 'Bold') + high_link('LspSagaDefPreviewBorder', 'Bold') + high_link('LspLinesDiagBorder', 'Bold') +end + +-- }}} -- }}} @@ -829,53 +892,11 @@ high_link('healthError', 'ErrorMsg') high_link('healthSuccess', 'Msg') high_link('healthWarning', 'WarningMsg') --- LspSaga {{{ - -local lspsaga = { - SagaShadow = { bg = bg }, - LspSagaDiagnosticHeader = { fg = red }, -} - -apply_highlight(lspsaga) -high_link('LspSagaDiagnosticBorder', 'Normal') -high_link('LspSagaDiagnosticTruncateLine', 'Normal') -high_link('LspFloatWinBorder', 'Normal') -high_link('LspSagaBorderTitle', 'Title') -high_link('TargetWord', 'Error') -high_link('ReferencesCount', 'Title') -high_link('ReferencesIcon', 'Special') -high_link('DefinitionCount', 'Title') -high_link('TargetFileName', 'Comment') -high_link('DefinitionIcon', 'Special') -high_link('ProviderTruncateLine', 'Normal') -high_link('LspSagaFinderSelection', 'Search') -high_link('DiagnosticTruncateLine', 'Normal') -high_link('DiagnosticError', 'LspDiagnosticsDefaultError') -high_link('DiagnosticWarn', 'LspDiagnosticsDefaultWarning') -high_link('DiagnosticInfo', 'LspDiagnosticsDefaultInformation') -high_link('DiagnosticHint', 'LspDiagnosticsDefaultHint') -high_link('DefinitionPreviewTitle', 'Title') -high_link('LspSagaShTruncateLine', 'Normal') -high_link('LspSagaDocTruncateLine', 'Normal') -high_link('LineDiagTuncateLine', 'Normal') -high_link('LspSagaCodeActionTitle', 'Title') -high_link('LspSagaCodeActionTruncateLine', 'Normal') -high_link('LspSagaCodeActionContent', 'Normal') -high_link('LspSagaRenamePromptPrefix', 'Normal') -high_link('LspSagaRenameBorder', 'Bold') -high_link('LspSagaHoverBorder', 'Bold') -high_link('LspSagaSignatureHelpBorder', 'Bold') -high_link('LspSagaCodeActionBorder', 'Bold') -high_link('LspSagaDefPreviewBorder', 'Bold') -high_link('LspLinesDiagBorder', 'Bold') - --- }}} - -- }}} -- TreeSitter {{{ -if vim.g.doom_one_enable_treesitter then +if configuration.enable_treesitter then -- We will set a special definition for TSStrike here local treesitter = { TSStrike = { fg = utils.Darken(violet, 0.2), cterm = 'strikethrough', gui = 'strikethrough' }, @@ -931,7 +952,7 @@ end -- Neovim Terminal Colors {{{ -if vim.g.doom_one_terminal_colors then +if configuration.terminal_colors then vim.g.terminal_color_0 = bg vim.g.terminal_color_1 = red vim.g.terminal_color_2 = green @@ -953,3 +974,5 @@ if vim.g.doom_one_terminal_colors then end -- }}} + +return doom_one diff --git a/lua/colors/doom-one/utils/init.lua b/lua/colors/doom-one/utils/init.lua new file mode 100644 index 000000000..111c0e7c4 --- /dev/null +++ b/lua/colors/doom-one/utils/init.lua @@ -0,0 +1,109 @@ +---[[------------------------]]--- +-- COLOR UTILITIES -- +---]]------------------------[[--- + +local M = {} + +------------------------------------------------------------------------------- +-- Functions {{{ + +-- Convert RGB to Hex color. +-- @param r Red value +-- @param g Green value +-- @param b Blue value +-- @return HEX color, e.g. '#1E1E1E' +local function RGB_to_Hex(r, g, b) + return '#' .. string.format('%02X%02X%02X', r, g, b) +end + +-- Convert Hex to RGB color. +-- @param color HEX color +-- @return RGB color, e.g. {30, 30, 30} +local function Hex_to_RGB(color) + color = color:gsub('#', '') + return { + tonumber('0x' .. string.sub(color, 1, 2)), + tonumber('0x' .. string.sub(color, 3, 4)), + tonumber('0x' .. string.sub(color, 5, 6)), + } +end + +-- }}} +------------------------------------------------------------------------------- +-- Composed functions {{{ + +M.Lighten = function(color, percentage) + local amount = percentage == nil and 5.0 or percentage + + if amount < 1.0 then + amount = 1.0 + amount + else + amount = 1.0 + (amount / 100.0) + end + + -- Let's pass amount variable to Neovim so we can use + -- the Neovim map function + vim.g.amount = amount + + local rgb = Hex_to_RGB(color) + rgb = vim.fn.map(rgb, 'v:val * amount') + -- Let's delete the g:amount variable since we don't need it anymore + vim.cmd('unlet g:amount') + + rgb = vim.fn.map(rgb, 'v:val > 255.0 ? 255.0 : v:val') + rgb = vim.fn.map(rgb, 'float2nr(v:val)') + local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) + + return hex +end + +M.Darken = function(color, percentage) + local amount = percentage == nil and 5.0 or percentage + + if amount < 1.0 then + amount = 1.0 - amount + else + amount = 1.0 - (amount / 100.0) + end + if amount < 0.0 then + amount = 0.0 + end + + -- Let's pass amount variable to Neovim so we can use + -- the Neovim map function + vim.g.amount = amount + + local rgb = Hex_to_RGB(color) + rgb = vim.fn.map(rgb, 'v:val * amount') + -- Let's delete the g:amount variable since we don't need it anymore + vim.cmd('unlet g:amount') + + rgb = vim.fn.map(rgb, 'v:val > 255.0 ? 255.0 : v:val') + rgb = vim.fn.map(rgb, 'float2nr(v:val)') + local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) + + return hex +end + +local function interpolate(start, _end, amount) + local diff = _end - start + return start + (diff * amount) +end + +M.Mix = function(first, second, percentage) + local amount = percentage == nil and 0.0 or percentage + + local first_rgb = Hex_to_RGB(first) + local second_rgb = Hex_to_RGB(second) + + local r = interpolate(first_rgb[1], second_rgb[1], amount) + local g = interpolate(first_rgb[2], second_rgb[2], amount) + local b = interpolate(first_rgb[3], second_rgb[3], amount) + + return RGB_to_Hex(r, g, b) +end +-- }}} + +return M + +-- vim: fdm=marker diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua index b80d7a350..fc7009046 100644 --- a/lua/doom/core/config/ui.lua +++ b/lua/doom/core/config/ui.lua @@ -39,14 +39,29 @@ end vim.cmd("highlight WhichKeyFloat guibg=" .. config.doom.whichkey_bg) -- Set doom-one colorscheme settings -local doom_one_options = { - "cursor_coloring", - "enable_treesitter", - "italic_comments", - "telescope_highlights", - "terminal_colors", - "transparent_background", -} -for _, option in ipairs(doom_one_options) do - vim.g["doom_one_" .. option] = config.doom.doom_one[option] -end +require("colors.doom-one").setup({ + cursor_coloring = config.doom.doom_one.cursor_coloring, + terminal_colors = config.doom.doom_one.terminal_colors, + italic_comments = config.doom.doom_one.italic_comments, + enable_treesitter = config.doom.doom_one.enable_treesitter, + transparent_background = config.doom.doom_one.transparent_background, + pumblend = { + enable = true, + transparency_amount = 20, + }, + plugins_integrations = { + barbar = false, + bufferline = true, + gitgutter = false, + gitsigns = true, + telescope = config.doom.doom_one.telescope_highlights, + neogit = true, + nvim_tree = true, + dashboard = true, + startify = false, + whichkey = true, + indent_blankline = true, + vim_illuminate = true, + lspsaga = false, + }, +}) From e4c47f9b98db4c973a32acd495af3214ad3adca3 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 02:15:29 -0400 Subject: [PATCH 132/290] fix(modules): use `0.5-compat` treesitter branch in Neovim 0.5 --- lua/doom/modules/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index e0d098e92..07dd729a1 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -52,6 +52,7 @@ packer.startup(function(use) "nvim-treesitter/nvim-treesitter", opt = true, run = ":TSUpdate", + branch = vim.fn.has("nvim-0.6.0") == 1 and "master" or "0.5-compat", config = require("doom.modules.config.doom-treesitter"), }) use({ From efbbbe3b69c142ed1a59c6161e0e47497f0d41a7 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Wed, 6 Oct 2021 02:47:51 -0400 Subject: [PATCH 133/290] docs(README): add Discord server badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f75bba48a..1f6397f27 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ ![Latest Release](https://img.shields.io/github/v/release/NTBBloodbath/doom-nvim?include_prereleases&style=for-the-badge&color=red) ![GitHub last commit (branch)](https://img.shields.io/github/last-commit/NTBBloodbath/doom-nvim/develop?style=for-the-badge) ![Neovim version](https://img.shields.io/badge/Neovim-0.5-57A143?style=for-the-badge&logo=neovim) +[![Discord](https://img.shields.io/badge/discord-join-7289da?style=for-the-badge&logo=discord)](https://discord.gg/xhvBM45zBf) [![All Contributors](https://img.shields.io/badge/all_contributors-14-orange.svg?style=flat-square)](#contributors-) From 80adc804693a494fd206fb9b58e50851c56660fb Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 03:09:57 -0400 Subject: [PATCH 134/290] feat(info): use `q` key to close info dashboard --- lua/doom/modules/built-in/info/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 46fd4c376..1a44b9039 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -607,6 +607,9 @@ info.open = function() fold = " ", -- supress dots between folds info } + -- Set the buffer keybinds + vim.api.nvim_buf_set_keymap(info_buffer, "n", "q", "bdelete", { noremap = true, silent = true }) + -- Set the buffer syntax set_syntax_highlighting(info_buffer) end From 530921edaa7ec798f7d1a629481faf433e225df6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 6 Oct 2021 07:10:23 +0000 Subject: [PATCH 135/290] chore: format source code --- lua/doom/modules/built-in/info/init.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 1a44b9039..398c650e2 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -608,7 +608,13 @@ info.open = function() } -- Set the buffer keybinds - vim.api.nvim_buf_set_keymap(info_buffer, "n", "q", "bdelete", { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap( + info_buffer, + "n", + "q", + "bdelete", + { noremap = true, silent = true } + ) -- Set the buffer syntax set_syntax_highlighting(info_buffer) From d4406b2b97a6f9de70077fffa59fb50e081427d6 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 05:15:27 -0400 Subject: [PATCH 136/290] feat(autocmds): run `PackerCompile` on exit when Doom modules or userplugins files were modified, closes #133 --- lua/doom/extras/autocmds/init.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 2eeb5eb71..f8aa95dcb 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -13,10 +13,17 @@ log.debug("Loading Doom autocmds module ...") local autocmds = { doom_core = { - -- Compile new plugins changes at save + -- Compile new plugins configurations changes at save { "BufWritePost", - "*/config/doom-*.lua,doom_modules.lua,doom_userplugins.lua", + "*/config/doom-*.lua", + "PackerCompile profile=true", + }, + -- Compile modules and custom plugins changes at exit, in that way we avoid + -- weird errors of Packer complaining about uninstalled plugins + { + "VimLeavePre", + "doom_modules.lua,doom_userplugins.lua", "PackerCompile profile=true", }, -- Live-reload user-defined settings when 'doom_config.lua' file was modified From fb7698944783585ef2da4f998070fdf23733cf8b Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 05:30:56 -0400 Subject: [PATCH 137/290] refact(reloader): accept reloading any module --- lua/doom/extras/autocmds/init.lua | 2 +- lua/doom/modules/built-in/reloader/init.lua | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index f8aa95dcb..e3bd69e2b 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -36,7 +36,7 @@ local autocmds = { { "BufWritePost", "*/config/doom-*.lua", - "lua require('doom.modules.built-in.reloader').reload_plugin_config(vim.fn.expand('%:p'))", + "lua require('doom.modules.built-in.reloader').reload_lua_module(vim.fn.expand('%:p'))", }, -- Automatically change colorscheme and background on exit { diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index 6bc6302ef..83187d93c 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -1,9 +1,9 @@ --- @class Reloader local reloader = {} ---- Reload a plugin configuration module +--- Reload a Lua module --- @param mod_path string The configuration module path -reloader.reload_plugin_config = function(mod_path) +reloader.reload_lua_module = function(mod_path) -- Remove the Neovim config dir and the file extension from the path, -- also replace '/' with '.' so we can access the modules by using package table -- e.g. doom.modules.config.doom-neorg @@ -11,12 +11,15 @@ reloader.reload_plugin_config = function(mod_path) -- Get the module from package table local mod = package.loaded[mod_path] - if type(mod) == "function" then + if type(mod) ~= "nil" then -- Unload the module and load it again package.loaded[mod_path] = nil require(mod_path) - -- Call the loaded module function so the reloading will take effect as expected - package.loaded[mod_path]() + + if type(mod) == "function" then + -- Call the loaded module function so the reloading will take effect as expected + package.loaded[mod_path]() + end require("doom.extras.logging").info( string.format("Successfully reloaded '%s' module", mod_path) From 21b30275a27e95cf61bb79ef08b94356b8725ba4 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 06:34:19 -0400 Subject: [PATCH 138/290] feat(reloader): add optional `quiet` param, sometimes I want it to be a ninja --- lua/doom/modules/built-in/reloader/init.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index 83187d93c..faf6ac358 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -3,7 +3,8 @@ local reloader = {} --- Reload a Lua module --- @param mod_path string The configuration module path -reloader.reload_lua_module = function(mod_path) +--- @param quiet boolean If the reloader should send an info log or not +reloader.reload_lua_module = function(mod_path, quiet) -- Remove the Neovim config dir and the file extension from the path, -- also replace '/' with '.' so we can access the modules by using package table -- e.g. doom.modules.config.doom-neorg @@ -21,9 +22,11 @@ reloader.reload_lua_module = function(mod_path) package.loaded[mod_path]() end - require("doom.extras.logging").info( - string.format("Successfully reloaded '%s' module", mod_path) - ) + if not quiet then + require("doom.extras.logging").info( + string.format("Successfully reloaded '%s' module", mod_path) + ) + end else require("doom.extras.logging").error(string.format("Failed to reload '%s' module", mod_path)) end From 0623858bb0377da5bfe4f0825954cc8e00e7adbb Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 06:36:34 -0400 Subject: [PATCH 139/290] feat: automatically install or uninstall plugins on save in plugins files (experimental but tested and working) - Fix an annoying bug with `PackerClean` that I was facing sometimes - Delay a bit more the installation of plugins on launch --- lua/doom/core/functions/init.lua | 28 ++++++++++++++++++++++++++++ lua/doom/extras/autocmds/init.lua | 18 ++++++++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 7e822a0c4..68492e26f 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -99,6 +99,34 @@ M.reload_custom_settings = function() end end +--- Reload the plugins definitions modules like doom_modules.lua to automatically +--- install or uninstall plugins on changes +M.reload_plugins_definitions = function() + local reload = require("doom.modules.built-in.reloader").reload_lua_module + -- Silently reload plugins modules + reload("doom.core.config.modules", true) + reload("doom.core.config.userplugins", true) + reload("doom.modules", true) + + -- Cleanup disabled plugins + vim.cmd("PackerClean") + -- Defer the installation of new plugins to avoid a weird bug where packer + -- tries to clean the plugins that are being installed right now + vim.defer_fn(function() + vim.cmd("PackerInstall") + end, 200) + vim.defer_fn(function() + -- Compile plugins changes and simulate a new Neovim launch + -- to load recently installed plugins + -- NOTE: this won't work to live disable uninstalled plugins, + -- they will keep working until you relaunch Neovim + vim.cmd([[ + PackerCompile + doautocmd VimEnter + ]]) + end, 800) +end + -- Change the 'doom_config.lua' file configurations for the colorscheme and the -- background if they were changed by the user within Neovim M.change_colors_and_bg = function() diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index e3bd69e2b..f952b5d2b 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -20,12 +20,18 @@ local autocmds = { "PackerCompile profile=true", }, -- Compile modules and custom plugins changes at exit, in that way we avoid - -- weird errors of Packer complaining about uninstalled plugins + -- weird errors of Packer complaining about uninstalled plugins on startup { "VimLeavePre", "doom_modules.lua,doom_userplugins.lua", "PackerCompile profile=true", }, + -- Live-reload plugins and automatically install or clean them at save + { + "BufWritePost", + "doom_modules.lua,doom_userplugins.lua", + "lua require('doom.core.functions').reload_plugins_definitions()", + }, -- Live-reload user-defined settings when 'doom_config.lua' file was modified { "BufWritePost", @@ -80,10 +86,14 @@ if config.doom.auto_install_plugins then else -- Clean disabled plugins vim.cmd("PackerClean") - -- Install the plugins - vim.cmd("PackerInstall") + -- Defer the installation of new plugins to avoid a weird bug where packer + -- tries to clean the plugins that are being installed right now + vim.defer_fn(function() + -- Install the plugins + vim.cmd("PackerInstall") + end, 200) end - end, 200) + end, 400) end -- Set autosave From 04579eded25d57d36b03087628ae37dace9c0d32 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 06:40:25 -0400 Subject: [PATCH 140/290] refact: move `reload_plugins_definitions` to reloader module --- lua/doom/core/functions/init.lua | 28 --------------------- lua/doom/extras/autocmds/init.lua | 2 +- lua/doom/modules/built-in/reloader/init.lua | 27 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 68492e26f..7e822a0c4 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -99,34 +99,6 @@ M.reload_custom_settings = function() end end ---- Reload the plugins definitions modules like doom_modules.lua to automatically ---- install or uninstall plugins on changes -M.reload_plugins_definitions = function() - local reload = require("doom.modules.built-in.reloader").reload_lua_module - -- Silently reload plugins modules - reload("doom.core.config.modules", true) - reload("doom.core.config.userplugins", true) - reload("doom.modules", true) - - -- Cleanup disabled plugins - vim.cmd("PackerClean") - -- Defer the installation of new plugins to avoid a weird bug where packer - -- tries to clean the plugins that are being installed right now - vim.defer_fn(function() - vim.cmd("PackerInstall") - end, 200) - vim.defer_fn(function() - -- Compile plugins changes and simulate a new Neovim launch - -- to load recently installed plugins - -- NOTE: this won't work to live disable uninstalled plugins, - -- they will keep working until you relaunch Neovim - vim.cmd([[ - PackerCompile - doautocmd VimEnter - ]]) - end, 800) -end - -- Change the 'doom_config.lua' file configurations for the colorscheme and the -- background if they were changed by the user within Neovim M.change_colors_and_bg = function() diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index f952b5d2b..033a274f8 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -30,7 +30,7 @@ local autocmds = { { "BufWritePost", "doom_modules.lua,doom_userplugins.lua", - "lua require('doom.core.functions').reload_plugins_definitions()", + "lua require('doom.modules.built-in.reloader').reload_plugins_definitions()", }, -- Live-reload user-defined settings when 'doom_config.lua' file was modified { diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index faf6ac358..d50bb305e 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -32,4 +32,31 @@ reloader.reload_lua_module = function(mod_path, quiet) end end +--- Reload the plugins definitions modules like doom_modules.lua to automatically +--- install or uninstall plugins on changes +reloader.reload_plugins_definitions = function() + -- Silently reload plugins modules + reloader.reload_lua_module("doom.core.config.modules", true) + reloader.reload_lua_module("doom.core.config.userplugins", true) + reloader.reload_lua_module("doom.modules", true) + + -- Cleanup disabled plugins + vim.cmd("PackerClean") + -- Defer the installation of new plugins to avoid a weird bug where packer + -- tries to clean the plugins that are being installed right now + vim.defer_fn(function() + vim.cmd("PackerInstall") + end, 200) + vim.defer_fn(function() + -- Compile plugins changes and simulate a new Neovim launch + -- to load recently installed plugins + -- NOTE: this won't work to live disable uninstalled plugins, + -- they will keep working until you relaunch Neovim + vim.cmd([[ + PackerCompile + doautocmd VimEnter + ]]) + end, 800) +end + return reloader From a1458360eb9ab4ee7a34d4d0b52706400cdc4af9 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 07:06:46 -0400 Subject: [PATCH 141/290] feat(lsp): add `packer_plugins` to sumneko globals --- lua/doom/modules/config/doom-lspinstall.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 910dcab56..52dc8f4c8 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -118,6 +118,9 @@ return function() workspace = { preloadFileSize = 200, }, + diagnostics = { + globals = { "packer_plugins" }, + } }, }, capabilities = capabilities, From 2e99b687029c5b13a69457627764a5c10b3d5af1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 6 Oct 2021 11:07:08 +0000 Subject: [PATCH 142/290] chore: format source code --- lua/doom/modules/config/doom-lspinstall.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 52dc8f4c8..700235d55 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -120,7 +120,7 @@ return function() }, diagnostics = { globals = { "packer_plugins" }, - } + }, }, }, capabilities = capabilities, From ddb3cf6a79794ea6d7244dafa92bed5b1ea7ea52 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 18:47:31 -0400 Subject: [PATCH 143/290] feat(init): document why we use a `defer_fn` --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 40cef49d1..0a5964bcd 100644 --- a/init.lua +++ b/init.lua @@ -23,6 +23,8 @@ vim.g.loaded_2html_plugin = false -- Load Doom core and UI related stuff (colorscheme, background) load_modules("doom", { "core" }) +-- Defer and schedule loading of plugins and extra functionalities until the +-- Neovim API functions are safe to call to avoid weird errors with plugins stuff vim.defer_fn(function() -- Load Doom extra stuff and plugins (modules, extras) load_modules("doom", { "modules", "extras" }) From 88b4c64b0aa47ff6213fcf722b2195ec8ee2fd73 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 20:32:47 -0400 Subject: [PATCH 144/290] feat(lint): let user choose the linters, closes #125 --- doom_config.lua | 21 +++++++++++++++++++-- lua/doom/modules/config/doom-lint.lua | 26 ++++++++++++++------------ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 716c75536..c4c1b11f9 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -325,18 +325,35 @@ M.config = { guifont = "FiraCode Nerd Font", guifont_size = "15", - -- change Which Key background color + -- Change Which Key background color -- can use hex, or normal color names (eg: Red, Gree, Blue) -- @default = #202328 whichkey_bg = "#202328", - -- set your custom lsp diagnostic symbols below + -- Set your custom lsp diagnostic symbols below lsp_error = "", lsp_warning = "", lsp_hint = "", lsp_information = "", lsp_virtual_text = " ", + -- Set your linters for the programming languages that you use, + -- see https://github.com/mfussenegger/nvim-lint#available-linters + linters = { + c = {}, + cpp = {}, + css = {}, + html = {}, + javascript = {}, + lua = {}, + markdown = {}, + nix = {}, + python = {}, + ruby = {}, + sh = {}, + typescript = {}, + }, + -- Set your dashboard custom colors below -- @default = doom emacs' default dashboard colors dashboard_custom_colors = { diff --git a/lua/doom/modules/config/doom-lint.lua b/lua/doom/modules/config/doom-lint.lua index 7a011ed49..34de56abb 100644 --- a/lua/doom/modules/config/doom-lint.lua +++ b/lua/doom/modules/config/doom-lint.lua @@ -1,16 +1,18 @@ return function() + local linters = require("doom.core.config").config.doom.linters + require("lint").linters_by_ft = { - c = { "clangtidy" }, - cpp = { "cppcheck" }, - css = { "stylelint" }, - html = { "tidy", "eslint" }, - javascript = { "eslint" }, - lua = { "luacheck" }, - markdown = { "vale", "markdownlint" }, - nix = { "nix" }, - python = { "pylint", "flake8", "pycodestyle" }, - ruby = { "ruby", "standardrb" }, - sh = { "shellcheck" }, - typescript = { "eslint" }, + c = linters.c, + cpp = linters.cpp, + css = linters.css, + html = linters.html, + javascript = linters.javascript, + lua = linters.lua, + markdown = linters.markdown, + nix = linters.nix, + python = linters.python, + ruby = linters.ruby, + sh = linters.sh, + typescript = linters.typescript, } end From d2a5f1a28e89b1d072a502fd09378fad64f62bcf Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 20:33:06 -0400 Subject: [PATCH 145/290] feat(config): update default configs for fallback --- lua/doom/core/config/init.lua | 65 ++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index a4132814e..a5964c6d2 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -47,8 +47,8 @@ M.config = { -- Disable Vim macros -- false : Enable Vim macros -- true : Disable Vim macros - -- @default = true - disable_macros = true, + -- @default = false + disable_macros = false, -- Autosave sessions -- false : Disable session autosave @@ -229,6 +229,14 @@ M.config = { completion = true, }, + -- Disable or enable Doom autocommands, this can break some configuration options (they will stop working) + -- e.g. preserve_edit_pos or autosave + -- + -- false : enable autocommands module + -- true : disable autocommands module + -- @default = false + disable_autocommands = false, + -- Default indent size -- @default = 4 indent = 4, @@ -294,7 +302,7 @@ M.config = { terminal_direction = "horizontal", -- NOTE: This will only be activated if 'backup' is true. - -- We don'recommend you put this outside of neovim so we've restricted to thepath: ~/.config/nvim + -- We don'recommend you put this outside of neovim so we've restricted to the path: ~/.config/nvim -- WARNING: only put the folder name that you want. (eg: undo_dir = '/undodir') -- @default_directory = '~/.config/nvim/undodir' undo_dir = "/undodir", @@ -336,18 +344,35 @@ M.config = { guifont = "FiraCode Nerd Font", guifont_size = "15", - -- change Which Key background color + -- Change Which Key background color -- can use hex, or normal color names (eg: Red, Gree, Blue) -- @default = #202328 whichkey_bg = "#202328", - -- set your custom lsp diagnostic symbols below + -- Set your custom lsp diagnostic symbols below lsp_error = "", lsp_warning = "", lsp_hint = "", lsp_information = "", lsp_virtual_text = " ", + -- Set your linters for the programming languages that you use, + -- see https://github.com/mfussenegger/nvim-lint#available-linters + linters = { + c = {}, + cpp = {}, + css = {}, + html = {}, + javascript = {}, + lua = {}, + markdown = {}, + nix = {}, + python = {}, + ruby = {}, + sh = {}, + typescript = {}, + }, + -- Set your dashboard custom colors below -- @default = doom emacs' default dashboard colors dashboard_custom_colors = { @@ -368,7 +393,16 @@ M.config = { -- Set custom Neovim global variables -- @default = {} -- example: - -- { ['sonokai_style'] = 'andromeda' } + -- { + -- ['sonokai_style'] = 'andromeda', + -- ['modelineexpr'] = true, + -- } + -- + -- modeline feature was turned off to reduce security exploit surfaces. + -- Since modeline now uses whitelist approach since nvim 0.4 /vim 8.1, + -- enabling this is as safe as external packages such as securemodelines. + -- See https://github.com/neovim/neovim/issues/2865 + -- global_variables = {}, -- Set custom autocommands @@ -406,11 +440,24 @@ M.config = { -- @default = {} -- example: -- { - -- hello_custom_func = function() - -- print("Hello, custom functions!") - -- end + -- { + -- hello_custom_func = function() + -- print("Hello, custom functions!") + -- end, + -- -- If the function should be ran on neovim launch or if it should + -- -- be a global function accesible from anywhere + -- run_on_start = false, + -- }, -- } functions = {}, + + -- Set custom options + -- @default = {} + -- example: + -- { + -- { ['shiftwidth'] = 4 } + -- } + options = {}, }, -- }}} } From a9678ee5425e48ad3e1ec40549926f422267b725 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 21:21:43 -0400 Subject: [PATCH 146/290] fix(modules): `ColorScheme` event was not triggering some plugins --- lua/doom/modules/init.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 07dd729a1..d3f9c44b9 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -109,7 +109,6 @@ packer.startup(function(use) use({ "GustavoPrietoP/doom-themes.nvim", disable = disabled_doom_themes, - event = "ColorSchemePre", }) -- Development icons @@ -480,7 +479,7 @@ packer.startup(function(use) "lukas-reineke/indent-blankline.nvim", config = require("doom.modules.config.doom-blankline"), disable = disabled_indent_lines, - event = "ColorScheme", + event = "BufWinEnter", }) -- EditorConfig support @@ -520,7 +519,7 @@ packer.startup(function(use) "norcalli/nvim-colorizer.lua", config = require("doom.modules.config.doom-colorizer"), disable = disabled_colorizer, - event = "ColorScheme", + event = "BufWinEnter", }) -- HTTP Client support @@ -565,7 +564,7 @@ packer.startup(function(use) requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), disable = disabled_todo, - event = "ColorScheme", + event = "BufWinEnter", }) local disabled_trouble = is_plugin_disabled("trouble") From 634b3107e6b6cccc65d67ce0239df076783215d6 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 21:29:08 -0400 Subject: [PATCH 147/290] feat: set indentation options in Doom config files --- doom_config.lua | 2 +- doom_modules.lua | 2 ++ doom_userplugins.lua | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doom_config.lua b/doom_config.lua index c4c1b11f9..9f5ebbb17 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -445,4 +445,4 @@ M.config = { return M --- vim: fdm=marker +-- vim: sw=2 sts=2 ts=2 fdm=marker noexpandtab diff --git a/doom_modules.lua b/doom_modules.lua index d0c614fa2..5541ce963 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -93,3 +93,5 @@ M.modules = { } return M + +-- vim: sw=2 sts=2 ts=2 noexpandtab diff --git a/doom_userplugins.lua b/doom_userplugins.lua index 513e478ee..075ea8bfc 100644 --- a/doom_userplugins.lua +++ b/doom_userplugins.lua @@ -16,3 +16,5 @@ M.source = debug.getinfo(1, "S").source:sub(2) M.plugins = {} return M + +-- vim: sw=2 sts=2 ts=2 noexpandtab From 338bf2f6df9105a48c2ad1241806ae734453399c Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 21:47:03 -0400 Subject: [PATCH 148/290] feat(doom-one): pull upstream changes --- colors/doom-one.lua | 2 +- lua/colors/doom-one/init.lua | 1468 +++++++++++++++++----------------- 2 files changed, 738 insertions(+), 732 deletions(-) diff --git a/colors/doom-one.lua b/colors/doom-one.lua index 79c0eebac..c2ceb3903 100644 --- a/colors/doom-one.lua +++ b/colors/doom-one.lua @@ -6,4 +6,4 @@ end vim.g["colors_name"] = "doom-one" package.loaded["colors.doom-one"] = nil -require("colors.doom-one") +require("colors.doom-one").load_colorscheme() diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua index 89e65d5e3..6739f1a6b 100644 --- a/lua/colors/doom-one/init.lua +++ b/lua/colors/doom-one/init.lua @@ -14,16 +14,18 @@ local config = require('colors.doom-one.config') -- }}} --- Customization variables {{{ - local configuration = config.get() --- Establish the user configurations --- @param user_configs table doom_one.setup = function(user_configs) configuration = config.set(user_configs or {}) + -- Reload colorscheme with user configurations override + doom_one.load_colorscheme() end +-- Customization variables {{{ + local transparent_bg = configuration.transparent_background if configuration.cursor_coloring then @@ -204,775 +206,779 @@ end -- }}} --- General UI {{{ - -local general_ui = { - Normal = { fg = fg, bg = transparent_bg and 'NONE' or bg }, - NormalPopup = { - fg = fg_highlight, - bg = transparent_bg and 'NONE' or bg_popup, - }, - NormalPopover = { - fg = fg_highlight, - bg = transparent_bg and 'NONE' or bg_popup, - }, - NormalPopupPrompt = { - fg = base7, - bg = transparent_bg and 'NONE' or utils.Darken(bg_popup, 0.3), - gui = 'bold', - }, - NormalPopupSubtle = { - fg = base6, - bg = transparent_bg and 'NONE' or bg_popup, - }, - EndOfBuffer = { fg = bg, bg = transparent_bg and 'NONE' or bg }, - - Visual = { bg = dark_blue }, - VisualBold = { bg = dark_blue, gui = 'bold' }, - - LineNr = { fg = grey, bg = transparent_bg and 'NONE' or bg }, - Cursor = { bg = blue }, - CursorLine = { bg = bg_highlight }, - CursorLineNr = { fg = fg, bg = bg_highlight }, - CursorColumn = { bg = bg_highlight }, - - Folded = { fg = base5, bg = bg_highlight }, - FoldColumn = { fg = fg_alt, bg = bg }, - SignColumn = { bg = transparent_bg and 'NONE' or bg }, - ColorColumn = { bg = bg_highlight }, - - IndentGuide = { fg = grey }, - IndentGuideEven = { fg = grey }, - IndentGuideOdd = { fg = grey }, - - TermCursor = { fg = fg, gui = 'reverse' }, - TermCursorNC = { fg = fg_alt, gui = 'reverse' }, - TermNormal = { fg = fg, bg = bg }, - TermNormalNC = { fg = fg, bg = bg }, - - WildMenu = { fg = fg, bg = dark_blue }, - Separator = { fg = fg_alt }, - VertSplit = { fg = grey, bg = bg }, - - TabLine = { - fg = base7, - bg = bg_alt, - gui = 'bold', - }, - TabLineSel = { fg = blue, bg = bg, gui = 'bold' }, - TabLineFill = { bg = base1, gui = 'bold' }, - - StatusLine = { fg = base8, bg = base3 }, - StatusLineNC = { fg = base6, bg = bg_popup }, - StatusLinePart = { fg = base6, bg = bg_popup, gui = 'bold' }, - StatusLinePartNC = { fg = base6, bg = bg_popup, gui = 'bold' }, - - Pmenu = { fg = fg, bg = bg_highlight }, - PmenuSel = { fg = base0, bg = blue }, - PmenuSelBold = { fg = base0, bg = blue, gui = 'bold' }, - PmenuSbar = { bg = bg_alt }, - PmenuThumb = { bg = fg }, -} - -if vim.opt.pumblend == 1 then - vim.opt.pumblend = 20 -end - -apply_highlight(general_ui) - --- }}} - --- Search, Highlight. Conceal, Messages {{{ - -local search_high_ui = { - Search = { fg = fg, bg = dark_blue, gui = 'bold' }, - Substitute = { fg = red, gui = 'strikethrough,bold' }, - IncSearch = { fg = fg, bg = dark_blue, gui = 'bold' }, - IncSearchCursor = { gui = 'reverse' }, - - Conceal = { fg = grey, gui = 'none' }, - SpecialKey = { fg = violet, gui = 'bold' }, - NonText = { fg = fg_alt, gui = 'bold' }, - MatchParen = { fg = red, gui = 'bold' }, - Whitespace = { fg = grey }, - - Highlight = { bg = bg_highlighted }, - HighlightSubtle = { bg = bg_highlighted }, - - Question = { fg = green, gui = 'bold' }, - - File = { fg = fg }, - Directory = { fg = violet, gui = 'bold' }, - Title = { fg = violet, gui = 'bold' }, - - Bold = { gui = 'bold' }, - Emphasis = { fg = green, gui = 'bold' }, -} - -apply_highlight(search_high_ui) - --- }}} - --- Text levels {{{ - -local text_colors = { - Normal = fg, - Info = blue, - Success = green, - Warning = yellow, - Debug = yellow, - Error = red, - Special = violet, - Muted = base7, -} - -for key, _ in pairs(text_colors) do - apply_highlight({ - ['Text' .. key] = { - fg = text_colors[key], - }, - }) - apply_highlight({ - ['Text' .. key .. 'Bold'] = { - fg = text_colors[key], - gui = 'bold', - }, - }) -end - -high_link('Msg', 'TextSuccess') -high_link('MoreMsg', 'TextInfo') -high_link('WarningMsg', 'TextWarning') -high_link('Error', 'TextError') -high_link('ErrorMsg', 'TextError') -high_link('ModeMsg', 'TextSpecial') -high_link('Todo', 'TextWarningBold') - --- }}} - --- Main Syntax {{{ - -local main_syntax = { - Tag = { fg = tag, gui = 'bold' }, - Link = { fg = green, gui = 'underline' }, - URL = { fg = green, gui = 'underline' }, - Underlined = { fg = tag, gui = 'underline' }, - - Comment = { - fg = fg_alt, - gui = configuration.italic_comments and 'italic' or 'NONE', - }, - CommentBold = { fg = fg_alt, gui = 'bold' }, - SpecialComment = { fg = base7, gui = 'bold' }, - - Macro = { fg = violet }, - Define = { fg = violet, gui = 'bold' }, - Include = { fg = violet, gui = 'bold' }, - PreProc = { fg = violet, gui = 'bold' }, - PreCondit = { fg = violet, gui = 'bold' }, - - Label = { fg = light_bg and orange or blue }, - Repeat = { fg = light_bg and orange or blue }, - Keyword = { fg = light_bg and orange or blue }, - Operator = { fg = light_bg and orange or blue }, - Delimiter = { fg = light_bg and orange or blue }, - Statement = { fg = light_bg and orange or blue }, - Exception = { fg = light_bg and orange or blue }, - Conditional = { fg = light_bg and orange or blue }, - - Variable = { fg = '#8B93E6' }, - VariableBuiltin = { fg = '#8B93E6', gui = 'bold' }, - Constant = { fg = violet, gui = 'bold' }, - - Number = { fg = light_bg and yellow or orange }, - Float = { fg = light_bg and yellow or orange }, - Boolean = { fg = light_bg and yellow or orange, gui = 'bold' }, - Enum = { fg = light_bg and yellow or orange }, - - Character = { fg = violet, gui = 'bold' }, - SpecialChar = { fg = base8, gui = 'bold' }, - - String = { fg = green }, - StringDelimiter = { fg = green }, - - Special = { fg = violet }, - SpecialBold = { fg = violet, gui = 'bold' }, - - Field = { fg = violet }, - Argument = { fg = light_magenta }, - Attribute = { fg = light_magenta }, - Identifier = { fg = light_magenta }, - Property = { fg = magenta }, - Function = { fg = magenta }, - FunctionBuiltin = { fg = light_magenta, gui = 'bold' }, - KeywordFunction = { fg = light_bg and orange or blue }, - Method = { fg = violet }, - - Type = { fg = yellow }, - TypeBuiltin = { fg = yellow, gui = 'bold' }, - StorageClass = { fg = light_bg and orange or blue }, - Class = { fg = light_bg and orange or blue }, - Structure = { fg = light_bg and orange or blue }, - Typedef = { fg = light_bg and orange or blue }, - - Regexp = { fg = '#dd0093' }, - RegexpSpecial = { fg = '#a40073' }, - RegexpDelimiter = { fg = '#540063', gui = 'bold' }, - RegexpKey = { fg = '#5f0041', gui = 'bold' }, -} - -apply_highlight(main_syntax) -high_link('CommentURL', 'URL') -high_link('CommentLabel', 'CommentBold') -high_link('CommentSection', 'CommentBold') -high_link('Noise', 'Comment') - --- }}} - --- Diff {{{ - -local diff = { - diffLine = { fg = base8, bg = diff_info_bg1 }, - diffSubName = { fg = base8, bg = diff_info_bg1 }, - - DiffAdd = { bg = diff_add_bg1 }, - DiffChange = { bg = diff_add_bg1 }, - DiffText = { bg = diff_add_bg0 }, - DiffDelete = { bg = gh_danger_bg0 }, - - DiffAdded = { fg = diff_add_fg0, bg = diff_add_bg1 }, - DiffModified = { fg = fg, bg = diff_info_bg0 }, - DiffRemoved = { fg = gh_danger_fg0, bg = gh_danger_bg1 }, - - DiffAddedGutter = { fg = diff_add_fg, gui = 'bold' }, - DiffModifiedGutter = { fg = diff_info_fg, gui = 'bold' }, - DiffRemovedGutter = { fg = gh_danger_fg, gui = 'bold' }, - - DiffAddedGutterLineNr = { fg = grey }, - DiffModifiedGutterLineNr = { fg = grey }, - DiffRemovedGutterLineNr = { fg = grey }, -} - -high_clear('DiffAdd') -high_clear('DiffChange') -high_clear('DiffText') -high_clear('DiffDelete') -apply_highlight(diff) - --- }}} - --- Markdown {{{ -local markdown = { - markdownCode = { bg = bg_highlight }, - markdownCodeBlock = { bg = bg_highlight }, - markdownH1 = { gui = 'bold' }, - markdownH2 = { gui = 'bold' }, - markdownLinkText = { gui = 'underline' }, -} - -apply_highlight(markdown) ---}}} - --- Plugins {{{ - --- barbar.nvim {{{ - -if configuration.plugins_integrations.barbar then - local barbar = { - BufferCurrent = { fg = base9, bg = bg }, - BufferCurrentIndex = { fg = base6, bg = bg }, - BufferCurrentMod = { fg = yellow, bg = bg }, - BufferCurrentSign = { fg = blue, bg = bg }, - BufferCurrentTarget = { fg = red, bg = bg, gui = 'bold' }, - - BufferVisible = { fg = base7, bg = bg }, - BufferVisibleIndex = { fg = base9, bg = bg }, - BufferVisibleMod = { fg = yellow, bg = bg }, - BufferVisibleSign = { fg = base4, bg = bg }, - BufferVisibleTarget = { fg = red, bg = bg, gui = 'bold' }, - - BufferInactive = { fg = base6, bg = base1 }, - BufferInactiveIndex = { fg = base6, bg = base1 }, - BufferInactiveMod = { fg = yellow, bg = base1 }, - BufferInactiveSign = { fg = base4, bg = base1 }, - BufferInactiveTarget = { fg = red, bg = base1, gui = 'bold' }, - - BufferTabpages = { fg = blue, bg = bg_statusline, gui = 'bold' }, - BufferTabpageFill = { fg = base4, bg = base1, gui = 'bold' }, - - BufferPart = { fg = diff_info_fg, bg = diff_info_bg0, gui = 'bold' }, - } - - apply_highlight(barbar) -end - --- }}} +--- Load the colorscheme +doom_one.load_colorscheme = function() + -- General UI {{{ --- BufferLine {{{ - -if configuration.plugins_integrations.bufferline and transparent_bg then - -- NOTE: this is a temporal workaround for using bufferline with a transparent - -- background and having highlighting, please refer to - -- https://github.com/NTBBloodbath/doom-one.nvim/issues/8#issuecomment-883737667 - -- for more information about this - local bufferline = { - BufferLineTab = { fg = fg, bg = bg }, - BufferLineTabClose = { fg = fg, bg = bg, gui = 'bold' }, - BufferLineTabSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, - BufferLineBackground = { fg = fg_alt, bg = bg }, - BufferLineBufferSelected = { fg = fg, bg = bg, gui = 'bold,italic' }, - BufferLineBufferVisible = { fg = fg, bg = bg }, - BufferLineCloseButton = { fg = fg_alt, bg = bg }, - BufferLineCloseButtonSelected = { fg = fg, bg = bg, gui = 'bold' }, - BufferLineCloseButtonVisible = { fg = fg, bg = bg }, - BufferLineModified = { fg = green, bg = bg }, - BufferLineModifiedSelected = { fg = green, bg = bg }, - BufferLineModifiedVisible = { fg = green, bg = bg }, - BufferLineFill = { fg = blue, bg = bg_alt }, - BufferLineIndicatorSelected = { fg = blue, bg = bg }, - BufferLineSeparator = { fg = base0, bg = bg }, - BufferLineSeparatorSelected = { fg = base0, bg = bg }, - BufferLineSeparatorVisible = { fg = base0, bg = bg_alt }, - BufferLinePick = { fg = fg, bg = bg, gui = 'bold' }, - BufferLinePickSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, - BufferLinePickVisible = { fg = fg, bg = bg_alt }, - - BufferLineDiagnostic = { fg = fg, bg = bg, sp = fg }, - BufferLineDiagnosticSelected = { fg = fg, bg = bg, sp = fg }, - BufferLineDiagnosticVisible = { fg = fg, bg = bg, sp = fg }, - - BufferLineInfo = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, - BufferLineInfoSelected = { - fg = cyan, - bg = bg, - sp = cyan, - gui = 'bold,italic', + local general_ui = { + Normal = { fg = fg, bg = transparent_bg and 'NONE' or bg }, + NormalPopup = { + fg = fg_highlight, + bg = transparent_bg and 'NONE' or bg_popup, }, - BufferLineInfoVisible = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, - BufferLineInfoDiagnostic = { fg = cyan, bg = bg, sp = cyan }, - BufferLineInfoDiagnosticSelected = { fg = cyan, bg = bg, sp = cyan }, - BufferLineInfoDiagnosticVisible = { fg = cyan, bg = bg, sp = cyan }, - BufferLineError = { fg = red, bg = bg, sp = red, gui = 'bold' }, - BufferLineErrorSelected = { - fg = red, - bg = bg, - sp = red, - gui = 'bold,italic', + NormalPopover = { + fg = fg_highlight, + bg = transparent_bg and 'NONE' or bg_popup, }, - BufferLineErrorVisible = { fg = red, bg = bg, sp = red, gui = 'bold' }, - BufferLineErrorDiagnostic = { fg = red, bg = bg, sp = red }, - BufferLineErrorDiagnosticSelected = { fg = red, bg = bg, sp = red }, - BufferLineErrorDiagnosticVisible = { fg = red, bg = bg, sp = red }, - BufferLineWarning = { - fg = yellow, - bg = bg, - sp = yellow, - gui = 'bold,italic', + NormalPopupPrompt = { + fg = base7, + bg = transparent_bg and 'NONE' or utils.Darken(bg_popup, 0.3), + gui = 'bold', }, - BufferLineWarningSelected = { - fg = yellow, - bg = bg, - sp = yellow, - gui = 'bold,italic', + NormalPopupSubtle = { + fg = base6, + bg = transparent_bg and 'NONE' or bg_popup, }, - BufferLineWarningVisible = { - fg = yellow, - bg = bg, - sp = yellow, + EndOfBuffer = { fg = bg, bg = transparent_bg and 'NONE' or bg }, + + Visual = { bg = dark_blue }, + VisualBold = { bg = dark_blue, gui = 'bold' }, + + LineNr = { fg = grey, bg = transparent_bg and 'NONE' or bg }, + Cursor = { bg = blue }, + CursorLine = { bg = bg_highlight }, + CursorLineNr = { fg = fg, bg = bg_highlight }, + CursorColumn = { bg = bg_highlight }, + + Folded = { fg = base5, bg = bg_highlight }, + FoldColumn = { fg = fg_alt, bg = bg }, + SignColumn = { bg = transparent_bg and 'NONE' or bg }, + ColorColumn = { bg = bg_highlight }, + + IndentGuide = { fg = grey }, + IndentGuideEven = { fg = grey }, + IndentGuideOdd = { fg = grey }, + + TermCursor = { fg = fg, gui = 'reverse' }, + TermCursorNC = { fg = fg_alt, gui = 'reverse' }, + TermNormal = { fg = fg, bg = bg }, + TermNormalNC = { fg = fg, bg = bg }, + + WildMenu = { fg = fg, bg = dark_blue }, + Separator = { fg = fg_alt }, + VertSplit = { fg = grey, bg = bg }, + + TabLine = { + fg = base7, + bg = bg_alt, gui = 'bold', }, - BufferLineWarningDiagnostic = { fg = yellow, bg = bg, sp = yellow }, - BufferLineWarningDiagnosticSelected = { fg = yellow, bg = bg, sp = yellow }, - BufferLineWarningDiagnosticVisible = { fg = yellow, bg = bg, sp = yellow }, - } - - apply_highlight(bufferline) -end - --- }}} - --- Gitgutter {{{ - -if configuration.plugins_integrations.gitgutter then - high_link('GitGutterAdd', 'DiffAddedGutter') - high_link('GitGutterChange', 'DiffModifiedGutter') - high_link('GitGutterDelete', 'DiffRemovedGutter') - high_link('GitGutterChangeDelete', 'DiffModifiedGutter') - - high_link('GitGutterAddLineNr', 'DiffAddedGutterLineNr') - high_link('GitGutterChangeLineNr', 'DiffModifiedGutterLineNr') - high_link('GitGutterDeleteLineNr', 'DiffRemovedGutterLineNr') - high_link('GitGutterChangeDeleteLineNr', 'DiffModifiedGutterLineNr') -end - --- }}} - --- Gitsigns {{{ - -if configuration.plugins_integrations.gitsigns then - high_link('GitSignsAdd', 'DiffAddedGutter') - high_link('GitSignsChange', 'DiffModifiedGutter') - high_link('GitSignsDelete', 'DiffRemovedGutter') - high_link('GitSignsChangeDelete', 'DiffModifiedGutter') -end - --- }}} - --- Telescope {{{ - -if configuration.plugins_integrations.telescope then - local telescope = { - TelescopeSelection = { fg = yellow, gui = 'bold' }, - TelescopeSelectionCaret = { fg = light_bg and orange or blue }, - TelescopeMultiSelection = { fg = grey }, - TelescopeNormal = { fg = fg }, - TelescopeMatching = { fg = green, gui = 'bold' }, - TelescopePromptPrefix = { fg = light_bg and orange or blue }, - TelescopeBorder = { fg = light_bg and orange or blue }, - TelescopePromptBorder = { fg = light_bg and orange or blue }, - TelescopeResultsBorder = { fg = light_bg and orange or blue }, - TelescopePreviewBorder = { fg = light_bg and orange or blue }, - } - - apply_highlight(telescope) - high_link('TelescopePrompt', 'TelescopeNormal') -end - --- }}} - --- Neogit {{{ - -if configuration.plugins_integrations.neogit then - local neogit = { - NeogitDiffAdd = { fg = ng_add_fg, bg = ng_add_bg}, - NeogitDiffAddHighlight = { fg = ng_add_fg_hl, bg = ng_add_bg_hl, gui = 'bold' }, - NeogitDiffDelete = { fg = ng_delete_fg, bg = ng_delete_bg }, - NeogitDiffDeleteHighlight = { fg = ng_delete_fg_hl, bg = ng_delete_bg_hl, gui = 'bold' }, - NeogitDiffContext = { fg = fg_alt, bg = bg }, - NeogitDiffContextHighlight = { fg = fg, bg = bg_alt }, - NeogitHunkHeader = { fg = bg, bg = ng_header_bg }, - NeogitHunkHeaderHighlight = { fg = bg_alt, bg = ng_header_bg_hl, gui = 'bold' }, - NeogitStagedChanges = { fg = blue, gui = 'bold' }, - NeogitStagedChangesRegion = { bg = bg_highlight }, - NeogitStashes = { fg = blue, gui = 'bold' }, - NeogitUnstagedChanges = { fg = blue, gui = 'bold' }, - NeogitUntrackedfiles = { fg = blue, gui = 'bold' }, + TabLineSel = { fg = blue, bg = bg, gui = 'bold' }, + TabLineFill = { bg = base1, gui = 'bold' }, + + StatusLine = { fg = base8, bg = base3 }, + StatusLineNC = { fg = base6, bg = bg_popup }, + StatusLinePart = { fg = base6, bg = bg_popup, gui = 'bold' }, + StatusLinePartNC = { fg = base6, bg = bg_popup, gui = 'bold' }, + + Pmenu = { fg = fg, bg = bg_highlight }, + PmenuSel = { fg = base0, bg = blue }, + PmenuSelBold = { fg = base0, bg = blue, gui = 'bold' }, + PmenuSbar = { bg = bg_alt }, + PmenuThumb = { bg = fg }, } - apply_highlight(neogit) -end - --- }}} + if vim.opt.pumblend == 1 then + vim.opt.pumblend = 20 + end --- NvimTree {{{ - -if configuration.plugins_integrations.nvim_tree then - local nvim_tree = { - NvimTreeFolderName = { fg = light_bg and base9 or blue, gui = 'bold' }, - NvimTreeRootFolder = { fg = green }, - NvimTreeEmptyFolderName = { fg = fg_alt, gui = 'bold' }, - NvimTreeSymlink = { fg = fg, gui = 'underline' }, - NvimTreeExecFile = { fg = green, gui = 'bold' }, - NvimTreeImageFile = { fg = light_bg and orange or blue }, - NvimTreeOpenedFile = { fg = fg_alt }, - NvimTreeSpecialFile = { fg = fg, gui = 'underline' }, - NvimTreeMarkdownFile = { fg = fg, gui = 'underline' }, - } + apply_highlight(general_ui) - apply_highlight(nvim_tree) - high_link('NvimTreeGitDirty', 'DiffModifiedGutter') - high_link('NvimTreeGitStaged', 'DiffModifiedGutter') - high_link('NvimTreeGitMerge', 'DiffModifiedGutter') - high_link('NvimTreeGitRenamed', 'DiffModifiedGutter') - high_link('NvimTreeGitNew', 'DiffAddedGutter') - high_link('NvimTreeGitDeleted', 'DiffRemovedGutter') + -- }}} - high_link('NvimTreeIndentMarker', 'IndentGuide') - high_link('NvimTreeOpenedFolderName', 'NvimTreeFolderName') -end + -- Search, Highlight. Conceal, Messages {{{ --- }}} + local search_high_ui = { + Search = { fg = fg, bg = dark_blue, gui = 'bold' }, + Substitute = { fg = red, gui = 'strikethrough,bold' }, + IncSearch = { fg = fg, bg = dark_blue, gui = 'bold' }, + IncSearchCursor = { gui = 'reverse' }, --- Dashboard {{{ + Conceal = { fg = grey, gui = 'none' }, + SpecialKey = { fg = violet, gui = 'bold' }, + NonText = { fg = fg_alt, gui = 'bold' }, + MatchParen = { fg = red, gui = 'bold' }, + Whitespace = { fg = grey }, -if configuration.plugins_integrations.dashboard then - local dashboard = { - dashboardHeader = { fg = '#586268' }, - dashboardCenter = { fg = light_bg and orange or blue }, - dashboardShortcut = { fg = '#9788b9' }, - } + Highlight = { bg = bg_highlighted }, + HighlightSubtle = { bg = bg_highlighted }, + LspHighlight = { bg = bg_highlight, style = 'bold' }, - apply_highlight(dashboard) - high_link('dashboardFooter', 'dashboardHeader') -end + Question = { fg = green, gui = 'bold' }, --- }}} + File = { fg = fg }, + Directory = { fg = violet, gui = 'bold' }, + Title = { fg = violet, gui = 'bold' }, --- Startify {{{ - -if configuration.plugins_integrations.startify then - local startify = { - StartifyHeader = { fg = bg_popup }, - StartifyBracket = { fg = bg_popup }, - StartifyNumber = { fg = blue }, - StartifyPath = { fg = violet }, - StartifySlash = { fg = violet }, - StartifyFile = { fg = green }, + Bold = { gui = 'bold' }, + Emphasis = { fg = green, gui = 'bold' }, } - apply_highlight(startify) -end + apply_highlight(search_high_ui) --- }}} + -- }}} --- WhichKey {{{ + -- Text levels {{{ -if configuration.plugins_integrations.whichkey then - local whichkey = { - WhichKey = { fg = light_bg and orange or blue }, - WhichKeyGroup = { fg = magenta }, - WhichKeyDesc = { fg = magenta }, - WhichKeySeparator = { fg = base5 }, - WhichKeyFloat = { bg = base2 }, - WhichKeyValue = { fg = grey }, + local text_colors = { + Normal = fg, + Info = blue, + Success = green, + Warning = yellow, + Debug = yellow, + Error = red, + Special = violet, + Muted = base7, } - apply_highlight(whichkey) -end - --- }}} - --- indent-blankline {{{ - -if configuration.plugins_integrations.indent_blankline then - local indent_blankline = { - IndentBlanklineChar = { - fg = base4, - cterm = 'nocombine', - gui = 'nocombine', - }, - IndentBlanklineContextChar = { - fg = blue, - cterm = 'nocombine', - gui = 'nocombine', - }, - IndentBlanklineSpaceChar = { - fg = base4, - cterm = 'nocombine', - gui = 'nocombine', - }, - IndentBlanklineSpaceCharBlankline = { - fg = base4, - cterm = 'nocombine', - gui = 'nocombine', + for key, _ in pairs(text_colors) do + apply_highlight({ + ['Text' .. key] = { + fg = text_colors[key], + }, + }) + apply_highlight({ + ['Text' .. key .. 'Bold'] = { + fg = text_colors[key], + gui = 'bold', + }, + }) + end + + high_link('Msg', 'TextSuccess') + high_link('MoreMsg', 'TextInfo') + high_link('WarningMsg', 'TextWarning') + high_link('Error', 'TextError') + high_link('ErrorMsg', 'TextError') + high_link('ModeMsg', 'TextSpecial') + high_link('Todo', 'TextWarningBold') + + -- }}} + + -- Main Syntax {{{ + + local main_syntax = { + Tag = { fg = tag, gui = 'bold' }, + Link = { fg = green, gui = 'underline' }, + URL = { fg = green, gui = 'underline' }, + Underlined = { fg = tag, gui = 'underline' }, + + Comment = { + fg = fg_alt, + gui = configuration.italic_comments and 'italic' or 'NONE', }, + CommentBold = { fg = fg_alt, gui = 'bold' }, + SpecialComment = { fg = base7, gui = 'bold' }, + + Macro = { fg = violet }, + Define = { fg = violet, gui = 'bold' }, + Include = { fg = violet, gui = 'bold' }, + PreProc = { fg = violet, gui = 'bold' }, + PreCondit = { fg = violet, gui = 'bold' }, + + Label = { fg = light_bg and orange or blue }, + Repeat = { fg = light_bg and orange or blue }, + Keyword = { fg = light_bg and orange or blue }, + Operator = { fg = light_bg and orange or blue }, + Delimiter = { fg = light_bg and orange or blue }, + Statement = { fg = light_bg and orange or blue }, + Exception = { fg = light_bg and orange or blue }, + Conditional = { fg = light_bg and orange or blue }, + + Variable = { fg = '#8B93E6' }, + VariableBuiltin = { fg = '#8B93E6', gui = 'bold' }, + Constant = { fg = violet, gui = 'bold' }, + + Number = { fg = light_bg and yellow or orange }, + Float = { fg = light_bg and yellow or orange }, + Boolean = { fg = light_bg and yellow or orange, gui = 'bold' }, + Enum = { fg = light_bg and yellow or orange }, + + Character = { fg = violet, gui = 'bold' }, + SpecialChar = { fg = base8, gui = 'bold' }, + + String = { fg = green }, + StringDelimiter = { fg = green }, + + Special = { fg = violet }, + SpecialBold = { fg = violet, gui = 'bold' }, + + Field = { fg = violet }, + Argument = { fg = light_magenta }, + Attribute = { fg = light_magenta }, + Identifier = { fg = light_magenta }, + Property = { fg = magenta }, + Function = { fg = magenta }, + FunctionBuiltin = { fg = light_magenta, gui = 'bold' }, + KeywordFunction = { fg = light_bg and orange or blue }, + Method = { fg = violet }, + + Type = { fg = yellow }, + TypeBuiltin = { fg = yellow, gui = 'bold' }, + StorageClass = { fg = light_bg and orange or blue }, + Class = { fg = light_bg and orange or blue }, + Structure = { fg = light_bg and orange or blue }, + Typedef = { fg = light_bg and orange or blue }, + + Regexp = { fg = '#dd0093' }, + RegexpSpecial = { fg = '#a40073' }, + RegexpDelimiter = { fg = '#540063', gui = 'bold' }, + RegexpKey = { fg = '#5f0041', gui = 'bold' }, } - apply_highlight(indent_blankline) -end + apply_highlight(main_syntax) + high_link('CommentURL', 'URL') + high_link('CommentLabel', 'CommentBold') + high_link('CommentSection', 'CommentBold') + high_link('Noise', 'Comment') --- }}} + -- }}} --- vim-illuminate {{{ + -- Diff {{{ -if configuration.plugins_integrations.vim_illuminate then - local illuminated = { - illuminatedWord = { - cterm = 'underline', - gui = 'underline', - }, - } + local diff = { + diffLine = { fg = base8, bg = diff_info_bg1 }, + diffSubName = { fg = base8, bg = diff_info_bg1 }, - apply_highlight(illuminated) -end + DiffAdd = { bg = diff_add_bg1 }, + DiffChange = { bg = diff_add_bg1 }, + DiffText = { bg = diff_add_bg0 }, + DiffDelete = { bg = gh_danger_bg0 }, --- }}} + DiffAdded = { fg = diff_add_fg0, bg = diff_add_bg1 }, + DiffModified = { fg = fg, bg = diff_info_bg0 }, + DiffRemoved = { fg = gh_danger_fg0, bg = gh_danger_bg1 }, --- LspSaga {{{ + DiffAddedGutter = { fg = diff_add_fg, gui = 'bold' }, + DiffModifiedGutter = { fg = diff_info_fg, gui = 'bold' }, + DiffRemovedGutter = { fg = gh_danger_fg, gui = 'bold' }, -if configuration.plugins_integrations.lspsaga then - local lspsaga = { - SagaShadow = { bg = bg }, - LspSagaDiagnosticHeader = { fg = red }, + DiffAddedGutterLineNr = { fg = grey }, + DiffModifiedGutterLineNr = { fg = grey }, + DiffRemovedGutterLineNr = { fg = grey }, } - apply_highlight(lspsaga) - high_link('LspSagaDiagnosticBorder', 'Normal') - high_link('LspSagaDiagnosticTruncateLine', 'Normal') - high_link('LspFloatWinBorder', 'Normal') - high_link('LspSagaBorderTitle', 'Title') - high_link('TargetWord', 'Error') - high_link('ReferencesCount', 'Title') - high_link('ReferencesIcon', 'Special') - high_link('DefinitionCount', 'Title') - high_link('TargetFileName', 'Comment') - high_link('DefinitionIcon', 'Special') - high_link('ProviderTruncateLine', 'Normal') - high_link('LspSagaFinderSelection', 'Search') - high_link('DiagnosticTruncateLine', 'Normal') - high_link('DiagnosticError', 'LspDiagnosticsDefaultError') - high_link('DiagnosticWarn', 'LspDiagnosticsDefaultWarning') - high_link('DiagnosticInfo', 'LspDiagnosticsDefaultInformation') - high_link('DiagnosticHint', 'LspDiagnosticsDefaultHint') - high_link('DefinitionPreviewTitle', 'Title') - high_link('LspSagaShTruncateLine', 'Normal') - high_link('LspSagaDocTruncateLine', 'Normal') - high_link('LineDiagTuncateLine', 'Normal') - high_link('LspSagaCodeActionTitle', 'Title') - high_link('LspSagaCodeActionTruncateLine', 'Normal') - high_link('LspSagaCodeActionContent', 'Normal') - high_link('LspSagaRenamePromptPrefix', 'Normal') - high_link('LspSagaRenameBorder', 'Bold') - high_link('LspSagaHoverBorder', 'Bold') - high_link('LspSagaSignatureHelpBorder', 'Bold') - high_link('LspSagaCodeActionBorder', 'Bold') - high_link('LspSagaDefPreviewBorder', 'Bold') - high_link('LspLinesDiagBorder', 'Bold') -end - --- }}} - --- }}} - --- LSP {{{ - -local msg_underline = { - ErrorMsgUnderline = { fg = red, gui = 'underline' }, - WarningMsgUnderline = { fg = yellow, gui = 'underline' }, - MoreMsgUnderline = { fg = blue, gui = 'underline' }, - MsgUnderline = { fg = green, gui = 'underline' }, -} - -apply_highlight(msg_underline) -high_link('LspDiagnosticsFloatingError', 'ErrorMsg') -high_link('LspDiagnosticsFloatingWarning', 'WarningMsg') -high_link('LspDiagnosticsFloatingInformation', 'MoreMsg') -high_link('LspDiagnosticsFloatingHint', 'Msg') -high_link('LspDiagnosticsDefaultError', 'ErrorMsg') -high_link('LspDiagnosticsDefaultWarning', 'WarningMsg') -high_link('LspDiagnosticsDefaultInformation', 'MoreMsg') -high_link('LspDiagnosticsDefaultHint', 'Msg') -high_link('LspDiagnosticsVirtualTextError', 'ErrorMsg') -high_link('LspDiagnosticsVirtualTextWarning', 'WarningMsg') -high_link('LspDiagnosticsVirtualTextInformation', 'MoreMsg') -high_link('LspDiagnosticsVirtualTextHint', 'Msg') -high_link('LspDiagnosticsUnderlineError', 'ErrorMsgUnderline') -high_link('LspDiagnosticsUnderlineWarning', 'WarningMsgUnderline') -high_link('LspDiagnosticsUnderlineInformation', 'MoreMsgUnderline') -high_link('LspDiagnosticsUnderlineHint', 'MsgUnderline') -high_link('LspDiagnosticsSignError', 'ErrorMsg') -high_link('LspDiagnosticsSignWarning', 'WarningMsg') -high_link('LspDiagnosticsSignInformation', 'MoreMsg') -high_link('LspDiagnosticsSignHint', 'Msg') -high_link('DiagnosticFloatingError', 'ErrorMsg') -high_link('DiagnosticFloatingWarn', 'WarningMsg') -high_link('DiagnosticFloatingInfo', 'MoreMsg') -high_link('DiagnosticFloatingHint', 'Msg') -high_link('DiagnosticDefaultError', 'ErrorMsg') -high_link('DiagnosticDefaultWarn', 'WarningMsg') -high_link('DiagnosticDefaultInfo', 'MoreMsg') -high_link('DiagnosticDefaultHint', 'Msg') -high_link('DiagnosticVirtualTextError', 'ErrorMsg') -high_link('DiagnosticVirtualTextWarn', 'WarningMsg') -high_link('DiagnosticVirtualTextInfo', 'MoreMsg') -high_link('DiagnosticVirtualTextHint', 'Msg') -high_link('DiagnosticUnderlineError', 'ErrorMsgUnderline') -high_link('DiagnosticUnderlineWarn', 'WarningMsgUnderline') -high_link('DiagnosticUnderlineInfo', 'MoreMsgUnderline') -high_link('DiagnosticUnderlineHint', 'MsgUnderline') -high_link('DiagnosticSignError', 'ErrorMsg') -high_link('DiagnosticSignWarning', 'WarningMsg') -high_link('DiagnosticSignInformation', 'MoreMsg') -high_link('DiagnosticSignHint', 'Msg') -high_link('LspReferenceText', 'Bold') -high_link('LspReferenceRead', 'Bold') -high_link('LspReferenceWrite', 'Bold') -high_link('TermCursor', 'Cursor') -high_link('healthError', 'ErrorMsg') -high_link('healthSuccess', 'Msg') -high_link('healthWarning', 'WarningMsg') - --- }}} - --- TreeSitter {{{ - -if configuration.enable_treesitter then - -- We will set a special definition for TSStrike here - local treesitter = { - TSStrike = { fg = utils.Darken(violet, 0.2), cterm = 'strikethrough', gui = 'strikethrough' }, + high_clear('DiffAdd') + high_clear('DiffChange') + high_clear('DiffText') + high_clear('DiffDelete') + apply_highlight(diff) + + -- }}} + + -- Markdown {{{ + local markdown = { + markdownCode = { bg = bg_highlight }, + markdownCodeBlock = { bg = bg_highlight }, + markdownH1 = { gui = 'bold' }, + markdownH2 = { gui = 'bold' }, + markdownLinkText = { gui = 'underline' }, } - apply_highlight(treesitter) - high_link('TSException', 'Exception') - high_link('TSAnnotation', 'PreProc') - high_link('TSAttribute', 'Attribute') - high_link('TSConditional', 'Conditional') - high_link('TSComment', 'Comment') - high_link('TSConstructor', 'Structure') - high_link('TSConstant', 'Constant') - high_link('TSConstBuiltin', 'Constant') - high_link('TSConstMacro', 'Macro') - high_link('TSError', 'Error') - high_link('TSField', 'Field') - high_link('TSFloat', 'Float') - high_link('TSFunction', 'Function') - high_link('TSFuncBuiltin', 'FunctionBuiltin') - high_link('TSFuncMacro', 'Macro') - high_link('TSInclude', 'Include') - high_link('TSKeyword', 'Keyword') - high_link('TSKeywordFunction', 'KeywordFunction') - high_link('TSLabel', 'Label') - high_link('TSMethod', 'Method') - high_link('TSNamespace', 'Directory') - high_link('TSNumber', 'Number') - high_link('TSOperator', 'Operator') - high_link('TSParameter', 'Argument') - high_link('TSParameterReference', 'Argument') - high_link('TSProperty', 'Property') - high_link('TSPunctDelimiter', 'Delimiter') - high_link('TSPunctBracket', 'Delimiter') - high_link('TSPunctSpecial', 'Delimiter') - high_link('TSRepeat', 'Repeat') - high_link('TSString', 'String') - high_link('TSStringRegex', 'StringDelimiter') - high_link('TSStringEscape', 'StringDelimiter') - high_link('TSTag', 'Tag') - high_link('TSTagDelimiter', 'Delimiter') - high_link('TSStrong', 'Bold') - high_link('TSURI', 'URL') - high_link('TSWarning', 'WarningMsg') - high_link('TSDanger', 'ErrorMsg') - high_link('TSType', 'Type') - high_link('TSTypeBuiltin', 'TypeBuiltin') - high_link('TSVariable', 'None') - high_link('TSVariableBuiltin', 'VariableBuiltin') -end - --- }}} + apply_highlight(markdown) + --}}} + + -- Plugins {{{ + + -- barbar.nvim {{{ + + if configuration.plugins_integrations.barbar then + local barbar = { + BufferCurrent = { fg = base9, bg = bg }, + BufferCurrentIndex = { fg = base6, bg = bg }, + BufferCurrentMod = { fg = yellow, bg = bg }, + BufferCurrentSign = { fg = blue, bg = bg }, + BufferCurrentTarget = { fg = red, bg = bg, gui = 'bold' }, + + BufferVisible = { fg = base7, bg = bg }, + BufferVisibleIndex = { fg = base9, bg = bg }, + BufferVisibleMod = { fg = yellow, bg = bg }, + BufferVisibleSign = { fg = base4, bg = bg }, + BufferVisibleTarget = { fg = red, bg = bg, gui = 'bold' }, + + BufferInactive = { fg = base6, bg = base1 }, + BufferInactiveIndex = { fg = base6, bg = base1 }, + BufferInactiveMod = { fg = yellow, bg = base1 }, + BufferInactiveSign = { fg = base4, bg = base1 }, + BufferInactiveTarget = { fg = red, bg = base1, gui = 'bold' }, + + BufferTabpages = { fg = blue, bg = bg_statusline, gui = 'bold' }, + BufferTabpageFill = { fg = base4, bg = base1, gui = 'bold' }, + + BufferPart = { fg = diff_info_fg, bg = diff_info_bg0, gui = 'bold' }, + } + + apply_highlight(barbar) + end + + -- }}} + + -- BufferLine {{{ + + if configuration.plugins_integrations.bufferline and transparent_bg then + -- NOTE: this is a temporal workaround for using bufferline with a transparent + -- background and having highlighting, please refer to + -- https://github.com/NTBBloodbath/doom-one.nvim/issues/8#issuecomment-883737667 + -- for more information about this + local bufferline = { + BufferLineTab = { fg = fg, bg = bg }, + BufferLineTabClose = { fg = fg, bg = bg, gui = 'bold' }, + BufferLineTabSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, + BufferLineBackground = { fg = fg_alt, bg = bg }, + BufferLineBufferSelected = { fg = fg, bg = bg, gui = 'bold,italic' }, + BufferLineBufferVisible = { fg = fg, bg = bg }, + BufferLineCloseButton = { fg = fg_alt, bg = bg }, + BufferLineCloseButtonSelected = { fg = fg, bg = bg, gui = 'bold' }, + BufferLineCloseButtonVisible = { fg = fg, bg = bg }, + BufferLineModified = { fg = green, bg = bg }, + BufferLineModifiedSelected = { fg = green, bg = bg }, + BufferLineModifiedVisible = { fg = green, bg = bg }, + BufferLineFill = { fg = blue, bg = bg_alt }, + BufferLineIndicatorSelected = { fg = blue, bg = bg }, + BufferLineSeparator = { fg = base0, bg = bg }, + BufferLineSeparatorSelected = { fg = base0, bg = bg }, + BufferLineSeparatorVisible = { fg = base0, bg = bg_alt }, + BufferLinePick = { fg = fg, bg = bg, gui = 'bold' }, + BufferLinePickSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, + BufferLinePickVisible = { fg = fg, bg = bg_alt }, + + BufferLineDiagnostic = { fg = fg, bg = bg, sp = fg }, + BufferLineDiagnosticSelected = { fg = fg, bg = bg, sp = fg }, + BufferLineDiagnosticVisible = { fg = fg, bg = bg, sp = fg }, + + BufferLineInfo = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, + BufferLineInfoSelected = { + fg = cyan, + bg = bg, + sp = cyan, + gui = 'bold,italic', + }, + BufferLineInfoVisible = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, + BufferLineInfoDiagnostic = { fg = cyan, bg = bg, sp = cyan }, + BufferLineInfoDiagnosticSelected = { fg = cyan, bg = bg, sp = cyan }, + BufferLineInfoDiagnosticVisible = { fg = cyan, bg = bg, sp = cyan }, + BufferLineError = { fg = red, bg = bg, sp = red, gui = 'bold' }, + BufferLineErrorSelected = { + fg = red, + bg = bg, + sp = red, + gui = 'bold,italic', + }, + BufferLineErrorVisible = { fg = red, bg = bg, sp = red, gui = 'bold' }, + BufferLineErrorDiagnostic = { fg = red, bg = bg, sp = red }, + BufferLineErrorDiagnosticSelected = { fg = red, bg = bg, sp = red }, + BufferLineErrorDiagnosticVisible = { fg = red, bg = bg, sp = red }, + BufferLineWarning = { + fg = yellow, + bg = bg, + sp = yellow, + gui = 'bold,italic', + }, + BufferLineWarningSelected = { + fg = yellow, + bg = bg, + sp = yellow, + gui = 'bold,italic', + }, + BufferLineWarningVisible = { + fg = yellow, + bg = bg, + sp = yellow, + gui = 'bold', + }, + BufferLineWarningDiagnostic = { fg = yellow, bg = bg, sp = yellow }, + BufferLineWarningDiagnosticSelected = { fg = yellow, bg = bg, sp = yellow }, + BufferLineWarningDiagnosticVisible = { fg = yellow, bg = bg, sp = yellow }, + } + + apply_highlight(bufferline) + end + + -- }}} + + -- Gitgutter {{{ + + if configuration.plugins_integrations.gitgutter then + high_link('GitGutterAdd', 'DiffAddedGutter') + high_link('GitGutterChange', 'DiffModifiedGutter') + high_link('GitGutterDelete', 'DiffRemovedGutter') + high_link('GitGutterChangeDelete', 'DiffModifiedGutter') + + high_link('GitGutterAddLineNr', 'DiffAddedGutterLineNr') + high_link('GitGutterChangeLineNr', 'DiffModifiedGutterLineNr') + high_link('GitGutterDeleteLineNr', 'DiffRemovedGutterLineNr') + high_link('GitGutterChangeDeleteLineNr', 'DiffModifiedGutterLineNr') + end + + -- }}} + + -- Gitsigns {{{ + + if configuration.plugins_integrations.gitsigns then + high_link('GitSignsAdd', 'DiffAddedGutter') + high_link('GitSignsChange', 'DiffModifiedGutter') + high_link('GitSignsDelete', 'DiffRemovedGutter') + high_link('GitSignsChangeDelete', 'DiffModifiedGutter') + end + + -- }}} + + -- Telescope {{{ + + if configuration.plugins_integrations.telescope then + local telescope = { + TelescopeSelection = { fg = yellow, gui = 'bold' }, + TelescopeSelectionCaret = { fg = light_bg and orange or blue }, + TelescopeMultiSelection = { fg = grey }, + TelescopeNormal = { fg = fg }, + TelescopeMatching = { fg = green, gui = 'bold' }, + TelescopePromptPrefix = { fg = light_bg and orange or blue }, + TelescopeBorder = { fg = light_bg and orange or blue }, + TelescopePromptBorder = { fg = light_bg and orange or blue }, + TelescopeResultsBorder = { fg = light_bg and orange or blue }, + TelescopePreviewBorder = { fg = light_bg and orange or blue }, + } + + apply_highlight(telescope) + high_link('TelescopePrompt', 'TelescopeNormal') + end + + -- }}} + + -- Neogit {{{ + + if configuration.plugins_integrations.neogit then + local neogit = { + NeogitDiffAdd = { fg = ng_add_fg, bg = ng_add_bg}, + NeogitDiffAddHighlight = { fg = ng_add_fg_hl, bg = ng_add_bg_hl, gui = 'bold' }, + NeogitDiffDelete = { fg = ng_delete_fg, bg = ng_delete_bg }, + NeogitDiffDeleteHighlight = { fg = ng_delete_fg_hl, bg = ng_delete_bg_hl, gui = 'bold' }, + NeogitDiffContext = { fg = fg_alt, bg = bg }, + NeogitDiffContextHighlight = { fg = fg, bg = bg_alt }, + NeogitHunkHeader = { fg = bg, bg = ng_header_bg }, + NeogitHunkHeaderHighlight = { fg = bg_alt, bg = ng_header_bg_hl, gui = 'bold' }, + NeogitStagedChanges = { fg = blue, gui = 'bold' }, + NeogitStagedChangesRegion = { bg = bg_highlight }, + NeogitStashes = { fg = blue, gui = 'bold' }, + NeogitUnstagedChanges = { fg = blue, gui = 'bold' }, + NeogitUntrackedfiles = { fg = blue, gui = 'bold' }, + } + + apply_highlight(neogit) + end + + -- }}} + + -- NvimTree {{{ + + if configuration.plugins_integrations.nvim_tree then + local nvim_tree = { + NvimTreeFolderName = { fg = light_bg and base9 or blue, gui = 'bold' }, + NvimTreeRootFolder = { fg = green }, + NvimTreeEmptyFolderName = { fg = fg_alt, gui = 'bold' }, + NvimTreeSymlink = { fg = fg, gui = 'underline' }, + NvimTreeExecFile = { fg = green, gui = 'bold' }, + NvimTreeImageFile = { fg = light_bg and orange or blue }, + NvimTreeOpenedFile = { fg = fg_alt }, + NvimTreeSpecialFile = { fg = fg, gui = 'underline' }, + NvimTreeMarkdownFile = { fg = fg, gui = 'underline' }, + } + + apply_highlight(nvim_tree) + high_link('NvimTreeGitDirty', 'DiffModifiedGutter') + high_link('NvimTreeGitStaged', 'DiffModifiedGutter') + high_link('NvimTreeGitMerge', 'DiffModifiedGutter') + high_link('NvimTreeGitRenamed', 'DiffModifiedGutter') + high_link('NvimTreeGitNew', 'DiffAddedGutter') + high_link('NvimTreeGitDeleted', 'DiffRemovedGutter') + + high_link('NvimTreeIndentMarker', 'IndentGuide') + high_link('NvimTreeOpenedFolderName', 'NvimTreeFolderName') + end + + -- }}} + + -- Dashboard {{{ + + if configuration.plugins_integrations.dashboard then + local dashboard = { + dashboardHeader = { fg = '#586268' }, + dashboardCenter = { fg = light_bg and orange or blue }, + dashboardShortcut = { fg = '#9788b9' }, + } + + apply_highlight(dashboard) + high_link('dashboardFooter', 'dashboardHeader') + end + + -- }}} + + -- Startify {{{ + + if configuration.plugins_integrations.startify then + local startify = { + StartifyHeader = { fg = bg_popup }, + StartifyBracket = { fg = bg_popup }, + StartifyNumber = { fg = blue }, + StartifyPath = { fg = violet }, + StartifySlash = { fg = violet }, + StartifyFile = { fg = green }, + } + + apply_highlight(startify) + end + + -- }}} + + -- WhichKey {{{ + + if configuration.plugins_integrations.whichkey then + local whichkey = { + WhichKey = { fg = light_bg and orange or blue }, + WhichKeyGroup = { fg = magenta }, + WhichKeyDesc = { fg = magenta }, + WhichKeySeparator = { fg = base5 }, + WhichKeyFloat = { bg = base2 }, + WhichKeyValue = { fg = grey }, + } + + apply_highlight(whichkey) + end + + -- }}} + + -- indent-blankline {{{ + + if configuration.plugins_integrations.indent_blankline then + local indent_blankline = { + IndentBlanklineChar = { + fg = base4, + cterm = 'nocombine', + gui = 'nocombine', + }, + IndentBlanklineContextChar = { + fg = blue, + cterm = 'nocombine', + gui = 'nocombine', + }, + IndentBlanklineSpaceChar = { + fg = base4, + cterm = 'nocombine', + gui = 'nocombine', + }, + IndentBlanklineSpaceCharBlankline = { + fg = base4, + cterm = 'nocombine', + gui = 'nocombine', + }, + } + + apply_highlight(indent_blankline) + end + + -- }}} + + -- vim-illuminate {{{ + + if configuration.plugins_integrations.vim_illuminate then + local illuminated = { + illuminatedWord = { + cterm = 'underline', + gui = 'underline', + }, + } + + apply_highlight(illuminated) + end + + -- }}} + + -- LspSaga {{{ + + if configuration.plugins_integrations.lspsaga then + local lspsaga = { + SagaShadow = { bg = bg }, + LspSagaDiagnosticHeader = { fg = red }, + } + + apply_highlight(lspsaga) + high_link('LspSagaDiagnosticBorder', 'Normal') + high_link('LspSagaDiagnosticTruncateLine', 'Normal') + high_link('LspFloatWinBorder', 'Normal') + high_link('LspSagaBorderTitle', 'Title') + high_link('TargetWord', 'Error') + high_link('ReferencesCount', 'Title') + high_link('ReferencesIcon', 'Special') + high_link('DefinitionCount', 'Title') + high_link('TargetFileName', 'Comment') + high_link('DefinitionIcon', 'Special') + high_link('ProviderTruncateLine', 'Normal') + high_link('LspSagaFinderSelection', 'Search') + high_link('DiagnosticTruncateLine', 'Normal') + high_link('DiagnosticError', 'LspDiagnosticsDefaultError') + high_link('DiagnosticWarn', 'LspDiagnosticsDefaultWarning') + high_link('DiagnosticInfo', 'LspDiagnosticsDefaultInformation') + high_link('DiagnosticHint', 'LspDiagnosticsDefaultHint') + high_link('DefinitionPreviewTitle', 'Title') + high_link('LspSagaShTruncateLine', 'Normal') + high_link('LspSagaDocTruncateLine', 'Normal') + high_link('LineDiagTuncateLine', 'Normal') + high_link('LspSagaCodeActionTitle', 'Title') + high_link('LspSagaCodeActionTruncateLine', 'Normal') + high_link('LspSagaCodeActionContent', 'Normal') + high_link('LspSagaRenamePromptPrefix', 'Normal') + high_link('LspSagaRenameBorder', 'Bold') + high_link('LspSagaHoverBorder', 'Bold') + high_link('LspSagaSignatureHelpBorder', 'Bold') + high_link('LspSagaCodeActionBorder', 'Bold') + high_link('LspSagaDefPreviewBorder', 'Bold') + high_link('LspLinesDiagBorder', 'Bold') + end + + -- }}} + + -- }}} + + -- LSP {{{ + + local msg_underline = { + ErrorMsgUnderline = { fg = red, gui = 'underline' }, + WarningMsgUnderline = { fg = yellow, gui = 'underline' }, + MoreMsgUnderline = { fg = blue, gui = 'underline' }, + MsgUnderline = { fg = green, gui = 'underline' }, + } --- Neovim Terminal Colors {{{ - -if configuration.terminal_colors then - vim.g.terminal_color_0 = bg - vim.g.terminal_color_1 = red - vim.g.terminal_color_2 = green - vim.g.terminal_color_3 = yellow - vim.g.terminal_color_4 = blue - vim.g.terminal_color_5 = violet - vim.g.terminal_color_6 = cyan - vim.g.terminal_color_7 = fg - vim.g.terminal_color_8 = grey - vim.g.terminal_color_9 = red - vim.g.terminal_color_10 = green - vim.g.terminal_color_11 = orange - vim.g.terminal_color_12 = blue - vim.g.terminal_color_13 = violet - vim.g.terminal_color_14 = cyan - vim.g.terminal_color_15 = white - vim.g.terminal_color_background = bg_alt - vim.g.terminal_color_foreground = fg_alt + apply_highlight(msg_underline) + high_link('LspDiagnosticsFloatingError', 'ErrorMsg') + high_link('LspDiagnosticsFloatingWarning', 'WarningMsg') + high_link('LspDiagnosticsFloatingInformation', 'MoreMsg') + high_link('LspDiagnosticsFloatingHint', 'Msg') + high_link('LspDiagnosticsDefaultError', 'ErrorMsg') + high_link('LspDiagnosticsDefaultWarning', 'WarningMsg') + high_link('LspDiagnosticsDefaultInformation', 'MoreMsg') + high_link('LspDiagnosticsDefaultHint', 'Msg') + high_link('LspDiagnosticsVirtualTextError', 'ErrorMsg') + high_link('LspDiagnosticsVirtualTextWarning', 'WarningMsg') + high_link('LspDiagnosticsVirtualTextInformation', 'MoreMsg') + high_link('LspDiagnosticsVirtualTextHint', 'Msg') + high_link('LspDiagnosticsUnderlineError', 'ErrorMsgUnderline') + high_link('LspDiagnosticsUnderlineWarning', 'WarningMsgUnderline') + high_link('LspDiagnosticsUnderlineInformation', 'MoreMsgUnderline') + high_link('LspDiagnosticsUnderlineHint', 'MsgUnderline') + high_link('LspDiagnosticsSignError', 'ErrorMsg') + high_link('LspDiagnosticsSignWarning', 'WarningMsg') + high_link('LspDiagnosticsSignInformation', 'MoreMsg') + high_link('LspDiagnosticsSignHint', 'Msg') + high_link('DiagnosticFloatingError', 'ErrorMsg') + high_link('DiagnosticFloatingWarn', 'WarningMsg') + high_link('DiagnosticFloatingInfo', 'MoreMsg') + high_link('DiagnosticFloatingHint', 'Msg') + high_link('DiagnosticDefaultError', 'ErrorMsg') + high_link('DiagnosticDefaultWarn', 'WarningMsg') + high_link('DiagnosticDefaultInfo', 'MoreMsg') + high_link('DiagnosticDefaultHint', 'Msg') + high_link('DiagnosticVirtualTextError', 'ErrorMsg') + high_link('DiagnosticVirtualTextWarn', 'WarningMsg') + high_link('DiagnosticVirtualTextInfo', 'MoreMsg') + high_link('DiagnosticVirtualTextHint', 'Msg') + high_link('DiagnosticUnderlineError', 'ErrorMsgUnderline') + high_link('DiagnosticUnderlineWarn', 'WarningMsgUnderline') + high_link('DiagnosticUnderlineInfo', 'MoreMsgUnderline') + high_link('DiagnosticUnderlineHint', 'MsgUnderline') + high_link('DiagnosticSignError', 'ErrorMsg') + high_link('DiagnosticSignWarning', 'WarningMsg') + high_link('DiagnosticSignInformation', 'MoreMsg') + high_link('DiagnosticSignHint', 'Msg') + high_link('LspReferenceText', 'LspHighlight') + high_link('LspReferenceRead', 'LspHighlight') + high_link('LspReferenceWrite', 'LspHighlight') + high_link('TermCursor', 'Cursor') + high_link('healthError', 'ErrorMsg') + high_link('healthSuccess', 'Msg') + high_link('healthWarning', 'WarningMsg') + + -- }}} + + -- TreeSitter {{{ + + if configuration.enable_treesitter then + -- We will set a special definition for TSStrike here + local treesitter = { + TSStrike = { fg = utils.Darken(violet, 0.2), cterm = 'strikethrough', gui = 'strikethrough' }, + } + + apply_highlight(treesitter) + high_link('TSException', 'Exception') + high_link('TSAnnotation', 'PreProc') + high_link('TSAttribute', 'Attribute') + high_link('TSConditional', 'Conditional') + high_link('TSComment', 'Comment') + high_link('TSConstructor', 'Structure') + high_link('TSConstant', 'Constant') + high_link('TSConstBuiltin', 'Constant') + high_link('TSConstMacro', 'Macro') + high_link('TSError', 'Error') + high_link('TSField', 'Field') + high_link('TSFloat', 'Float') + high_link('TSFunction', 'Function') + high_link('TSFuncBuiltin', 'FunctionBuiltin') + high_link('TSFuncMacro', 'Macro') + high_link('TSInclude', 'Include') + high_link('TSKeyword', 'Keyword') + high_link('TSKeywordFunction', 'KeywordFunction') + high_link('TSLabel', 'Label') + high_link('TSMethod', 'Method') + high_link('TSNamespace', 'Directory') + high_link('TSNumber', 'Number') + high_link('TSOperator', 'Operator') + high_link('TSParameter', 'Argument') + high_link('TSParameterReference', 'Argument') + high_link('TSProperty', 'Property') + high_link('TSPunctDelimiter', 'Delimiter') + high_link('TSPunctBracket', 'Delimiter') + high_link('TSPunctSpecial', 'Delimiter') + high_link('TSRepeat', 'Repeat') + high_link('TSString', 'String') + high_link('TSStringRegex', 'StringDelimiter') + high_link('TSStringEscape', 'StringDelimiter') + high_link('TSTag', 'Tag') + high_link('TSTagDelimiter', 'Delimiter') + high_link('TSStrong', 'Bold') + high_link('TSURI', 'URL') + high_link('TSWarning', 'WarningMsg') + high_link('TSDanger', 'ErrorMsg') + high_link('TSType', 'Type') + high_link('TSTypeBuiltin', 'TypeBuiltin') + high_link('TSVariable', 'None') + high_link('TSVariableBuiltin', 'VariableBuiltin') + end + + -- }}} + + -- Neovim Terminal Colors {{{ + + if configuration.terminal_colors then + vim.g.terminal_color_0 = bg + vim.g.terminal_color_1 = red + vim.g.terminal_color_2 = green + vim.g.terminal_color_3 = yellow + vim.g.terminal_color_4 = blue + vim.g.terminal_color_5 = violet + vim.g.terminal_color_6 = cyan + vim.g.terminal_color_7 = fg + vim.g.terminal_color_8 = grey + vim.g.terminal_color_9 = red + vim.g.terminal_color_10 = green + vim.g.terminal_color_11 = orange + vim.g.terminal_color_12 = blue + vim.g.terminal_color_13 = violet + vim.g.terminal_color_14 = cyan + vim.g.terminal_color_15 = white + vim.g.terminal_color_background = bg_alt + vim.g.terminal_color_foreground = fg_alt + end + + -- }}} end --- }}} - return doom_one From f1a01eb66d8e67b2051f01c9abb8182f93621db2 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 22:26:31 -0400 Subject: [PATCH 149/290] refact: move `get_git_output` function to utils module - Use `get_git_output` function in `:DoomUpdate` and `:DoomRollback` commands - Use `xpcall` instead of `pcall` in functions module for better tracebacks --- lua/doom/core/functions/init.lua | 50 +++++++++++-------------- lua/doom/modules/built-in/info/init.lua | 29 +++----------- lua/doom/utils/init.lua | 19 ++++++++++ 3 files changed, 47 insertions(+), 51 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 7e822a0c4..e8929ba10 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -102,7 +102,7 @@ end -- Change the 'doom_config.lua' file configurations for the colorscheme and the -- background if they were changed by the user within Neovim M.change_colors_and_bg = function() - local changed_colorscheme, err = pcall(function() + local changed_colorscheme, err = xpcall(function() log.debug("Checking if the colorscheme or background were changed ...") local target_colorscheme = vim.g.colors_name local target_background = vim.opt.background:get() @@ -130,7 +130,7 @@ M.change_colors_and_bg = function() fs.write_file(doom_config_path, doom_config, "w+") log.debug("Background successfully changed to " .. target_background) end - end) + end, debug.traceback) if not changed_colorscheme then log.error("Unable to write to the doom_config.lua file. Traceback:\n" .. err) @@ -157,10 +157,10 @@ end -- check_updates checks for plugins updates M.check_updates = function() - local updated_plugins, err = pcall(function() + local updated_plugins, err = xpcall(function() log.info("Updating the outdated plugins ...") vim.cmd("PackerSync") - end) + end, debug.traceback) if not updated_plugins then log.error("Unable to update plugins. Traceback:\n" .. err) @@ -207,7 +207,7 @@ M.create_report = function() local date = os.date("%Y-%m-%d %H:%M:%S") local log_date_format = os.date("%a %d %b %Y") - local created_report, err = pcall(function() + local created_report, err = xpcall(function() -- Get and save only the warning and error logs from today local today_logs = {} local doom_logs = vim.split(fs.read_file(system.doom_logs), "\n") @@ -278,7 +278,7 @@ M.create_report = function() ) fs.write_file(system.doom_report, report, "w+") log.info("Report created at " .. system.doom_report) - end) + end, debug.traceback) if not created_report then log.error("Error while writing report. Traceback:\n" .. err) @@ -288,21 +288,17 @@ end -- save_backup_hashes saves the commits or releases SHA for future rollbacks local function save_backup_hashes() -- Check for the current branch - local branch_handler = io.popen(system.git_workspace .. "branch --show-current") - local git_branch = branch_handler:read("*a"):gsub("[\r\n]", "") - branch_handler:close() + local git_branch = utils.get_git_output("branch --show-current", true) if git_branch == "main" then local releases_database_path = string.format("%s%s.doom_releases", system.doom_root, system.sep) -- Fetch for a file containing the releases tags log.info("Saving the Doom releases for future rollbacks ...") - local saved_releases, releases_err = pcall(function() + local saved_releases, releases_err = xpcall(function() -- Get the releases log.debug('Executing "' .. system.git_workspace .. 'show-ref --tags"') - local releases_handler = io.popen(system.git_workspace .. "show-ref --tags") - local doom_releases = releases_handler:read("*a") - releases_handler:close() + local doom_releases = utils.get_git_output("show-ref --tags", false) -- Put all the releases into a table so we can sort them later local releases = {} @@ -339,7 +335,7 @@ local function save_backup_hashes() fs.write_file(releases_database_path, release .. "\n", "a+") end end - end) + end, debug.traceback) if not saved_releases then log.error("Error while saving the Doom releases. Traceback:\n" .. releases_err) @@ -347,7 +343,7 @@ local function save_backup_hashes() else -- Get the current commit SHA and store it into a hidden file log.info("Saving the current commit SHA for future rollbacks ...") - local saved_backup_hash, backup_err = pcall(function() + local saved_backup_hash, backup_err = xpcall(function() os.execute( system.git_workspace .. "rev-parse --short HEAD > " @@ -355,7 +351,7 @@ local function save_backup_hashes() .. system.sep .. ".doom_backup_hash" ) - end) + end, debug.traceback) if not saved_backup_hash then log.error("Error while saving the backup commit hash. Traceback:\n" .. backup_err) @@ -369,9 +365,9 @@ M.update_doom = function() save_backup_hashes() log.info("Pulling Doom remote changes ...") - local updated_doom, update_err = pcall(function() + local updated_doom, update_err = xpcall(function() os.execute(system.git_workspace .. "pull -q") - end) + end, debug.traceback) if not updated_doom then log.error("Error while updating Doom. Traceback:\n" .. update_err) @@ -409,9 +405,7 @@ M.rollback_doom = function() -- Check the current commit hash and compare it with the ones in the -- releases table local current_version - local commit_handler = io.popen(system.git_workspace .. "rev-parse HEAD") - local current_commit = commit_handler:read("*a"):gsub("[\r\n]", "") - commit_handler:close() + local current_commit = utils.get_git_output("rev-parse HEAD", true) for _, version_info in ipairs(sorted_releases) do for release_hash, version in version_info:gmatch("(%w+)%s(%w+%W+%w+%W+%w+)") do if release_hash == current_commit then @@ -445,9 +439,9 @@ M.rollback_doom = function() end log.info("Reverting back to version " .. rollback_version .. " (" .. rollback_sha .. ") ...") - local rolled_back, rolled_err = pcall(function() + local rolled_back, rolled_err = xpcall(function() os.execute(system.git_workspace .. "checkout " .. rollback_sha) - end) + end, debug.traceback) if not rolled_back then log.error( @@ -470,9 +464,9 @@ M.rollback_doom = function() elseif vim.fn.filereadable(rolling_backup) == 1 then local backup_commit = fs.read_file(rolling_backup):gsub("[\r\n]+", "") log.info("Reverting back to commit " .. backup_commit .. " ...") - local rolled_back, rolled_err = pcall(function() + local rolled_back, rolled_err = xpcall(function() os.execute(system.git_workspace .. "checkout " .. backup_commit) - end) + end, debug.traceback) if not rolled_back then log.error( @@ -536,7 +530,7 @@ local normal_buftype = function() return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt" end M.toggle_completion = function() - local ok, cmp = pcall(require, "cmp") + local ok, cmp = xpcall(require, debug.traceback, "cmp") if ok then local next_cmp_toggle_flag = not vim.g.cmp_toggle_flag if next_cmp_toggle_flag then @@ -620,7 +614,7 @@ end -- toggle_autopairs() -- tp -- toggle autopairs M.toggle_autopairs = function() - local ok, autopairs = pcall(require, "nvim-autopairs") + local ok, autopairs = xpcall(require, debug.traceback, "nvim-autopairs") if ok then if autopairs.state.disabled then autopairs.enable() @@ -650,7 +644,7 @@ end -- change_syntax() -- tx -- toggle syntax/treesetter M.change_syntax = function() - local ok, parsers = pcall(require, "nvim-treesitter.parsers") + local ok, parsers = xpcall(require, debug.traceback, "nvim-treesitter.parsers") if ok and parsers and parsers.has_parser() then if vim.o.syntax then vim.cmd("TSBufDisable highlight") diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 398c650e2..72912da79 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -108,23 +108,6 @@ local get_lsp_clients = function(bufnr) return string.len(client_names) > 0 and client_names or msg end ---- Executes a git command and gets the output ---- @param command string ---- @param remove_newlines boolean ---- @return string -local function get_git_output(command, remove_newlines) - local git_command_handler = io.popen(system.git_workspace .. command) - -- Read the command output and remove newlines if wanted - local command_output = git_command_handler:read("*a") - if remove_newlines then - command_output = command_output:gsub("[\r\n]", "") - end - -- Close child process - git_command_handler:close() - - return command_output -end - local function get_doom_info() local doom_info = {} @@ -133,7 +116,7 @@ local function get_doom_info() -- Doom version local doom_version = utils.doom_version -- Doom branch - local doom_branch = get_git_output("branch --show-current", true) + local doom_branch = utils.get_git_output("branch --show-current", true) -- Configurations path local config_path = require("doom.core.config").source local modules_path = require("doom.core.config.modules").source @@ -156,8 +139,8 @@ local function get_doom_info() ) -- Local commit and last update date - local current_commit = get_git_output("rev-parse HEAD", true) - local last_update_date = get_git_output("show -s --format=%cD " .. current_commit, true) + local current_commit = utils.get_git_output("rev-parse HEAD", true) + local last_update_date = utils.get_git_output("show -s --format=%cD " .. current_commit, true) vim.list_extend(doom_info, { "Doom Nvim Information", @@ -179,12 +162,12 @@ local function get_doom_info() }) if doom_branch == "develop" then -- Current commit relevant information - local current_commit_author = get_git_output( + local current_commit_author = utils.get_git_output( 'show -s --format="%cN <%cE>" ' .. current_commit, true ) - local current_commit_message = get_git_output("show -s --format=%s " .. current_commit, true) - local current_commit_body = get_git_output("show -s --format=%b " .. current_commit, false) + local current_commit_message = utils.get_git_output("show -s --format=%s " .. current_commit, true) + local current_commit_body = utils.get_git_output("show -s --format=%b " .. current_commit, false) vim.list_extend(doom_info, { "", diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index f0833140d..eda0d457a 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -7,6 +7,8 @@ --- @class utils local utils = {} +local system = require("doom.core.system") + -------------------- HELPERS -------------------- --- Doom Nvim version utils.doom_version = "3.2.0-beta2" @@ -48,4 +50,21 @@ utils.has_value = function(tabl, val) return false end +--- Executes a git command and gets the output +--- @param command string +--- @param remove_newlines boolean +--- @return string +utils.get_git_output = function(command, remove_newlines) + local git_command_handler = io.popen(system.git_workspace .. command) + -- Read the command output and remove newlines if wanted + local command_output = git_command_handler:read("*a") + if remove_newlines then + command_output = command_output:gsub("[\r\n]", "") + end + -- Close child process + git_command_handler:close() + + return command_output +end + return utils From cbe4db0ab64f92dbf23cd59105c5153a9d7df92c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 7 Oct 2021 02:27:12 +0000 Subject: [PATCH 150/290] chore: format source code --- lua/doom/modules/built-in/info/init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 72912da79..1f5a4aff1 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -166,8 +166,14 @@ local function get_doom_info() 'show -s --format="%cN <%cE>" ' .. current_commit, true ) - local current_commit_message = utils.get_git_output("show -s --format=%s " .. current_commit, true) - local current_commit_body = utils.get_git_output("show -s --format=%b " .. current_commit, false) + local current_commit_message = utils.get_git_output( + "show -s --format=%s " .. current_commit, + true + ) + local current_commit_body = utils.get_git_output( + "show -s --format=%b " .. current_commit, + false + ) vim.list_extend(doom_info, { "", From 63a4008091ff9d46c0f6b5e1fa1015f3dea104a8 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 22:30:27 -0400 Subject: [PATCH 151/290] refact: use `xpcall` instead of `pcall` in all modules to provide a better traceback in case of an error --- lua/doom/core/config/init.lua | 2 +- lua/doom/core/config/modules.lua | 2 +- lua/doom/core/config/ui.lua | 4 ++-- lua/doom/core/config/userplugins.lua | 2 +- lua/doom/extras/logging/init.lua | 2 +- lua/doom/modules/built-in/compiler/init.lua | 8 ++++---- lua/doom/modules/built-in/runner/init.lua | 8 ++++---- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index a5964c6d2..797d6a8a7 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -472,7 +472,7 @@ log.debug("Loading Doom config module ...") -- 1. /doom_config.lua -- 2. /home/user/.config/doom-nvim/doom_config.lua -- 3. stdpath('config')/doom_config.lua -local ok, ret = pcall(require, "doom_config") +local ok, ret = xpcall(require, debug.traceback, "doom_config") if ok then M.config = ret.config M.source = ret.source diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua index a10cc5826..284fa2d01 100644 --- a/lua/doom/core/config/modules.lua +++ b/lua/doom/core/config/modules.lua @@ -88,7 +88,7 @@ log.debug("Loading Doom modules module ...") -- 1. /doom_modules.lua -- 2. /home/user/.config/doom-nvim/doom_modules.lua -- 3. stdpath('config')/doom_modules.lua -local ok, ret = pcall(require, "doom_modules") +local ok, ret = xpcall(require, debug.traceback, "doom_modules") if ok then M.modules = ret.modules M.source = ret.source diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua index fc7009046..91bca0717 100644 --- a/lua/doom/core/config/ui.lua +++ b/lua/doom/core/config/ui.lua @@ -12,10 +12,10 @@ log.debug("Loading Doom UI module ...") -- If no colorscheme was established then fallback to defauls if not utils.is_empty(config.doom.colorscheme) then - local loaded_colorscheme = pcall(function() + local loaded_colorscheme = xpcall(function() vim.opt.background = config.doom.colorscheme_bg vim.api.nvim_command("colorscheme " .. config.doom.colorscheme) - end) + end, debug.traceback) if not loaded_colorscheme then log.warn("Colorscheme '" .. config.doom.colorscheme .. "' not found, falling to doom-one") diff --git a/lua/doom/core/config/userplugins.lua b/lua/doom/core/config/userplugins.lua index 7ba66e314..ea01fa694 100644 --- a/lua/doom/core/config/userplugins.lua +++ b/lua/doom/core/config/userplugins.lua @@ -18,7 +18,7 @@ log.debug("Loading Doom userplugins module...") -- 1. /doom_userplugins.lua -- 2. /home/user/.config/doom-nvim/doom_userplugins.lua -- 3. stdpath('config')/doom_userplugins.lua -local ok, ret = pcall(require, "doom_userplugins") +local ok, ret = xpcall(require, debug.traceback, "doom_userplugins") if ok then M.plugins = ret.plugins M.source = ret.source diff --git a/lua/doom/extras/logging/init.lua b/lua/doom/extras/logging/init.lua index 8765bde24..fed606c70 100644 --- a/lua/doom/extras/logging/init.lua +++ b/lua/doom/extras/logging/init.lua @@ -14,7 +14,7 @@ local system = require("doom.core.system") local logging_level = "info" -- Manually load doom_config.lua to avoid circular dependencies -local ok, ret = pcall(require, "doom_config") +local ok, ret = xpcall(require, debug.traceback, "doom_config") if ok then logging_level = ret.config.doom.logging or logging_level else diff --git a/lua/doom/modules/built-in/compiler/init.lua b/lua/doom/modules/built-in/compiler/init.lua index f861e949e..bb0421a09 100644 --- a/lua/doom/modules/built-in/compiler/init.lua +++ b/lua/doom/modules/built-in/compiler/init.lua @@ -23,7 +23,7 @@ M.compile = function() local filetype = vim.bo.filetype local lang_bin = languages[filetype] - local compiled_code, err = pcall(function() + local compiled_code, err = xpcall(function() if lang_bin then -- Set the properly builder command for the project local compiler_cmd @@ -39,7 +39,7 @@ M.compile = function() else log.error("The filetype " .. filetype .. " is not yet supported in the Doom compiler plugin") end - end) + end, debug.traceback) if not compiled_code then log.error("Error while trying to compile the project. Traceback:\n" .. err) @@ -51,7 +51,7 @@ M.compile_and_run = function() local filetype = vim.bo.filetype local lang_bin = languages[filetype] - local compiled_code, err = pcall(function() + local compiled_code, err = xpcall(function() if lang_bin then -- Set the properly builder command for the project local compiler_cmd @@ -72,7 +72,7 @@ M.compile_and_run = function() else log.error("The filetype " .. filetype .. " is not yet supported in the Doom compiler plugin") end - end) + end, debug.traceback) if not compiled_code then log.error("Error while trying to compile and run the project. Traceback:\n" .. err) diff --git a/lua/doom/modules/built-in/runner/init.lua b/lua/doom/modules/built-in/runner/init.lua index 1a604d065..bc4c60eea 100644 --- a/lua/doom/modules/built-in/runner/init.lua +++ b/lua/doom/modules/built-in/runner/init.lua @@ -28,7 +28,7 @@ M.start_repl = function() local filetype = vim.bo.filetype local repl_cmd = languages[filetype] - local opened_repl, err = pcall(function() + local opened_repl, err = xpcall(function() if repl_cmd then local repl = term:new({ cmd = repl_cmd, hidden = true }) repl:open() @@ -39,7 +39,7 @@ M.start_repl = function() .. ". Maybe it is not yet supported in the Doom runner plugin?" ) end - end) + end, debug.traceback) if not opened_repl then log.error("Error while trying to opening a repl for " .. filetype .. ". Traceback:\n" .. err) @@ -51,7 +51,7 @@ M.run_code = function() local filetype = vim.bo.filetype local lang_bin = languages[filetype] - local run_code, err = pcall(function() + local run_code, err = xpcall(function() if lang_bin then local runner = term:new({ cmd = lang_bin .. " " .. vim.fn.expand("%"), @@ -66,7 +66,7 @@ M.run_code = function() .. ". Maybe it is not yet supported in the Doom runner plugin?" ) end - end) + end, debug.traceback) if not run_code then log.error("Error while trying to run the current file. Traceback:\n" .. err) From 510e4f3f894c88bcbea14a774da9b4866e6baf46 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 22:35:03 -0400 Subject: [PATCH 152/290] refact(system): rename module from `M` to `system` Add missing newlines to improve readability --- lua/doom/core/system/init.lua | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lua/doom/core/system/init.lua b/lua/doom/core/system/init.lua index 58f8d77d1..822f8553a 100644 --- a/lua/doom/core/system/init.lua +++ b/lua/doom/core/system/init.lua @@ -4,28 +4,33 @@ -- License: GPLv2 -- ---[[---------------------------------------]]--- -local M = {} +local system = {} local stdpath = vim.fn.stdpath local config_dir = stdpath("config"):match(".*[/\\]"):sub(1, -2) -M.sep = package.config:sub(1, 1) +system.sep = package.config:sub(1, 1) -- The doom-nvim root directory, works as a fallback for looking Doom Nvim configurations -- in case that doom_configs_root directory does not exists. -M.doom_root = stdpath("config") +system.doom_root = stdpath("config") + -- The doom-nvim configurations root directory -M.doom_configs_root = table.concat({ config_dir, "doom-nvim" }, M.sep) -local testdir = vim.loop.fs_opendir(M.doom_configs_root) +system.doom_configs_root = table.concat({ config_dir, "doom-nvim" }, system.sep) + +local testdir = vim.loop.fs_opendir(system.doom_configs_root) if testdir then vim.loop.fs_closedir(testdir) else - M.doom_configs_root = stdpath("config") + system.doom_configs_root = stdpath("config") end + -- The doom-nvim logs file path -M.doom_logs = table.concat({ stdpath("data"), "doom.log" }, M.sep) +system.doom_logs = table.concat({ stdpath("data"), "doom.log" }, system.sep) + -- The doom-nvim bug report file path -M.doom_report = table.concat({ stdpath("data"), "doom_report.md" }, M.sep) +system.doom_report = table.concat({ stdpath("data"), "doom_report.md" }, system.sep) + -- The git workspace for doom-nvim, e.g. 'git -C /home/JohnDoe/.config/nvim' -M.git_workspace = string.format("git -C %s ", stdpath("config")) +system.git_workspace = string.format("git -C %s ", stdpath("config")) -return M +return system From 0ce8e678216ad577c4c66e2d0a317fd6a6907e47 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 22:43:13 -0400 Subject: [PATCH 153/290] docs: small updates to built-in docs --- doc/doom_nvim.norg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index 1b6bc804a..cc278c3a5 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -34,6 +34,8 @@ --> [General](#General) ---> [Who is Doom Nvim intended for?](#Who is Doom Nvim intended for?) ---> [Why does Doom Nvim only support Neovim 0.5.0 (and beyond)?](#Why does Doom Nvim only support Neovim 0.5.0 and beyond?) + --> [Workaround](#Workaround) + ---> [Missing nvim help documentation](#Missing nvim help documentation) -> [Acknowledgements](#Acknowledgements) -> [Contributing](#Contributing) -> [License](#License) @@ -639,5 +641,6 @@ * License Doom Nvim is distributed under GPLv2 license. + $comment -vim:sw=2:ts=2:cole=3:cocu=n:tw=100:cc=100:norl: +vim:sw=2:ts=2:cole=3:cocu=n:tw=100:norl: From fb15b681a8234a7bf1811f2d786d7eb486d1e2f2 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 23:08:02 -0400 Subject: [PATCH 154/290] feat(doom-one): pull upstream changes --- lua/colors/doom-one/config/init.lua | 1 + lua/colors/doom-one/init.lua | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lua/colors/doom-one/config/init.lua b/lua/colors/doom-one/config/init.lua index d668c6492..a9bff10d9 100644 --- a/lua/colors/doom-one/config/init.lua +++ b/lua/colors/doom-one/config/init.lua @@ -12,6 +12,7 @@ local configuration = { transparency_amount = 20, }, plugins_integrations = { + neorg = true, barbar = true, bufferline = false, gitgutter = false, diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua index 6739f1a6b..9f37de452 100644 --- a/lua/colors/doom-one/init.lua +++ b/lua/colors/doom-one/init.lua @@ -837,6 +837,23 @@ doom_one.load_colorscheme = function() -- }}} + -- Neorg {{{ + + if configuration.plugins_integrations.neorg then + local neorg = { + -- Colors are for nested quotes + Blue = { fg = cyan }, + Yellow = { fg = yellow }, + Red = { fg = red }, + Green = { fg = green }, + Brown = { fg = orange }, + } + + apply_highlight(neorg) + end + + -- }}} + -- }}} -- LSP {{{ From d73f94607d30755cde09d1bc3de8381455ec1961 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 6 Oct 2021 23:08:17 -0400 Subject: [PATCH 155/290] feat(ui): update doom-one setup --- lua/doom/core/config/ui.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua index 91bca0717..1cdd5b39c 100644 --- a/lua/doom/core/config/ui.lua +++ b/lua/doom/core/config/ui.lua @@ -47,9 +47,10 @@ require("colors.doom-one").setup({ transparent_background = config.doom.doom_one.transparent_background, pumblend = { enable = true, - transparency_amount = 20, + transparency_amount = config.doom.complete_transparency, }, plugins_integrations = { + neorg = true, barbar = false, bufferline = true, gitgutter = false, From 11ce3a5954b5307634896d9e2b70d09140bb13ba Mon Sep 17 00:00:00 2001 From: tamton-aquib Date: Wed, 6 Oct 2021 17:12:21 +0530 Subject: [PATCH 156/290] updating diagnostic signs and their highlights --- doc/doom_nvim.norg | 4 ++-- lua/doom/modules/config/doom-lspconfig.lua | 24 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index cc278c3a5..9fdf8c585 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -157,7 +157,7 @@ *NOTE*: You can see a list of currently supported languages at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall#bundled-installers). ** Autocompletion - Doom Nvim uses the [built-in LSP](https://neovim.io/doc/user/lsp.html) plus [nvim-compe](https://github.com/hrsh7th/nvim-compe) plugin as completion engine. + Doom Nvim uses the [built-in LSP](https://neovim.io/doc/user/lsp.html) plus [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) plugin as completion engine. Use `` to select the next suggestion and `` to select the current one. @@ -579,7 +579,7 @@ │ └── doom-one.lua -> doom-one colorscheme ported to Nvim (default one) ├── doc -> Docs to be used inside Nvim │ └── doom_nvim.norg -> Doom Nvim User Manual - ├── docs -> Docs meant to be readed on GitHub + ├── docs -> Docs meant to be read on GitHub ├── doom_modules.lua -> Doom modules configurations file ├── doom_config.lua -> Doom main configurations file ├── doom_userplugins.lua -> User defined plugins diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index f0cd2a897..c04ab6abb 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -4,25 +4,25 @@ return function() local config = require("doom.core.config").config -- Lsp Symbols - fn.sign_define("LspDiagnosticsSignError", { - texthl = "LspDiagnosticsSignError", + fn.sign_define("DiagnosticSignError", { + texthl = "DiagnosticSignError", text = config.doom.lsp_error, - numhl = "LspDiagnosticsSignError", + numhl = "DiagnosticSignError", }) - fn.sign_define("LspDiagnosticsSignWarning", { - texthl = "LspDiagnosticsSignWarning", + fn.sign_define("DiagnosticSignWarn", { + texthl = "DiagnosticSignWarn", text = config.doom.lsp_warning, - numhl = "LspDiagnosticsSignWarning", + numhl = "DiagnosticSignWarn", }) - fn.sign_define("LspDiagnosticsSignHint", { - texthl = "LspDiagnosticsSignHint", + fn.sign_define("DiagnosticSignHint", { + texthl = "DiagnosticSignHint", text = config.doom.lsp_hint, - numhl = "LspDiagnosticsSignHint", + numhl = "DiagnosticSignHint", }) - fn.sign_define("LspDiagnosticsSignInformation", { - texthl = "LspDiagnosticsSignInformation", + fn.sign_define("DiagnosticSignInfo", { + texthl = "DiagnosticSignInfo", text = config.doom.lsp_information, - numhl = "LspDiagnosticsSignInformation", + numhl = "DiagnosticSignInfo", }) lsp.handlers["textDocument/publishDiagnostics"] = From a8a52611428a63d0948901f18c5e7b463d91a2dd Mon Sep 17 00:00:00 2001 From: tamton-aquib Date: Thu, 7 Oct 2021 17:12:42 +0530 Subject: [PATCH 157/290] changing warning->warn and information->info across --- doom_config.lua | 4 +- lua/doom/core/config/init.lua | 4 +- lua/doom/modules/config/doom-eviline.lua | 2 +- lua/doom/modules/config/doom-lspconfig.lua | 48 +++++++++++++--------- lua/doom/modules/config/doom-tree.lua | 4 +- 5 files changed, 35 insertions(+), 27 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 9f5ebbb17..59eb70f2b 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -332,9 +332,9 @@ M.config = { -- Set your custom lsp diagnostic symbols below lsp_error = "", - lsp_warning = "", + lsp_warn = "", lsp_hint = "", - lsp_information = "", + lsp_info = "", lsp_virtual_text = " ", -- Set your linters for the programming languages that you use, diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 797d6a8a7..934e95445 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -351,9 +351,9 @@ M.config = { -- Set your custom lsp diagnostic symbols below lsp_error = "", - lsp_warning = "", + lsp_warn = "", lsp_hint = "", - lsp_information = "", + lsp_info = "", lsp_virtual_text = " ", -- Set your linters for the programming languages that you use, diff --git a/lua/doom/modules/config/doom-eviline.lua b/lua/doom/modules/config/doom-eviline.lua index 6d5f550c5..afd23e63c 100644 --- a/lua/doom/modules/config/doom-eviline.lua +++ b/lua/doom/modules/config/doom-eviline.lua @@ -140,7 +140,7 @@ return function() DiagnosticWarn = { provider = "DiagnosticWarn", condition = is_not_dashboard, - icon = config.doom.lsp_warning .. " ", + icon = config.doom.lsp_warn .. " ", highlight = { colors("orange"), colors("bg") }, }, } diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index c04ab6abb..8cadb5f89 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -4,26 +4,34 @@ return function() local config = require("doom.core.config").config -- Lsp Symbols - fn.sign_define("DiagnosticSignError", { - texthl = "DiagnosticSignError", - text = config.doom.lsp_error, - numhl = "DiagnosticSignError", - }) - fn.sign_define("DiagnosticSignWarn", { - texthl = "DiagnosticSignWarn", - text = config.doom.lsp_warning, - numhl = "DiagnosticSignWarn", - }) - fn.sign_define("DiagnosticSignHint", { - texthl = "DiagnosticSignHint", - text = config.doom.lsp_hint, - numhl = "DiagnosticSignHint", - }) - fn.sign_define("DiagnosticSignInfo", { - texthl = "DiagnosticSignInfo", - text = config.doom.lsp_information, - numhl = "DiagnosticSignInfo", - }) + local signs, hl + if vim.fn.has("nvim-0.6.0") == 1 then + signs = { + Error = config.doom.lsp_error, + Warn = config.doom.lsp_warn, + Info = config.doom.lsp_info, + Hint = config.doom.lsp_hint, + } + hl = "DiagnosticSign" + else + signs = { + Error = config.doom.lsp_error, + Warning = config.doom.lsp_warn, + Information = config.doom.lsp_info, + Hint = config.doom.lsp_hint, + } + hl = "LspDiagnosticsSign" + end + + for severity, icon in pairs(signs) do + local highlight = hl .. severity + + fn.sign_define(highlight, { + text = icon, + texthl = highlight, + numhl = highlight, + }) + end lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, { diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index 740daf031..2c8c9e6b3 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -79,8 +79,8 @@ return function() }, lsp = { hint = config.doom.lsp_hint, - info = config.doom.lsp_information, - warning = config.doom.lsp_warning, + info = config.doom.lsp_info, + warning = config.doom.lsp_warn, error = config.doom.lsp_error, }, } From 3f7b88b85fbc1b7f9b889716efc4acc3fa35ccfc Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 7 Oct 2021 09:15:05 -0400 Subject: [PATCH 158/290] feat(settings): use a better syntax for Neovim folds - Set foldcolumn - Set fillchars - Modify signcolumn default value --- lua/doom/core/functions/init.lua | 5 +++++ lua/doom/core/settings/init.lua | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index e8929ba10..eb54d438d 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -666,4 +666,9 @@ M.change_syntax = function() end end +M.sugar_folds = function() + local start_line = vim.fn.getline(vim.v.foldstart):gsub("\t", ("\t"):rep(vim.opt.tabstop:get())) + return string.format("%s ... (%d lines)", start_line, vim.v.foldend - vim.v.foldstart + 1) +end + return M diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index 5921e33da..e9aaeee08 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -29,14 +29,26 @@ M.load_default_options = function() vim.opt.shortmess:append("atsc") vim.opt.inccommand = "split" vim.opt.path = "**" - vim.opt.signcolumn = "yes" + vim.opt.signcolumn = "auto:2-9" + vim.opt.foldcolumn = "auto:9" + + vim.opt.fillchars = { + vert = "▕", + fold = " ", + eob = " ", + diff = "─", + msgsep = "‾", + foldopen = "▾", + foldclose = "▸", + foldsep = "│", + } -- Buffer options vim.opt.smartindent = true vim.opt.copyindent = true vim.opt.preserveindent = true - -- set Gui Fonts + -- Set Gui Fonts vim.opt.guifont = config.doom.guifont .. ":h" .. config.doom.guifont_size -- Use clipboard outside vim @@ -133,6 +145,9 @@ M.load_default_options = function() vim.opt.softtabstop = config.doom.indent vim.opt.colorcolumn = tostring(config.doom.max_columns) vim.opt.conceallevel = config.doom.conceallevel + + -- Better folding + vim.cmd([[set foldtext=luaeval(\"require('doom.core.functions').sugar_folds()\")]]) end -- Doom Nvim commands From ef37daa2769171b40dc84fcbae70f22f8e03bd90 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 7 Oct 2021 09:15:32 -0400 Subject: [PATCH 159/290] fix: move documentation to top in configuration files --- doom_config.lua | 12 +++++------- doom_modules.lua | 8 +++++--- doom_userplugins.lua | 7 +++++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 59eb70f2b..3064fcc0b 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -1,5 +1,3 @@ -local M = {} -M.source = debug.getinfo(1, "S").source:sub(2) -- doom_config - Doom Nvim user configurations file -- -- This file contains the user-defined configurations for Doom nvim and consists @@ -10,8 +8,11 @@ M.source = debug.getinfo(1, "S").source:sub(2) -- 2. Nvim, this one defines all the custom configurations that you want to -- use in Neovim, e.g. a colorscheme italic_comments global variable +local M = {} + +M.source = debug.getinfo(1, "S").source:sub(2) + M.config = { - -- {{{ Doom doom = { -- Autosave -- false : Disable autosave @@ -367,9 +368,7 @@ M.config = { -- @default = doom emacs' default dashboard header dashboard_custom_header = {}, }, - -- }}} - -- {{{ Nvim nvim = { -- Set custom Neovim global variables -- @default = {} @@ -440,9 +439,8 @@ M.config = { -- } options = {}, }, - -- }}} } return M --- vim: sw=2 sts=2 ts=2 fdm=marker noexpandtab +-- vim: sw=2 sts=2 ts=2 fdm=indent noexpandtab diff --git a/doom_modules.lua b/doom_modules.lua index 5541ce963..4e4d50950 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -1,5 +1,3 @@ -local M = {} -M.source = debug.getinfo(1, "S").source:sub(2) -- doom_modules - Doom nvim module selection -- -- The doom_modules controls what Doom nvim plugins modules are enabled and @@ -13,6 +11,10 @@ M.source = debug.getinfo(1, "S").source:sub(2) -- "Configuration" one. In that section you will find a comprehensive list of -- the available modules and all their supported flags. +local M = {} + +M.source = debug.getinfo(1, "S").source:sub(2) + M.modules = { ui = { "dashboard", -- Start screen @@ -94,4 +96,4 @@ M.modules = { return M --- vim: sw=2 sts=2 ts=2 noexpandtab +-- vim: sw=2 sts=2 ts=2 fdm=indent noexpandtab diff --git a/doom_userplugins.lua b/doom_userplugins.lua index 075ea8bfc..a03700002 100644 --- a/doom_userplugins.lua +++ b/doom_userplugins.lua @@ -1,5 +1,3 @@ -local M = {} -M.source = debug.getinfo(1, "S").source:sub(2) -- doom_userplugins - Doom nvim custom plugins -- -- This file contains all the custom plugins that are not in Doom nvim but that @@ -13,6 +11,11 @@ M.source = debug.getinfo(1, "S").source:sub(2) -- requires = { 'nvim-lua/telescope.nvim' }, -- }, -- } + +local M = {} + +M.source = debug.getinfo(1, "S").source:sub(2) + M.plugins = {} return M From b9f6d6f877a9f9d9dbaa7ada44e5dc95a129501d Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 7 Oct 2021 10:03:19 -0400 Subject: [PATCH 160/290] feat: add `enable_lsp_virtual_text` configuration option disable LSP diagnostics virtual text by default, show diagnostics on CursorHold --- doom_config.lua | 4 ++++ lua/doom/core/config/init.lua | 4 ++++ lua/doom/extras/autocmds/init.lua | 9 +++++++++ lua/doom/modules/config/doom-lspconfig.lua | 4 ++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 3064fcc0b..6e774b4fb 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -219,6 +219,10 @@ M.config = { -- @default = false disable_autocommands = false, + -- Enable LSP diagnostics virtual text + -- @default = false + enable_lsp_virtual_text = false, + -- Default indent size -- @default = 4 indent = 4, diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 934e95445..a190836b0 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -237,6 +237,10 @@ M.config = { -- @default = false disable_autocommands = false, + -- Enable LSP diagnostics virtual text + -- @default = false + enable_lsp_virtual_text = false, + -- Default indent size -- @default = 4 indent = 4, diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 033a274f8..7f12b62c8 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -153,5 +153,14 @@ if not is_plugin_disabled("linter") and packer_plugins and packer_plugins["nvim- }) end +-- Show line diagnostics on hover +if not config.doom.enable_lsp_virtual_text then + table.insert(autocmds["doom_extras"], { + "CursorHold,CursorHoldI", + "", + 'lua vim.lsp.diagnostic.show_line_diagnostics({ focusable=false, border "single" })', + }) +end + -- Create augroups utils.create_augroups(autocmds) diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index 8cadb5f89..2e7891098 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -35,9 +35,9 @@ return function() lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, { - virtual_text = { + virtual_text = config.doom.enable_lsp_virtual_text and { prefix = config.doom.lsp_virtual_text, -- change this to whatever you want your diagnostic icons to be - }, + } or false, }) -- symbols for autocomplete lsp.protocol.CompletionItemKind = { From 4881aee35ab9579d4009539ba97a5ceecbac17ad Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 7 Oct 2021 10:05:38 -0400 Subject: [PATCH 161/290] fix: missing `=` in border option, update `cll` keybind --- lua/doom/extras/autocmds/init.lua | 2 +- lua/doom/extras/keybindings/leader.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 7f12b62c8..db0d13a72 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -158,7 +158,7 @@ if not config.doom.enable_lsp_virtual_text then table.insert(autocmds["doom_extras"], { "CursorHold,CursorHoldI", "", - 'lua vim.lsp.diagnostic.show_line_diagnostics({ focusable=false, border "single" })', + 'lua vim.lsp.diagnostic.show_line_diagnostics({ focusable = false, border = "single" })', }) end diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 92cf1f25e..51b90a953 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -770,7 +770,7 @@ mappings.map( mappings.map( "n", "cll", - "lua vim.lsp.diagnostic.show_line_diagnostics()", + 'lua vim.lsp.diagnostic.show_line_diagnostics({ focusable = false, border = "single" })', opts, "LSP", "line_diagnostic", From 17dfa9dc0e23715a04fcfb465cad00057ae36853 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 7 Oct 2021 10:30:54 -0400 Subject: [PATCH 162/290] feat(modules): add logging message when downloading packer --- lua/doom/modules/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index d3f9c44b9..3303b317c 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -10,6 +10,7 @@ local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim" if vim.fn.empty(vim.fn.glob(packer_path)) > 0 then + log.info("Bootstrapping packer.nvim, please wait ...") vim.fn.system({ "git", "clone", From 4301afe731bd8961c4cdeccf0a56571ec75881b7 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 7 Oct 2021 10:49:28 -0400 Subject: [PATCH 163/290] feat: add `use_floating_win_packer` configuration option decide if using floating windows for packer stuff --- doom_config.lua | 4 ++++ lua/doom/core/config/init.lua | 4 ++++ lua/doom/modules/init.lua | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/doom_config.lua b/doom_config.lua index 6e774b4fb..26cd54c16 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -223,6 +223,10 @@ M.config = { -- @default = false enable_lsp_virtual_text = false, + -- Use floating windows for plugins manager (packer) operations + -- @default = false + use_floating_win_packer = false, + -- Default indent size -- @default = 4 indent = 4, diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index a190836b0..297f98f9f 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -241,6 +241,10 @@ M.config = { -- @default = false enable_lsp_virtual_text = false, + -- Use floating windows for plugins manager (packer) operations + -- @default = false + use_floating_win_packer = false, + -- Default indent size -- @default = 4 indent = 4, diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 3303b317c..f906120ef 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -4,6 +4,7 @@ -- to our FAQ to see why. local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled +local use_floating_win_packer = require("doom.core.config").config.doom.use_floating_win_packer ---- Packer Bootstrap --------------------------- ------------------------------------------------- @@ -33,6 +34,11 @@ packer.init({ install = "clone --depth %i --progress", }, }, + display = { + open_fn = use_floating_win_packer and function() + return require("packer.util").float({ border = "single" }) + end or nil, + }, profile = { enable = true, }, From ea97e7de96f1b5615437f873b2651fcbfd793e32 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 7 Oct 2021 22:13:29 -0400 Subject: [PATCH 164/290] feat(modules): add `async` module --- lua/doom/modules/built-in/async/init.lua | 102 +++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 lua/doom/modules/built-in/async/init.lua diff --git a/lua/doom/modules/built-in/async/init.lua b/lua/doom/modules/built-in/async/init.lua new file mode 100644 index 000000000..3ae04b4bb --- /dev/null +++ b/lua/doom/modules/built-in/async/init.lua @@ -0,0 +1,102 @@ +--- @class async +local async = {} + +--- Safely close child processes +--- @param handle uv_pipe_t +local function safe_close(handle) + if handle and not handle:is_closing() then + handle:close() + end +end + +--- Create a new async process +--- @param job_opts table The async job options +--- @return table +function async:new(job_opts) + job_opts = job_opts or {} + for opt, val in pairs(job_opts) do + self[opt] = val + end + setmetatable(job_opts, self) + self.__index = self + + return job_opts +end + +--- Set the async job options +--- @return table +function async.options() + local options = {} + local args = vim.split(async.cmd, " ") + + async.stdin = vim.loop.new_pipe(false) + async.stdout = vim.loop.new_pipe(false) + async.stderr = vim.loop.new_pipe(false) + + -- Get the async job command, e.g. 'git' + options.command = table.remove(args, 1) + options.args = args + options.stdio = { async.stdin, async.stdout, async.stderr } + + if async.cwd then + options.cwd = async.cwd + end + + if async.env then + options.env = async.env + end + + if async.detach then + options.detach = async.detach + end + + return options +end + +--- Send data to stdin +--- @param data string +async.send = function(data) + async.stdin:write(data) + async.stdin:shutdown() +end + +--- Shutdown stdio in async jobs +--- @param code number The exit code +--- @param signal number The exit signal +async.shutdown = function(code, signal) + if async.on_exit then + async.on_exit(code, signal) + end + if async.on_stdout then + async.stdout:read_stop() + end + if async.on_stderr then + async.stderr:read_stop() + end + async.stop() +end + +--- Start a new async job +async.start = function() + local opts = async.options() + local cmd = opts.command + opts.command = nil + + async.handle = vim.loop.spawn(cmd, opts, async.shutdown) + if async.on_stdout then + vim.loop.read_start(async.stdout, vim.schedule_wrap(async.on_stdout)) + end + if async.on_stderr then + vim.loop.read_start(async.stderr, async.on_stderr) + end +end + +--- Stop an async job +async.stop = function() + safe_close(async.stdin) + safe_close(async.stdout) + safe_close(async.stderr) + safe_close(async.handle) +end + +return async From acb2300fc9c52e30607d3b0d604ba62d6a290d2f Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 7 Oct 2021 22:17:32 -0400 Subject: [PATCH 165/290] refact: async Doom updating, see #158 - Fix undefined log in `doom.modules` module (fixes ci too) BREAKING CHANGE: move `is_plugin_disabled` and `check_plugin` from `doom.core.functions` to `doom.utils` --- init.lua | 2 +- lua/doom/core/functions/init.lua | 58 +++++++-------------- lua/doom/extras/autocmds/init.lua | 2 +- lua/doom/extras/keybindings/completion.lua | 2 +- lua/doom/extras/keybindings/core.lua | 2 +- lua/doom/extras/keybindings/leader.lua | 2 +- lua/doom/modules/built-in/info/init.lua | 4 +- lua/doom/modules/config/doom-autopairs.lua | 2 +- lua/doom/modules/config/doom-blankline.lua | 4 +- lua/doom/modules/config/doom-lspinstall.lua | 2 +- lua/doom/modules/config/doom-neorg.lua | 1 + lua/doom/modules/config/doom-tree.lua | 2 +- lua/doom/modules/config/doom-treesitter.lua | 4 +- lua/doom/modules/config/doom-whichkey.lua | 2 +- lua/doom/modules/init.lua | 6 +-- lua/doom/utils/init.lua | 32 ++++++++++++ 16 files changed, 68 insertions(+), 59 deletions(-) diff --git a/init.lua b/init.lua index 0a5964bcd..8b2a4585a 100644 --- a/init.lua +++ b/init.lua @@ -45,7 +45,7 @@ vim.defer_fn(function() doautocmd BufEnter ]]) - if not require("doom.core.functions").is_plugin_disabled("which-key") then + if not require("doom.utils").is_plugin_disabled("which-key") then vim.cmd([[ PackerLoad which-key.nvim ]]) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index eb54d438d..c664bfc7e 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -8,41 +8,12 @@ local log = require("doom.extras.logging") local utils, fs = require("doom.utils"), require("doom.utils.fs") local system = require("doom.core.system") local config = require("doom.core.config").config +local async = require("doom.modules.built-in.async") local M = {} log.debug("Loading Doom functions module ...") --- check_plugin checks if the given plugin exists --- @tparam string plugin_name The plugin name, e.g. nvim-tree.lua --- @tparam string path Where should be searched the plugin in packer's path, defaults to `start` --- @return bool -M.check_plugin = function(plugin_name, path) - if not path then - path = "start" - end - - return vim.fn.isdirectory( - vim.fn.stdpath("data") .. "/site/pack/packer/" .. path .. "/" .. plugin_name - ) == 1 -end - --- is_plugin_disabled checks if the given plugin is disabled in doom_modules.lua --- @tparam string plugin The plugin identifier, e.g. statusline --- @return bool -M.is_plugin_disabled = function(plugin) - local modules = require("doom.core.config.modules").modules - - -- Iterate over all modules sections (e.g. ui) and their plugins - for _, section in pairs(modules) do - if utils.has_value(section, plugin) then - return false - end - end - - return true -end - -- Load user-defined settings from the Neovim field in the doom_config.lua -- @param settings_tbl The settings table to iterate over -- @param scope The settings scope, e.g. autocmds @@ -365,17 +336,24 @@ M.update_doom = function() save_backup_hashes() log.info("Pulling Doom remote changes ...") - local updated_doom, update_err = xpcall(function() - os.execute(system.git_workspace .. "pull -q") - end, debug.traceback) - if not updated_doom then - log.error("Error while updating Doom. Traceback:\n" .. update_err) - end - -- Run syntax_on event to fix UI if it's broke after the git pull - vim.cmd("syntax on") - - log.info("Successfully updated Doom, please restart") + local updater = async:new({ + cmd = "git pull", + cwd = system.doom_root, + on_stdout = function(_, data) + if data then + log.info("Successfully updated Doom, please restart") + end + end, + on_stderr = function(err, data) + if err then + log.error("Error while updating Doom. Traceback:\n" .. err) + elseif data then + log.error("Error while updating Doom. Traceback:\n" .. data:gsub("[\r\n]", "")) + end + end, + }) + updater:start() end -- rollback_doom will rollback the local doom version to an older one diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index db0d13a72..1af7ee0a9 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -7,7 +7,7 @@ local utils = require("doom.utils") local log = require("doom.extras.logging") local config = require("doom.core.config").config -local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled +local is_plugin_disabled = require("doom.utils").is_plugin_disabled log.debug("Loading Doom autocmds module ...") diff --git a/lua/doom/extras/keybindings/completion.lua b/lua/doom/extras/keybindings/completion.lua index 3eef8246a..926566566 100644 --- a/lua/doom/extras/keybindings/completion.lua +++ b/lua/doom/extras/keybindings/completion.lua @@ -3,7 +3,7 @@ ---]]-----------------[[--- local mappings = require("doom.utils.mappings") -local check_plugin = require("doom.core.functions").check_plugin +local check_plugin = require("doom.utils").check_plugin local opts = { silent = true } local lsp_opts = vim.tbl_extend("force", opts, { expr = true }) diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua index d499e4db1..8967089c5 100644 --- a/lua/doom/extras/keybindings/core.lua +++ b/lua/doom/extras/keybindings/core.lua @@ -1,6 +1,6 @@ local mappings = require("doom.utils.mappings") local config = require("doom.core.config").config -local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled +local is_plugin_disabled = require("doom.utils").is_plugin_disabled -- Additional options for mappings local opts = { silent = true } diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 51b90a953..df2da0cf6 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -4,7 +4,7 @@ local mappings = require("doom.utils.mappings") local config = require("doom.core.config").config -local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled +local is_plugin_disabled = require("doom.utils").is_plugin_disabled -- Additional options for mappings local opts = { silent = true } diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index 1f5a4aff1..fd0f6b815 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -235,7 +235,7 @@ local function get_doom_info() ----- LSP INFORMATION ------------------------- ----------------------------------------------- if - not require("doom.core.functions").is_plugin_disabled("lsp") + not require("doom.utils").is_plugin_disabled("lsp") and packer_plugins["nvim-lspinstall"] then vim.list_extend(doom_info, { @@ -340,7 +340,7 @@ local function get_buffer_info() ----- LSP INFORMATION ------------------------- ----------------------------------------------- if - not require("doom.core.functions").is_plugin_disabled("lsp") + not require("doom.utils").is_plugin_disabled("lsp") and packer_plugins["nvim-lspinstall"] then vim.list_extend(buffer_info, { diff --git a/lua/doom/modules/config/doom-autopairs.lua b/lua/doom/modules/config/doom-autopairs.lua index 13940fdff..d0c0c3927 100644 --- a/lua/doom/modules/config/doom-autopairs.lua +++ b/lua/doom/modules/config/doom-autopairs.lua @@ -1,5 +1,5 @@ return function() - local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled + local is_plugin_disabled = require("doom.utils").is_plugin_disabled require("nvim-autopairs").setup({ check_ts = is_plugin_disabled("treesitter") and false or true, enable_afterquote = true, diff --git a/lua/doom/modules/config/doom-blankline.lua b/lua/doom/modules/config/doom-blankline.lua index 9ecf39aa8..b23bc58cd 100644 --- a/lua/doom/modules/config/doom-blankline.lua +++ b/lua/doom/modules/config/doom-blankline.lua @@ -5,9 +5,7 @@ return function() enabled = config.doom.show_indent, char = "│", -- If treesitter plugin is enabled then use its indentation - use_treesitter = require("doom.core.functions").check_plugin("nvim-treesitter", "opt") - and true - or false, + use_treesitter = require("doom.utils").check_plugin("nvim-treesitter", "opt"), show_first_indent_level = false, filetype_exclude = { "help", "dashboard", "packer", "norg", "DoomInfo" }, buftype_exclude = { "terminal" }, diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua index 700235d55..69e8d3e1b 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspinstall.lua @@ -2,7 +2,7 @@ return function() local log = require("doom.extras.logging") local utils = require("doom.utils") local nvim_lsp = require("lspconfig") - local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled + local is_plugin_disabled = require("doom.utils").is_plugin_disabled -- Snippets support local capabilities = vim.lsp.protocol.make_client_capabilities() diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index 10d4a864c..02e6cd71f 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -21,6 +21,7 @@ return function() }, }, }, + ["core.integrations.pandoc"] = {}, }, }) end diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index 2c8c9e6b3..655583d6c 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -105,7 +105,7 @@ return function() -- updates the root directory of the tree on `DirChanged` (when your run `:cd` usually) update_cwd = true, -- show lsp diagnostics in the signcolumn - lsp_diagnostics = require("doom.core.functions").is_plugin_disabled("lsp") and false or true, + lsp_diagnostics = require("doom.utils").is_plugin_disabled("lsp") and false or true, -- update the focused file on `BufEnter`, un-collapses the folders recursively until it finds the file update_focused_file = { -- enables the feature diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index c5fd6d789..99cc2704c 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -1,7 +1,7 @@ return function() local has_value = require("doom.utils").has_value local modules = require("doom.core.config.modules").modules - local functions = require("doom.core.functions") + local is_plugin_disabled = require("doom.utils").is_plugin_disabled local function get_ts_parsers(languages) local langs = {} @@ -57,7 +57,7 @@ return function() ensure_installed = get_ts_parsers(modules.langs), highlight = { enable = true }, autopairs = { - enable = functions.is_plugin_disabled("autopairs") and false or true, + enable = is_plugin_disabled("autopairs") and false or true, }, indent = { enable = true }, playground = { enable = true }, diff --git a/lua/doom/modules/config/doom-whichkey.lua b/lua/doom/modules/config/doom-whichkey.lua index 0d260b45c..72aa7f30d 100644 --- a/lua/doom/modules/config/doom-whichkey.lua +++ b/lua/doom/modules/config/doom-whichkey.lua @@ -218,7 +218,7 @@ return function() ["t"] = { "jump to tag" }, }, } - local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled + local is_plugin_disabled = require("doom.utils").is_plugin_disabled if not is_plugin_disabled("autopairs") then mappings["t"]["p"] = { "autopairs" } end diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index f906120ef..065e760e1 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -3,7 +3,7 @@ -- NOTE: We do not provide other LSP integration like coc.nvim, please refer -- to our FAQ to see why. -local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled +local is_plugin_disabled = require("doom.utils").is_plugin_disabled local use_floating_win_packer = require("doom.core.config").config.doom.use_floating_win_packer ---- Packer Bootstrap --------------------------- @@ -11,7 +11,7 @@ local use_floating_win_packer = require("doom.core.config").config.doom.use_floa local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim" if vim.fn.empty(vim.fn.glob(packer_path)) > 0 then - log.info("Bootstrapping packer.nvim, please wait ...") + require("doom.extras.logging").info("Bootstrapping packer.nvim, please wait ...") vim.fn.system({ "git", "clone", @@ -85,7 +85,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", - branch = "unstable", + branch = "pandoc-integration", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, after = { "nvim-treesitter" }, diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index eda0d457a..9b71632bb 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -67,4 +67,36 @@ utils.get_git_output = function(command, remove_newlines) return command_output end + +--- Check if the given plugin is disabled in doom_modules.lua +--- @param plugin string The plugin identifier, e.g. statusline +--- @return boolean +utils.is_plugin_disabled = function(plugin) + local modules = require("doom.core.config.modules").modules + + -- Iterate over all modules sections (e.g. ui) and their plugins + for _, section in pairs(modules) do + if utils.has_value(section, plugin) then + return false + end + end + + return true +end + + +-- Check if the given plugin exists +-- @param plugin_name string The plugin name, e.g. nvim-tree.lua +-- @param path string Where should be searched the plugin in packer's path, defaults to `start` +-- @return boolean +utils.check_plugin = function(plugin_name, path) + if not path then + path = "start" + end + + return vim.fn.isdirectory( + vim.fn.stdpath("data") .. "/site/pack/packer/" .. path .. "/" .. plugin_name + ) == 1 +end + return utils From ae56f97e9c03cab275dcda016ae1a4e06f29c712 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 02:18:14 +0000 Subject: [PATCH 166/290] chore: format source code --- lua/doom/modules/built-in/info/init.lua | 10 ++-------- lua/doom/utils/init.lua | 2 -- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index fd0f6b815..a15fa19a8 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -234,10 +234,7 @@ local function get_doom_info() ----- LSP INFORMATION ------------------------- ----------------------------------------------- - if - not require("doom.utils").is_plugin_disabled("lsp") - and packer_plugins["nvim-lspinstall"] - then + if not require("doom.utils").is_plugin_disabled("lsp") and packer_plugins["nvim-lspinstall"] then vim.list_extend(doom_info, { "", string.format("%s▶ Installed language servers", padding_level[1]), @@ -339,10 +336,7 @@ local function get_buffer_info() ----- LSP INFORMATION ------------------------- ----------------------------------------------- - if - not require("doom.utils").is_plugin_disabled("lsp") - and packer_plugins["nvim-lspinstall"] - then + if not require("doom.utils").is_plugin_disabled("lsp") and packer_plugins["nvim-lspinstall"] then vim.list_extend(buffer_info, { "", string.format("%s▶ Language Servers", padding_level[1]), diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 9b71632bb..a21777262 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -67,7 +67,6 @@ utils.get_git_output = function(command, remove_newlines) return command_output end - --- Check if the given plugin is disabled in doom_modules.lua --- @param plugin string The plugin identifier, e.g. statusline --- @return boolean @@ -84,7 +83,6 @@ utils.is_plugin_disabled = function(plugin) return true end - -- Check if the given plugin exists -- @param plugin_name string The plugin name, e.g. nvim-tree.lua -- @param path string Where should be searched the plugin in packer's path, defaults to `start` From fca4a460728d3033a793b150f0dbf888a86496fd Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Thu, 7 Oct 2021 22:34:06 -0400 Subject: [PATCH 167/290] feat(utils): add `escape_str` function use `utils.escape_str` in `change_colors_and_bg` function --- lua/doom/core/functions/init.lua | 4 ++-- lua/doom/utils/init.lua | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index c664bfc7e..67a44198d 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -85,8 +85,8 @@ M.change_colors_and_bg = function() local doom_config = fs.read_file(doom_config_path) doom_config = string.gsub( doom_config, - string.format('"%s"', config.doom.colorscheme:gsub("[%-]", "%%%1")), - string.format('"%s"', target_colorscheme:gsub("[%-]", "%%%1")) + string.format('"%s"', utils.escape_str(config.doom.colorscheme)), + string.format('"%s"', utils.escape_str(target_colorscheme)) ) fs.write_file(doom_config_path, doom_config, "w+") log.debug("Colorscheme successfully changed to " .. target_colorscheme) diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index a21777262..d8b9f4797 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -35,6 +35,25 @@ utils.is_empty = function(str) return str == "" or str == nil end +utils.escape_str = function(str) + local escape_patterns = { + "%^", + "%$", + "%(", + "%)", + "%[", + "%]", + "%%", + "%.", + "%-", + "%*", + "%+", + "%?", + } + + return str:gsub(("([%s])"):format(table.concat(escape_patterns)), "%%%1") +end + --- Search if a table have the value we are looking for, --- useful for plugins management --- @param tabl table From 7fc31b9649f34e22d4b5e1c3e8ab0587ef238752 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 8 Oct 2021 02:13:09 -0400 Subject: [PATCH 168/290] feat(modules): improve lazy-loading of some plugins --- init.lua | 3 +++ lua/doom/modules/init.lua | 11 +++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 8b2a4585a..d43728559 100644 --- a/init.lua +++ b/init.lua @@ -29,6 +29,9 @@ vim.defer_fn(function() -- Load Doom extra stuff and plugins (modules, extras) load_modules("doom", { "modules", "extras" }) + -- This loads certain plugins related to UI + vim.cmd("doautocmd ColorScheme") + -- If the current buffer name is empty then trigger Dashboard. -- NOTE: this is done to avoid some weird issues with Dashboard and -- number / signcolumn when Dashboard gets triggered automatically diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 065e760e1..bf247a58a 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -407,7 +407,6 @@ packer.startup(function(use) "kabouzeid/nvim-lspinstall", config = require("doom.modules.config.doom-lspinstall"), disable = disabled_lsp, - event = "BufWinEnter", }) -- Show function signature when you type @@ -468,7 +467,7 @@ packer.startup(function(use) "lukas-reineke/format.nvim", config = require("doom.modules.config.doom-format"), disable = disabled_formatter, - event = "BufWinEnter", + cmd = { "Format", "FormatWrite" }, }) -- Linting @@ -477,7 +476,7 @@ packer.startup(function(use) "mfussenegger/nvim-lint", config = require("doom.modules.config.doom-lint"), disable = disabled_linter, - event = "BufWinEnter", + module = "lint", }) -- Indent Lines @@ -486,7 +485,7 @@ packer.startup(function(use) "lukas-reineke/indent-blankline.nvim", config = require("doom.modules.config.doom-blankline"), disable = disabled_indent_lines, - event = "BufWinEnter", + event = "ColorScheme", }) -- EditorConfig support @@ -526,7 +525,7 @@ packer.startup(function(use) "norcalli/nvim-colorizer.lua", config = require("doom.modules.config.doom-colorizer"), disable = disabled_colorizer, - event = "BufWinEnter", + event = "ColorScheme", }) -- HTTP Client support @@ -571,7 +570,7 @@ packer.startup(function(use) requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), disable = disabled_todo, - event = "BufWinEnter", + event = "ColorScheme", }) local disabled_trouble = is_plugin_disabled("trouble") From 1d39d358b1de3e4b3bc6c8d7b321b30acafe3282 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 8 Oct 2021 02:13:58 -0400 Subject: [PATCH 169/290] fix(keybindings): set `` to `` only if which-key is not enabled --- lua/doom/extras/keybindings/leader.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index df2da0cf6..6ff4655a1 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -10,7 +10,9 @@ local is_plugin_disabled = require("doom.utils").is_plugin_disabled local opts = { silent = true } -- Set Space key as leader -mappings.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu") +if is_plugin_disabled("which-key") then + mappings.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu") +end vim.g.mapleader = " " if config.doom.new_file_split then From f3c077893f45fdeafb3bd0b99b03b10f9d3fffa9 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 8 Oct 2021 02:16:34 -0400 Subject: [PATCH 170/290] refact(modules): use `package.loaded` to check toggleterm existence in built-in modules --- lua/doom/modules/built-in/compiler/init.lua | 2 +- lua/doom/modules/built-in/runner/init.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/built-in/compiler/init.lua b/lua/doom/modules/built-in/compiler/init.lua index bb0421a09..14735f04f 100644 --- a/lua/doom/modules/built-in/compiler/init.lua +++ b/lua/doom/modules/built-in/compiler/init.lua @@ -1,7 +1,7 @@ local log = require("doom.extras.logging") local term -if packer_plugins and packer_plugins["nvim-toggleterm.lua"] then +if package.loaded["toggleterm"] then term = require("toggleterm.terminal").Terminal else log.error( diff --git a/lua/doom/modules/built-in/runner/init.lua b/lua/doom/modules/built-in/runner/init.lua index bc4c60eea..d152f4294 100644 --- a/lua/doom/modules/built-in/runner/init.lua +++ b/lua/doom/modules/built-in/runner/init.lua @@ -1,7 +1,7 @@ local log = require("doom.extras.logging") local term -if packer_plugins and packer_plugins["nvim-toggleterm.lua"] then +if package.loaded["toggleterm"] then term = require("toggleterm.terminal").Terminal else log.error( From 323086571b24b1ae5d9e34e747b46f6078c77cba Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 8 Oct 2021 02:46:46 -0400 Subject: [PATCH 171/290] feat: completely reload Doom after updating. Closes #158 - Call modules functions in a protected call - Add `reload_lua_modules`, `reload_configs` and `full_reload` functions to reloader module --- lua/doom/core/functions/init.lua | 4 +- lua/doom/modules/built-in/reloader/init.lua | 183 ++++++++++++++++++-- 2 files changed, 169 insertions(+), 18 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 67a44198d..c44d2f965 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -342,7 +342,9 @@ M.update_doom = function() cwd = system.doom_root, on_stdout = function(_, data) if data then - log.info("Successfully updated Doom, please restart") + log.info("Successfully updated Doom!") + --- Completely reload Doom Nvim + require("doom.modules.built-in.reloader").full_reload() end end, on_stderr = function(err, data) diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index d50bb305e..c8ce66f81 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -1,34 +1,138 @@ --- @class Reloader local reloader = {} +local fs = require("doom.utils.fs") +local utils = require("doom.utils") +local log = require("doom.extras.logging") +local system = require("doom.core.system") + +--- Paths to reload plugins +local plugins_files_path = string.format("%s/site/pack/packer/start/*", vim.fn.stdpath("data")) +local vim_subdirs = { "doc", "after", "syntax", "plugin" } + +local installed_plenary, _ = pcall(require, "plenary") +if not installed_plenary then + log.warn("Skipped reloader module loading, requires 'plenary.nvim' plugin to be installed") + return +end + +local scan_dir = require("plenary.scandir").scan_dir + +--- Converts a Lua module path into an acceptable Lua module format +--- @param module_path string The path to the module +--- @return string +local function path_to_lua_module(module_path) + local lua_path = string.format("%s/lua", system.doom_root) + + -- Remove the Neovim config dir and the file extension from the path + module_path = string.match( + module_path, + string.format("%s/(.*)%%.lua", utils.escape_str(lua_path)) + ) + + -- Replace '/' with '.' to follow the common Lua modules format + module_path = module_path:gsub("/", ".") + + -- Remove '.init' if the module ends with it + module_path = module_path:gsub("%.init$", "") + + return module_path +end + +--- Gets the runtime files found in the given path +--- @param parent_path string The parent path to look for files +--- @return table +local function get_runtime_files(parent_path) + local runtime_files = {} + + -- Look in each Neovim subdir for runtime files (documentation, syntax files, etc) + for _, subdir in ipairs(vim_subdirs) do + local path = string.format("%s/%s", parent_path, subdir) + + if fs.file_exists(path) then + local dir_files = {} + -- We scan VimL and Lua files because some plugins has a 'plugin/foo.lua' file + local dir_vim_files = scan_dir(path, { search_pattern = "%.vim$", hidden = true }) + local dir_lua_files = scan_dir(path, { search_pattern = "%.lua$", hidden = true }) + vim.list_extend(dir_files, dir_vim_files) + vim.list_extend(dir_files, dir_lua_files) + + for _, file in ipairs(dir_files) do + runtime_files[#runtime_files + 1] = file + end + end + end + + return runtime_files +end + +--- Gets all the Lua files found in '~/.config/nvim/lua' directory +--- @return table +local function get_lua_modules(path) + -- Look for Lua modules in Doom Nvim root + local modules = scan_dir(path, { search_pattern = "%.lua$", hidden = true }) + for idx, module in ipairs(modules) do + module = path_to_lua_module(module) + + -- Override previous value with new value + modules[idx] = module + end + + return modules +end + +--- Reloads all Neovim runtime files found in plugins +local function reload_runtime_files() + local paths = vim.fn.glob(plugins_files_path, 0, 1) + + for _, path in ipairs(paths) do + local runtime_files = get_runtime_files(path) + + for _, file in ipairs(runtime_files) do + vim.cmd("silent! source " .. file) + end + end +end + --- Reload a Lua module --- @param mod_path string The configuration module path --- @param quiet boolean If the reloader should send an info log or not reloader.reload_lua_module = function(mod_path, quiet) - -- Remove the Neovim config dir and the file extension from the path, - -- also replace '/' with '.' so we can access the modules by using package table - -- e.g. doom.modules.config.doom-neorg - mod_path = mod_path:gsub(vim.fn.stdpath("config") .. "/lua/", ""):gsub("/", "."):gsub(".lua", "") + if mod_path:find("/") then + mod_path = path_to_lua_module(mod_path) + end + -- Get the module from package table local mod = package.loaded[mod_path] - if type(mod) ~= "nil" then - -- Unload the module and load it again - package.loaded[mod_path] = nil - require(mod_path) + -- Unload the module and load it again + package.loaded[mod_path] = nil + require(mod_path) - if type(mod) == "function" then - -- Call the loaded module function so the reloading will take effect as expected - package.loaded[mod_path]() + if type(mod) == "function" then + -- Call the loaded module function so the reloading will take effect as expected + local ok, _ = pcall(package.loaded[mod_path]) + if not ok then + log.error(string.format("Failed to reload '%s' module", mod_path)) end + end + + if not quiet then + log.info(string.format("Successfully reloaded '%s' module", mod_path)) + end +end + +--- Reload all Lua modules +--- @param quiet boolean If the reloader should send an info log or not +reloader.reload_lua_modules = function(quiet) + local paths = vim.fn.glob(system.doom_root .. "/lua", 0, 1) + + for _, path in ipairs(paths) do + local modules = get_lua_modules(path) - if not quiet then - require("doom.extras.logging").info( - string.format("Successfully reloaded '%s' module", mod_path) - ) + for _, module in ipairs(modules) do + reloader.reload_lua_module(module, quiet) end - else - require("doom.extras.logging").error(string.format("Failed to reload '%s' module", mod_path)) end end @@ -59,4 +163,49 @@ reloader.reload_plugins_definitions = function() end, 800) end +--- Reload all Neovim configurations +reloader.reload_configs = function() + --- Clear highlighting + vim.cmd("hi clear") + + --- Restart running language servers + if vim.fn.exists(":LspRestart") ~= 0 then + vim.cmd("silent! LspRestart") + end + + --- Source Doom init + vim.cmd("source $MYVIMRC") + + --- Reload all loaded Lua modules + reloader.reload_lua_modules(true) + + --- Reload start plugins + reload_runtime_files() + + --- Fix some syntax highlighting issues caused by clearing highlighting + vim.cmd("doautocmd Syntax") +end + +--- Reload Neovim and simulate a new run +reloader.full_reload = function() + -- Store the time taken to reload Doom + local reload_time = vim.fn.reltime() + + --- Reload Neovim configurations + reloader.reload_configs() + + --- Run VimEnter autocommand to simulate a new Neovim launch + --- and reload all buffers + vim.cmd([[ + doautocmd VimEnter + ]]) + + log.info( + "Reloaded Doom in " .. vim.fn.printf( + "%.3f", + vim.fn.reltimefloat(vim.fn.reltime(reload_time)) + ) .. " seconds" + ) +end + return reloader From a439fd7d93fd4fa5dc3fb23016ba4b77fad962f8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 06:47:26 +0000 Subject: [PATCH 172/290] chore: format source code --- lua/doom/modules/built-in/reloader/init.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index c8ce66f81..025912354 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -201,10 +201,9 @@ reloader.full_reload = function() ]]) log.info( - "Reloaded Doom in " .. vim.fn.printf( - "%.3f", - vim.fn.reltimefloat(vim.fn.reltime(reload_time)) - ) .. " seconds" + "Reloaded Doom in " + .. vim.fn.printf("%.3f", vim.fn.reltimefloat(vim.fn.reltime(reload_time))) + .. " seconds" ) end From 614076938e510e7a84e45011084dbdcc7b9a5306 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 8 Oct 2021 03:07:59 -0400 Subject: [PATCH 173/290] chore(reloader): add extra logging message --- lua/doom/modules/built-in/reloader/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index 025912354..0658ed969 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -190,6 +190,7 @@ end reloader.full_reload = function() -- Store the time taken to reload Doom local reload_time = vim.fn.reltime() + log.info("Reloading Doom ...") --- Reload Neovim configurations reloader.reload_configs() From a253eb0b0ae0046d3362d00264109f3ef27a1128 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 8 Oct 2021 03:13:53 -0400 Subject: [PATCH 174/290] feat(autocmds): use `q` to exit Neovim in dashboard --- lua/doom/extras/autocmds/init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 1af7ee0a9..35a2cd6a2 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -153,6 +153,15 @@ if not is_plugin_disabled("linter") and packer_plugins and packer_plugins["nvim- }) end +-- Quickly exit Neovim on dashboard +if not is_plugin_disabled("dashboard") then + table.insert(autocmds["doom_extras"], { + "FileType", + "dashboard", + "nnoremap q :q", + }) +end + -- Show line diagnostics on hover if not config.doom.enable_lsp_virtual_text then table.insert(autocmds["doom_extras"], { From cc6120b537643e0f4ed9424c991c2ef2829cbcb3 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 8 Oct 2021 03:15:23 -0400 Subject: [PATCH 175/290] fix(settings): allow a lower amount of signs in signcolumn --- lua/doom/core/settings/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index e9aaeee08..bbce94757 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -29,7 +29,7 @@ M.load_default_options = function() vim.opt.shortmess:append("atsc") vim.opt.inccommand = "split" vim.opt.path = "**" - vim.opt.signcolumn = "auto:2-9" + vim.opt.signcolumn = "auto:2-3" vim.opt.foldcolumn = "auto:9" vim.opt.fillchars = { From d97b68aca8c328496af5125eb534a661bf8e9425 Mon Sep 17 00:00:00 2001 From: Aquib <77913442+tamton-aquib@users.noreply.github.com> Date: Fri, 8 Oct 2021 13:00:20 +0530 Subject: [PATCH 176/290] Find files from folder of currently active files regarding #94 (#160) --- lua/doom/extras/keybindings/leader.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 6ff4655a1..c1813cfd0 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -53,11 +53,11 @@ end mappings.map( "n", "`", - "Telescope find_files", + "lua require('telescope.builtin').find_files({cwd=vim.fn.expand('%:p:h')})", opts, "Editor", - "find_files", - "Find file" + "cwd_file_browser", + "Find file from CWD of current file" ) mappings.map( "n", From 21dfc61a1a5c6f801276c4832cf69a37a781c580 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 8 Oct 2021 03:42:47 -0400 Subject: [PATCH 177/290] fix(modules): use `unstable` branch of neorg --- lua/doom/modules/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index bf247a58a..a735f7350 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -85,7 +85,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", - branch = "pandoc-integration", + branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, after = { "nvim-treesitter" }, From d65db01c661f9f6f902b2085a729191ef5894102 Mon Sep 17 00:00:00 2001 From: Steven Teskey Date: Thu, 7 Oct 2021 19:54:24 -0600 Subject: [PATCH 178/290] Updated file path for keybindings config file --- docs/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 40ddd1602..5fa0ff4ba 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -527,7 +527,7 @@ Where `OVERRIDE_LSP_NAME` is a different option at [bundled installers](https:// You can modify the default keybindings by modifying the following files: -- `lua/doom/core/keybindings/init.lua` - General and SPC keybindings +- `lua/doom/extras/keybindings/init.lua` - General and SPC keybindings - `lua/doom/modules/config` - lua plugins keybindings You can also define your own keybindings in your `doom_config.lua` with the `nvim.mappings` field. From 491b7071da9e8662ecc373eeb64ad680f732979f Mon Sep 17 00:00:00 2001 From: max397574 Date: Fri, 8 Oct 2021 15:17:08 +0200 Subject: [PATCH 179/290] fix use new function to check for cmp completitions --- lua/doom/modules/config/doom-cmp.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/config/doom-cmp.lua b/lua/doom/modules/config/doom-cmp.lua index c267775d8..988e600fe 100644 --- a/lua/doom/modules/config/doom-cmp.lua +++ b/lua/doom/modules/config/doom-cmp.lua @@ -79,7 +79,7 @@ return function() select = true, }), [""] = cmp.mapping(function(fallback) - if vim.fn.pumvisible() == 1 then + if cmp.visible() then vim.fn.feedkeys(t(""), "n") elseif luasnip.expand_or_jumpable() then vim.fn.feedkeys(t("luasnip-expand-or-jump"), "") @@ -93,7 +93,7 @@ return function() "s", }), [""] = cmp.mapping(function(fallback) - if vim.fn.pumvisible() == 1 then + if cmp.visible() then vim.fn.feedkeys(t(""), "n") elseif luasnip.jumpable(-1) then vim.fn.feedkeys(t("luasnip-jump-prev"), "") From 4fdbe456cad197ac68dcaea01fc0e2df99f55620 Mon Sep 17 00:00:00 2001 From: max397574 Date: Fri, 8 Oct 2021 15:29:29 +0200 Subject: [PATCH 180/290] fix cmp use new functions to select items --- lua/doom/modules/config/doom-cmp.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/config/doom-cmp.lua b/lua/doom/modules/config/doom-cmp.lua index 988e600fe..2b76e9230 100644 --- a/lua/doom/modules/config/doom-cmp.lua +++ b/lua/doom/modules/config/doom-cmp.lua @@ -80,7 +80,7 @@ return function() }), [""] = cmp.mapping(function(fallback) if cmp.visible() then - vim.fn.feedkeys(t(""), "n") + cmp.select_next_item() elseif luasnip.expand_or_jumpable() then vim.fn.feedkeys(t("luasnip-expand-or-jump"), "") elseif check_backspace() then @@ -94,7 +94,7 @@ return function() }), [""] = cmp.mapping(function(fallback) if cmp.visible() then - vim.fn.feedkeys(t(""), "n") + cmp.select_prev_item() elseif luasnip.jumpable(-1) then vim.fn.feedkeys(t("luasnip-jump-prev"), "") else From fafec4d5da021f43dec0e13de0dd19cc46dd1af1 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sat, 9 Oct 2021 21:58:03 -0400 Subject: [PATCH 181/290] feat: disable foldcolumn in norg docs --- lua/doom/core/functions/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index c44d2f965..a492aeaad 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -161,6 +161,7 @@ M.open_docs = function() vim.opt_local.modified = false vim.opt_local.modifiable = false vim.opt_local.signcolumn = "no" + vim.opt_local.foldcolumn = "0" vim.opt_local.number = false vim.opt_local.relativenumber = false vim.opt_local.colorcolumn = "0" From fb0e6c597e7bd4d392dc06f2460b61bf6d8310d3 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sat, 9 Oct 2021 21:58:16 -0400 Subject: [PATCH 182/290] feat(neorg): add GTD setup --- lua/doom/modules/config/doom-neorg.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index 02e6cd71f..ff61bff7a 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -17,11 +17,16 @@ return function() config = { workspaces = { default_workspace = "~/neorg", + gtd = "~/neorg/gtd", doom_docs = string.format("%s/doc", doom_root), }, }, }, - ["core.integrations.pandoc"] = {}, + ["core.gtd.base"] = { + config = { + workspace = "gtd", + }, + }, }, }) end From 6783a1ad9dc710b4fdcf55ccb0e8eae78041e80b Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sat, 16 Oct 2021 05:13:33 -0400 Subject: [PATCH 183/290] fix(doom_config): fix example for custom options --- doom_config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doom_config.lua b/doom_config.lua index 26cd54c16..0a9639d61 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -443,7 +443,7 @@ M.config = { -- @default = {} -- example: -- { - -- { ['shiftwidth'] = 4 } + -- ['shiftwidth'] = 4 -- } options = {}, }, From 9ca01a5e2117804b490bc1ee831bb010ad3b6ea1 Mon Sep 17 00:00:00 2001 From: shift-d Date: Sat, 16 Oct 2021 12:42:30 +0300 Subject: [PATCH 184/290] fix: docs in doom_config --- doom_config.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 0a9639d61..445c628a5 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -109,8 +109,8 @@ M.config = { line_highlight = true, -- Automatically split right - -- false : splits right (vertically) - -- true : splits left (vertically) + -- false : splits left (vertically) + -- true : splits right (vertically) -- @default = true split_right = true, From 6ac43817e88f167e9973af54b560de99e95220ed Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sat, 16 Oct 2021 05:59:08 -0400 Subject: [PATCH 185/290] feat: expose `:DoomReload` command to reload Doom Nvim --- doc/doom_nvim.norg | 36 +++++++++++++++++---------------- lua/doom/core/settings/init.lua | 3 +++ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index 9fdf8c585..853c39843 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -252,23 +252,25 @@ ** Commands Doom Nvim has its own commands, to make your life easier when developing on it. - ┌──────────────────┬────────────────────────────────────────────┐ - │Command │ Description │ - ├──────────────────┼────────────────────────────────────────────┤ - │DoomUpdate │ Update Doom Nvim if there are updates │ - ├──────────────────┼────────────────────────────────────────────┤ - │DoomRollback │ Rollback Doom Nvim to a previous version │ - ├──────────────────┼────────────────────────────────────────────┤ - │DoomManual │ Open Doom Nvim User Manual │ - ├──────────────────┼────────────────────────────────────────────┤ - │DoomConfigs │ Open a selection menu to edit Doom configs │ - ├──────────────────┼────────────────────────────────────────────┤ - │DoomConfigsReload │ Reload user-defined keybindings, etc │ - ├──────────────────┼────────────────────────────────────────────┤ - │DoomReport │ Create a Doom Nvim markdown crash report │ - ├──────────────────┼────────────────────────────────────────────┤ - │DoomInfo │ Open Doom Nivm information dashboard │ - └──────────────────┴────────────────────────────────────────────┘ + ┌──────────────────┬────────────────────────────────────────────────┐ + │Command │ Description │ + ├──────────────────┼────────────────────────────────────────────────┤ + │DoomUpdate │ Update Doom Nvim if there are updates │ + ├──────────────────┼────────────────────────────────────────────────┤ + │DoomRollback │ Rollback Doom Nvim to a previous version │ + ├──────────────────┼────────────────────────────────────────────────┤ + │DoomManual │ Open Doom Nvim User Manual │ + ├──────────────────┼────────────────────────────────────────────────┤ + │DoomConfigs │ Open a selection menu to edit Doom configs │ + ├──────────────────┼────────────────────────────────────────────────┤ + │DoomConfigsReload │ Reload user-defined keybindings, etc │ + ├──────────────────┼────────────────────────────────────────────────┤ + │DoomReload │ Reload Doom Nvim and simulate a new Neovim run │ + ├──────────────────┼────────────────────────────────────────────────┤ + │DoomReport │ Create a Doom Nvim markdown crash report │ + ├──────────────────┼────────────────────────────────────────────────┤ + │DoomInfo │ Open Doom Nivm information dashboard │ + └──────────────────┴────────────────────────────────────────────────┘ Doom Nvim also uses [which-key.nvim](https://github.com/folke/which-key.nvim) as a commands manager, inspired by emacs' guide-key. To open it, press `SPC` and wait for the popup to show, it should not take much time. diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index bbce94757..483cbb15c 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -167,6 +167,9 @@ M.doom_commands = function() -- Set a custom command to reload Doom Nvim custom mappings, autocommands, etc -- can be called by using :DoomConfigsReload vim.cmd('command! DoomConfigsReload lua require("doom.core.functions").reload_custom_settings()') + -- Set a custom command to fully reload Doom Nvim and simulate a new Neovim run + -- can be called by using :DoomReload + vim.cmd('command! DoomReload lua require("doom.modules.built-in.reloader").full_reload()') -- Set a custom command to create a crash report -- can be called by using :DoomReport vim.cmd('command! DoomReport lua require("doom.core.functions").create_report()') From 12ec3552c3cd8e559edbad973b01136d6bacdf9d Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sat, 16 Oct 2021 06:10:49 -0400 Subject: [PATCH 186/290] fix(reloader): proper Windows support when looking for Lua modules paths --- lua/doom/modules/built-in/reloader/init.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index 0658ed969..eb0282808 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -7,7 +7,15 @@ local log = require("doom.extras.logging") local system = require("doom.core.system") --- Paths to reload plugins -local plugins_files_path = string.format("%s/site/pack/packer/start/*", vim.fn.stdpath("data")) +local plugins_files_path = string.format( + "%s%ssite%spack%spacker%sstart%s*", + vim.fn.stdpath("data"), + system.sep, + system.sep, + system.sep, + system.sep, + system.sep +) local vim_subdirs = { "doc", "after", "syntax", "plugin" } local installed_plenary, _ = pcall(require, "plenary") @@ -22,16 +30,16 @@ local scan_dir = require("plenary.scandir").scan_dir --- @param module_path string The path to the module --- @return string local function path_to_lua_module(module_path) - local lua_path = string.format("%s/lua", system.doom_root) + local lua_path = string.format("%s%slua", system.doom_root, system.sep) -- Remove the Neovim config dir and the file extension from the path module_path = string.match( module_path, - string.format("%s/(.*)%%.lua", utils.escape_str(lua_path)) + string.format("%s%s(.*)%%.lua", utils.escape_str(lua_path), system.sep) ) -- Replace '/' with '.' to follow the common Lua modules format - module_path = module_path:gsub("/", ".") + module_path = module_path:gsub(system.sep, ".") -- Remove '.init' if the module ends with it module_path = module_path:gsub("%.init$", "") @@ -47,7 +55,7 @@ local function get_runtime_files(parent_path) -- Look in each Neovim subdir for runtime files (documentation, syntax files, etc) for _, subdir in ipairs(vim_subdirs) do - local path = string.format("%s/%s", parent_path, subdir) + local path = string.format("%s%s%s", parent_path, system.sep, subdir) if fs.file_exists(path) then local dir_files = {} @@ -125,7 +133,7 @@ end --- Reload all Lua modules --- @param quiet boolean If the reloader should send an info log or not reloader.reload_lua_modules = function(quiet) - local paths = vim.fn.glob(system.doom_root .. "/lua", 0, 1) + local paths = vim.fn.glob(system.doom_root .. system.sep .. "lua", 0, 1) for _, path in ipairs(paths) do local modules = get_lua_modules(path) From 9ecbef0589b2876cabf989fcd43a8111d1ad67f4 Mon Sep 17 00:00:00 2001 From: ashincoder Date: Sat, 16 Oct 2021 10:19:10 +0530 Subject: [PATCH 187/290] chore(nvim-tree): Update nvim-tree lsp_diagnostics config --- lua/doom/modules/config/doom-tree.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index 655583d6c..a0e1c1ac9 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -105,7 +105,15 @@ return function() -- updates the root directory of the tree on `DirChanged` (when your run `:cd` usually) update_cwd = true, -- show lsp diagnostics in the signcolumn - lsp_diagnostics = require("doom.utils").is_plugin_disabled("lsp") and false or true, + diagnostics = { + enable = require("doom.core.functions").is_plugin_disabled("lsp") and false or true, + icons = { + hint = config.doom.lsp_hint, + info = config.doom.lsp_info, + warning = config.doom.lsp_warn, + error = config.doom.lsp_error, + }, + }, -- update the focused file on `BufEnter`, un-collapses the folders recursively until it finds the file update_focused_file = { -- enables the feature From 1ba13c5026363660a52fc9cff00e77d75cf72bd9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 16 Oct 2021 10:17:17 +0000 Subject: [PATCH 188/290] chore: format source code --- lua/doom/modules/config/doom-tree.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index a0e1c1ac9..109478fb1 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -106,13 +106,13 @@ return function() update_cwd = true, -- show lsp diagnostics in the signcolumn diagnostics = { - enable = require("doom.core.functions").is_plugin_disabled("lsp") and false or true, - icons = { - hint = config.doom.lsp_hint, - info = config.doom.lsp_info, - warning = config.doom.lsp_warn, - error = config.doom.lsp_error, - }, + enable = require("doom.core.functions").is_plugin_disabled("lsp") and false or true, + icons = { + hint = config.doom.lsp_hint, + info = config.doom.lsp_info, + warning = config.doom.lsp_warn, + error = config.doom.lsp_error, + }, }, -- update the focused file on `BufEnter`, un-collapses the folders recursively until it finds the file update_focused_file = { From 5302f17e8e0c8c56845f469022f74655d1a5ca63 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sat, 16 Oct 2021 07:51:58 -0400 Subject: [PATCH 189/290] fix(config): proper precedence in paths to source configuration files --- lua/doom/core/config/init.lua | 18 ++++++++++++------ lua/doom/core/config/modules.lua | 18 ++++++++++++------ lua/doom/core/config/userplugins.lua | 18 ++++++++++++------ 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 297f98f9f..4ffdc77c5 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -477,20 +477,26 @@ M.source = nil log.debug("Loading Doom config module ...") -- Path cases: --- 1. /doom_config.lua --- 2. /home/user/.config/doom-nvim/doom_config.lua --- 3. stdpath('config')/doom_config.lua -local ok, ret = xpcall(require, debug.traceback, "doom_config") +-- 1. /home/user/.config/doom-nvim/doom_config.lua +-- 2. stdpath('config')/doom_config.lua +-- 3. /doom_config.lua +local ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_config.lua") if ok then M.config = ret.config M.source = ret.source else - ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_config.lua") + local ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_config.lua") if ok then M.config = ret.config M.source = ret.source else - log.error("Error while loading doom_config.lua. Traceback:\n" .. ret) + ok, ret = xpcall(require, debug.traceback, "doom_config") + if ok then + M.config = ret.config + M.source = ret.source + else + log.error("Error while loading doom_config.lua. Traceback:\n" .. ret) + end end end diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua index 284fa2d01..3c67ecae6 100644 --- a/lua/doom/core/config/modules.lua +++ b/lua/doom/core/config/modules.lua @@ -85,20 +85,26 @@ M.source = nil log.debug("Loading Doom modules module ...") -- Path cases: --- 1. /doom_modules.lua --- 2. /home/user/.config/doom-nvim/doom_modules.lua --- 3. stdpath('config')/doom_modules.lua -local ok, ret = xpcall(require, debug.traceback, "doom_modules") +-- 1. /home/user/.config/doom-nvim/doom_modules.lua +-- 2. stdpath('config')/doom_modules.lua +-- 3. /doom_modules.lua +local ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_modules.lua") if ok then M.modules = ret.modules M.source = ret.source else - ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_modules.lua") + local ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_modules.lua") if ok then M.modules = ret.modules M.source = ret.source else - log.error("Error while loading doom_modules.lua. Traceback:\n" .. ret) + ok, ret = xpcall(require, debug.traceback, "doom_modules") + if ok then + M.modules = ret.modules + M.source = ret.source + else + log.error("Error while loading doom_modules.lua. Traceback:\n" .. ret) + end end end diff --git a/lua/doom/core/config/userplugins.lua b/lua/doom/core/config/userplugins.lua index ea01fa694..c068d8221 100644 --- a/lua/doom/core/config/userplugins.lua +++ b/lua/doom/core/config/userplugins.lua @@ -15,20 +15,26 @@ M.source = nil log.debug("Loading Doom userplugins module...") -- Path cases: --- 1. /doom_userplugins.lua --- 2. /home/user/.config/doom-nvim/doom_userplugins.lua --- 3. stdpath('config')/doom_userplugins.lua -local ok, ret = xpcall(require, debug.traceback, "doom_userplugins") +-- 1. /home/user/.config/doom-nvim/doom_userplugins.lua +-- 2. stdpath('config')/doom_userplugins.lua +-- 3. /doom_userplugins.lua +local ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_userplugins.lua") if ok then M.plugins = ret.plugins M.source = ret.source else - ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_userplugins.lua") + local ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_userplugins.lua") if ok then M.plugins = ret.plugins M.source = ret.source else - log.error("Error while loading doom_userplugins.lua. Traceback:\n" .. ret) + ok, ret = xpcall(require, debug.traceback, "doom_userplugins") + if ok then + M.plugins = ret.plugins + M.source = ret.source + else + log.error("Error while loading doom_userplugins.lua. Traceback:\n" .. ret) + end end end From dd4e929941eaf5eb2b17c64ecb05852e66e90f37 Mon Sep 17 00:00:00 2001 From: ashincoder Date: Sun, 17 Oct 2021 07:17:47 +0530 Subject: [PATCH 190/290] feat: Cherry pick lsp_popup borders | Also add single border to whichkey --- lua/doom/modules/config/doom-lspconfig.lua | 7 +++++++ lua/doom/modules/config/doom-whichkey.lua | 1 + 2 files changed, 8 insertions(+) diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index 2e7891098..5dc7b38ae 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -39,6 +39,13 @@ return function() prefix = config.doom.lsp_virtual_text, -- change this to whatever you want your diagnostic icons to be } or false, }) + -- Border for lsp_popups + lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "single", + }) + lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "single", + }) -- symbols for autocomplete lsp.protocol.CompletionItemKind = { "  (Text) ", diff --git a/lua/doom/modules/config/doom-whichkey.lua b/lua/doom/modules/config/doom-whichkey.lua index 72aa7f30d..6d347bd46 100644 --- a/lua/doom/modules/config/doom-whichkey.lua +++ b/lua/doom/modules/config/doom-whichkey.lua @@ -43,6 +43,7 @@ return function() }, window = { padding = { 0, 0, 0, 0 }, -- extra window padding [top, right, bottom, left] + border = "single", }, layout = { height = { min = 1, max = 10 }, -- min and max height of the columns From 3388440c5c1a27c06f749121447ecbbb0f815938 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 17 Oct 2021 02:57:37 +0000 Subject: [PATCH 191/290] chore: format source code --- lua/doom/modules/config/doom-lspconfig.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index 5dc7b38ae..6a32f830a 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -41,11 +41,11 @@ return function() }) -- Border for lsp_popups lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "single", - }) + border = "single", + }) lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "single", - }) + border = "single", + }) -- symbols for autocomplete lsp.protocol.CompletionItemKind = { "  (Text) ", From 66bb549bb3f2a9604dc73f8c002dde8a89354931 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sat, 16 Oct 2021 23:26:38 -0400 Subject: [PATCH 192/290] fix(ci): do not shadow variables --- lua/doom/core/config/init.lua | 2 +- lua/doom/core/config/modules.lua | 2 +- lua/doom/core/config/userplugins.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 4ffdc77c5..917d2a87f 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -485,7 +485,7 @@ if ok then M.config = ret.config M.source = ret.source else - local ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_config.lua") + ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_config.lua") if ok then M.config = ret.config M.source = ret.source diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua index 3c67ecae6..e95d48aa6 100644 --- a/lua/doom/core/config/modules.lua +++ b/lua/doom/core/config/modules.lua @@ -93,7 +93,7 @@ if ok then M.modules = ret.modules M.source = ret.source else - local ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_modules.lua") + ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_modules.lua") if ok then M.modules = ret.modules M.source = ret.source diff --git a/lua/doom/core/config/userplugins.lua b/lua/doom/core/config/userplugins.lua index c068d8221..affb1010c 100644 --- a/lua/doom/core/config/userplugins.lua +++ b/lua/doom/core/config/userplugins.lua @@ -23,7 +23,7 @@ if ok then M.plugins = ret.plugins M.source = ret.source else - local ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_userplugins.lua") + ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_userplugins.lua") if ok then M.plugins = ret.plugins M.source = ret.source From 5c4148dd5abd45b30caf6018d82afbbeefc2b26d Mon Sep 17 00:00:00 2001 From: joalon Date: Thu, 14 Oct 2021 15:37:48 +0200 Subject: [PATCH 193/290] fix(#164): Update the require condition to check for toggleterm.nvim in the built-in runner and compiler Update the toggleterm url in the docs --- doc/doom_nvim.norg | 2 +- lua/doom/modules/built-in/compiler/init.lua | 2 +- lua/doom/modules/built-in/runner/init.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index 853c39843..c94f01e96 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -228,7 +228,7 @@ - `SPC - o - t` (only `NORMAL` mode!) - `` - Check [nvim-toggleterm.lua repository](https://github.com/akinsho/nvim-toggleterm.lua) for more information. + Check [toggleterm.nvim repository](https://github.com/akinsho/toggleterm.nvim) for more information. *** Minimap Doom Nvim uses `wfxr/minimap.vim` plugin as its minimap. It can be toggled by diff --git a/lua/doom/modules/built-in/compiler/init.lua b/lua/doom/modules/built-in/compiler/init.lua index 14735f04f..c11c94f6d 100644 --- a/lua/doom/modules/built-in/compiler/init.lua +++ b/lua/doom/modules/built-in/compiler/init.lua @@ -1,7 +1,7 @@ local log = require("doom.extras.logging") local term -if package.loaded["toggleterm"] then +if packer_plugins and packer_plugins["toggleterm.nvim"] then term = require("toggleterm.terminal").Terminal else log.error( diff --git a/lua/doom/modules/built-in/runner/init.lua b/lua/doom/modules/built-in/runner/init.lua index d152f4294..b1cc7ab77 100644 --- a/lua/doom/modules/built-in/runner/init.lua +++ b/lua/doom/modules/built-in/runner/init.lua @@ -1,7 +1,7 @@ local log = require("doom.extras.logging") local term -if package.loaded["toggleterm"] then +if packer_plugins and packer_plugins["toggleterm.nvim"] then term = require("toggleterm.terminal").Terminal else log.error( From 8f2f16da682547f1e7bb0aa4e023757384a62940 Mon Sep 17 00:00:00 2001 From: mordechai Date: Sat, 16 Oct 2021 22:20:56 +0300 Subject: [PATCH 194/290] feat(lspmanager): Changed lspinstall to lspmanager --- .../{doom-lspinstall.lua => doom-lspmanager.lua} | 12 +++--------- lua/doom/modules/init.lua | 6 +++--- 2 files changed, 6 insertions(+), 12 deletions(-) rename lua/doom/modules/config/{doom-lspinstall.lua => doom-lspmanager.lua} (92%) diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspmanager.lua similarity index 92% rename from lua/doom/modules/config/doom-lspinstall.lua rename to lua/doom/modules/config/doom-lspmanager.lua index 69e8d3e1b..a563a08b2 100644 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -131,13 +131,13 @@ return function() -- https://github.com/kabouzeid/nvim-lspinstall#advanced-configuration-recommended local function setup_servers() -- Provide the missing :LspInstall - require("lspinstall").setup() + require("lspmanager").setup() local servers = require("lspinstall").installed_servers() for _, server in pairs(servers) do -- Configure sumneko for neovim lua development - if server == "lua" then - nvim_lsp.lua.setup(lua_lsp) + if server == "sumneko_lua" then + nvim_lsp.sumneko_lua.setup(lua_lsp) else -- Use default settings for all the other language servers nvim_lsp[server].setup({ @@ -149,10 +149,4 @@ return function() end setup_servers() - - -- Automatically reload after `:LspInstall ` so we don't have to restart neovim - require("lspinstall").post_install_hook = function() - setup_servers() -- reload installed servers - vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server - end end diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index a735f7350..9271596cf 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -402,10 +402,10 @@ packer.startup(function(use) after = "nvim-cmp", }) - -- provides the missing `:LspInstall` for `nvim-lspconfig`. + -- Manage Language serverss with ease. use({ - "kabouzeid/nvim-lspinstall", - config = require("doom.modules.config.doom-lspinstall"), + "MordechaiHadad/nvim-lspmanager", + config = require("doom.modules.config.doom-lspmanager"), disable = disabled_lsp, }) From e0552fbca0c60a04811eaced42041bff80263af1 Mon Sep 17 00:00:00 2001 From: mordechai Date: Sat, 16 Oct 2021 22:26:49 +0300 Subject: [PATCH 195/290] fix(lspmanager): Forgot to change some lspinstall stuff feat(lspmanager): add servers table for file name fix(lspmanager): doom_modules formatting --- lua/colors/doom-one/config/init.lua | 50 +- lua/colors/doom-one/init.lua | 1765 +++++++++---------- lua/colors/doom-one/utils/init.lua | 116 +- lua/colors/utils/init.lua | 116 +- lua/doom/modules/config/doom-lspmanager.lua | 29 +- 5 files changed, 1043 insertions(+), 1033 deletions(-) diff --git a/lua/colors/doom-one/config/init.lua b/lua/colors/doom-one/config/init.lua index a9bff10d9..4a0c91364 100644 --- a/lua/colors/doom-one/config/init.lua +++ b/lua/colors/doom-one/config/init.lua @@ -2,31 +2,31 @@ local config = {} local configuration = { - cursor_coloring = false, - terminal_colors = false, - italic_comments = false, - enable_treesitter = true, - transparent_background = false, - pumblend = { - enable = true, - transparency_amount = 20, - }, - plugins_integrations = { - neorg = true, - barbar = true, - bufferline = false, - gitgutter = false, - gitsigns = true, - telescope = false, - neogit = true, - nvim_tree = true, - dashboard = true, - startify = true, - whichkey = true, - indent_blankline = true, - vim_illuminate = true, - lspsaga = false, - } + cursor_coloring = false, + terminal_colors = false, + italic_comments = false, + enable_treesitter = true, + transparent_background = false, + pumblend = { + enable = true, + transparency_amount = 20, + }, + plugins_integrations = { + neorg = true, + barbar = true, + bufferline = false, + gitgutter = false, + gitsigns = true, + telescope = false, + neogit = true, + nvim_tree = true, + dashboard = true, + startify = true, + whichkey = true, + indent_blankline = true, + vim_illuminate = true, + lspsaga = false, + }, } --- Get a configuration value diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua index 9f37de452..6b0c967d3 100644 --- a/lua/colors/doom-one/init.lua +++ b/lua/colors/doom-one/init.lua @@ -9,8 +9,8 @@ local doom_one = {} -local utils = require('colors.utils') -local config = require('colors.doom-one.config') +local utils = require("colors.utils") +local config = require("colors.doom-one.config") -- }}} @@ -19,9 +19,9 @@ local configuration = config.get() --- Establish the user configurations --- @param user_configs table doom_one.setup = function(user_configs) - configuration = config.set(user_configs or {}) - -- Reload colorscheme with user configurations override - doom_one.load_colorscheme() + configuration = config.set(user_configs or {}) + -- Reload colorscheme with user configurations override + doom_one.load_colorscheme() end -- Customization variables {{{ @@ -29,12 +29,11 @@ end local transparent_bg = configuration.transparent_background if configuration.cursor_coloring then - vim.opt.guicursor = - 'n-v-c:block-Cursor,i-ci-ve:ver25-Cursor,r-cr-o:hor25-Cursor' + vim.opt.guicursor = "n-v-c:block-Cursor,i-ci-ve:ver25-Cursor,r-cr-o:hor25-Cursor" end if configuration.pumblend.enable then - vim.opt.pumblend = configuration.pumblend.transparency_amount + vim.opt.pumblend = configuration.pumblend.transparency_amount end -- }}} @@ -42,28 +41,26 @@ end -- Highlight Functions and Color definitions {{{ local function high_clear(group) - vim.api.nvim_command('hi! clear ' .. group) + vim.api.nvim_command("hi! clear " .. group) end local function high_link(group, link) - vim.api.nvim_command('hi! link ' .. group .. ' ' .. link) + vim.api.nvim_command("hi! link " .. group .. " " .. link) end local function highlight(group, styles) - local bg = styles.bg and 'guibg=' .. styles.bg or 'guibg=NONE' - local fg = styles.fg and 'guifg=' .. styles.fg or 'guifg=NONE' - local sp = styles.sp and 'guisp=' .. styles.sp or 'guisp=NONE' - local gui = styles.gui and 'gui=' .. styles.gui or 'gui=NONE' - - vim.api.nvim_command( - 'hi! ' .. group .. ' ' .. bg .. ' ' .. fg .. ' ' .. sp .. ' ' .. gui - ) + local bg = styles.bg and "guibg=" .. styles.bg or "guibg=NONE" + local fg = styles.fg and "guifg=" .. styles.fg or "guifg=NONE" + local sp = styles.sp and "guisp=" .. styles.sp or "guisp=NONE" + local gui = styles.gui and "gui=" .. styles.gui or "gui=NONE" + + vim.api.nvim_command("hi! " .. group .. " " .. bg .. " " .. fg .. " " .. sp .. " " .. gui) end local function apply_highlight(groups) - for group, styles in pairs(groups) do - highlight(group, styles) - end + for group, styles in pairs(groups) do + highlight(group, styles) + end end -- Change the colorscheme colors depending on the current background, defaults to @@ -71,931 +68,931 @@ end local current_bg = vim.opt.background:get() local light_bg = false -local base0 = '#1B2229' -local base1 = '#1c1f24' -local base2 = '#202328' -local base3 = '#23272e' -local base4 = '#3f444a' -local base5 = '#5B6268' -local base6 = '#73797e' -local base7 = '#9ca0a4' -local base8 = '#DFDFDF' -local base9 = '#E6E6E6' +local base0 = "#1B2229" +local base1 = "#1c1f24" +local base2 = "#202328" +local base3 = "#23272e" +local base4 = "#3f444a" +local base5 = "#5B6268" +local base6 = "#73797e" +local base7 = "#9ca0a4" +local base8 = "#DFDFDF" +local base9 = "#E6E6E6" local grey = base4 -local red = '#ff6c6b' -local orange = '#da8548' -local green = '#98be65' -local yellow = '#ECBE7B' -local blue = '#51afef' -local dark_blue = '#2257A0' -local magenta = '#c678dd' +local red = "#ff6c6b" +local orange = "#da8548" +local green = "#98be65" +local yellow = "#ECBE7B" +local blue = "#51afef" +local dark_blue = "#2257A0" +local magenta = "#c678dd" local light_magenta = utils.Lighten(magenta, 0.4) -local violet = '#a9a1e1' -local dark_violet = '#4e4f67' -local cyan = '#46D9FF' -local white = '#efefef' - -local bg = '#282c34' -local bg_alt = '#21242b' -local bg_highlight = '#21252a' -local bg_popup = '#3E4556' +local violet = "#a9a1e1" +local dark_violet = "#4e4f67" +local cyan = "#46D9FF" +local white = "#efefef" + +local bg = "#282c34" +local bg_alt = "#21242b" +local bg_highlight = "#21252a" +local bg_popup = "#3E4556" local bg_statusline = bg_popup -local bg_highlighted = '#4A4A45' +local bg_highlighted = "#4A4A45" -local fg = '#bbc2cf' -local fg_alt = '#5B6268' +local fg = "#bbc2cf" +local fg_alt = "#5B6268" local fg_highlight = utils.Lighten(fg, 0.2) local tag = utils.Mix(blue, cyan, 0.5) local diff_info_fg = orange -local diff_info_bg0 = utils.Mix('#D8EEFD', bg, 0.6) -local diff_info_bg1 = utils.Mix('#D8EEFD', bg, 0.8) +local diff_info_bg0 = utils.Mix("#D8EEFD", bg, 0.6) +local diff_info_bg1 = utils.Mix("#D8EEFD", bg, 0.8) local diff_add_fg = green local diff_add_fg0 = utils.Mix(green, fg, 0.4) -local diff_add_bg0 = utils.Mix('#506d5b', bg, 0.6) -local diff_add_bg1 = utils.Mix('#acf2bd', bg, 0.8) +local diff_add_bg0 = utils.Mix("#506d5b", bg, 0.6) +local diff_add_bg1 = utils.Mix("#acf2bd", bg, 0.8) -local ng_add_fg = '#799850' +local ng_add_fg = "#799850" local ng_add_fg_hl = green -local ng_add_bg = '#333a38' -local ng_add_bg_hl = '#3e493d' +local ng_add_bg = "#333a38" +local ng_add_bg_hl = "#3e493d" -local ng_delete_fg = '#cc5655' +local ng_delete_fg = "#cc5655" local ng_delete_fg_hl = red -local ng_delete_bg = '#392d34' -local ng_delete_bg_hl = '#3f343a' +local ng_delete_bg = "#392d34" +local ng_delete_bg_hl = "#3f343a" local ng_header_bg = dark_violet local ng_header_bg_hl = violet local gh_danger_fg = red local gh_danger_fg0 = utils.Mix(red, fg, 0.6) -local gh_danger_bg0 = utils.Mix('#ffdce0', bg, 0.6) -local gh_danger_bg1 = utils.Mix('#ffdce0', bg, 0.8) - -if current_bg == 'light' then - light_bg = true - - base0 = '#f0f0f0' - base1 = '#e7e7e7' - base2 = '#dfdfdf' - base3 = '#c6c7c7' - base4 = '#9ca0a4' - base5 = '#383a42' - base6 = '#202328' - base7 = '#23272e' - base8 = '#1c1f24' - base9 = '#1B2229' - - grey = base4 - red = '#e45649' - orange = '#da8548' - green = '#50a14f' - yellow = '#986801' - blue = '#4078f2' - dark_blue = '#a0bcf8' - magenta = '#a626a4' - light_magenta = utils.Darken(magenta, 0.36) - violet = '#b751b6' - dark_violet = '#e5c7e5' - cyan = '#0184bc' - white = '#efefef' - - bg = '#fafafa' - bg_alt = '#f0f0f0' - bg_highlight = utils.Darken(bg, 0.3) - bg_popup = bg_alt - bg_statusline = bg_popup - - fg = base5 - fg_alt = base3 - fg_highlight = utils.Lighten(fg, 0.2) - - tag = utils.Mix(blue, cyan, 0.5) - - diff_info_fg = orange - diff_info_bg0 = utils.Mix('#D8EEFD', bg, 0.6) - diff_info_bg1 = utils.Mix('#D8EEFD', bg, 0.8) - - diff_add_fg = green - diff_add_fg0 = utils.Mix(green, fg, 0.4) - diff_add_bg0 = utils.Mix('#506d5b', bg, 0.4) - diff_add_bg1 = utils.Mix('#acf2bd', bg, 0.8) - - ng_add_fg = '#40803f' - ng_add_fg_hl = green - ng_add_bg = '#e9f1e8' - ng_add_bg_hl = '#d8e8d7' - - ng_delete_fg = '#cc5655' - ng_delete_fg_hl = red - ng_delete_bg = '#f7e9e8' - ng_delete_bg_hl = '#f5d9d6' - - ng_header_bg = dark_violet - ng_header_bg_hl = violet - - gh_danger_fg = red - gh_danger_fg0 = utils.Mix(red, fg, 0.6) - gh_danger_bg0 = utils.Mix('#ffdce0', bg, 0.8) - gh_danger_bg1 = utils.Mix('#ffdce0', bg, 0.9) +local gh_danger_bg0 = utils.Mix("#ffdce0", bg, 0.6) +local gh_danger_bg1 = utils.Mix("#ffdce0", bg, 0.8) + +if current_bg == "light" then + light_bg = true + + base0 = "#f0f0f0" + base1 = "#e7e7e7" + base2 = "#dfdfdf" + base3 = "#c6c7c7" + base4 = "#9ca0a4" + base5 = "#383a42" + base6 = "#202328" + base7 = "#23272e" + base8 = "#1c1f24" + base9 = "#1B2229" + + grey = base4 + red = "#e45649" + orange = "#da8548" + green = "#50a14f" + yellow = "#986801" + blue = "#4078f2" + dark_blue = "#a0bcf8" + magenta = "#a626a4" + light_magenta = utils.Darken(magenta, 0.36) + violet = "#b751b6" + dark_violet = "#e5c7e5" + cyan = "#0184bc" + white = "#efefef" + + bg = "#fafafa" + bg_alt = "#f0f0f0" + bg_highlight = utils.Darken(bg, 0.3) + bg_popup = bg_alt + bg_statusline = bg_popup + + fg = base5 + fg_alt = base3 + fg_highlight = utils.Lighten(fg, 0.2) + + tag = utils.Mix(blue, cyan, 0.5) + + diff_info_fg = orange + diff_info_bg0 = utils.Mix("#D8EEFD", bg, 0.6) + diff_info_bg1 = utils.Mix("#D8EEFD", bg, 0.8) + + diff_add_fg = green + diff_add_fg0 = utils.Mix(green, fg, 0.4) + diff_add_bg0 = utils.Mix("#506d5b", bg, 0.4) + diff_add_bg1 = utils.Mix("#acf2bd", bg, 0.8) + + ng_add_fg = "#40803f" + ng_add_fg_hl = green + ng_add_bg = "#e9f1e8" + ng_add_bg_hl = "#d8e8d7" + + ng_delete_fg = "#cc5655" + ng_delete_fg_hl = red + ng_delete_bg = "#f7e9e8" + ng_delete_bg_hl = "#f5d9d6" + + ng_header_bg = dark_violet + ng_header_bg_hl = violet + + gh_danger_fg = red + gh_danger_fg0 = utils.Mix(red, fg, 0.6) + gh_danger_bg0 = utils.Mix("#ffdce0", bg, 0.8) + gh_danger_bg1 = utils.Mix("#ffdce0", bg, 0.9) end -- }}} --- Load the colorscheme doom_one.load_colorscheme = function() - -- General UI {{{ - - local general_ui = { - Normal = { fg = fg, bg = transparent_bg and 'NONE' or bg }, - NormalPopup = { - fg = fg_highlight, - bg = transparent_bg and 'NONE' or bg_popup, - }, - NormalPopover = { - fg = fg_highlight, - bg = transparent_bg and 'NONE' or bg_popup, - }, - NormalPopupPrompt = { - fg = base7, - bg = transparent_bg and 'NONE' or utils.Darken(bg_popup, 0.3), - gui = 'bold', - }, - NormalPopupSubtle = { - fg = base6, - bg = transparent_bg and 'NONE' or bg_popup, - }, - EndOfBuffer = { fg = bg, bg = transparent_bg and 'NONE' or bg }, - - Visual = { bg = dark_blue }, - VisualBold = { bg = dark_blue, gui = 'bold' }, - - LineNr = { fg = grey, bg = transparent_bg and 'NONE' or bg }, - Cursor = { bg = blue }, - CursorLine = { bg = bg_highlight }, - CursorLineNr = { fg = fg, bg = bg_highlight }, - CursorColumn = { bg = bg_highlight }, - - Folded = { fg = base5, bg = bg_highlight }, - FoldColumn = { fg = fg_alt, bg = bg }, - SignColumn = { bg = transparent_bg and 'NONE' or bg }, - ColorColumn = { bg = bg_highlight }, - - IndentGuide = { fg = grey }, - IndentGuideEven = { fg = grey }, - IndentGuideOdd = { fg = grey }, - - TermCursor = { fg = fg, gui = 'reverse' }, - TermCursorNC = { fg = fg_alt, gui = 'reverse' }, - TermNormal = { fg = fg, bg = bg }, - TermNormalNC = { fg = fg, bg = bg }, - - WildMenu = { fg = fg, bg = dark_blue }, - Separator = { fg = fg_alt }, - VertSplit = { fg = grey, bg = bg }, - - TabLine = { - fg = base7, - bg = bg_alt, - gui = 'bold', - }, - TabLineSel = { fg = blue, bg = bg, gui = 'bold' }, - TabLineFill = { bg = base1, gui = 'bold' }, - - StatusLine = { fg = base8, bg = base3 }, - StatusLineNC = { fg = base6, bg = bg_popup }, - StatusLinePart = { fg = base6, bg = bg_popup, gui = 'bold' }, - StatusLinePartNC = { fg = base6, bg = bg_popup, gui = 'bold' }, - - Pmenu = { fg = fg, bg = bg_highlight }, - PmenuSel = { fg = base0, bg = blue }, - PmenuSelBold = { fg = base0, bg = blue, gui = 'bold' }, - PmenuSbar = { bg = bg_alt }, - PmenuThumb = { bg = fg }, + -- General UI {{{ + + local general_ui = { + Normal = { fg = fg, bg = transparent_bg and "NONE" or bg }, + NormalPopup = { + fg = fg_highlight, + bg = transparent_bg and "NONE" or bg_popup, + }, + NormalPopover = { + fg = fg_highlight, + bg = transparent_bg and "NONE" or bg_popup, + }, + NormalPopupPrompt = { + fg = base7, + bg = transparent_bg and "NONE" or utils.Darken(bg_popup, 0.3), + gui = "bold", + }, + NormalPopupSubtle = { + fg = base6, + bg = transparent_bg and "NONE" or bg_popup, + }, + EndOfBuffer = { fg = bg, bg = transparent_bg and "NONE" or bg }, + + Visual = { bg = dark_blue }, + VisualBold = { bg = dark_blue, gui = "bold" }, + + LineNr = { fg = grey, bg = transparent_bg and "NONE" or bg }, + Cursor = { bg = blue }, + CursorLine = { bg = bg_highlight }, + CursorLineNr = { fg = fg, bg = bg_highlight }, + CursorColumn = { bg = bg_highlight }, + + Folded = { fg = base5, bg = bg_highlight }, + FoldColumn = { fg = fg_alt, bg = bg }, + SignColumn = { bg = transparent_bg and "NONE" or bg }, + ColorColumn = { bg = bg_highlight }, + + IndentGuide = { fg = grey }, + IndentGuideEven = { fg = grey }, + IndentGuideOdd = { fg = grey }, + + TermCursor = { fg = fg, gui = "reverse" }, + TermCursorNC = { fg = fg_alt, gui = "reverse" }, + TermNormal = { fg = fg, bg = bg }, + TermNormalNC = { fg = fg, bg = bg }, + + WildMenu = { fg = fg, bg = dark_blue }, + Separator = { fg = fg_alt }, + VertSplit = { fg = grey, bg = bg }, + + TabLine = { + fg = base7, + bg = bg_alt, + gui = "bold", + }, + TabLineSel = { fg = blue, bg = bg, gui = "bold" }, + TabLineFill = { bg = base1, gui = "bold" }, + + StatusLine = { fg = base8, bg = base3 }, + StatusLineNC = { fg = base6, bg = bg_popup }, + StatusLinePart = { fg = base6, bg = bg_popup, gui = "bold" }, + StatusLinePartNC = { fg = base6, bg = bg_popup, gui = "bold" }, + + Pmenu = { fg = fg, bg = bg_highlight }, + PmenuSel = { fg = base0, bg = blue }, + PmenuSelBold = { fg = base0, bg = blue, gui = "bold" }, + PmenuSbar = { bg = bg_alt }, + PmenuThumb = { bg = fg }, + } + + if vim.opt.pumblend == 1 then + vim.opt.pumblend = 20 + end + + apply_highlight(general_ui) + + -- }}} + + -- Search, Highlight. Conceal, Messages {{{ + + local search_high_ui = { + Search = { fg = fg, bg = dark_blue, gui = "bold" }, + Substitute = { fg = red, gui = "strikethrough,bold" }, + IncSearch = { fg = fg, bg = dark_blue, gui = "bold" }, + IncSearchCursor = { gui = "reverse" }, + + Conceal = { fg = grey, gui = "none" }, + SpecialKey = { fg = violet, gui = "bold" }, + NonText = { fg = fg_alt, gui = "bold" }, + MatchParen = { fg = red, gui = "bold" }, + Whitespace = { fg = grey }, + + Highlight = { bg = bg_highlighted }, + HighlightSubtle = { bg = bg_highlighted }, + LspHighlight = { bg = bg_highlight, style = "bold" }, + + Question = { fg = green, gui = "bold" }, + + File = { fg = fg }, + Directory = { fg = violet, gui = "bold" }, + Title = { fg = violet, gui = "bold" }, + + Bold = { gui = "bold" }, + Emphasis = { fg = green, gui = "bold" }, + } + + apply_highlight(search_high_ui) + + -- }}} + + -- Text levels {{{ + + local text_colors = { + Normal = fg, + Info = blue, + Success = green, + Warning = yellow, + Debug = yellow, + Error = red, + Special = violet, + Muted = base7, + } + + for key, _ in pairs(text_colors) do + apply_highlight({ + ["Text" .. key] = { + fg = text_colors[key], + }, + }) + apply_highlight({ + ["Text" .. key .. "Bold"] = { + fg = text_colors[key], + gui = "bold", + }, + }) + end + + high_link("Msg", "TextSuccess") + high_link("MoreMsg", "TextInfo") + high_link("WarningMsg", "TextWarning") + high_link("Error", "TextError") + high_link("ErrorMsg", "TextError") + high_link("ModeMsg", "TextSpecial") + high_link("Todo", "TextWarningBold") + + -- }}} + + -- Main Syntax {{{ + + local main_syntax = { + Tag = { fg = tag, gui = "bold" }, + Link = { fg = green, gui = "underline" }, + URL = { fg = green, gui = "underline" }, + Underlined = { fg = tag, gui = "underline" }, + + Comment = { + fg = fg_alt, + gui = configuration.italic_comments and "italic" or "NONE", + }, + CommentBold = { fg = fg_alt, gui = "bold" }, + SpecialComment = { fg = base7, gui = "bold" }, + + Macro = { fg = violet }, + Define = { fg = violet, gui = "bold" }, + Include = { fg = violet, gui = "bold" }, + PreProc = { fg = violet, gui = "bold" }, + PreCondit = { fg = violet, gui = "bold" }, + + Label = { fg = light_bg and orange or blue }, + Repeat = { fg = light_bg and orange or blue }, + Keyword = { fg = light_bg and orange or blue }, + Operator = { fg = light_bg and orange or blue }, + Delimiter = { fg = light_bg and orange or blue }, + Statement = { fg = light_bg and orange or blue }, + Exception = { fg = light_bg and orange or blue }, + Conditional = { fg = light_bg and orange or blue }, + + Variable = { fg = "#8B93E6" }, + VariableBuiltin = { fg = "#8B93E6", gui = "bold" }, + Constant = { fg = violet, gui = "bold" }, + + Number = { fg = light_bg and yellow or orange }, + Float = { fg = light_bg and yellow or orange }, + Boolean = { fg = light_bg and yellow or orange, gui = "bold" }, + Enum = { fg = light_bg and yellow or orange }, + + Character = { fg = violet, gui = "bold" }, + SpecialChar = { fg = base8, gui = "bold" }, + + String = { fg = green }, + StringDelimiter = { fg = green }, + + Special = { fg = violet }, + SpecialBold = { fg = violet, gui = "bold" }, + + Field = { fg = violet }, + Argument = { fg = light_magenta }, + Attribute = { fg = light_magenta }, + Identifier = { fg = light_magenta }, + Property = { fg = magenta }, + Function = { fg = magenta }, + FunctionBuiltin = { fg = light_magenta, gui = "bold" }, + KeywordFunction = { fg = light_bg and orange or blue }, + Method = { fg = violet }, + + Type = { fg = yellow }, + TypeBuiltin = { fg = yellow, gui = "bold" }, + StorageClass = { fg = light_bg and orange or blue }, + Class = { fg = light_bg and orange or blue }, + Structure = { fg = light_bg and orange or blue }, + Typedef = { fg = light_bg and orange or blue }, + + Regexp = { fg = "#dd0093" }, + RegexpSpecial = { fg = "#a40073" }, + RegexpDelimiter = { fg = "#540063", gui = "bold" }, + RegexpKey = { fg = "#5f0041", gui = "bold" }, + } + + apply_highlight(main_syntax) + high_link("CommentURL", "URL") + high_link("CommentLabel", "CommentBold") + high_link("CommentSection", "CommentBold") + high_link("Noise", "Comment") + + -- }}} + + -- Diff {{{ + + local diff = { + diffLine = { fg = base8, bg = diff_info_bg1 }, + diffSubName = { fg = base8, bg = diff_info_bg1 }, + + DiffAdd = { bg = diff_add_bg1 }, + DiffChange = { bg = diff_add_bg1 }, + DiffText = { bg = diff_add_bg0 }, + DiffDelete = { bg = gh_danger_bg0 }, + + DiffAdded = { fg = diff_add_fg0, bg = diff_add_bg1 }, + DiffModified = { fg = fg, bg = diff_info_bg0 }, + DiffRemoved = { fg = gh_danger_fg0, bg = gh_danger_bg1 }, + + DiffAddedGutter = { fg = diff_add_fg, gui = "bold" }, + DiffModifiedGutter = { fg = diff_info_fg, gui = "bold" }, + DiffRemovedGutter = { fg = gh_danger_fg, gui = "bold" }, + + DiffAddedGutterLineNr = { fg = grey }, + DiffModifiedGutterLineNr = { fg = grey }, + DiffRemovedGutterLineNr = { fg = grey }, + } + + high_clear("DiffAdd") + high_clear("DiffChange") + high_clear("DiffText") + high_clear("DiffDelete") + apply_highlight(diff) + + -- }}} + + -- Markdown {{{ + local markdown = { + markdownCode = { bg = bg_highlight }, + markdownCodeBlock = { bg = bg_highlight }, + markdownH1 = { gui = "bold" }, + markdownH2 = { gui = "bold" }, + markdownLinkText = { gui = "underline" }, + } + + apply_highlight(markdown) + --}}} + + -- Plugins {{{ + + -- barbar.nvim {{{ + + if configuration.plugins_integrations.barbar then + local barbar = { + BufferCurrent = { fg = base9, bg = bg }, + BufferCurrentIndex = { fg = base6, bg = bg }, + BufferCurrentMod = { fg = yellow, bg = bg }, + BufferCurrentSign = { fg = blue, bg = bg }, + BufferCurrentTarget = { fg = red, bg = bg, gui = "bold" }, + + BufferVisible = { fg = base7, bg = bg }, + BufferVisibleIndex = { fg = base9, bg = bg }, + BufferVisibleMod = { fg = yellow, bg = bg }, + BufferVisibleSign = { fg = base4, bg = bg }, + BufferVisibleTarget = { fg = red, bg = bg, gui = "bold" }, + + BufferInactive = { fg = base6, bg = base1 }, + BufferInactiveIndex = { fg = base6, bg = base1 }, + BufferInactiveMod = { fg = yellow, bg = base1 }, + BufferInactiveSign = { fg = base4, bg = base1 }, + BufferInactiveTarget = { fg = red, bg = base1, gui = "bold" }, + + BufferTabpages = { fg = blue, bg = bg_statusline, gui = "bold" }, + BufferTabpageFill = { fg = base4, bg = base1, gui = "bold" }, + + BufferPart = { fg = diff_info_fg, bg = diff_info_bg0, gui = "bold" }, + } + + apply_highlight(barbar) + end + + -- }}} + + -- BufferLine {{{ + + if configuration.plugins_integrations.bufferline and transparent_bg then + -- NOTE: this is a temporal workaround for using bufferline with a transparent + -- background and having highlighting, please refer to + -- https://github.com/NTBBloodbath/doom-one.nvim/issues/8#issuecomment-883737667 + -- for more information about this + local bufferline = { + BufferLineTab = { fg = fg, bg = bg }, + BufferLineTabClose = { fg = fg, bg = bg, gui = "bold" }, + BufferLineTabSelected = { fg = blue, bg = bg, gui = "bold,italic" }, + BufferLineBackground = { fg = fg_alt, bg = bg }, + BufferLineBufferSelected = { fg = fg, bg = bg, gui = "bold,italic" }, + BufferLineBufferVisible = { fg = fg, bg = bg }, + BufferLineCloseButton = { fg = fg_alt, bg = bg }, + BufferLineCloseButtonSelected = { fg = fg, bg = bg, gui = "bold" }, + BufferLineCloseButtonVisible = { fg = fg, bg = bg }, + BufferLineModified = { fg = green, bg = bg }, + BufferLineModifiedSelected = { fg = green, bg = bg }, + BufferLineModifiedVisible = { fg = green, bg = bg }, + BufferLineFill = { fg = blue, bg = bg_alt }, + BufferLineIndicatorSelected = { fg = blue, bg = bg }, + BufferLineSeparator = { fg = base0, bg = bg }, + BufferLineSeparatorSelected = { fg = base0, bg = bg }, + BufferLineSeparatorVisible = { fg = base0, bg = bg_alt }, + BufferLinePick = { fg = fg, bg = bg, gui = "bold" }, + BufferLinePickSelected = { fg = blue, bg = bg, gui = "bold,italic" }, + BufferLinePickVisible = { fg = fg, bg = bg_alt }, + + BufferLineDiagnostic = { fg = fg, bg = bg, sp = fg }, + BufferLineDiagnosticSelected = { fg = fg, bg = bg, sp = fg }, + BufferLineDiagnosticVisible = { fg = fg, bg = bg, sp = fg }, + + BufferLineInfo = { fg = cyan, bg = bg, sp = cyan, gui = "bold" }, + BufferLineInfoSelected = { + fg = cyan, + bg = bg, + sp = cyan, + gui = "bold,italic", + }, + BufferLineInfoVisible = { fg = cyan, bg = bg, sp = cyan, gui = "bold" }, + BufferLineInfoDiagnostic = { fg = cyan, bg = bg, sp = cyan }, + BufferLineInfoDiagnosticSelected = { fg = cyan, bg = bg, sp = cyan }, + BufferLineInfoDiagnosticVisible = { fg = cyan, bg = bg, sp = cyan }, + BufferLineError = { fg = red, bg = bg, sp = red, gui = "bold" }, + BufferLineErrorSelected = { + fg = red, + bg = bg, + sp = red, + gui = "bold,italic", + }, + BufferLineErrorVisible = { fg = red, bg = bg, sp = red, gui = "bold" }, + BufferLineErrorDiagnostic = { fg = red, bg = bg, sp = red }, + BufferLineErrorDiagnosticSelected = { fg = red, bg = bg, sp = red }, + BufferLineErrorDiagnosticVisible = { fg = red, bg = bg, sp = red }, + BufferLineWarning = { + fg = yellow, + bg = bg, + sp = yellow, + gui = "bold,italic", + }, + BufferLineWarningSelected = { + fg = yellow, + bg = bg, + sp = yellow, + gui = "bold,italic", + }, + BufferLineWarningVisible = { + fg = yellow, + bg = bg, + sp = yellow, + gui = "bold", + }, + BufferLineWarningDiagnostic = { fg = yellow, bg = bg, sp = yellow }, + BufferLineWarningDiagnosticSelected = { fg = yellow, bg = bg, sp = yellow }, + BufferLineWarningDiagnosticVisible = { fg = yellow, bg = bg, sp = yellow }, } - if vim.opt.pumblend == 1 then - vim.opt.pumblend = 20 - end + apply_highlight(bufferline) + end - apply_highlight(general_ui) + -- }}} - -- }}} + -- Gitgutter {{{ - -- Search, Highlight. Conceal, Messages {{{ + if configuration.plugins_integrations.gitgutter then + high_link("GitGutterAdd", "DiffAddedGutter") + high_link("GitGutterChange", "DiffModifiedGutter") + high_link("GitGutterDelete", "DiffRemovedGutter") + high_link("GitGutterChangeDelete", "DiffModifiedGutter") - local search_high_ui = { - Search = { fg = fg, bg = dark_blue, gui = 'bold' }, - Substitute = { fg = red, gui = 'strikethrough,bold' }, - IncSearch = { fg = fg, bg = dark_blue, gui = 'bold' }, - IncSearchCursor = { gui = 'reverse' }, + high_link("GitGutterAddLineNr", "DiffAddedGutterLineNr") + high_link("GitGutterChangeLineNr", "DiffModifiedGutterLineNr") + high_link("GitGutterDeleteLineNr", "DiffRemovedGutterLineNr") + high_link("GitGutterChangeDeleteLineNr", "DiffModifiedGutterLineNr") + end - Conceal = { fg = grey, gui = 'none' }, - SpecialKey = { fg = violet, gui = 'bold' }, - NonText = { fg = fg_alt, gui = 'bold' }, - MatchParen = { fg = red, gui = 'bold' }, - Whitespace = { fg = grey }, + -- }}} - Highlight = { bg = bg_highlighted }, - HighlightSubtle = { bg = bg_highlighted }, - LspHighlight = { bg = bg_highlight, style = 'bold' }, + -- Gitsigns {{{ - Question = { fg = green, gui = 'bold' }, + if configuration.plugins_integrations.gitsigns then + high_link("GitSignsAdd", "DiffAddedGutter") + high_link("GitSignsChange", "DiffModifiedGutter") + high_link("GitSignsDelete", "DiffRemovedGutter") + high_link("GitSignsChangeDelete", "DiffModifiedGutter") + end - File = { fg = fg }, - Directory = { fg = violet, gui = 'bold' }, - Title = { fg = violet, gui = 'bold' }, + -- }}} + + -- Telescope {{{ + + if configuration.plugins_integrations.telescope then + local telescope = { + TelescopeSelection = { fg = yellow, gui = "bold" }, + TelescopeSelectionCaret = { fg = light_bg and orange or blue }, + TelescopeMultiSelection = { fg = grey }, + TelescopeNormal = { fg = fg }, + TelescopeMatching = { fg = green, gui = "bold" }, + TelescopePromptPrefix = { fg = light_bg and orange or blue }, + TelescopeBorder = { fg = light_bg and orange or blue }, + TelescopePromptBorder = { fg = light_bg and orange or blue }, + TelescopeResultsBorder = { fg = light_bg and orange or blue }, + TelescopePreviewBorder = { fg = light_bg and orange or blue }, + } - Bold = { gui = 'bold' }, - Emphasis = { fg = green, gui = 'bold' }, + apply_highlight(telescope) + high_link("TelescopePrompt", "TelescopeNormal") + end + + -- }}} + + -- Neogit {{{ + + if configuration.plugins_integrations.neogit then + local neogit = { + NeogitDiffAdd = { fg = ng_add_fg, bg = ng_add_bg }, + NeogitDiffAddHighlight = { fg = ng_add_fg_hl, bg = ng_add_bg_hl, gui = "bold" }, + NeogitDiffDelete = { fg = ng_delete_fg, bg = ng_delete_bg }, + NeogitDiffDeleteHighlight = { fg = ng_delete_fg_hl, bg = ng_delete_bg_hl, gui = "bold" }, + NeogitDiffContext = { fg = fg_alt, bg = bg }, + NeogitDiffContextHighlight = { fg = fg, bg = bg_alt }, + NeogitHunkHeader = { fg = bg, bg = ng_header_bg }, + NeogitHunkHeaderHighlight = { fg = bg_alt, bg = ng_header_bg_hl, gui = "bold" }, + NeogitStagedChanges = { fg = blue, gui = "bold" }, + NeogitStagedChangesRegion = { bg = bg_highlight }, + NeogitStashes = { fg = blue, gui = "bold" }, + NeogitUnstagedChanges = { fg = blue, gui = "bold" }, + NeogitUntrackedfiles = { fg = blue, gui = "bold" }, } - apply_highlight(search_high_ui) + apply_highlight(neogit) + end - -- }}} + -- }}} - -- Text levels {{{ + -- NvimTree {{{ - local text_colors = { - Normal = fg, - Info = blue, - Success = green, - Warning = yellow, - Debug = yellow, - Error = red, - Special = violet, - Muted = base7, + if configuration.plugins_integrations.nvim_tree then + local nvim_tree = { + NvimTreeFolderName = { fg = light_bg and base9 or blue, gui = "bold" }, + NvimTreeRootFolder = { fg = green }, + NvimTreeEmptyFolderName = { fg = fg_alt, gui = "bold" }, + NvimTreeSymlink = { fg = fg, gui = "underline" }, + NvimTreeExecFile = { fg = green, gui = "bold" }, + NvimTreeImageFile = { fg = light_bg and orange or blue }, + NvimTreeOpenedFile = { fg = fg_alt }, + NvimTreeSpecialFile = { fg = fg, gui = "underline" }, + NvimTreeMarkdownFile = { fg = fg, gui = "underline" }, } - for key, _ in pairs(text_colors) do - apply_highlight({ - ['Text' .. key] = { - fg = text_colors[key], - }, - }) - apply_highlight({ - ['Text' .. key .. 'Bold'] = { - fg = text_colors[key], - gui = 'bold', - }, - }) - end - - high_link('Msg', 'TextSuccess') - high_link('MoreMsg', 'TextInfo') - high_link('WarningMsg', 'TextWarning') - high_link('Error', 'TextError') - high_link('ErrorMsg', 'TextError') - high_link('ModeMsg', 'TextSpecial') - high_link('Todo', 'TextWarningBold') - - -- }}} - - -- Main Syntax {{{ - - local main_syntax = { - Tag = { fg = tag, gui = 'bold' }, - Link = { fg = green, gui = 'underline' }, - URL = { fg = green, gui = 'underline' }, - Underlined = { fg = tag, gui = 'underline' }, - - Comment = { - fg = fg_alt, - gui = configuration.italic_comments and 'italic' or 'NONE', - }, - CommentBold = { fg = fg_alt, gui = 'bold' }, - SpecialComment = { fg = base7, gui = 'bold' }, - - Macro = { fg = violet }, - Define = { fg = violet, gui = 'bold' }, - Include = { fg = violet, gui = 'bold' }, - PreProc = { fg = violet, gui = 'bold' }, - PreCondit = { fg = violet, gui = 'bold' }, - - Label = { fg = light_bg and orange or blue }, - Repeat = { fg = light_bg and orange or blue }, - Keyword = { fg = light_bg and orange or blue }, - Operator = { fg = light_bg and orange or blue }, - Delimiter = { fg = light_bg and orange or blue }, - Statement = { fg = light_bg and orange or blue }, - Exception = { fg = light_bg and orange or blue }, - Conditional = { fg = light_bg and orange or blue }, - - Variable = { fg = '#8B93E6' }, - VariableBuiltin = { fg = '#8B93E6', gui = 'bold' }, - Constant = { fg = violet, gui = 'bold' }, - - Number = { fg = light_bg and yellow or orange }, - Float = { fg = light_bg and yellow or orange }, - Boolean = { fg = light_bg and yellow or orange, gui = 'bold' }, - Enum = { fg = light_bg and yellow or orange }, - - Character = { fg = violet, gui = 'bold' }, - SpecialChar = { fg = base8, gui = 'bold' }, - - String = { fg = green }, - StringDelimiter = { fg = green }, - - Special = { fg = violet }, - SpecialBold = { fg = violet, gui = 'bold' }, - - Field = { fg = violet }, - Argument = { fg = light_magenta }, - Attribute = { fg = light_magenta }, - Identifier = { fg = light_magenta }, - Property = { fg = magenta }, - Function = { fg = magenta }, - FunctionBuiltin = { fg = light_magenta, gui = 'bold' }, - KeywordFunction = { fg = light_bg and orange or blue }, - Method = { fg = violet }, - - Type = { fg = yellow }, - TypeBuiltin = { fg = yellow, gui = 'bold' }, - StorageClass = { fg = light_bg and orange or blue }, - Class = { fg = light_bg and orange or blue }, - Structure = { fg = light_bg and orange or blue }, - Typedef = { fg = light_bg and orange or blue }, - - Regexp = { fg = '#dd0093' }, - RegexpSpecial = { fg = '#a40073' }, - RegexpDelimiter = { fg = '#540063', gui = 'bold' }, - RegexpKey = { fg = '#5f0041', gui = 'bold' }, + apply_highlight(nvim_tree) + high_link("NvimTreeGitDirty", "DiffModifiedGutter") + high_link("NvimTreeGitStaged", "DiffModifiedGutter") + high_link("NvimTreeGitMerge", "DiffModifiedGutter") + high_link("NvimTreeGitRenamed", "DiffModifiedGutter") + high_link("NvimTreeGitNew", "DiffAddedGutter") + high_link("NvimTreeGitDeleted", "DiffRemovedGutter") + + high_link("NvimTreeIndentMarker", "IndentGuide") + high_link("NvimTreeOpenedFolderName", "NvimTreeFolderName") + end + + -- }}} + + -- Dashboard {{{ + + if configuration.plugins_integrations.dashboard then + local dashboard = { + dashboardHeader = { fg = "#586268" }, + dashboardCenter = { fg = light_bg and orange or blue }, + dashboardShortcut = { fg = "#9788b9" }, } - apply_highlight(main_syntax) - high_link('CommentURL', 'URL') - high_link('CommentLabel', 'CommentBold') - high_link('CommentSection', 'CommentBold') - high_link('Noise', 'Comment') + apply_highlight(dashboard) + high_link("dashboardFooter", "dashboardHeader") + end + + -- }}} - -- }}} + -- Startify {{{ - -- Diff {{{ + if configuration.plugins_integrations.startify then + local startify = { + StartifyHeader = { fg = bg_popup }, + StartifyBracket = { fg = bg_popup }, + StartifyNumber = { fg = blue }, + StartifyPath = { fg = violet }, + StartifySlash = { fg = violet }, + StartifyFile = { fg = green }, + } - local diff = { - diffLine = { fg = base8, bg = diff_info_bg1 }, - diffSubName = { fg = base8, bg = diff_info_bg1 }, + apply_highlight(startify) + end + + -- }}} + + -- WhichKey {{{ + + if configuration.plugins_integrations.whichkey then + local whichkey = { + WhichKey = { fg = light_bg and orange or blue }, + WhichKeyGroup = { fg = magenta }, + WhichKeyDesc = { fg = magenta }, + WhichKeySeparator = { fg = base5 }, + WhichKeyFloat = { bg = base2 }, + WhichKeyValue = { fg = grey }, + } + + apply_highlight(whichkey) + end + + -- }}} + + -- indent-blankline {{{ + + if configuration.plugins_integrations.indent_blankline then + local indent_blankline = { + IndentBlanklineChar = { + fg = base4, + cterm = "nocombine", + gui = "nocombine", + }, + IndentBlanklineContextChar = { + fg = blue, + cterm = "nocombine", + gui = "nocombine", + }, + IndentBlanklineSpaceChar = { + fg = base4, + cterm = "nocombine", + gui = "nocombine", + }, + IndentBlanklineSpaceCharBlankline = { + fg = base4, + cterm = "nocombine", + gui = "nocombine", + }, + } + + apply_highlight(indent_blankline) + end + + -- }}} + + -- vim-illuminate {{{ + + if configuration.plugins_integrations.vim_illuminate then + local illuminated = { + illuminatedWord = { + cterm = "underline", + gui = "underline", + }, + } - DiffAdd = { bg = diff_add_bg1 }, - DiffChange = { bg = diff_add_bg1 }, - DiffText = { bg = diff_add_bg0 }, - DiffDelete = { bg = gh_danger_bg0 }, + apply_highlight(illuminated) + end - DiffAdded = { fg = diff_add_fg0, bg = diff_add_bg1 }, - DiffModified = { fg = fg, bg = diff_info_bg0 }, - DiffRemoved = { fg = gh_danger_fg0, bg = gh_danger_bg1 }, + -- }}} - DiffAddedGutter = { fg = diff_add_fg, gui = 'bold' }, - DiffModifiedGutter = { fg = diff_info_fg, gui = 'bold' }, - DiffRemovedGutter = { fg = gh_danger_fg, gui = 'bold' }, + -- LspSaga {{{ - DiffAddedGutterLineNr = { fg = grey }, - DiffModifiedGutterLineNr = { fg = grey }, - DiffRemovedGutterLineNr = { fg = grey }, + if configuration.plugins_integrations.lspsaga then + local lspsaga = { + SagaShadow = { bg = bg }, + LspSagaDiagnosticHeader = { fg = red }, } - high_clear('DiffAdd') - high_clear('DiffChange') - high_clear('DiffText') - high_clear('DiffDelete') - apply_highlight(diff) - - -- }}} - - -- Markdown {{{ - local markdown = { - markdownCode = { bg = bg_highlight }, - markdownCodeBlock = { bg = bg_highlight }, - markdownH1 = { gui = 'bold' }, - markdownH2 = { gui = 'bold' }, - markdownLinkText = { gui = 'underline' }, + apply_highlight(lspsaga) + high_link("LspSagaDiagnosticBorder", "Normal") + high_link("LspSagaDiagnosticTruncateLine", "Normal") + high_link("LspFloatWinBorder", "Normal") + high_link("LspSagaBorderTitle", "Title") + high_link("TargetWord", "Error") + high_link("ReferencesCount", "Title") + high_link("ReferencesIcon", "Special") + high_link("DefinitionCount", "Title") + high_link("TargetFileName", "Comment") + high_link("DefinitionIcon", "Special") + high_link("ProviderTruncateLine", "Normal") + high_link("LspSagaFinderSelection", "Search") + high_link("DiagnosticTruncateLine", "Normal") + high_link("DiagnosticError", "LspDiagnosticsDefaultError") + high_link("DiagnosticWarn", "LspDiagnosticsDefaultWarning") + high_link("DiagnosticInfo", "LspDiagnosticsDefaultInformation") + high_link("DiagnosticHint", "LspDiagnosticsDefaultHint") + high_link("DefinitionPreviewTitle", "Title") + high_link("LspSagaShTruncateLine", "Normal") + high_link("LspSagaDocTruncateLine", "Normal") + high_link("LineDiagTuncateLine", "Normal") + high_link("LspSagaCodeActionTitle", "Title") + high_link("LspSagaCodeActionTruncateLine", "Normal") + high_link("LspSagaCodeActionContent", "Normal") + high_link("LspSagaRenamePromptPrefix", "Normal") + high_link("LspSagaRenameBorder", "Bold") + high_link("LspSagaHoverBorder", "Bold") + high_link("LspSagaSignatureHelpBorder", "Bold") + high_link("LspSagaCodeActionBorder", "Bold") + high_link("LspSagaDefPreviewBorder", "Bold") + high_link("LspLinesDiagBorder", "Bold") + end + + -- }}} + + -- Neorg {{{ + + if configuration.plugins_integrations.neorg then + local neorg = { + -- Colors are for nested quotes + Blue = { fg = cyan }, + Yellow = { fg = yellow }, + Red = { fg = red }, + Green = { fg = green }, + Brown = { fg = orange }, } - apply_highlight(markdown) - --}}} - - -- Plugins {{{ - - -- barbar.nvim {{{ - - if configuration.plugins_integrations.barbar then - local barbar = { - BufferCurrent = { fg = base9, bg = bg }, - BufferCurrentIndex = { fg = base6, bg = bg }, - BufferCurrentMod = { fg = yellow, bg = bg }, - BufferCurrentSign = { fg = blue, bg = bg }, - BufferCurrentTarget = { fg = red, bg = bg, gui = 'bold' }, - - BufferVisible = { fg = base7, bg = bg }, - BufferVisibleIndex = { fg = base9, bg = bg }, - BufferVisibleMod = { fg = yellow, bg = bg }, - BufferVisibleSign = { fg = base4, bg = bg }, - BufferVisibleTarget = { fg = red, bg = bg, gui = 'bold' }, - - BufferInactive = { fg = base6, bg = base1 }, - BufferInactiveIndex = { fg = base6, bg = base1 }, - BufferInactiveMod = { fg = yellow, bg = base1 }, - BufferInactiveSign = { fg = base4, bg = base1 }, - BufferInactiveTarget = { fg = red, bg = base1, gui = 'bold' }, - - BufferTabpages = { fg = blue, bg = bg_statusline, gui = 'bold' }, - BufferTabpageFill = { fg = base4, bg = base1, gui = 'bold' }, - - BufferPart = { fg = diff_info_fg, bg = diff_info_bg0, gui = 'bold' }, - } - - apply_highlight(barbar) - end - - -- }}} - - -- BufferLine {{{ - - if configuration.plugins_integrations.bufferline and transparent_bg then - -- NOTE: this is a temporal workaround for using bufferline with a transparent - -- background and having highlighting, please refer to - -- https://github.com/NTBBloodbath/doom-one.nvim/issues/8#issuecomment-883737667 - -- for more information about this - local bufferline = { - BufferLineTab = { fg = fg, bg = bg }, - BufferLineTabClose = { fg = fg, bg = bg, gui = 'bold' }, - BufferLineTabSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, - BufferLineBackground = { fg = fg_alt, bg = bg }, - BufferLineBufferSelected = { fg = fg, bg = bg, gui = 'bold,italic' }, - BufferLineBufferVisible = { fg = fg, bg = bg }, - BufferLineCloseButton = { fg = fg_alt, bg = bg }, - BufferLineCloseButtonSelected = { fg = fg, bg = bg, gui = 'bold' }, - BufferLineCloseButtonVisible = { fg = fg, bg = bg }, - BufferLineModified = { fg = green, bg = bg }, - BufferLineModifiedSelected = { fg = green, bg = bg }, - BufferLineModifiedVisible = { fg = green, bg = bg }, - BufferLineFill = { fg = blue, bg = bg_alt }, - BufferLineIndicatorSelected = { fg = blue, bg = bg }, - BufferLineSeparator = { fg = base0, bg = bg }, - BufferLineSeparatorSelected = { fg = base0, bg = bg }, - BufferLineSeparatorVisible = { fg = base0, bg = bg_alt }, - BufferLinePick = { fg = fg, bg = bg, gui = 'bold' }, - BufferLinePickSelected = { fg = blue, bg = bg, gui = 'bold,italic' }, - BufferLinePickVisible = { fg = fg, bg = bg_alt }, - - BufferLineDiagnostic = { fg = fg, bg = bg, sp = fg }, - BufferLineDiagnosticSelected = { fg = fg, bg = bg, sp = fg }, - BufferLineDiagnosticVisible = { fg = fg, bg = bg, sp = fg }, - - BufferLineInfo = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, - BufferLineInfoSelected = { - fg = cyan, - bg = bg, - sp = cyan, - gui = 'bold,italic', - }, - BufferLineInfoVisible = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' }, - BufferLineInfoDiagnostic = { fg = cyan, bg = bg, sp = cyan }, - BufferLineInfoDiagnosticSelected = { fg = cyan, bg = bg, sp = cyan }, - BufferLineInfoDiagnosticVisible = { fg = cyan, bg = bg, sp = cyan }, - BufferLineError = { fg = red, bg = bg, sp = red, gui = 'bold' }, - BufferLineErrorSelected = { - fg = red, - bg = bg, - sp = red, - gui = 'bold,italic', - }, - BufferLineErrorVisible = { fg = red, bg = bg, sp = red, gui = 'bold' }, - BufferLineErrorDiagnostic = { fg = red, bg = bg, sp = red }, - BufferLineErrorDiagnosticSelected = { fg = red, bg = bg, sp = red }, - BufferLineErrorDiagnosticVisible = { fg = red, bg = bg, sp = red }, - BufferLineWarning = { - fg = yellow, - bg = bg, - sp = yellow, - gui = 'bold,italic', - }, - BufferLineWarningSelected = { - fg = yellow, - bg = bg, - sp = yellow, - gui = 'bold,italic', - }, - BufferLineWarningVisible = { - fg = yellow, - bg = bg, - sp = yellow, - gui = 'bold', - }, - BufferLineWarningDiagnostic = { fg = yellow, bg = bg, sp = yellow }, - BufferLineWarningDiagnosticSelected = { fg = yellow, bg = bg, sp = yellow }, - BufferLineWarningDiagnosticVisible = { fg = yellow, bg = bg, sp = yellow }, - } - - apply_highlight(bufferline) - end - - -- }}} - - -- Gitgutter {{{ - - if configuration.plugins_integrations.gitgutter then - high_link('GitGutterAdd', 'DiffAddedGutter') - high_link('GitGutterChange', 'DiffModifiedGutter') - high_link('GitGutterDelete', 'DiffRemovedGutter') - high_link('GitGutterChangeDelete', 'DiffModifiedGutter') - - high_link('GitGutterAddLineNr', 'DiffAddedGutterLineNr') - high_link('GitGutterChangeLineNr', 'DiffModifiedGutterLineNr') - high_link('GitGutterDeleteLineNr', 'DiffRemovedGutterLineNr') - high_link('GitGutterChangeDeleteLineNr', 'DiffModifiedGutterLineNr') - end - - -- }}} - - -- Gitsigns {{{ - - if configuration.plugins_integrations.gitsigns then - high_link('GitSignsAdd', 'DiffAddedGutter') - high_link('GitSignsChange', 'DiffModifiedGutter') - high_link('GitSignsDelete', 'DiffRemovedGutter') - high_link('GitSignsChangeDelete', 'DiffModifiedGutter') - end - - -- }}} - - -- Telescope {{{ - - if configuration.plugins_integrations.telescope then - local telescope = { - TelescopeSelection = { fg = yellow, gui = 'bold' }, - TelescopeSelectionCaret = { fg = light_bg and orange or blue }, - TelescopeMultiSelection = { fg = grey }, - TelescopeNormal = { fg = fg }, - TelescopeMatching = { fg = green, gui = 'bold' }, - TelescopePromptPrefix = { fg = light_bg and orange or blue }, - TelescopeBorder = { fg = light_bg and orange or blue }, - TelescopePromptBorder = { fg = light_bg and orange or blue }, - TelescopeResultsBorder = { fg = light_bg and orange or blue }, - TelescopePreviewBorder = { fg = light_bg and orange or blue }, - } - - apply_highlight(telescope) - high_link('TelescopePrompt', 'TelescopeNormal') - end - - -- }}} - - -- Neogit {{{ - - if configuration.plugins_integrations.neogit then - local neogit = { - NeogitDiffAdd = { fg = ng_add_fg, bg = ng_add_bg}, - NeogitDiffAddHighlight = { fg = ng_add_fg_hl, bg = ng_add_bg_hl, gui = 'bold' }, - NeogitDiffDelete = { fg = ng_delete_fg, bg = ng_delete_bg }, - NeogitDiffDeleteHighlight = { fg = ng_delete_fg_hl, bg = ng_delete_bg_hl, gui = 'bold' }, - NeogitDiffContext = { fg = fg_alt, bg = bg }, - NeogitDiffContextHighlight = { fg = fg, bg = bg_alt }, - NeogitHunkHeader = { fg = bg, bg = ng_header_bg }, - NeogitHunkHeaderHighlight = { fg = bg_alt, bg = ng_header_bg_hl, gui = 'bold' }, - NeogitStagedChanges = { fg = blue, gui = 'bold' }, - NeogitStagedChangesRegion = { bg = bg_highlight }, - NeogitStashes = { fg = blue, gui = 'bold' }, - NeogitUnstagedChanges = { fg = blue, gui = 'bold' }, - NeogitUntrackedfiles = { fg = blue, gui = 'bold' }, - } - - apply_highlight(neogit) - end - - -- }}} - - -- NvimTree {{{ - - if configuration.plugins_integrations.nvim_tree then - local nvim_tree = { - NvimTreeFolderName = { fg = light_bg and base9 or blue, gui = 'bold' }, - NvimTreeRootFolder = { fg = green }, - NvimTreeEmptyFolderName = { fg = fg_alt, gui = 'bold' }, - NvimTreeSymlink = { fg = fg, gui = 'underline' }, - NvimTreeExecFile = { fg = green, gui = 'bold' }, - NvimTreeImageFile = { fg = light_bg and orange or blue }, - NvimTreeOpenedFile = { fg = fg_alt }, - NvimTreeSpecialFile = { fg = fg, gui = 'underline' }, - NvimTreeMarkdownFile = { fg = fg, gui = 'underline' }, - } - - apply_highlight(nvim_tree) - high_link('NvimTreeGitDirty', 'DiffModifiedGutter') - high_link('NvimTreeGitStaged', 'DiffModifiedGutter') - high_link('NvimTreeGitMerge', 'DiffModifiedGutter') - high_link('NvimTreeGitRenamed', 'DiffModifiedGutter') - high_link('NvimTreeGitNew', 'DiffAddedGutter') - high_link('NvimTreeGitDeleted', 'DiffRemovedGutter') - - high_link('NvimTreeIndentMarker', 'IndentGuide') - high_link('NvimTreeOpenedFolderName', 'NvimTreeFolderName') - end - - -- }}} - - -- Dashboard {{{ - - if configuration.plugins_integrations.dashboard then - local dashboard = { - dashboardHeader = { fg = '#586268' }, - dashboardCenter = { fg = light_bg and orange or blue }, - dashboardShortcut = { fg = '#9788b9' }, - } - - apply_highlight(dashboard) - high_link('dashboardFooter', 'dashboardHeader') - end - - -- }}} - - -- Startify {{{ - - if configuration.plugins_integrations.startify then - local startify = { - StartifyHeader = { fg = bg_popup }, - StartifyBracket = { fg = bg_popup }, - StartifyNumber = { fg = blue }, - StartifyPath = { fg = violet }, - StartifySlash = { fg = violet }, - StartifyFile = { fg = green }, - } - - apply_highlight(startify) - end - - -- }}} - - -- WhichKey {{{ - - if configuration.plugins_integrations.whichkey then - local whichkey = { - WhichKey = { fg = light_bg and orange or blue }, - WhichKeyGroup = { fg = magenta }, - WhichKeyDesc = { fg = magenta }, - WhichKeySeparator = { fg = base5 }, - WhichKeyFloat = { bg = base2 }, - WhichKeyValue = { fg = grey }, - } - - apply_highlight(whichkey) - end - - -- }}} - - -- indent-blankline {{{ - - if configuration.plugins_integrations.indent_blankline then - local indent_blankline = { - IndentBlanklineChar = { - fg = base4, - cterm = 'nocombine', - gui = 'nocombine', - }, - IndentBlanklineContextChar = { - fg = blue, - cterm = 'nocombine', - gui = 'nocombine', - }, - IndentBlanklineSpaceChar = { - fg = base4, - cterm = 'nocombine', - gui = 'nocombine', - }, - IndentBlanklineSpaceCharBlankline = { - fg = base4, - cterm = 'nocombine', - gui = 'nocombine', - }, - } - - apply_highlight(indent_blankline) - end - - -- }}} - - -- vim-illuminate {{{ - - if configuration.plugins_integrations.vim_illuminate then - local illuminated = { - illuminatedWord = { - cterm = 'underline', - gui = 'underline', - }, - } - - apply_highlight(illuminated) - end - - -- }}} - - -- LspSaga {{{ - - if configuration.plugins_integrations.lspsaga then - local lspsaga = { - SagaShadow = { bg = bg }, - LspSagaDiagnosticHeader = { fg = red }, - } - - apply_highlight(lspsaga) - high_link('LspSagaDiagnosticBorder', 'Normal') - high_link('LspSagaDiagnosticTruncateLine', 'Normal') - high_link('LspFloatWinBorder', 'Normal') - high_link('LspSagaBorderTitle', 'Title') - high_link('TargetWord', 'Error') - high_link('ReferencesCount', 'Title') - high_link('ReferencesIcon', 'Special') - high_link('DefinitionCount', 'Title') - high_link('TargetFileName', 'Comment') - high_link('DefinitionIcon', 'Special') - high_link('ProviderTruncateLine', 'Normal') - high_link('LspSagaFinderSelection', 'Search') - high_link('DiagnosticTruncateLine', 'Normal') - high_link('DiagnosticError', 'LspDiagnosticsDefaultError') - high_link('DiagnosticWarn', 'LspDiagnosticsDefaultWarning') - high_link('DiagnosticInfo', 'LspDiagnosticsDefaultInformation') - high_link('DiagnosticHint', 'LspDiagnosticsDefaultHint') - high_link('DefinitionPreviewTitle', 'Title') - high_link('LspSagaShTruncateLine', 'Normal') - high_link('LspSagaDocTruncateLine', 'Normal') - high_link('LineDiagTuncateLine', 'Normal') - high_link('LspSagaCodeActionTitle', 'Title') - high_link('LspSagaCodeActionTruncateLine', 'Normal') - high_link('LspSagaCodeActionContent', 'Normal') - high_link('LspSagaRenamePromptPrefix', 'Normal') - high_link('LspSagaRenameBorder', 'Bold') - high_link('LspSagaHoverBorder', 'Bold') - high_link('LspSagaSignatureHelpBorder', 'Bold') - high_link('LspSagaCodeActionBorder', 'Bold') - high_link('LspSagaDefPreviewBorder', 'Bold') - high_link('LspLinesDiagBorder', 'Bold') - end - - -- }}} - - -- Neorg {{{ - - if configuration.plugins_integrations.neorg then - local neorg = { - -- Colors are for nested quotes - Blue = { fg = cyan }, - Yellow = { fg = yellow }, - Red = { fg = red }, - Green = { fg = green }, - Brown = { fg = orange }, - } - - apply_highlight(neorg) - end - - -- }}} - - -- }}} - - -- LSP {{{ - - local msg_underline = { - ErrorMsgUnderline = { fg = red, gui = 'underline' }, - WarningMsgUnderline = { fg = yellow, gui = 'underline' }, - MoreMsgUnderline = { fg = blue, gui = 'underline' }, - MsgUnderline = { fg = green, gui = 'underline' }, + apply_highlight(neorg) + end + + -- }}} + + -- }}} + + -- LSP {{{ + + local msg_underline = { + ErrorMsgUnderline = { fg = red, gui = "underline" }, + WarningMsgUnderline = { fg = yellow, gui = "underline" }, + MoreMsgUnderline = { fg = blue, gui = "underline" }, + MsgUnderline = { fg = green, gui = "underline" }, + } + + apply_highlight(msg_underline) + high_link("LspDiagnosticsFloatingError", "ErrorMsg") + high_link("LspDiagnosticsFloatingWarning", "WarningMsg") + high_link("LspDiagnosticsFloatingInformation", "MoreMsg") + high_link("LspDiagnosticsFloatingHint", "Msg") + high_link("LspDiagnosticsDefaultError", "ErrorMsg") + high_link("LspDiagnosticsDefaultWarning", "WarningMsg") + high_link("LspDiagnosticsDefaultInformation", "MoreMsg") + high_link("LspDiagnosticsDefaultHint", "Msg") + high_link("LspDiagnosticsVirtualTextError", "ErrorMsg") + high_link("LspDiagnosticsVirtualTextWarning", "WarningMsg") + high_link("LspDiagnosticsVirtualTextInformation", "MoreMsg") + high_link("LspDiagnosticsVirtualTextHint", "Msg") + high_link("LspDiagnosticsUnderlineError", "ErrorMsgUnderline") + high_link("LspDiagnosticsUnderlineWarning", "WarningMsgUnderline") + high_link("LspDiagnosticsUnderlineInformation", "MoreMsgUnderline") + high_link("LspDiagnosticsUnderlineHint", "MsgUnderline") + high_link("LspDiagnosticsSignError", "ErrorMsg") + high_link("LspDiagnosticsSignWarning", "WarningMsg") + high_link("LspDiagnosticsSignInformation", "MoreMsg") + high_link("LspDiagnosticsSignHint", "Msg") + high_link("DiagnosticFloatingError", "ErrorMsg") + high_link("DiagnosticFloatingWarn", "WarningMsg") + high_link("DiagnosticFloatingInfo", "MoreMsg") + high_link("DiagnosticFloatingHint", "Msg") + high_link("DiagnosticDefaultError", "ErrorMsg") + high_link("DiagnosticDefaultWarn", "WarningMsg") + high_link("DiagnosticDefaultInfo", "MoreMsg") + high_link("DiagnosticDefaultHint", "Msg") + high_link("DiagnosticVirtualTextError", "ErrorMsg") + high_link("DiagnosticVirtualTextWarn", "WarningMsg") + high_link("DiagnosticVirtualTextInfo", "MoreMsg") + high_link("DiagnosticVirtualTextHint", "Msg") + high_link("DiagnosticUnderlineError", "ErrorMsgUnderline") + high_link("DiagnosticUnderlineWarn", "WarningMsgUnderline") + high_link("DiagnosticUnderlineInfo", "MoreMsgUnderline") + high_link("DiagnosticUnderlineHint", "MsgUnderline") + high_link("DiagnosticSignError", "ErrorMsg") + high_link("DiagnosticSignWarning", "WarningMsg") + high_link("DiagnosticSignInformation", "MoreMsg") + high_link("DiagnosticSignHint", "Msg") + high_link("LspReferenceText", "LspHighlight") + high_link("LspReferenceRead", "LspHighlight") + high_link("LspReferenceWrite", "LspHighlight") + high_link("TermCursor", "Cursor") + high_link("healthError", "ErrorMsg") + high_link("healthSuccess", "Msg") + high_link("healthWarning", "WarningMsg") + + -- }}} + + -- TreeSitter {{{ + + if configuration.enable_treesitter then + -- We will set a special definition for TSStrike here + local treesitter = { + TSStrike = { fg = utils.Darken(violet, 0.2), cterm = "strikethrough", gui = "strikethrough" }, } - apply_highlight(msg_underline) - high_link('LspDiagnosticsFloatingError', 'ErrorMsg') - high_link('LspDiagnosticsFloatingWarning', 'WarningMsg') - high_link('LspDiagnosticsFloatingInformation', 'MoreMsg') - high_link('LspDiagnosticsFloatingHint', 'Msg') - high_link('LspDiagnosticsDefaultError', 'ErrorMsg') - high_link('LspDiagnosticsDefaultWarning', 'WarningMsg') - high_link('LspDiagnosticsDefaultInformation', 'MoreMsg') - high_link('LspDiagnosticsDefaultHint', 'Msg') - high_link('LspDiagnosticsVirtualTextError', 'ErrorMsg') - high_link('LspDiagnosticsVirtualTextWarning', 'WarningMsg') - high_link('LspDiagnosticsVirtualTextInformation', 'MoreMsg') - high_link('LspDiagnosticsVirtualTextHint', 'Msg') - high_link('LspDiagnosticsUnderlineError', 'ErrorMsgUnderline') - high_link('LspDiagnosticsUnderlineWarning', 'WarningMsgUnderline') - high_link('LspDiagnosticsUnderlineInformation', 'MoreMsgUnderline') - high_link('LspDiagnosticsUnderlineHint', 'MsgUnderline') - high_link('LspDiagnosticsSignError', 'ErrorMsg') - high_link('LspDiagnosticsSignWarning', 'WarningMsg') - high_link('LspDiagnosticsSignInformation', 'MoreMsg') - high_link('LspDiagnosticsSignHint', 'Msg') - high_link('DiagnosticFloatingError', 'ErrorMsg') - high_link('DiagnosticFloatingWarn', 'WarningMsg') - high_link('DiagnosticFloatingInfo', 'MoreMsg') - high_link('DiagnosticFloatingHint', 'Msg') - high_link('DiagnosticDefaultError', 'ErrorMsg') - high_link('DiagnosticDefaultWarn', 'WarningMsg') - high_link('DiagnosticDefaultInfo', 'MoreMsg') - high_link('DiagnosticDefaultHint', 'Msg') - high_link('DiagnosticVirtualTextError', 'ErrorMsg') - high_link('DiagnosticVirtualTextWarn', 'WarningMsg') - high_link('DiagnosticVirtualTextInfo', 'MoreMsg') - high_link('DiagnosticVirtualTextHint', 'Msg') - high_link('DiagnosticUnderlineError', 'ErrorMsgUnderline') - high_link('DiagnosticUnderlineWarn', 'WarningMsgUnderline') - high_link('DiagnosticUnderlineInfo', 'MoreMsgUnderline') - high_link('DiagnosticUnderlineHint', 'MsgUnderline') - high_link('DiagnosticSignError', 'ErrorMsg') - high_link('DiagnosticSignWarning', 'WarningMsg') - high_link('DiagnosticSignInformation', 'MoreMsg') - high_link('DiagnosticSignHint', 'Msg') - high_link('LspReferenceText', 'LspHighlight') - high_link('LspReferenceRead', 'LspHighlight') - high_link('LspReferenceWrite', 'LspHighlight') - high_link('TermCursor', 'Cursor') - high_link('healthError', 'ErrorMsg') - high_link('healthSuccess', 'Msg') - high_link('healthWarning', 'WarningMsg') - - -- }}} - - -- TreeSitter {{{ - - if configuration.enable_treesitter then - -- We will set a special definition for TSStrike here - local treesitter = { - TSStrike = { fg = utils.Darken(violet, 0.2), cterm = 'strikethrough', gui = 'strikethrough' }, - } - - apply_highlight(treesitter) - high_link('TSException', 'Exception') - high_link('TSAnnotation', 'PreProc') - high_link('TSAttribute', 'Attribute') - high_link('TSConditional', 'Conditional') - high_link('TSComment', 'Comment') - high_link('TSConstructor', 'Structure') - high_link('TSConstant', 'Constant') - high_link('TSConstBuiltin', 'Constant') - high_link('TSConstMacro', 'Macro') - high_link('TSError', 'Error') - high_link('TSField', 'Field') - high_link('TSFloat', 'Float') - high_link('TSFunction', 'Function') - high_link('TSFuncBuiltin', 'FunctionBuiltin') - high_link('TSFuncMacro', 'Macro') - high_link('TSInclude', 'Include') - high_link('TSKeyword', 'Keyword') - high_link('TSKeywordFunction', 'KeywordFunction') - high_link('TSLabel', 'Label') - high_link('TSMethod', 'Method') - high_link('TSNamespace', 'Directory') - high_link('TSNumber', 'Number') - high_link('TSOperator', 'Operator') - high_link('TSParameter', 'Argument') - high_link('TSParameterReference', 'Argument') - high_link('TSProperty', 'Property') - high_link('TSPunctDelimiter', 'Delimiter') - high_link('TSPunctBracket', 'Delimiter') - high_link('TSPunctSpecial', 'Delimiter') - high_link('TSRepeat', 'Repeat') - high_link('TSString', 'String') - high_link('TSStringRegex', 'StringDelimiter') - high_link('TSStringEscape', 'StringDelimiter') - high_link('TSTag', 'Tag') - high_link('TSTagDelimiter', 'Delimiter') - high_link('TSStrong', 'Bold') - high_link('TSURI', 'URL') - high_link('TSWarning', 'WarningMsg') - high_link('TSDanger', 'ErrorMsg') - high_link('TSType', 'Type') - high_link('TSTypeBuiltin', 'TypeBuiltin') - high_link('TSVariable', 'None') - high_link('TSVariableBuiltin', 'VariableBuiltin') - end - - -- }}} - - -- Neovim Terminal Colors {{{ - - if configuration.terminal_colors then - vim.g.terminal_color_0 = bg - vim.g.terminal_color_1 = red - vim.g.terminal_color_2 = green - vim.g.terminal_color_3 = yellow - vim.g.terminal_color_4 = blue - vim.g.terminal_color_5 = violet - vim.g.terminal_color_6 = cyan - vim.g.terminal_color_7 = fg - vim.g.terminal_color_8 = grey - vim.g.terminal_color_9 = red - vim.g.terminal_color_10 = green - vim.g.terminal_color_11 = orange - vim.g.terminal_color_12 = blue - vim.g.terminal_color_13 = violet - vim.g.terminal_color_14 = cyan - vim.g.terminal_color_15 = white - vim.g.terminal_color_background = bg_alt - vim.g.terminal_color_foreground = fg_alt - end - - -- }}} + apply_highlight(treesitter) + high_link("TSException", "Exception") + high_link("TSAnnotation", "PreProc") + high_link("TSAttribute", "Attribute") + high_link("TSConditional", "Conditional") + high_link("TSComment", "Comment") + high_link("TSConstructor", "Structure") + high_link("TSConstant", "Constant") + high_link("TSConstBuiltin", "Constant") + high_link("TSConstMacro", "Macro") + high_link("TSError", "Error") + high_link("TSField", "Field") + high_link("TSFloat", "Float") + high_link("TSFunction", "Function") + high_link("TSFuncBuiltin", "FunctionBuiltin") + high_link("TSFuncMacro", "Macro") + high_link("TSInclude", "Include") + high_link("TSKeyword", "Keyword") + high_link("TSKeywordFunction", "KeywordFunction") + high_link("TSLabel", "Label") + high_link("TSMethod", "Method") + high_link("TSNamespace", "Directory") + high_link("TSNumber", "Number") + high_link("TSOperator", "Operator") + high_link("TSParameter", "Argument") + high_link("TSParameterReference", "Argument") + high_link("TSProperty", "Property") + high_link("TSPunctDelimiter", "Delimiter") + high_link("TSPunctBracket", "Delimiter") + high_link("TSPunctSpecial", "Delimiter") + high_link("TSRepeat", "Repeat") + high_link("TSString", "String") + high_link("TSStringRegex", "StringDelimiter") + high_link("TSStringEscape", "StringDelimiter") + high_link("TSTag", "Tag") + high_link("TSTagDelimiter", "Delimiter") + high_link("TSStrong", "Bold") + high_link("TSURI", "URL") + high_link("TSWarning", "WarningMsg") + high_link("TSDanger", "ErrorMsg") + high_link("TSType", "Type") + high_link("TSTypeBuiltin", "TypeBuiltin") + high_link("TSVariable", "None") + high_link("TSVariableBuiltin", "VariableBuiltin") + end + + -- }}} + + -- Neovim Terminal Colors {{{ + + if configuration.terminal_colors then + vim.g.terminal_color_0 = bg + vim.g.terminal_color_1 = red + vim.g.terminal_color_2 = green + vim.g.terminal_color_3 = yellow + vim.g.terminal_color_4 = blue + vim.g.terminal_color_5 = violet + vim.g.terminal_color_6 = cyan + vim.g.terminal_color_7 = fg + vim.g.terminal_color_8 = grey + vim.g.terminal_color_9 = red + vim.g.terminal_color_10 = green + vim.g.terminal_color_11 = orange + vim.g.terminal_color_12 = blue + vim.g.terminal_color_13 = violet + vim.g.terminal_color_14 = cyan + vim.g.terminal_color_15 = white + vim.g.terminal_color_background = bg_alt + vim.g.terminal_color_foreground = fg_alt + end + + -- }}} end return doom_one diff --git a/lua/colors/doom-one/utils/init.lua b/lua/colors/doom-one/utils/init.lua index 111c0e7c4..e95019f1f 100644 --- a/lua/colors/doom-one/utils/init.lua +++ b/lua/colors/doom-one/utils/init.lua @@ -13,19 +13,19 @@ local M = {} -- @param b Blue value -- @return HEX color, e.g. '#1E1E1E' local function RGB_to_Hex(r, g, b) - return '#' .. string.format('%02X%02X%02X', r, g, b) + return "#" .. string.format("%02X%02X%02X", r, g, b) end -- Convert Hex to RGB color. -- @param color HEX color -- @return RGB color, e.g. {30, 30, 30} local function Hex_to_RGB(color) - color = color:gsub('#', '') - return { - tonumber('0x' .. string.sub(color, 1, 2)), - tonumber('0x' .. string.sub(color, 3, 4)), - tonumber('0x' .. string.sub(color, 5, 6)), - } + color = color:gsub("#", "") + return { + tonumber("0x" .. string.sub(color, 1, 2)), + tonumber("0x" .. string.sub(color, 3, 4)), + tonumber("0x" .. string.sub(color, 5, 6)), + } end -- }}} @@ -33,74 +33,74 @@ end -- Composed functions {{{ M.Lighten = function(color, percentage) - local amount = percentage == nil and 5.0 or percentage + local amount = percentage == nil and 5.0 or percentage - if amount < 1.0 then - amount = 1.0 + amount - else - amount = 1.0 + (amount / 100.0) - end + if amount < 1.0 then + amount = 1.0 + amount + else + amount = 1.0 + (amount / 100.0) + end - -- Let's pass amount variable to Neovim so we can use - -- the Neovim map function - vim.g.amount = amount + -- Let's pass amount variable to Neovim so we can use + -- the Neovim map function + vim.g.amount = amount - local rgb = Hex_to_RGB(color) - rgb = vim.fn.map(rgb, 'v:val * amount') - -- Let's delete the g:amount variable since we don't need it anymore - vim.cmd('unlet g:amount') + local rgb = Hex_to_RGB(color) + rgb = vim.fn.map(rgb, "v:val * amount") + -- Let's delete the g:amount variable since we don't need it anymore + vim.cmd("unlet g:amount") - rgb = vim.fn.map(rgb, 'v:val > 255.0 ? 255.0 : v:val') - rgb = vim.fn.map(rgb, 'float2nr(v:val)') - local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) + rgb = vim.fn.map(rgb, "v:val > 255.0 ? 255.0 : v:val") + rgb = vim.fn.map(rgb, "float2nr(v:val)") + local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) - return hex + return hex end M.Darken = function(color, percentage) - local amount = percentage == nil and 5.0 or percentage - - if amount < 1.0 then - amount = 1.0 - amount - else - amount = 1.0 - (amount / 100.0) - end - if amount < 0.0 then - amount = 0.0 - end - - -- Let's pass amount variable to Neovim so we can use - -- the Neovim map function - vim.g.amount = amount - - local rgb = Hex_to_RGB(color) - rgb = vim.fn.map(rgb, 'v:val * amount') - -- Let's delete the g:amount variable since we don't need it anymore - vim.cmd('unlet g:amount') - - rgb = vim.fn.map(rgb, 'v:val > 255.0 ? 255.0 : v:val') - rgb = vim.fn.map(rgb, 'float2nr(v:val)') - local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) - - return hex + local amount = percentage == nil and 5.0 or percentage + + if amount < 1.0 then + amount = 1.0 - amount + else + amount = 1.0 - (amount / 100.0) + end + if amount < 0.0 then + amount = 0.0 + end + + -- Let's pass amount variable to Neovim so we can use + -- the Neovim map function + vim.g.amount = amount + + local rgb = Hex_to_RGB(color) + rgb = vim.fn.map(rgb, "v:val * amount") + -- Let's delete the g:amount variable since we don't need it anymore + vim.cmd("unlet g:amount") + + rgb = vim.fn.map(rgb, "v:val > 255.0 ? 255.0 : v:val") + rgb = vim.fn.map(rgb, "float2nr(v:val)") + local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) + + return hex end local function interpolate(start, _end, amount) - local diff = _end - start - return start + (diff * amount) + local diff = _end - start + return start + (diff * amount) end M.Mix = function(first, second, percentage) - local amount = percentage == nil and 0.0 or percentage + local amount = percentage == nil and 0.0 or percentage - local first_rgb = Hex_to_RGB(first) - local second_rgb = Hex_to_RGB(second) + local first_rgb = Hex_to_RGB(first) + local second_rgb = Hex_to_RGB(second) - local r = interpolate(first_rgb[1], second_rgb[1], amount) - local g = interpolate(first_rgb[2], second_rgb[2], amount) - local b = interpolate(first_rgb[3], second_rgb[3], amount) + local r = interpolate(first_rgb[1], second_rgb[1], amount) + local g = interpolate(first_rgb[2], second_rgb[2], amount) + local b = interpolate(first_rgb[3], second_rgb[3], amount) - return RGB_to_Hex(r, g, b) + return RGB_to_Hex(r, g, b) end -- }}} diff --git a/lua/colors/utils/init.lua b/lua/colors/utils/init.lua index 111c0e7c4..e95019f1f 100644 --- a/lua/colors/utils/init.lua +++ b/lua/colors/utils/init.lua @@ -13,19 +13,19 @@ local M = {} -- @param b Blue value -- @return HEX color, e.g. '#1E1E1E' local function RGB_to_Hex(r, g, b) - return '#' .. string.format('%02X%02X%02X', r, g, b) + return "#" .. string.format("%02X%02X%02X", r, g, b) end -- Convert Hex to RGB color. -- @param color HEX color -- @return RGB color, e.g. {30, 30, 30} local function Hex_to_RGB(color) - color = color:gsub('#', '') - return { - tonumber('0x' .. string.sub(color, 1, 2)), - tonumber('0x' .. string.sub(color, 3, 4)), - tonumber('0x' .. string.sub(color, 5, 6)), - } + color = color:gsub("#", "") + return { + tonumber("0x" .. string.sub(color, 1, 2)), + tonumber("0x" .. string.sub(color, 3, 4)), + tonumber("0x" .. string.sub(color, 5, 6)), + } end -- }}} @@ -33,74 +33,74 @@ end -- Composed functions {{{ M.Lighten = function(color, percentage) - local amount = percentage == nil and 5.0 or percentage + local amount = percentage == nil and 5.0 or percentage - if amount < 1.0 then - amount = 1.0 + amount - else - amount = 1.0 + (amount / 100.0) - end + if amount < 1.0 then + amount = 1.0 + amount + else + amount = 1.0 + (amount / 100.0) + end - -- Let's pass amount variable to Neovim so we can use - -- the Neovim map function - vim.g.amount = amount + -- Let's pass amount variable to Neovim so we can use + -- the Neovim map function + vim.g.amount = amount - local rgb = Hex_to_RGB(color) - rgb = vim.fn.map(rgb, 'v:val * amount') - -- Let's delete the g:amount variable since we don't need it anymore - vim.cmd('unlet g:amount') + local rgb = Hex_to_RGB(color) + rgb = vim.fn.map(rgb, "v:val * amount") + -- Let's delete the g:amount variable since we don't need it anymore + vim.cmd("unlet g:amount") - rgb = vim.fn.map(rgb, 'v:val > 255.0 ? 255.0 : v:val') - rgb = vim.fn.map(rgb, 'float2nr(v:val)') - local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) + rgb = vim.fn.map(rgb, "v:val > 255.0 ? 255.0 : v:val") + rgb = vim.fn.map(rgb, "float2nr(v:val)") + local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) - return hex + return hex end M.Darken = function(color, percentage) - local amount = percentage == nil and 5.0 or percentage - - if amount < 1.0 then - amount = 1.0 - amount - else - amount = 1.0 - (amount / 100.0) - end - if amount < 0.0 then - amount = 0.0 - end - - -- Let's pass amount variable to Neovim so we can use - -- the Neovim map function - vim.g.amount = amount - - local rgb = Hex_to_RGB(color) - rgb = vim.fn.map(rgb, 'v:val * amount') - -- Let's delete the g:amount variable since we don't need it anymore - vim.cmd('unlet g:amount') - - rgb = vim.fn.map(rgb, 'v:val > 255.0 ? 255.0 : v:val') - rgb = vim.fn.map(rgb, 'float2nr(v:val)') - local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) - - return hex + local amount = percentage == nil and 5.0 or percentage + + if amount < 1.0 then + amount = 1.0 - amount + else + amount = 1.0 - (amount / 100.0) + end + if amount < 0.0 then + amount = 0.0 + end + + -- Let's pass amount variable to Neovim so we can use + -- the Neovim map function + vim.g.amount = amount + + local rgb = Hex_to_RGB(color) + rgb = vim.fn.map(rgb, "v:val * amount") + -- Let's delete the g:amount variable since we don't need it anymore + vim.cmd("unlet g:amount") + + rgb = vim.fn.map(rgb, "v:val > 255.0 ? 255.0 : v:val") + rgb = vim.fn.map(rgb, "float2nr(v:val)") + local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3]) + + return hex end local function interpolate(start, _end, amount) - local diff = _end - start - return start + (diff * amount) + local diff = _end - start + return start + (diff * amount) end M.Mix = function(first, second, percentage) - local amount = percentage == nil and 0.0 or percentage + local amount = percentage == nil and 0.0 or percentage - local first_rgb = Hex_to_RGB(first) - local second_rgb = Hex_to_RGB(second) + local first_rgb = Hex_to_RGB(first) + local second_rgb = Hex_to_RGB(second) - local r = interpolate(first_rgb[1], second_rgb[1], amount) - local g = interpolate(first_rgb[2], second_rgb[2], amount) - local b = interpolate(first_rgb[3], second_rgb[3], amount) + local r = interpolate(first_rgb[1], second_rgb[1], amount) + local g = interpolate(first_rgb[2], second_rgb[2], amount) + local b = interpolate(first_rgb[3], second_rgb[3], amount) - return RGB_to_Hex(r, g, b) + return RGB_to_Hex(r, g, b) end -- }}} diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index a563a08b2..ddd1161eb 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -4,6 +4,20 @@ return function() local nvim_lsp = require("lspconfig") local is_plugin_disabled = require("doom.utils").is_plugin_disabled + local servers = { + lua = { "sumneko_lua" }, + angular = { "angularls" }, + bash = { "bashls" }, + c = { "clangd" }, + cpp = { "clangd" }, + css = { "cssls" }, + html = { "html" }, + json = { "jsonls" }, + docker = { "dockerls" }, + python = { "pyright" }, + rust = { "rust_analyser" }, + } + -- Snippets support local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.preselectSupport = true @@ -36,11 +50,11 @@ return function() -- Load langs from doom_modules and install servers with +lsp flag local function install_servers() - local lspinstall = require("lspinstall") - lspinstall.setup() + local lspmanager = require("lspmanager") + lspmanager.setup() - local installed_servers = lspinstall.installed_servers() - local available_servers = lspinstall.available_servers() + local installed_servers = lspmanager.installed_servers() + local available_servers = lspmanager.available_servers() local modules = require("doom.core.config.modules").modules local langs = modules.langs @@ -68,7 +82,7 @@ return function() .. lsp_override .. "." ) - lspinstall.uninstall_server(lang) + lspmanager.uninstall_server(lang) end end @@ -77,7 +91,7 @@ return function() -- Try to install the server only if there is a server available for -- the language, oterwise raise a warning if utils.has_value(available_servers, lsp_name) then - lspinstall.install_server(lsp_name) + lspmanager.install_server(lsp_name) else if lsp_override == nil then log.warn( @@ -128,12 +142,11 @@ return function() }, }) - -- https://github.com/kabouzeid/nvim-lspinstall#advanced-configuration-recommended local function setup_servers() -- Provide the missing :LspInstall require("lspmanager").setup() - local servers = require("lspinstall").installed_servers() + local servers = require("lspmanager").installed_servers() for _, server in pairs(servers) do -- Configure sumneko for neovim lua development if server == "sumneko_lua" then From 3826efb1716da202cd2d82ed178094e4ff6ed0c2 Mon Sep 17 00:00:00 2001 From: mordechai Date: Sun, 17 Oct 2021 12:58:23 +0300 Subject: [PATCH 196/290] fix(lspmanager): change from filetype to first lsp of filetype --- lua/doom/modules/config/doom-lspmanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index ddd1161eb..5c6bb486e 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -82,7 +82,7 @@ return function() .. lsp_override .. "." ) - lspmanager.uninstall_server(lang) + lspmanager.uninstall_server(servers[lang][1]) end end From 0f8ac17cbd8a80bfabf60cf5a142ffe134f145c9 Mon Sep 17 00:00:00 2001 From: mordechai Date: Sun, 17 Oct 2021 13:34:01 +0300 Subject: [PATCH 197/290] refactor(lspmanager): lspname to use server name rather than filetype refactor(lspmanger): use lsp_name --- lua/doom/modules/config/doom-lspmanager.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index 5c6bb486e..b37216292 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -62,7 +62,7 @@ return function() for _, lang in ipairs(langs) do local lang_str = lang lang = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") - local lsp_name = lang + local lsp_name = servers[lang][1] -- Allow overriding of LSP using `+lsp(OVERRIDE_LSP_NAME)` syntax local lsp_override = lang_str:match("+lsp%((%a+)%)") @@ -82,7 +82,7 @@ return function() .. lsp_override .. "." ) - lspmanager.uninstall_server(servers[lang][1]) + lspmanager.uninstall_server(lsp_name) end end From 9de73b7ed5e40b23e720815aab6b13553ce784a6 Mon Sep 17 00:00:00 2001 From: mordechai Date: Sun, 17 Oct 2021 13:44:34 +0300 Subject: [PATCH 198/290] fix(lspmanager): redefining servers change(lspmanager): changed servers to installed_servers --- lua/doom/modules/config/doom-lspmanager.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index b37216292..30602cc56 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -113,7 +113,7 @@ return function() install_servers() - --- Intelligent highlighting of word under cursor + --- Intelligent highlighting of w ord under cursor local on_attach if not is_plugin_disabled("illuminated") and packer_plugins["vim-illuminate"] then on_attach = function(client) @@ -146,8 +146,8 @@ return function() -- Provide the missing :LspInstall require("lspmanager").setup() - local servers = require("lspmanager").installed_servers() - for _, server in pairs(servers) do + local installed_servers = require("lspmanager").installed_servers() + for _, server in pairs(installed_servers) do -- Configure sumneko for neovim lua development if server == "sumneko_lua" then nvim_lsp.sumneko_lua.setup(lua_lsp) From 4f3856b500cc133d7e2b4b365d3d44f4a069b37d Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 17 Oct 2021 11:14:47 -0400 Subject: [PATCH 199/290] fix(lspmanager): stuff working weird for non supported filetypes - Add more language servers - Add `has_key` function in `doom.utils` module --- lua/doom/modules/config/doom-lspmanager.lua | 97 +++++++++++---------- lua/doom/utils/init.lua | 15 ++++ 2 files changed, 68 insertions(+), 44 deletions(-) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index 30602cc56..a2b965f3a 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -2,6 +2,7 @@ return function() local log = require("doom.extras.logging") local utils = require("doom.utils") local nvim_lsp = require("lspconfig") + local lspmanager = require("lspmanager") local is_plugin_disabled = require("doom.utils").is_plugin_disabled local servers = { @@ -10,12 +11,18 @@ return function() bash = { "bashls" }, c = { "clangd" }, cpp = { "clangd" }, + cmake = { "cmake" }, css = { "cssls" }, html = { "html" }, + javascript = { "tsserver" }, + typescript = { "tsserver" }, json = { "jsonls" }, docker = { "dockerls" }, python = { "pyright" }, - rust = { "rust_analyser" }, + rust = { "rust_analyzer" }, + elixir = { "elixirls" }, + haskell = { "hls" }, + vue = { "vuels" }, } -- Snippets support @@ -50,9 +57,6 @@ return function() -- Load langs from doom_modules and install servers with +lsp flag local function install_servers() - local lspmanager = require("lspmanager") - lspmanager.setup() - local installed_servers = lspmanager.installed_servers() local available_servers = lspmanager.available_servers() @@ -62,51 +66,56 @@ return function() for _, lang in ipairs(langs) do local lang_str = lang lang = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") - local lsp_name = servers[lang][1] - - -- Allow overriding of LSP using `+lsp(OVERRIDE_LSP_NAME)` syntax - local lsp_override = lang_str:match("+lsp%((%a+)%)") - if lsp_override ~= nil then - lsp_name = lsp_override + if utils.has_key(servers, lang) then + local lsp_name = servers[lang][1] - -- Uninstall the default LSP to avoid conflicts - if utils.has_value(installed_servers, lang) then - log.warn( - "Uninstalling " - .. lang - .. " LSP due to " - .. lsp_override - .. " LSP being supplied in config. If you want to revert back to " - .. lang - .. " LSP you will have to manually uninstall " - .. lsp_override - .. "." - ) - lspmanager.uninstall_server(lsp_name) - end - end + -- Allow overriding of LSP using `+lsp(OVERRIDE_LSP_NAME)` syntax + local lsp_override = lang_str:match("+lsp%((%a+)%)") + if lsp_override ~= nil then + lsp_name = lsp_override - -- If the +lsp flag exists and the language server is not installed yet - if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lsp_name)) then - -- Try to install the server only if there is a server available for - -- the language, oterwise raise a warning - if utils.has_value(available_servers, lsp_name) then - lspmanager.install_server(lsp_name) - else - if lsp_override == nil then - log.warn( - "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' - ) - else + -- Uninstall the default LSP to avoid conflicts + if utils.has_value(installed_servers, lsp_name) then log.warn( - 'The LSP override supplied in "' - .. lang_str - .. '" does not exist, please remove "(' + "Uninstalling " + .. lang + .. " (" .. lsp_name .. ") " + .. " LSP due to " + .. lsp_override + .. " LSP being supplied in config. If you want to revert back to " .. lsp_name - .. ')"' + .. " LSP you will have to manually uninstall " + .. lsp_override + .. "." ) + lspmanager.uninstall_server(lsp_name) end end + + -- If the +lsp flag exists and the language server is not installed yet + if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lsp_name)) then + -- Try to install the server only if there is a server available for + -- the language, oterwise raise a warning + if utils.has_value(available_servers, lsp_name) then + lspmanager.install(lsp_name) + else + if lsp_override ~= nil then + log.warn( + 'The LSP override supplied in "' + .. lang_str + .. '" does not exist, please remove "(' + .. lsp_name + .. ')"' + ) + end + end + end + else + if lang_str:find("%+lsp") then + log.warn( + "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' + ) + end end end end @@ -144,9 +153,9 @@ return function() local function setup_servers() -- Provide the missing :LspInstall - require("lspmanager").setup() + lspmanager.setup() - local installed_servers = require("lspmanager").installed_servers() + local installed_servers = lspmanager.installed_servers() for _, server in pairs(installed_servers) do -- Configure sumneko for neovim lua development if server == "sumneko_lua" then diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index d8b9f4797..793c859fa 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -69,6 +69,21 @@ utils.has_value = function(tabl, val) return false end +--- Search if a table have the key we are looking for, +--- useful for plugins management +--- @param tabl table +--- @param key string +--- @return boolean +utils.has_key = function(tabl, key) + for _, k in ipairs(vim.tbl_keys(tabl)) do + if k == key then + return true + end + end + + return false +end + --- Executes a git command and gets the output --- @param command string --- @param remove_newlines boolean From 55c1af9dba7ea34dd14cec111e4cda3077a5cb18 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 17 Oct 2021 15:19:34 +0000 Subject: [PATCH 200/290] chore: format source code --- lua/doom/modules/config/doom-lspmanager.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index a2b965f3a..de8529ee9 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -79,7 +79,9 @@ return function() log.warn( "Uninstalling " .. lang - .. " (" .. lsp_name .. ") " + .. " (" + .. lsp_name + .. ") " .. " LSP due to " .. lsp_override .. " LSP being supplied in config. If you want to revert back to " From 45069d616c2d63ef39cfbfbc32113000757f231d Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 17 Oct 2021 23:04:10 -0400 Subject: [PATCH 201/290] feat(lspmanager): add go support --- lua/doom/modules/config/doom-lspmanager.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index de8529ee9..e762f4570 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -11,6 +11,7 @@ return function() bash = { "bashls" }, c = { "clangd" }, cpp = { "clangd" }, + go = { "gopls" }, cmake = { "cmake" }, css = { "cssls" }, html = { "html" }, From bfc1c504d4d1f9a35f49026b550b831397200d99 Mon Sep 17 00:00:00 2001 From: rhcher <2032877541@qq.com> Date: Tue, 19 Oct 2021 17:01:36 +0800 Subject: [PATCH 202/290] fix nvim_tree config --- lua/doom/modules/config/doom-tree.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index 109478fb1..62ccf804d 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -106,7 +106,7 @@ return function() update_cwd = true, -- show lsp diagnostics in the signcolumn diagnostics = { - enable = require("doom.core.functions").is_plugin_disabled("lsp") and false or true, + enable = require("doom.utils").is_plugin_disabled("lsp") and false or true, icons = { hint = config.doom.lsp_hint, info = config.doom.lsp_info, From 0cd6140f68e243b525545271fab9163867aea6ba Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 19 Oct 2021 11:17:17 -0400 Subject: [PATCH 203/290] feat: improve netrw looking in Doom, add `use_netrw` configuration option. Decide if Doom.should use netrw or nvim-tree for mappings --- doom_config.lua | 6 + lua/colors/doom-one/init.lua | 12 ++ lua/doom/core/init.lua | 2 +- lua/doom/core/settings/netrw.lua | 164 ++++++++++++++++++++ lua/doom/extras/autocmds/init.lua | 14 ++ lua/doom/extras/keybindings/core.lua | 15 +- lua/doom/extras/keybindings/leader.lua | 33 ++-- lua/doom/modules/config/doom-bufferline.lua | 5 + lua/doom/modules/config/doom-eviline.lua | 1 + lua/doom/modules/init.lua | 2 +- 10 files changed, 242 insertions(+), 12 deletions(-) create mode 100644 lua/doom/core/settings/netrw.lua diff --git a/doom_config.lua b/doom_config.lua index 445c628a5..d3a732e4c 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -32,6 +32,12 @@ M.config = { -- @default = false disable_macros = false, + -- Use netrw as files explorer + -- false : Use nvim-tree.lua + -- true : Use netrw + -- @default = false + use_netrw = false, + -- Autosave sessions -- false : Disable session autosave -- true : Enable session autosave diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua index 6b0c967d3..4fbeb9168 100644 --- a/lua/colors/doom-one/init.lua +++ b/lua/colors/doom-one/init.lua @@ -477,6 +477,18 @@ doom_one.load_colorscheme = function() -- Plugins {{{ + -- netrw {{{ + local netrw = { + netrwClassify = { fg = blue }, + netrwDir = { fg = blue }, + netrwExe = { fg = green }, + netrwMakefile = { fg = yellow }, + } + + apply_highlight(netrw) + high_link("netrwTreeBar", "Comment") + -- }}} + -- barbar.nvim {{{ if configuration.plugins_integrations.barbar then diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index 5cc5bb696..fb544585e 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -6,7 +6,7 @@ local log = require("doom.extras.logging") log.debug("Loading Doom core ...") -local core_modules = { "settings", "config.ui", "config" } +local core_modules = { "settings", "settings.netrw", "config.ui", "config" } for i = 1, #core_modules, 1 do local ok, err = xpcall(require, debug.traceback, ("doom.core.%s"):format(core_modules[i])) if ok then diff --git a/lua/doom/core/settings/netrw.lua b/lua/doom/core/settings/netrw.lua new file mode 100644 index 000000000..b79f1d24b --- /dev/null +++ b/lua/doom/core/settings/netrw.lua @@ -0,0 +1,164 @@ +---[[---------------------------------------]]--- +-- netrw - Doom Nvim netrw setup -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------]]--- + +local utils = require("doom.utils") +local system = require("doom.core.system") +local config = require("doom.core.config").config.doom + +-- Netrw banner +-- 0 : Disable banner +-- 1 : Enable banner +vim.g.netrw_banner = 0 + +-- Keep the current directory and the browsing directory synced. +-- This helps you avoid the move files error. +vim.g.netrw_keepdir = 0 + +-- Show directories first (sorting) +vim.g.netrw_sort_sequence = [[[\/]$,*]] + +-- Human-readable files sizes +vim.g.netrw_sizestyle = "H" + +-- Netrw list style +-- 0 : thin listing (one file per line) +-- 1 : long listing (one file per line with timestamp information and file size) +-- 2 : wide listing (multiple files in columns) +-- 3 : tree style listing +vim.g.netrw_liststyle = 3 + +-- Patterns for hiding files, e.g. node_modules +-- NOTE: this works by reading '.gitignore' file +vim.g.netrw_list_hide = vim.fn["netrw_gitignore#Hide"]() + +-- Show hidden files +-- 0 : show all files +-- 1 : show not-hidden files +-- 2 : show hidden files only +vim.g.netrw_hide = config.show_hidden and 0 or 1 + +-- Change the size of the Netrw window when it creates a split +vim.g.netrw_winsize = config.sidebar_width + +-- Preview files in a vertical split window +vim.g.netrw_preview = 1 + +-- Open files in split +-- 0 : re-use the same window (default) +-- 1 : horizontally splitting the window first +-- 2 : vertically splitting the window first +-- 3 : open file in new tab +-- 4 : act like "P" (ie. open previous window) +vim.g.netrw_browse_split = 4 + +-- Setup file operations commands +-- TODO: figure out how to add these feature in Windows +if system.sep == "/" then + -- Enable recursive copy of directories in *nix systems + vim.g.netrw_localcopydircmd = "cp -r" + + -- Enable recursive creation of directories in *nix systems + vim.g.netrw_localmkdir = "mkdir -p" + + -- Enable recursive removal of directories in *nix systems + -- NOTE: we use 'rm' instead of 'rmdir' (default) to be able to remove non-empty directories + vim.g.netrw_localrmdir = "rm -r" +end + +-- Highlight marked files in the same way search matches are +vim.cmd("hi! link netrwMarkFile Search") + +----- ICONS --------------------------- +--------------------------------------- +local function draw_icons() + if vim.bo.filetype ~= "netrw" then + return + end + local is_devicons_available, devicons = pcall(require, "nvim-web-devicons") + if not is_devicons_available then + return + end + local default_signs = { + netrw_dir = { + text = "", + texthl = "netrwDir", + }, + netrw_file = { + text = "", + texthl = "netrwPlain", + }, + netrw_exec = { + text = "", + texthl = "netrwExe", + }, + netrw_link = { + text = "", + texthl = "netrwSymlink", + }, + } + + local bufnr = vim.api.nvim_win_get_buf(0) + + -- Unplace all signs + vim.fn.sign_unplace("*", { buffer = bufnr }) + + -- Define default signs + for sign_name, sign_opts in pairs(default_signs) do + vim.fn.sign_define(sign_name, sign_opts) + end + + local cur_line_nr = 1 + local total_lines = vim.fn.line("$") + while cur_line_nr <= total_lines do + -- Set default sign + local sign_name = "netrw_file" + + -- Get line contents + local line = vim.fn.getline(cur_line_nr) + + if utils.is_empty(line) then + -- If current line is an empty line (newline) then increase current line count + -- without doing nothing more + cur_line_nr = cur_line_nr + 1 + else + if line:find("/$") then + sign_name = "netrw_dir" + elseif line:find("@%s+-->") then + sign_name = "netrw_link" + elseif line:find("*$") then + sign_name:find("netrw_exec") + else + local filetype = line:match("^.*%.(.*)") + if not filetype and line:find("LICENSE") then + filetype = "md" + elseif not filetype and line:find("rc$") then + filetype = "conf" + end + + -- If filetype is still nil after manually setting extensions + -- for unknown filetypes then let's use 'default' + if not filetype then + filetype = "default" + end + + local icon, icon_highlight = devicons.get_icon(line, filetype, { default = "" }) + sign_name = "netrw_" .. filetype + vim.fn.sign_define(sign_name, { + text = icon, + texthl = icon_highlight, + }) + end + vim.fn.sign_place(cur_line_nr, sign_name, sign_name, bufnr, { + lnum = cur_line_nr, + }) + cur_line_nr = cur_line_nr + 1 + end + end +end + +return { + draw_icons = draw_icons, +} diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 35a2cd6a2..c2cba8e81 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -171,5 +171,19 @@ if not config.doom.enable_lsp_virtual_text then }) end +-- Eye candy netrw (add icons) +if config.doom.use_netrw then + table.insert(autocmds["doom_extras"], { + "FileType", + "netrw", + "lua require('doom.core.settings.netrw').draw_icons()", + }) + table.insert(autocmds["doom_extras"], { + "TextChanged", + "*", + "lua require('doom.core.settings.netrw').draw_icons()", + }) +end + -- Create augroups utils.create_augroups(autocmds) diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua index 8967089c5..ea44fe919 100644 --- a/lua/doom/extras/keybindings/core.lua +++ b/lua/doom/extras/keybindings/core.lua @@ -69,7 +69,7 @@ if not is_plugin_disabled("symbols") then "Toggle SymbolsOutline (LSP tags)" ) end -if not is_plugin_disabled("explorer") then +if not is_plugin_disabled("explorer") and not config.doom.use_netrw then mappings.map( "n", "", @@ -79,6 +79,19 @@ if not is_plugin_disabled("explorer") then "open_tree", "Toggle file explorer" ) +else + mappings.map( + "n", + "", + string.format( + ":Lexplore%s", + config.doom.explorer_right and "!" or "" + ), + opts, + "Editor", + "open_tree", + "Toggle file explorer" + ) end if not is_plugin_disabled("minimap") then mappings.map( diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index c1813cfd0..a743e59a2 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -588,15 +588,30 @@ mappings.map( "open_dashboard", "Open start screen" ) -mappings.map( - "n", - "oe", - "NvimTreeToggle", - opts, - "Editor", - "open_tree_alt", - "Toggle file explorer" -) +if not config.doom.use_netrw then + mappings.map( + "n", + "oe", + "NvimTreeToggle", + opts, + "Editor", + "open_tree_alt", + "Toggle file explorer" + ) +else + mappings.map( + "n", + "oe", + string.format( + "Lexplore%s", + config.doom.explorer_right and "!" or "" + ), + opts, + "Editor", + "open_tree_alt", + "Toggle file explorer" + ) +end mappings.map( "n", "om", diff --git a/lua/doom/modules/config/doom-bufferline.lua b/lua/doom/modules/config/doom-bufferline.lua index 488b1125d..6a6e5a817 100644 --- a/lua/doom/modules/config/doom-bufferline.lua +++ b/lua/doom/modules/config/doom-bufferline.lua @@ -65,6 +65,11 @@ return function() text = "File Explorer", text_align = "center", }, + { + filetype = "netrw", + text = "File Explorer", + text_align = "center", + }, { filetype = "minimap", text = "Minimap", diff --git a/lua/doom/modules/config/doom-eviline.lua b/lua/doom/modules/config/doom-eviline.lua index afd23e63c..2175c2fc4 100644 --- a/lua/doom/modules/config/doom-eviline.lua +++ b/lua/doom/modules/config/doom-eviline.lua @@ -17,6 +17,7 @@ return function() "minimap", "Outline", "toggleterm", + "netrw", } if not config.doom.dashboard_statline then diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 9271596cf..7a2e4a495 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -125,7 +125,7 @@ packer.startup(function(use) }) -- File tree - local disabled_tree = is_plugin_disabled("explorer") + local disabled_tree = is_plugin_disabled("explorer") and config.doom.use_netrw use({ "kyazdani42/nvim-tree.lua", requires = "nvim-web-devicons", From b964675edbf0156d806647f4cca87f31ef1bb44d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 19 Oct 2021 15:17:47 +0000 Subject: [PATCH 204/290] chore: format source code --- doom_config.lua | 10 +++++----- lua/doom/core/settings/netrw.lua | 2 +- lua/doom/extras/keybindings/core.lua | 5 +---- lua/doom/extras/keybindings/leader.lua | 5 +---- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index d3a732e4c..1e4c1cb86 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -32,11 +32,11 @@ M.config = { -- @default = false disable_macros = false, - -- Use netrw as files explorer - -- false : Use nvim-tree.lua - -- true : Use netrw - -- @default = false - use_netrw = false, + -- Use netrw as files explorer + -- false : Use nvim-tree.lua + -- true : Use netrw + -- @default = false + use_netrw = false, -- Autosave sessions -- false : Disable session autosave diff --git a/lua/doom/core/settings/netrw.lua b/lua/doom/core/settings/netrw.lua index b79f1d24b..9453434a2 100644 --- a/lua/doom/core/settings/netrw.lua +++ b/lua/doom/core/settings/netrw.lua @@ -143,7 +143,7 @@ local function draw_icons() if not filetype then filetype = "default" end - + local icon, icon_highlight = devicons.get_icon(line, filetype, { default = "" }) sign_name = "netrw_" .. filetype vim.fn.sign_define(sign_name, { diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua index ea44fe919..f7eae77ec 100644 --- a/lua/doom/extras/keybindings/core.lua +++ b/lua/doom/extras/keybindings/core.lua @@ -83,10 +83,7 @@ else mappings.map( "n", "", - string.format( - ":Lexplore%s", - config.doom.explorer_right and "!" or "" - ), + string.format(":Lexplore%s", config.doom.explorer_right and "!" or ""), opts, "Editor", "open_tree", diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index a743e59a2..6a9a05ccd 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -602,10 +602,7 @@ else mappings.map( "n", "oe", - string.format( - "Lexplore%s", - config.doom.explorer_right and "!" or "" - ), + string.format("Lexplore%s", config.doom.explorer_right and "!" or ""), opts, "Editor", "open_tree_alt", From a4ab86629608d7d9171f91c4b6ba2ec490dcddf6 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Tue, 19 Oct 2021 12:11:38 -0400 Subject: [PATCH 205/290] fix(netrw): proper `rc` files icons detection --- lua/doom/core/settings/netrw.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/core/settings/netrw.lua b/lua/doom/core/settings/netrw.lua index 9453434a2..6c5bbd145 100644 --- a/lua/doom/core/settings/netrw.lua +++ b/lua/doom/core/settings/netrw.lua @@ -134,7 +134,7 @@ local function draw_icons() local filetype = line:match("^.*%.(.*)") if not filetype and line:find("LICENSE") then filetype = "md" - elseif not filetype and line:find("rc$") then + elseif line:find("rc$") then filetype = "conf" end From 908d9a8a61cdeaecd0a5ac2c285459fc807ffb4c Mon Sep 17 00:00:00 2001 From: joalon Date: Tue, 19 Oct 2021 21:03:38 +0200 Subject: [PATCH 206/290] feat(keybindings): Stay in visual mode after indenting a selection with < or > --- lua/doom/extras/keybindings/movement.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lua/doom/extras/keybindings/movement.lua b/lua/doom/extras/keybindings/movement.lua index 82f041a82..fc3b63f19 100644 --- a/lua/doom/extras/keybindings/movement.lua +++ b/lua/doom/extras/keybindings/movement.lua @@ -95,6 +95,26 @@ mappings.map( ) mappings.map("x", "J", ":move '>+1gv-gv", opts, "Editor", "select_left", "Move selection left") +-- stay in visual mode after indenting with < or > +mappings.map( + "v", + ">", + ">gv", + opts, + "Editor", + "stay_vselect_indent", + "Stay in visual mode after indenting a selection" +) +mappings.map( + "v", + "<", + " Date: Wed, 20 Oct 2021 06:36:36 +0530 Subject: [PATCH 207/290] feat: Add keybinding for lsp_rename functionality --- lua/doom/extras/keybindings/leader.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 6a9a05ccd..cb5ec7ccc 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -799,6 +799,15 @@ mappings.map( "diagnostic_list", "Diagnostics into location list" ) +mappings.map( + "n", + "clr", + "lua vim.lsp.buf.rename()", + opts, + "LSP", + "rename_reference", + "Rename the reference under cursor" +) -- jumps mappings.map("n", "ja", "", opts, "Jumps", "jump_alternate_file", "Alternate file") From 60a2e3373ffa21ad7650ebb3ffe46255a7016c03 Mon Sep 17 00:00:00 2001 From: ashincoder Date: Wed, 20 Oct 2021 06:37:19 +0530 Subject: [PATCH 208/290] fix(CI): Fix the undefined variable --- lua/doom/modules/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 7a2e4a495..e587170ff 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -125,7 +125,8 @@ packer.startup(function(use) }) -- File tree - local disabled_tree = is_plugin_disabled("explorer") and config.doom.use_netrw + local disabled_tree = is_plugin_disabled("explorer") + and require("doom.core.config").config.doom.use_netrw use({ "kyazdani42/nvim-tree.lua", requires = "nvim-web-devicons", From 24279242d2ec15fab2c3ec29acd0d15af69fbcb3 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 20 Oct 2021 02:40:58 -0400 Subject: [PATCH 209/290] refact(netrw): use negative winsize --- lua/doom/core/settings/netrw.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/core/settings/netrw.lua b/lua/doom/core/settings/netrw.lua index 6c5bbd145..b0658eb3d 100644 --- a/lua/doom/core/settings/netrw.lua +++ b/lua/doom/core/settings/netrw.lua @@ -41,7 +41,7 @@ vim.g.netrw_list_hide = vim.fn["netrw_gitignore#Hide"]() vim.g.netrw_hide = config.show_hidden and 0 or 1 -- Change the size of the Netrw window when it creates a split -vim.g.netrw_winsize = config.sidebar_width +vim.g.netrw_winsize = (0 - config.sidebar_width) -- Preview files in a vertical split window vim.g.netrw_preview = 1 From c56b4aa71ddbee64fff8ff89b61fbbb7a65cc356 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 20 Oct 2021 05:48:10 -0400 Subject: [PATCH 210/290] feat(netrw): add saner keybindings (wrappers for default keybinds) --- lua/doom/core/settings/netrw.lua | 106 +++++++++++++++++++++++++++++- lua/doom/extras/autocmds/init.lua | 5 ++ 2 files changed, 110 insertions(+), 1 deletion(-) diff --git a/lua/doom/core/settings/netrw.lua b/lua/doom/core/settings/netrw.lua index b0658eb3d..4d3560ad9 100644 --- a/lua/doom/core/settings/netrw.lua +++ b/lua/doom/core/settings/netrw.lua @@ -44,7 +44,7 @@ vim.g.netrw_hide = config.show_hidden and 0 or 1 vim.g.netrw_winsize = (0 - config.sidebar_width) -- Preview files in a vertical split window -vim.g.netrw_preview = 1 +-- vim.g.netrw_preview = 1 -- Open files in split -- 0 : re-use the same window (default) @@ -71,6 +71,109 @@ end -- Highlight marked files in the same way search matches are vim.cmd("hi! link netrwMarkFile Search") +----- KEYBINDS ------------------------ +--------------------------------------- +local function netrw_maps() + if vim.bo.filetype ~= "netrw" then + return + end + + local opts = { silent = true } + ----- General ----------------------- + ------------------------------------- + -- Toggle dotfiles + vim.api.nvim_buf_set_keymap(0, "n", ".", "gh", opts) + + -- Open file and close netrw + vim.api.nvim_buf_set_keymap(0, "n", "l", ":Lexplore", opts) + + -- Open file or directory + vim.api.nvim_buf_set_keymap(0, "n", "o", "", opts) + + -- Show netrw help in a floating (or maybe sidebar?) window + -- TODO: implement show_help function so we can implement this mapping + --[[ vim.api.nvim_buf_set_keymap( + 0, + "n", + "?", + ":lua require('doom.core.settings.netrw').show_help()", + opts + ) ]] + + -- Close netrw + vim.api.nvim_buf_set_keymap(0, "n", "q", ":Lexplore", opts) + + ----- Files and Directories --------- + ------------------------------------- + -- Create a new file and save it + vim.api.nvim_buf_set_keymap(0, "n", "ff", "%:w:buffer #", opts) + + -- Create a new directory + vim.api.nvim_buf_set_keymap(0, "n", "fa", "d", opts) + + -- Rename file + vim.api.nvim_buf_set_keymap(0, "n", "fr", "R", opts) + + -- Remove file or directory + vim.api.nvim_buf_set_keymap(0, "n", "fd", "D", opts) + + -- Copy marked file + vim.api.nvim_buf_set_keymap(0, "n", "fc", "mc", opts) + + -- Copy marked file in one step, with this we can put the cursor in a directory + -- after marking the file to assign target directory and copy file + vim.api.nvim_buf_set_keymap(0, "n", "fC", "mtmc", opts) + + -- Move marked file + vim.api.nvim_buf_set_keymap(0, "n", "fx", "mm", opts) + + -- Move marked file in one step, same as fC but for moving files + vim.api.nvim_buf_set_keymap(0, "n", "fX", "mtmm", opts) + + -- Execute commands in marked file or directory + vim.api.nvim_buf_set_keymap(0, "n", "fe", "mx", opts) + + -- Show a list of marked files and directories + vim.api.nvim_buf_set_keymap( + 0, + "n", + "fm", + ':echo "Marked files:\n" . join(netrw#Expose("netrwmarkfilelist"), "\n")', + opts + ) + + -- Show target directory + vim.api.nvim_buf_set_keymap( + 0, + "n", + "ft", + ':echo "Target: " . netrw#Expose("netrwmftgt")', + opts + ) + + ----- Marks (selections) ------------ + ------------------------------------- + -- Toggle the mark on a file or directory + vim.api.nvim_buf_set_keymap(0, "n", "", "mf", opts) + + -- Unmark all the files in the current buffer + vim.api.nvim_buf_set_keymap(0, "n", "", "mF", opts) + + -- Remove all the marks on all files + vim.api.nvim_buf_set_keymap(0, "n", "", "mu", opts) + + ----- Bookmarks --------------------- + ------------------------------------- + -- Create a bookmark + vim.api.nvim_buf_set_keymap(0, "n", "bc", "mb", opts) + + -- Remove the most recent bookmark + vim.api.nvim_buf_set_keymap(0, "n", "bd", "mB", opts) + + -- Jumo to the most recent bookmark + vim.api.nvim_buf_set_keymap(0, "n", "bj", "gb", opts) +end + ----- ICONS --------------------------- --------------------------------------- local function draw_icons() @@ -161,4 +264,5 @@ end return { draw_icons = draw_icons, + set_maps = netrw_maps, } diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index c2cba8e81..5c5da14af 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -173,6 +173,11 @@ end -- Eye candy netrw (add icons) if config.doom.use_netrw then + table.insert(autocmds["doom_extras"], { + "FileType", + "netrw", + "lua require('doom.core.settings.netrw').set_maps()", + }) table.insert(autocmds["doom_extras"], { "FileType", "netrw", From 30cb48e9bc6810284ce5fb08b0052daae4a8b948 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 20 Oct 2021 05:58:16 -0400 Subject: [PATCH 211/290] refact(modules): uae dev branch of lspmanager --- lua/doom/modules/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index e587170ff..d6d7899e7 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -406,6 +406,7 @@ packer.startup(function(use) -- Manage Language serverss with ease. use({ "MordechaiHadad/nvim-lspmanager", + branch = "dev", config = require("doom.modules.config.doom-lspmanager"), disable = disabled_lsp, }) From 43c4bf519681cd8447a45364edf231648c1e465e Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 20 Oct 2021 05:58:39 -0400 Subject: [PATCH 212/290] refact(functions): rename module from `M` to `functions` --- lua/doom/core/functions/init.lua | 46 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index a492aeaad..77304d1bf 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -10,14 +10,14 @@ local system = require("doom.core.system") local config = require("doom.core.config").config local async = require("doom.modules.built-in.async") -local M = {} +local functions = {} log.debug("Loading Doom functions module ...") -- Load user-defined settings from the Neovim field in the doom_config.lua -- @param settings_tbl The settings table to iterate over -- @param scope The settings scope, e.g. autocmds -M.load_custom_settings = function(settings_tbl, scope) +functions.load_custom_settings = function(settings_tbl, scope) -- If the provided settings table is not empty if next(settings_tbl) ~= nil then log.debug("Loading custom " .. scope .. " ...") @@ -61,18 +61,18 @@ end -- reload_custom_settings reloads all the user-defined configurations -- in the 'doom_config.lua' file. -M.reload_custom_settings = function() +functions.reload_custom_settings = function() -- Get the user-defined settings, the 'nvim' field in our 'doom_config.lua' local custom_settings = require("doom.core.config").config.nvim -- iterate over all the custom settings fields, e.g. global_variables, mappings, etc. for scope, _ in pairs(custom_settings) do - M.load_custom_settings(custom_settings[scope], scope) + functions.load_custom_settings(custom_settings[scope], scope) end end -- Change the 'doom_config.lua' file configurations for the colorscheme and the -- background if they were changed by the user within Neovim -M.change_colors_and_bg = function() +functions.change_colors_and_bg = function() local changed_colorscheme, err = xpcall(function() log.debug("Checking if the colorscheme or background were changed ...") local target_colorscheme = vim.g.colors_name @@ -112,8 +112,8 @@ end -- dump all messages to doom.log file -- @tparam bool write If doom should save before exiting -- @tparam bool force If doom should force the exiting -M.quit_doom = function(write, force) - M.change_colors_and_bg() +functions.quit_doom = function(write, force) + functions.change_colors_and_bg() local quit_cmd = "" if write then @@ -127,7 +127,7 @@ M.quit_doom = function(write, force) end -- check_updates checks for plugins updates -M.check_updates = function() +functions.check_updates = function() local updated_plugins, err = xpcall(function() log.info("Updating the outdated plugins ...") vim.cmd("PackerSync") @@ -139,7 +139,7 @@ M.check_updates = function() end -- Open Doom Nvim user manual and set extra options to buffer -M.open_docs = function() +functions.open_docs = function() -- NOTE: we aren't using the default Neovim way with ':h doom' because of some bugs -- with the tags and Neovim overriding the filetype, causing some highlighting issues @@ -175,7 +175,7 @@ end -- create_report creates a markdown report. It's meant to be used when a bug -- occurs, useful for debugging issues. -M.create_report = function() +functions.create_report = function() local date = os.date("%Y-%m-%d %H:%M:%S") local log_date_format = os.date("%a %d %b %Y") @@ -333,7 +333,7 @@ end -- update_doom saves the current commit/release hash into a file for future -- restore if needed and then updates Doom. -M.update_doom = function() +functions.update_doom = function() save_backup_hashes() log.info("Pulling Doom remote changes ...") @@ -361,7 +361,7 @@ end -- rollback_doom will rollback the local doom version to an older one -- in case that the local one is broken -M.rollback_doom = function() +functions.rollback_doom = function() -- Backup file for main (stable) branch local releases_database_path = string.format("%s%s.doom_releases", system.doom_root, system.sep) -- Backup file for development branch @@ -462,7 +462,7 @@ M.rollback_doom = function() end -- edit_config creates a prompt to modify a doom configuration file -M.edit_config = function() +functions.edit_config = function() vim.ui.select( { "doom_config.lua", "doom_modules.lua", "doom_userplugins.lua" }, { prompt = "Select a configuration file to edit:" }, @@ -494,7 +494,7 @@ end -- followings are called from lua/doom/extras/keybindings/leader.lua -- -- toggle_background() -- tb -- toggle background light/dark -M.toggle_background = function() +functions.toggle_background = function() local background = vim.go.background if background == "light" then vim.go.background = "dark" @@ -510,7 +510,7 @@ vim.g.cmp_toggle_flag = true -- initialize local normal_buftype = function() return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt" end -M.toggle_completion = function() +functions.toggle_completion = function() local ok, cmp = xpcall(require, debug.traceback, "cmp") if ok then local next_cmp_toggle_flag = not vim.g.cmp_toggle_flag @@ -535,7 +535,7 @@ M.toggle_completion = function() end -- toggle_signcolumn() -- tg -- signcolumn auto/no -M.toggle_signcolumn = function() +functions.toggle_signcolumn = function() local signcolumn = vim.o.signcolumn if signcolumn == "no" then vim.o.signcolumn = "auto" @@ -547,7 +547,7 @@ M.toggle_signcolumn = function() end -- set_indent() -- ti -- set the indent and tab related numbers -M.set_indent = function() +functions.set_indent = function() local indent = tonumber( vim.fn.input( "Set all tab related options to a specified number and set expandtab\n(0 to reset to vim defaults, ? to print current settings): " @@ -571,7 +571,7 @@ M.set_indent = function() end -- change_number() -- tn -- change the number display modes -M.change_number = function() +functions.change_number = function() local number = vim.o.number local relativenumber = vim.o.relativenumber if (number == false) and (relativenumber == false) then @@ -594,7 +594,7 @@ M.change_number = function() end -- toggle_autopairs() -- tp -- toggle autopairs -M.toggle_autopairs = function() +functions.toggle_autopairs = function() local ok, autopairs = xpcall(require, debug.traceback, "nvim-autopairs") if ok then if autopairs.state.disabled then @@ -610,7 +610,7 @@ M.toggle_autopairs = function() end -- toggle_spell() -- ts -- toggle spell -M.toggle_spell = function() +functions.toggle_spell = function() if vim.o.spell then vim.o.spell = false print("spell off") @@ -624,7 +624,7 @@ M.toggle_spell = function() end -- change_syntax() -- tx -- toggle syntax/treesetter -M.change_syntax = function() +functions.change_syntax = function() local ok, parsers = xpcall(require, debug.traceback, "nvim-treesitter.parsers") if ok and parsers and parsers.has_parser() then if vim.o.syntax then @@ -647,9 +647,9 @@ M.change_syntax = function() end end -M.sugar_folds = function() +functions.sugar_folds = function() local start_line = vim.fn.getline(vim.v.foldstart):gsub("\t", ("\t"):rep(vim.opt.tabstop:get())) return string.format("%s ... (%d lines)", start_line, vim.v.foldend - vim.v.foldstart + 1) end -return M +return functions From d9bace75ffa5748d119184dd657e8d1108af764e Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 24 Oct 2021 12:48:39 -0400 Subject: [PATCH 213/290] feat(eviline): small visual tweaks, show filetype + lsps --- lua/doom/modules/config/doom-eviline.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lua/doom/modules/config/doom-eviline.lua b/lua/doom/modules/config/doom-eviline.lua index 2175c2fc4..bf9372f5a 100644 --- a/lua/doom/modules/config/doom-eviline.lua +++ b/lua/doom/modules/config/doom-eviline.lua @@ -3,7 +3,6 @@ return function() local config = require("doom.core.config").config local colors = require("galaxyline.themes.colors").get_color - local bo = vim.bo local gl = require("galaxyline") local lsp = require("galaxyline.providers.lsp") local buffer = require("galaxyline.providers.buffer") @@ -181,15 +180,15 @@ return function() -- Check if there's a LSP client running to avoid redundant -- statusline elements if lsp.get_lsp_client() ~= "No Active Lsp" then - return " " .. lsp.get_lsp_client():gsub("^%l", string.upper) + return string.format(" %s » %s ", vim.bo.filetype, lsp.get_lsp_client()) else - -- Use the filetype instead and capitalize it - return " " .. (vim.bo.filetype:gsub("^%l", string.upper)) + -- Use the filetype instead + return string.format(" %s ", vim.bo.filetype) end end, condition = function() local tbl = { ["dashboard"] = true, [""] = true } - if tbl[bo.filetype] then + if tbl[vim.bo.filetype] then return false end return true @@ -220,7 +219,7 @@ return function() gls.right[6] = { DiffSeparator = { provider = function() - return " " + return " " end, condition = condition.hide_in_width, highlight = { colors("bg"), colors("bg") }, From dc7763a7eddced314f33e71e58c928ad2104e211 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 24 Oct 2021 13:10:22 -0400 Subject: [PATCH 214/290] refact: do not use `M` as the module names. Closes #156 --- lua/doom/core/config/init.lua | 22 +++++++++++----------- lua/doom/core/config/modules.lua | 20 ++++++++++---------- lua/doom/core/config/userplugins.lua | 21 +++++++++++---------- lua/doom/core/settings/init.lua | 10 +++++----- 4 files changed, 37 insertions(+), 36 deletions(-) diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 917d2a87f..d7c84a49d 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -4,7 +4,7 @@ -- License: GPLv2 -- ---[[------------------------------]]--- -local M = {} +local config = {} local log = require("doom.extras.logging") local system = require("doom.core.system") @@ -29,7 +29,7 @@ end -- {{{ Default doom_config values -M.config = { +config.config = { -- {{{ Doom doom = { -- Autosave @@ -472,7 +472,7 @@ M.config = { -- }}} -M.source = nil +config.source = nil log.debug("Loading Doom config module ...") @@ -482,18 +482,18 @@ log.debug("Loading Doom config module ...") -- 3. /doom_config.lua local ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_config.lua") if ok then - M.config = ret.config - M.source = ret.source + config.config = ret.config + config.source = ret.source else ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_config.lua") if ok then - M.config = ret.config - M.source = ret.source + config.config = ret.config + config.source = ret.source else ok, ret = xpcall(require, debug.traceback, "doom_config") if ok then - M.config = ret.config - M.source = ret.source + config.config = ret.config + config.source = ret.source else log.error("Error while loading doom_config.lua. Traceback:\n" .. ret) end @@ -501,10 +501,10 @@ else end -- Check plugins updates on start if enabled -if M.config.doom.check_updates then +if config.config.doom.check_updates then require("doom.core.functions").check_updates() end -return M +return config -- vim: fdm=marker diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua index e95d48aa6..dfd2f8d62 100644 --- a/lua/doom/core/config/modules.lua +++ b/lua/doom/core/config/modules.lua @@ -7,9 +7,9 @@ local system = require("doom.core.system") local log = require("doom.extras.logging") -local M = {} +local modules = {} -M.modules = { +modules.modules = { ui = { "dashboard", -- Start screen -- "doom-themes", -- Additional doom emacs' colorschemes @@ -80,7 +80,7 @@ M.modules = { }, } -M.source = nil +modules.source = nil log.debug("Loading Doom modules module ...") @@ -90,22 +90,22 @@ log.debug("Loading Doom modules module ...") -- 3. /doom_modules.lua local ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_modules.lua") if ok then - M.modules = ret.modules - M.source = ret.source + modules.modules = ret.modules + modules.source = ret.source else ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_modules.lua") if ok then - M.modules = ret.modules - M.source = ret.source + modules.modules = ret.modules + modules.source = ret.source else ok, ret = xpcall(require, debug.traceback, "doom_modules") if ok then - M.modules = ret.modules - M.source = ret.source + modules.modules = ret.modules + modules.source = ret.source else log.error("Error while loading doom_modules.lua. Traceback:\n" .. ret) end end end -return M +return modules diff --git a/lua/doom/core/config/userplugins.lua b/lua/doom/core/config/userplugins.lua index affb1010c..03c6f620a 100644 --- a/lua/doom/core/config/userplugins.lua +++ b/lua/doom/core/config/userplugins.lua @@ -1,4 +1,3 @@ -local M = {} ---[[---------------------------------------]]--- -- userplugins - Load Doom Nvim doom_userplugins -- -- Author: NTBBloodbath -- @@ -8,9 +7,11 @@ local M = {} local system = require("doom.core.system") local log = require("doom.extras.logging") -M.plugins = {} +local userplugins = {} -M.source = nil +userplugins.plugins = {} + +userplugins.source = nil log.debug("Loading Doom userplugins module...") @@ -20,22 +21,22 @@ log.debug("Loading Doom userplugins module...") -- 3. /doom_userplugins.lua local ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_userplugins.lua") if ok then - M.plugins = ret.plugins - M.source = ret.source + userplugins.plugins = ret.plugins + userplugins.source = ret.source else ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_userplugins.lua") if ok then - M.plugins = ret.plugins - M.source = ret.source + userplugins.plugins = ret.plugins + userplugins.source = ret.source else ok, ret = xpcall(require, debug.traceback, "doom_userplugins") if ok then - M.plugins = ret.plugins - M.source = ret.source + userplugins.plugins = ret.plugins + userplugins.source = ret.source else log.error("Error while loading doom_userplugins.lua. Traceback:\n" .. ret) end end end -return M +return userplugins diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index 483cbb15c..5ed649bf4 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -8,12 +8,12 @@ local functions = require("doom.core.functions") local log = require("doom.extras.logging") local config = require("doom.core.config").config -local M = {} +local settings = {} log.debug("Loading Doom defaults module ...") -- load_default_options sets and loads default Neovim options based on doom_config.lua values -M.load_default_options = function() +settings.load_default_options = function() ----- Default Neovim configurations -- Global options vim.opt.hidden = true @@ -151,7 +151,7 @@ M.load_default_options = function() end -- Doom Nvim commands -M.doom_commands = function() +settings.doom_commands = function() -- Set a custom command to update Doom Nvim -- can be called by using :DoomUpdate vim.cmd('command! DoomUpdate lua require("doom.core.functions").update_doom()') @@ -179,7 +179,7 @@ M.doom_commands = function() end -- Custom Doom Nvim options -M.custom_options = function() +settings.custom_options = function() -- Load user-defined settings from the Neovim field in the doom_config.lua file functions.load_custom_settings(config.nvim.functions, "functions") functions.load_custom_settings(config.nvim.autocmds, "autocmds") @@ -189,4 +189,4 @@ M.custom_options = function() functions.load_custom_settings(config.nvim.options, "options") end -return M +return settings From bf7269c5563a709b5f0c3892943138fb0fde8740 Mon Sep 17 00:00:00 2001 From: joalon Date: Tue, 26 Oct 2021 07:10:34 +0200 Subject: [PATCH 215/290] Adds an option to turn off folding --- doom_config.lua | 6 ++++++ lua/doom/core/settings/init.lua | 1 + 2 files changed, 7 insertions(+) diff --git a/doom_config.lua b/doom_config.lua index 1e4c1cb86..925a030aa 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -56,6 +56,12 @@ M.config = { -- @default = false swap_files = false, + -- Enable folding + -- true : fold is enabled + -- false : fold is disabled + -- @default = true + foldenable = true, + -- Undo Directories -- the backup variable enables backup related settings (undofile, undodir) -- false : ignores undo Directories (this code block will be ignored) diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index 5ed649bf4..5576c83e2 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -145,6 +145,7 @@ settings.load_default_options = function() vim.opt.softtabstop = config.doom.indent vim.opt.colorcolumn = tostring(config.doom.max_columns) vim.opt.conceallevel = config.doom.conceallevel + vim.opt.foldenable = config.doom.foldenable -- Better folding vim.cmd([[set foldtext=luaeval(\"require('doom.core.functions').sugar_folds()\")]]) From cff590cdddbd6c173fb02f0e2389ef0e732e8bcf Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 27 Oct 2021 07:11:48 -0400 Subject: [PATCH 216/290] feat(autocmds): use a bit more aggressive rule for linting --- lua/doom/extras/autocmds/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 5c5da14af..707deccc1 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -147,7 +147,7 @@ end -- Linting if not is_plugin_disabled("linter") and packer_plugins and packer_plugins["nvim-lint"] then table.insert(autocmds["doom_extras"], { - "BufWritePost", + "BufWinEnter,BufWritePost", "", "lua require('lint').try_lint()", }) From 785d5eddf1c5083dbc4a9d4c0e57cfd45898ff7c Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Wed, 27 Oct 2021 13:17:44 -0400 Subject: [PATCH 217/290] chore(doom_config): move foldenable option --- doom_config.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 925a030aa..1fffda057 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -38,6 +38,12 @@ M.config = { -- @default = false use_netrw = false, + -- Enable folding + -- true : fold is enabled + -- false : fold is disabled + -- @default = true + foldenable = true, + -- Autosave sessions -- false : Disable session autosave -- true : Enable session autosave @@ -56,12 +62,6 @@ M.config = { -- @default = false swap_files = false, - -- Enable folding - -- true : fold is enabled - -- false : fold is disabled - -- @default = true - foldenable = true, - -- Undo Directories -- the backup variable enables backup related settings (undofile, undodir) -- false : ignores undo Directories (this code block will be ignored) From 1e24007a91637e555f56493e6a9e51cc0f698eb2 Mon Sep 17 00:00:00 2001 From: joalon Date: Sat, 30 Oct 2021 09:01:18 +0200 Subject: [PATCH 218/290] fix(#203): Tightens up the regexes for excluding files in telescope. Otherwise would exclude files or folders like doom-neogit.lua or my_other_node_modules --- lua/doom/modules/config/doom-telescope.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-telescope.lua b/lua/doom/modules/config/doom-telescope.lua index 048773d81..c644d3427 100644 --- a/lua/doom/modules/config/doom-telescope.lua +++ b/lua/doom/modules/config/doom-telescope.lua @@ -31,7 +31,7 @@ return function() }, }, file_sorter = require("telescope.sorters").get_fuzzy_file, - file_ignore_patterns = { ".git", "node_modules", "__pycache__" }, + file_ignore_patterns = { "^.git/", "^node_modules/", "^__pycache__/" }, generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, winblend = 0, scroll_strategy = "cycle", From ad55c6cc7cbd85b4dedb7bdf5c4458e88fef3c88 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Oct 2021 16:04:19 +1100 Subject: [PATCH 219/290] Added development docker image and bootstrap script --- .gitignore | 6 +++ docker/Dockerfile | 53 ++++++++++++++++++++++ docker/README.md | 32 +++++++++++++ docker/bootstrap.sh | 104 +++++++++++++++++++++++++++++++++++++++++++ docker/entrypoint.sh | 15 +++++++ 5 files changed, 210 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/README.md create mode 100755 docker/bootstrap.sh create mode 100755 docker/entrypoint.sh diff --git a/.gitignore b/.gitignore index fdcf8fa8d..058e0879f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,9 @@ tags # editor artifacts *~ *.swp +# OS files +.DS_Store +# Doom Nvim Contrib files +docker/doom-nvim-contrib +docker/local-share-nvim +docker/workspace diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..5379e1b2c --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,53 @@ +FROM archlinux:latest + +LABEL \ + maintainer="n.debonnaire@gmail.com" \ + url.github="https://github.com/nicodebo/neovim-docker" \ + url.dockerhub="https://hub.docker.com/r/nicodebo/neovim-docker/" + +ENV \ + UID="1000" \ + GID="1000" \ + UNAME="doom" \ + GNAME="doom" \ + SHELL="/bin/bash" \ + WORKSPACE="" \ + NVIM_CONFIG="/home/doom/.config/nvim" \ + PATH="/home/doom/.local/bin:${PATH}" + +# Update repositories +RUN pacman -Syy + +# Install neovim +RUN pacman -Sy neovim --noconfirm + +# Install runtime dependencies of doom-nvim +RUN pacman -Sy ripgrep nodejs-lts-fermium npm git bash gcc --noconfirm + +# Required for watching Doom-nvim-contrib for changes +RUN npm i -g chokidar-cli + +# Create the doom user and group +RUN groupadd doom +RUN useradd -m -g doom doom + +RUN mkdir /usr/local/lib/node_modules +RUN chown -R ${UNAME}:${GNAME} /usr/local/lib/node_modules/ + +USER doom +WORKDIR /home/doom + +# Install packer +RUN git clone --depth 1 https://github.com/wbthomason/packer.nvim\ + ~/.local/share/nvim/site/pack/packer/start/packer.nvim + +COPY entrypoint.sh /usr/local/bin/ + +# Doom-nvim-contrib +VOLUME "~/.config/nvim" +# For storing packer plugins +VOLUME "~/.local/share/nvim" +# Files and projects for testing on disk +VOLUME "~/workspace" + +ENTRYPOINT ["sh", "/usr/local/bin/entrypoint.sh"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..9c3c345e0 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,32 @@ +# Doom Contrib Docker Image + +This docker image aids in development by setting up a docker virtual environment and git worktree of doom-nvim to make your changes within. + +## How to use + +The setup and start process is handled in the `./bootstrap.sh` script. + +``` +Bootstraps a docker image for contributing changes to doom-nvim + +Syntax: ./bootstrap.sh [-b ] +options: +-b Create a new branch for the contribution (default is doom-nvim-contrib) +-h Shows this help menu +``` + +## What this script does + +1. On first execution it will setup a git worktree of doom-nvim, this means your main config and this copy of the repo will share the same git history. + - This worktree will be placed in the `docker/doom-nvim-contrib` folder inside of this repository. + - Because they share history you wont be able to checkout the same branch on both copies of the repository. Unless specified, a new branch called `doom-nvim-contrib` will be created off the latest version of `develop`. +2. It will setup a new docker image to run this config within (if necessary). +3. It will then start the docker image and enter you into neovim. + +## Folders + +These are the folders used by this docker image, they will be auto generated when `./bootstrap.sh` is run + +`docker/doom-nvim-contrib/` - Git worktree for doom-nvim contributions +`docker/local-share-nvim/` - Stores the data from `~/.local/share/nvim/` +`docker/workspace/` - Directory to store test files and project that you want to test your changes upon diff --git a/docker/bootstrap.sh b/docker/bootstrap.sh new file mode 100755 index 000000000..2d81d5f0d --- /dev/null +++ b/docker/bootstrap.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +if ! docker info > /dev/null 2>&1; then + echo "This script uses docker, and it isn't running - please start docker and try again!" + exit 1 +fi + +############################################################ +# Help # +############################################################ +Help() +{ + # Display Help + echo "Bootstraps a docker image for contributing changes to doom-nvim" + echo + echo "Syntax: ./bootstrap.sh [-b ]" + echo "options:" + echo "-b Create a new branch for the contribution" + echo "-h Shows this help menu" + echo +} + +# Get directory of script +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +# Default options +BRANCH_NAME=doom-nvim-contrib # Branch to checkout / create + +while getopts "b:h" option; do + case $option in + b) # set branch name + BRANCH_NAME=$OPTARG + echo "Setting branchname to $OPTARG" + ;; + h) # display Help + Help + exit;; + esac +done + +# Create the worktree if it doesn't already exist +if [[ ! -d ./doom-nvim-contrib ]]; then + echo "0. Creating new git worktree of doom-nvim at $SCRIPT_DIR/doom-nvim-contrib" + git worktree add ./doom-nvim-contrib origin/develop -b $BRANCH_NAME -f +fi + +# CD into worktree +cd ./doom-nvim-contrib + +echo "1. Setting up branch" +# If branch exists just check it out +if git show-ref --quiet refs/heads/$BRANCH_NAME; then + if [[ ! `git rev-parse --abbrev-ref HEAD` == $BRANCH_NAME ]]; then + echo " - Checking out branch $BRANCH_NAME..." + git checkout $BRANCH_NAME + fi +else + # Pull latest version of develop + echo " - Creating new branch off develop..." + git checkout -b $BRANCH_NAME develop + git fetch --quiet + # If changes between local and origin, get latest changes + if [[ ! `git rev-list develop...origin/develop --count` -eq 0 ]]; then + echo " - WARN: There are upstream changes to develop branch. Please pull latest changes" + read -p " Do you want to continue creating $BRANCH_NAME? (y/n) " -n 1 -r + fi + # Create new branch for feature and check it out + echo " - Creating new branch $BRANCH_NAME..." + git checkout -b $BRANCH_NAME +fi + +cd .. +echo " - Success! Checked out $BRANCH_NAME branch at:" +echo " $SCRIPT_DIR/doom-nvim-contrib" +echo "" + +echo "2. Setting up docker environment" +# Ensure docker image exists +if [[ ! "$(docker images -q doom-nvim-contrib)" ]]; then + echo " - Docker image does not exist. Building docker image..." + docker build -t doom-nvim-contrib . +fi + +if [ "$(docker ps -aq -f status=exited -f name=doom-nvim-contrib-container)" ]; then + echo " - Cleaning up old container..." + # cleanup + docker rm doom-nvim-contrib-container >> /dev/null +fi + +# Create docker container if haven't already +echo " - Success! Running docker container doom-nvim-contrib-container..." +echo "" +docker run \ + -it \ + -e UID="1000" \ + -e GID="1000" \ + -v $SCRIPT_DIR/doom-nvim-contrib:/home/doom/.config/nvim \ + -v $SCRIPT_DIR/local-share-nvim:/home/doom/.local/share/nvim \ + -v $SCRIPT_DIR/workspace:/home/doom/workspace \ + --name doom-nvim-contrib-container \ + --user doom \ + doom-nvim-contrib + + diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 000000000..b8e1704c8 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +# Automatically enter into nvim (by doing this in entrypoint rather than Dockerfile you can still quit and re-enter neovim) +# Add alias to watch config for changes and reload nvim, +# this needs to be debounced otherwise it's quite hard to exit. + +echo "alias doomwatch=\"chokidar '/home/doom/.config/nvim/**/*.lua' -t 100 -c 'debounce 1 | nvim'\"" >> ~/.bashrc +echo "echo 'Use '\$ doomwatch' command to automatically restart nvim on changes to doom-nvim-contrib'." >> ~/.bashrc +echo "echo ' This command is still buggy and hard to exit, you may have to close your terminal if you use it. :( " >> ~/.bashrc + +echo "nvim" >> ~/.bashrc +# Cd into workspace folder +cd ~/workspace +# Start bash and therefore neovim +bash + From 058bc0cbbf44136cad2de54c36a7300b0912fef7 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Oct 2021 16:52:32 +1100 Subject: [PATCH 220/290] Renamed and restructured so this folder can be used for other development tools as well --- {docker => contribute}/Dockerfile | 4 ++-- {docker => contribute}/README.md | 24 +++++++++++-------- .../_docker_entry.sh | 0 .../start_docker.sh | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) rename {docker => contribute}/Dockerfile (93%) rename {docker => contribute}/README.md (62%) rename docker/entrypoint.sh => contribute/_docker_entry.sh (100%) rename docker/bootstrap.sh => contribute/start_docker.sh (98%) diff --git a/docker/Dockerfile b/contribute/Dockerfile similarity index 93% rename from docker/Dockerfile rename to contribute/Dockerfile index 5379e1b2c..63bbca950 100644 --- a/docker/Dockerfile +++ b/contribute/Dockerfile @@ -41,7 +41,7 @@ WORKDIR /home/doom RUN git clone --depth 1 https://github.com/wbthomason/packer.nvim\ ~/.local/share/nvim/site/pack/packer/start/packer.nvim -COPY entrypoint.sh /usr/local/bin/ +COPY _docker_entry.sh /usr/local/bin/ # Doom-nvim-contrib VOLUME "~/.config/nvim" @@ -50,4 +50,4 @@ VOLUME "~/.local/share/nvim" # Files and projects for testing on disk VOLUME "~/workspace" -ENTRYPOINT ["sh", "/usr/local/bin/entrypoint.sh"] +ENTRYPOINT ["sh", "/usr/local/bin/_docker_entry.sh"] diff --git a/docker/README.md b/contribute/README.md similarity index 62% rename from docker/README.md rename to contribute/README.md index 9c3c345e0..6073f1ef3 100644 --- a/docker/README.md +++ b/contribute/README.md @@ -1,21 +1,25 @@ -# Doom Contrib Docker Image +# Contributing Tools for Doom Neovim + +This directory stores various tools has + +## Doom Contrib Docker Image `./start_docker.sh` This docker image aids in development by setting up a docker virtual environment and git worktree of doom-nvim to make your changes within. -## How to use +### How to use -The setup and start process is handled in the `./bootstrap.sh` script. +The setup and start process is handled in the `./start_docker.sh` script. ``` Bootstraps a docker image for contributing changes to doom-nvim -Syntax: ./bootstrap.sh [-b ] +Syntax: ./start_docker.sh [-b ] options: -b Create a new branch for the contribution (default is doom-nvim-contrib) -h Shows this help menu ``` -## What this script does +### What this script does 1. On first execution it will setup a git worktree of doom-nvim, this means your main config and this copy of the repo will share the same git history. - This worktree will be placed in the `docker/doom-nvim-contrib` folder inside of this repository. @@ -23,10 +27,10 @@ options: 2. It will setup a new docker image to run this config within (if necessary). 3. It will then start the docker image and enter you into neovim. -## Folders +### Generated Folders -These are the folders used by this docker image, they will be auto generated when `./bootstrap.sh` is run +These are the folders used by this docker image, they will be auto generated when `./start_docker.sh` is run -`docker/doom-nvim-contrib/` - Git worktree for doom-nvim contributions -`docker/local-share-nvim/` - Stores the data from `~/.local/share/nvim/` -`docker/workspace/` - Directory to store test files and project that you want to test your changes upon +`contribute/doom-nvim-contrib/` - Git worktree for doom-nvim contributions +`contribute/local-share-nvim/` - Stores the data from `~/.local/share/nvim/` +`contribute/workspace/` - Directory to store test files and project that you want to test your changes upon diff --git a/docker/entrypoint.sh b/contribute/_docker_entry.sh similarity index 100% rename from docker/entrypoint.sh rename to contribute/_docker_entry.sh diff --git a/docker/bootstrap.sh b/contribute/start_docker.sh similarity index 98% rename from docker/bootstrap.sh rename to contribute/start_docker.sh index 2d81d5f0d..d9d431158 100755 --- a/docker/bootstrap.sh +++ b/contribute/start_docker.sh @@ -13,7 +13,7 @@ Help() # Display Help echo "Bootstraps a docker image for contributing changes to doom-nvim" echo - echo "Syntax: ./bootstrap.sh [-b ]" + echo "Syntax: ./start_docker.sh [-b ]" echo "options:" echo "-b Create a new branch for the contribution" echo "-h Shows this help menu" From ff7ea5a07459cbc5c57ba16dfd5ef64b2052481e Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Oct 2021 17:22:49 +1100 Subject: [PATCH 221/290] Fixup bashrc changes --- contribute/_docker_entry.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contribute/_docker_entry.sh b/contribute/_docker_entry.sh index b8e1704c8..40f8ff5c9 100755 --- a/contribute/_docker_entry.sh +++ b/contribute/_docker_entry.sh @@ -4,8 +4,8 @@ # this needs to be debounced otherwise it's quite hard to exit. echo "alias doomwatch=\"chokidar '/home/doom/.config/nvim/**/*.lua' -t 100 -c 'debounce 1 | nvim'\"" >> ~/.bashrc -echo "echo 'Use '\$ doomwatch' command to automatically restart nvim on changes to doom-nvim-contrib'." >> ~/.bashrc -echo "echo ' This command is still buggy and hard to exit, you may have to close your terminal if you use it. :( " >> ~/.bashrc +echo "echo 'Use '\$ doomwatch' command to automatically restart nvim on changes to doom-nvim-contrib.'" >> ~/.bashrc +echo "echo ' This command is still buggy and hard to exit, you may have to close your terminal if you use it. :( '" >> ~/.bashrc echo "nvim" >> ~/.bashrc # Cd into workspace folder From eb9e877ec8b7af1fef292e3d3bd72908cc20ba88 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sun, 31 Oct 2021 16:08:17 +1100 Subject: [PATCH 222/290] Cleanup and lint start_docker.sh script --- contribute/README.md | 6 ++-- contribute/start_docker.sh | 73 ++++++++++++++++++++------------------ docs/contributing.md | 12 +++++++ 3 files changed, 54 insertions(+), 37 deletions(-) diff --git a/contribute/README.md b/contribute/README.md index 6073f1ef3..a994afbb4 100644 --- a/contribute/README.md +++ b/contribute/README.md @@ -1,6 +1,6 @@ # Contributing Tools for Doom Neovim -This directory stores various tools has +This directory stores various tools and automations to help contributors or develpers of doom-nvim. ## Doom Contrib Docker Image `./start_docker.sh` @@ -13,7 +13,7 @@ The setup and start process is handled in the `./start_docker.sh` script. ``` Bootstraps a docker image for contributing changes to doom-nvim -Syntax: ./start_docker.sh [-b ] +Syntax: ./start_docker.sh [-b ] options: -b Create a new branch for the contribution (default is doom-nvim-contrib) -h Shows this help menu @@ -22,7 +22,7 @@ options: ### What this script does 1. On first execution it will setup a git worktree of doom-nvim, this means your main config and this copy of the repo will share the same git history. - - This worktree will be placed in the `docker/doom-nvim-contrib` folder inside of this repository. + - This worktree will be placed in the `contribute/doom-nvim-contrib` folder inside of this repository. - Because they share history you wont be able to checkout the same branch on both copies of the repository. Unless specified, a new branch called `doom-nvim-contrib` will be created off the latest version of `develop`. 2. It will setup a new docker image to run this config within (if necessary). 3. It will then start the docker image and enter you into neovim. diff --git a/contribute/start_docker.sh b/contribute/start_docker.sh index d9d431158..02e9dbc34 100755 --- a/contribute/start_docker.sh +++ b/contribute/start_docker.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if ! docker info > /dev/null 2>&1; then echo "This script uses docker, and it isn't running - please start docker and try again!" @@ -10,14 +10,14 @@ fi ############################################################ Help() { - # Display Help - echo "Bootstraps a docker image for contributing changes to doom-nvim" - echo - echo "Syntax: ./start_docker.sh [-b ]" - echo "options:" - echo "-b Create a new branch for the contribution" - echo "-h Shows this help menu" - echo + # Display Help + echo "Bootstraps a docker image for contributing changes to doom-nvim" + echo + echo "Syntax: ./start_docker.sh [-b ]" + echo "options:" + echo "-b Create a new branch for the contribution" + echo "-h Shows this help menu" + echo } # Get directory of script @@ -27,49 +27,54 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) BRANCH_NAME=doom-nvim-contrib # Branch to checkout / create while getopts "b:h" option; do - case $option in - b) # set branch name - BRANCH_NAME=$OPTARG - echo "Setting branchname to $OPTARG" - ;; - h) # display Help - Help - exit;; - esac + case $option in + b) # set branch name + BRANCH_NAME=$OPTARG + echo "Setting branchname to $OPTARG" + ;; + h) # display Help + Help + exit;; + *) + Help + exit;; + esac done +cd "$SCRIPT_DIR" || exit + # Create the worktree if it doesn't already exist -if [[ ! -d ./doom-nvim-contrib ]]; then +if [[ ! -d "$SCRIPT_DIR"/doom-nvim-contrib ]]; then echo "0. Creating new git worktree of doom-nvim at $SCRIPT_DIR/doom-nvim-contrib" - git worktree add ./doom-nvim-contrib origin/develop -b $BRANCH_NAME -f + git worktree add ./doom-nvim-contrib origin/develop -b "$BRANCH_NAME" -f fi # CD into worktree -cd ./doom-nvim-contrib +cd ./doom-nvim-contrib || exit echo "1. Setting up branch" # If branch exists just check it out -if git show-ref --quiet refs/heads/$BRANCH_NAME; then - if [[ ! `git rev-parse --abbrev-ref HEAD` == $BRANCH_NAME ]]; then +if git show-ref --quiet refs/heads/"$BRANCH_NAME"; then + if [[ ! $( git rev-parse --abbrev-ref HEAD ) == "$BRANCH_NAME" ]]; then echo " - Checking out branch $BRANCH_NAME..." - git checkout $BRANCH_NAME + git checkout "$BRANCH_NAME" fi else # Pull latest version of develop echo " - Creating new branch off develop..." - git checkout -b $BRANCH_NAME develop + git checkout -b "$BRANCH_NAME" develop git fetch --quiet # If changes between local and origin, get latest changes - if [[ ! `git rev-list develop...origin/develop --count` -eq 0 ]]; then + if [[ ! $( git rev-list develop...origin/develop --count ) -eq 0 ]]; then echo " - WARN: There are upstream changes to develop branch. Please pull latest changes" read -p " Do you want to continue creating $BRANCH_NAME? (y/n) " -n 1 -r fi # Create new branch for feature and check it out echo " - Creating new branch $BRANCH_NAME..." - git checkout -b $BRANCH_NAME + git checkout -b "$BRANCH_NAME" fi -cd .. +cd .. || exit echo " - Success! Checked out $BRANCH_NAME branch at:" echo " $SCRIPT_DIR/doom-nvim-contrib" echo "" @@ -82,9 +87,9 @@ if [[ ! "$(docker images -q doom-nvim-contrib)" ]]; then fi if [ "$(docker ps -aq -f status=exited -f name=doom-nvim-contrib-container)" ]; then - echo " - Cleaning up old container..." - # cleanup - docker rm doom-nvim-contrib-container >> /dev/null + echo " - Cleaning up old container..." + # cleanup + docker rm doom-nvim-contrib-container >> /dev/null fi # Create docker container if haven't already @@ -94,9 +99,9 @@ docker run \ -it \ -e UID="1000" \ -e GID="1000" \ - -v $SCRIPT_DIR/doom-nvim-contrib:/home/doom/.config/nvim \ - -v $SCRIPT_DIR/local-share-nvim:/home/doom/.local/share/nvim \ - -v $SCRIPT_DIR/workspace:/home/doom/workspace \ + -v "$SCRIPT_DIR"/doom-nvim-contrib:/home/doom/.config/nvim \ + -v "$SCRIPT_DIR"/local-share-nvim:/home/doom/.local/share/nvim \ + -v "$SCRIPT_DIR"/workspace:/home/doom/workspace \ --name doom-nvim-contrib-container \ --user doom \ doom-nvim-contrib diff --git a/docs/contributing.md b/docs/contributing.md index 22ef49d78..f75a16425 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -32,6 +32,8 @@ will have less settings and plugins than you personal branch and therefore it wi not work as expected otherwise. Eg. you will see 'Dashboard' text on vim load instead of 'Doom'. +> Alternatively you can setup an isolated dev environment for contributing using our docker image [here](../contribute/README.md#doom-contrib-docker-image-start_dockersh). + ## Reporting issues ### Acquire a backtrace from errors @@ -116,3 +118,13 @@ your pull request :) [gist]: https://gist.github.com/ [stylua]: https://github.com/JohnnyMorganz/StyLua [luacheck]:https://github.com/luarocks/luacheck + +### Tools + +A range of tools for contributors are currently housed in the `contribute/` folder. +Read the detailed [documentation](../contribute/README.md). + +#### Notable Tools + + - [`contribute/start_docker.sh`](../contribute/README.md#doom-contrib-docker-image-start_dockersh) Sets up a dev environment for contributing to doom-nvim. Creates a git worktree to make changes and a docker image to test them within. + From c37d28bc2cf238cda1ea6f4e7a430912afe6fae0 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Nov 2021 18:33:38 +1100 Subject: [PATCH 223/290] Let doom-nvim bootstrap docker --- .gitignore | 6 +++--- contribute/Dockerfile | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 058e0879f..fb3a9c1dc 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,6 @@ tags # OS files .DS_Store # Doom Nvim Contrib files -docker/doom-nvim-contrib -docker/local-share-nvim -docker/workspace +contribute/doom-nvim-contrib +contribute/local-share-nvim +contribute/workspace diff --git a/contribute/Dockerfile b/contribute/Dockerfile index 63bbca950..a7e1bbe1d 100644 --- a/contribute/Dockerfile +++ b/contribute/Dockerfile @@ -37,10 +37,6 @@ RUN chown -R ${UNAME}:${GNAME} /usr/local/lib/node_modules/ USER doom WORKDIR /home/doom -# Install packer -RUN git clone --depth 1 https://github.com/wbthomason/packer.nvim\ - ~/.local/share/nvim/site/pack/packer/start/packer.nvim - COPY _docker_entry.sh /usr/local/bin/ # Doom-nvim-contrib From 8c1f0df71e639dbb08d48446c848abd222c49edb Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Nov 2021 18:33:57 +1100 Subject: [PATCH 224/290] Allowed start_docker.sh to bootstrap on a branch that already exists --- contribute/start_docker.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contribute/start_docker.sh b/contribute/start_docker.sh index 02e9dbc34..4aaeb5a67 100755 --- a/contribute/start_docker.sh +++ b/contribute/start_docker.sh @@ -46,7 +46,11 @@ cd "$SCRIPT_DIR" || exit # Create the worktree if it doesn't already exist if [[ ! -d "$SCRIPT_DIR"/doom-nvim-contrib ]]; then echo "0. Creating new git worktree of doom-nvim at $SCRIPT_DIR/doom-nvim-contrib" - git worktree add ./doom-nvim-contrib origin/develop -b "$BRANCH_NAME" -f + if git show-ref --quiet refs/heads/"$BRANCH_NAME"; then + git worktree add ./doom-nvim-contrib "$BRANCH_NAME" + else + git worktree add ./doom-nvim-contrib origin/develop -b "$BRANCH_NAME" + fi fi # CD into worktree From 1616098f79fe9c117cc68514ebe744b4a2d2b187 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Nov 2021 20:48:34 +1100 Subject: [PATCH 225/290] Added jq as dependency for nvim-lspmanager --- contribute/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribute/Dockerfile b/contribute/Dockerfile index a7e1bbe1d..373e78188 100644 --- a/contribute/Dockerfile +++ b/contribute/Dockerfile @@ -22,7 +22,7 @@ RUN pacman -Syy RUN pacman -Sy neovim --noconfirm # Install runtime dependencies of doom-nvim -RUN pacman -Sy ripgrep nodejs-lts-fermium npm git bash gcc --noconfirm +RUN pacman -Sy ripgrep nodejs-lts-fermium npm git bash gcc jq --noconfirm # Required for watching Doom-nvim-contrib for changes RUN npm i -g chokidar-cli From 57758dcfd6d7c92cf72956bfe2d5b28545a2ef20 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Nov 2021 20:55:43 +1100 Subject: [PATCH 226/290] Added use case/explanation to documentation for docker image. --- contribute/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contribute/README.md b/contribute/README.md index a994afbb4..bf3cae045 100644 --- a/contribute/README.md +++ b/contribute/README.md @@ -19,6 +19,9 @@ options: -h Shows this help menu ``` +The script will start an instance of neovim that uses `./contribute/doom-nvim-contrib/` for configuration. +You will then be able to start making changes within `doom-nvim-contrib` without breaking your existing config. + ### What this script does 1. On first execution it will setup a git worktree of doom-nvim, this means your main config and this copy of the repo will share the same git history. From 52923b0ecef48014571e448dc166fbd423aa0283 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Oct 2021 16:46:18 +1100 Subject: [PATCH 227/290] Implemented basic pinned commit update script Implemented script and pinned commits --- contribute/update_dependencies.sh | 68 +++++++++++++++++++++++++++++++ doom_config.lua | 4 ++ lua/doom/modules/init.lua | 61 ++++++++++++++++++++++++++- 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100755 contribute/update_dependencies.sh diff --git a/contribute/update_dependencies.sh b/contribute/update_dependencies.sh new file mode 100755 index 000000000..c0f95c805 --- /dev/null +++ b/contribute/update_dependencies.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +# This script updates pinned dependencies in ../lua/doom/modules/init.lua +# It uses grep to find instances of packer.use, uses the repository url to fetch the latest commit sha, and modifies the values +# Dependencies +# perl -- used for Regexing the repository / with capture groups to extract inner text +# grep -- Used for regexing the use({}) block with line numbers +# + +index=0 +repo_regex='"([^"]+)"' +pin_commit_regex='pin_commit[(][^()]*[)]' + +repo='' +latest_commit='' + +while read -r line; do + if [[ $index -eq 1 ]]; then + # Get the repository name as `/reponame` + if [[ $line =~ $repo_regex ]]; then # Regex $line against $repo_regex + repo="${BASH_REMATCH[1]}" # Get first capture group + echo "" + echo "Updating $repo:" + + # Sometimes the github api requests will fail, in which case we need to re-try after a delay. + while [ -z "$latest_commit" ]; do + # Get the commit sha from github + api_result=`curl -s \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/$repo/commits?per_page=1` + + is_array=`echo $api_result | jq -r 'if type=="array" then "yes" else "no" end'` + + # If there's an error, log it and wait 30 seconds + if [ "$is_array" = "no" ]; then + echo "- Github API Error: $( echo "$api_result" | jq -r .message )" + echo "- Waiting 30 seconds before trying again..." + sleep 30 + else + latest_commit=`echo $api_result | jq -r .[0].sha` + fi + + done + else + echo " - ERROR: No repo name for $line :(" + fi + fi + + if [[ $index -eq 2 ]]; then # + if [ ! -z "$repo" ] && [ ! -z "$latest_commit" ] && [[ $line =~ $pin_commit_regex ]]; then + line_number=`echo $line | awk -F "-" '{print $1}'` + sed -r -i -- "${line_number}s/pin_commit[(][^()]*[)]/pin_commit('${latest_commit}')/" "../lua/doom/modules/init.lua" + echo " - Updated to $latest_commit" + else + echo " - ERROR: Did not update $repo because \`commit = pin_commit('...')\` was not immediately after the repo name." + fi + fi + + let index+=1 + if [[ $line == '--' ]]; then + sleep 5 + index=0 + repo='' + latest_commit='' + fi +done < <(grep -n "use\(\{" -A 2 -E ../lua/doom/modules/init.lua) + + diff --git a/doom_config.lua b/doom_config.lua index 1fffda057..d023a331b 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -14,6 +14,10 @@ M.source = debug.getinfo(1, "S").source:sub(2) M.config = { doom = { + -- Pins plugins to a commit sha to prevent breaking changes + -- @default = true + freeze_dependencies = true, + -- Autosave -- false : Disable autosave -- true : Enable autosave diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index d6d7899e7..b16fda1be 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -6,6 +6,10 @@ local is_plugin_disabled = require("doom.utils").is_plugin_disabled local use_floating_win_packer = require("doom.core.config").config.doom.use_floating_win_packer +-- Freeze dependencies and helper function for clean code +local freeze_dependencies = require("doom.core.config").config.doom.freeze_dependencies +local pin_commit = function(commit_sha) freeze_dependencies and commit_sha or nil end + ---- Packer Bootstrap --------------------------- ------------------------------------------------- local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim" @@ -64,20 +68,24 @@ packer.startup(function(use) }) use({ "JoosepAlviste/nvim-ts-context-commentstring", + commit = pin_commit('a2283cfc9f4aa892349004153ab54dfe8911241c'), after = "nvim-treesitter", }) use({ "nvim-treesitter/nvim-tree-docs", + commit = pin_commit('10a49cef11fee8b2f7bd9f6e4d118caa3d43b28e'), after = "nvim-treesitter", }) use({ "windwp/nvim-ts-autotag", + commit = pin_commit('80d427af7b898768c8d8538663d52dee133da86f'), after = "nvim-treesitter", }) -- Aniseed, required by some treesitter modules use({ "Olical/aniseed", + commit = pin_commit('4bb3a4c1a1e329ebefa7ff022f7b3947770f7f26'), module_pattern = "aniseed", }) @@ -85,6 +93,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", + commit = pin_commit('592fb0c9c220ca53238e6de7685c3151fe3a3085'), branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, @@ -95,6 +104,7 @@ packer.startup(function(use) local disabled_sessions = is_plugin_disabled("auto-session") use({ "folke/persistence.nvim", + commit = pin_commit('77cf5a6ee162013b97237ff25450080401849f85'), config = require("doom.modules.config.doom-persistence"), -- event = "VimEnter", disable = disabled_sessions, @@ -107,6 +117,7 @@ packer.startup(function(use) local disabled_dashboard = is_plugin_disabled("dashboard") use({ "glepnir/dashboard-nvim", + commit = pin_commit('ba98ab86487b8eda3b0934b5423759944b5f7ebd'), config = require("doom.modules.config.doom-dashboard"), disable = disabled_dashboard, }) @@ -115,12 +126,14 @@ packer.startup(function(use) local disabled_doom_themes = is_plugin_disabled("doom-themes") use({ "GustavoPrietoP/doom-themes.nvim", + commit = pin_commit('03d417d3eab71c320744f8da22251715ba6cee53'), disable = disabled_doom_themes, }) -- Development icons use({ "kyazdani42/nvim-web-devicons", + commit = pin_commit('ee101462d127ed6a5561ce9ce92bfded87d7d478'), module = "nvim-web-devicons", }) @@ -129,6 +142,7 @@ packer.startup(function(use) and require("doom.core.config").config.doom.use_netrw use({ "kyazdani42/nvim-tree.lua", + commit = pin_commit('c4ecf4416bc0a5f5b2ffacc18476a776953f9e03'), requires = "nvim-web-devicons", config = require("doom.modules.config.doom-tree"), disable = disabled_tree, @@ -146,6 +160,7 @@ packer.startup(function(use) local disabled_ranger = is_plugin_disabled("ranger") use({ "francoiscabrol/ranger.vim", + commit = pin_commit('91e82debdf566dfaf47df3aef0a5fd823cedf41c'), requires = "rbgrouleff/bclose.vim", disable = disabled_ranger, }) @@ -155,6 +170,7 @@ packer.startup(function(use) local disabled_statusline = is_plugin_disabled("statusline") use({ "NTBBloodbath/galaxyline.nvim", + commit = pin_commit('7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d'), config = require("doom.modules.config.doom-eviline"), disable = disabled_statusline, }) @@ -164,6 +180,7 @@ packer.startup(function(use) local disabled_tabline = is_plugin_disabled("tabline") use({ "akinsho/bufferline.nvim", + commit = pin_commit('58e8d9b7c9aaf603f1093f808628b5a8f03493af'), config = require("doom.modules.config.doom-bufferline"), disable = disabled_tabline, event = "BufWinEnter", @@ -174,6 +191,7 @@ packer.startup(function(use) local disabled_terminal = is_plugin_disabled("terminal") use({ "akinsho/toggleterm.nvim", + commit = pin_commit('9cdc5e9bb2affb25af5d4bda930738144193bd36'), config = require("doom.modules.config.doom-toggleterm"), disable = disabled_terminal, module = { "toggleterm", "toggleterm.terminal" }, @@ -185,6 +203,7 @@ packer.startup(function(use) local disabled_outline = is_plugin_disabled("symbols") use({ "simrat39/symbols-outline.nvim", + commit = pin_commit('552b67993ed959993279e0b0f8a1da9f3c5e6fc0'), config = require("doom.modules.config.doom-symbols"), disable = disabled_outline, cmd = { @@ -199,6 +218,7 @@ packer.startup(function(use) local disabled_minimap = is_plugin_disabled("minimap") use({ "wfxr/minimap.vim", + commit = pin_commit('5c54258d34b8ae4be70a8fbc09b400eb7be0bee8'), disable = disabled_minimap, cmd = { "Minimap", @@ -213,6 +233,7 @@ packer.startup(function(use) local disabled_whichkey = is_plugin_disabled("which-key") use({ "folke/which-key.nvim", + commit = pin_commit('d3032b6d3e0adb667975170f626cb693bfc66baa'), opt = true, config = require("doom.modules.config.doom-whichkey"), disable = disabled_whichkey, @@ -222,13 +243,15 @@ packer.startup(function(use) local disabled_show_registers = is_plugin_disabled("show_registers") use({ "tversteeg/registers.nvim", + commit = pin_commit('4d1f3525c6f9be4297e99e6aed515af3677d7241'), disable = disabled_show_registers, }) -- Distraction free environment local disabled_zen = is_plugin_disabled("zen") use({ - "kdav5758/TrueZen.nvim", + "Pocco81/TrueZen.nvim", + commit = pin_commit('508b977d71650da5c9243698614a9a1416f116d4'), config = require("doom.modules.config.doom-zen"), disable = disabled_zen, module = "true-zen", @@ -239,6 +262,7 @@ packer.startup(function(use) local disabled_illuminate = is_plugin_disabled("illuminated") use({ "RRethy/vim-illuminate", + commit = pin_commit('084b012ce5bc1bf302b69eb73562146afe0a9756'), setup = function() vim.g.Illuminate_ftblacklist = { "help", @@ -260,16 +284,19 @@ packer.startup(function(use) -----]]--------------[[----- use({ "nvim-lua/plenary.nvim", + commit = pin_commit('96e821e8001c21bc904d3c15aa96a70c11462c5f'), module = "plenary", }) use({ "nvim-lua/popup.nvim", + commit = pin_commit('f91d80973f80025d4ed00380f2e06c669dfda49d'), module = "popup", }) local disabled_telescope = is_plugin_disabled("telescope") use({ "nvim-telescope/telescope.nvim", + commit = pin_commit('3b9ac8edba8c1b4053c7f6ac8a4e78969cec66dd'), cmd = "Telescope", module = "telescope", requires = { @@ -281,6 +308,7 @@ packer.startup(function(use) }) use({ "lazytanuki/nvim-mapper", + commit = pin_commit('e11e852bafa41a4a2c160fcd2d38779add423db9'), config = function() local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep require("nvim-mapper").setup({ @@ -307,6 +335,7 @@ packer.startup(function(use) local disabled_gitsigns = is_plugin_disabled("gitsigns") use({ "lewis6991/gitsigns.nvim", + commit = pin_commit('d12442a924dc431467149f1fcb33e1c648116803'), config = require("doom.modules.config.doom-gitsigns"), disable = disabled_gitsigns, requires = "plenary.nvim", @@ -317,6 +346,7 @@ packer.startup(function(use) local disabled_neogit = is_plugin_disabled("neogit") use({ "TimUntersberger/neogit", + commit = pin_commit('f214200d71391dfc5763769ca1120e3aa5902c2d'), config = function() require("neogit").setup({}) end, @@ -329,6 +359,7 @@ packer.startup(function(use) local disabled_lazygit = is_plugin_disabled("lazygit") use({ "kdheepak/lazygit.nvim", + commit = pin_commit('b1ebb53902a4f5d8c565f7485d4e57d937f89b91'), requires = "plenary.nvim", disable = disabled_lazygit, cmd = { "LazyGit", "LazyGitConfig" }, @@ -341,6 +372,7 @@ packer.startup(function(use) -- Built-in LSP Config use({ "neovim/nvim-lspconfig", + commit = pin_commit('9314d0a8da0f5ccd700d8a1fa699949a95971420'), config = require("doom.modules.config.doom-lspconfig"), disable = disabled_lsp, }) @@ -356,6 +388,7 @@ packer.startup(function(use) -- can be disabled to use your own completion plugin use({ "hrsh7th/nvim-cmp", + commit = pin_commit('669803b9ffb31b3963afb4f05c1622fc48ab65cb'), wants = { "LuaSnip" }, requires = { { @@ -379,26 +412,31 @@ packer.startup(function(use) }) use({ "hrsh7th/cmp-nvim-lua", + commit = pin_commit('d276254e7198ab7d00f117e88e223b4bd8c02d21'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-nvim-lsp", + commit = pin_commit('accbe6d97548d8d3471c04d512d36fa61d0e4be8'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-path", + commit = pin_commit('97661b00232a2fe145fe48e295875bc3299ed1f7'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-buffer", + commit = pin_commit('5dde5430757696be4169ad409210cf5088554ed6'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "saadparwaiz1/cmp_luasnip", + commit = pin_commit('16832bb50e760223a403ffa3042859845dd9ef9d'), disable = disabled_lsp, after = "nvim-cmp", }) @@ -406,6 +444,7 @@ packer.startup(function(use) -- Manage Language serverss with ease. use({ "MordechaiHadad/nvim-lspmanager", + commit = pin_commit('9d0ecc5010bca0a78624e99bfffb64cab5ae390f'), branch = "dev", config = require("doom.modules.config.doom-lspmanager"), disable = disabled_lsp, @@ -414,6 +453,7 @@ packer.startup(function(use) -- Show function signature when you type use({ "ray-x/lsp_signature.nvim", + commit = pin_commit('6469c55ce7afc8cdfb6d0b6b3fbfd331bcc26410'), config = require("doom.modules.config.doom-lsp-signature"), after = "nvim-lspconfig", event = "InsertEnter", @@ -422,6 +462,7 @@ packer.startup(function(use) -- Setup for Lua development in Neovim use({ "folke/lua-dev.nvim", + commit = pin_commit('6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0'), disable = disabled_lsp, module = "lua-dev", }) @@ -432,12 +473,14 @@ packer.startup(function(use) local disabled_dap = is_plugin_disabled("dap") use({ "mfussenegger/nvim-dap", + commit = pin_commit('dd778f65dc95323f781f291fb7c5bf3c17d057b1'), disable = disabled_dap, event = "BufWinEnter", }) use({ "rcarriga/nvim-dap-ui", + commit = pin_commit('547635e7ba1dace13189386c98c3c7b064d585c4'), config = require("doom.modules.config.doom-dap-ui"), disable = disabled_dap, after = "nvim-dap", @@ -445,6 +488,7 @@ packer.startup(function(use) use({ "Pocco81/DAPInstall.nvim", + commit = pin_commit('b95e9ad32f1c45855b9965b545c86e82d8a827ac'), config = require("doom.modules.config.doom-dap-install"), disable = disabled_dap, after = "nvim-dap", @@ -458,6 +502,7 @@ packer.startup(function(use) local disabled_suda = is_plugin_disabled("suda") use({ "lambdalisue/suda.vim", + commit = pin_commit('0290c93c148a14eab2b661a1933003d86436f6ec'), disable = disabled_suda, cmd = { "SudaRead", "SudaWrite" }, }) @@ -467,6 +512,7 @@ packer.startup(function(use) local disabled_formatter = is_plugin_disabled("formatter") use({ "lukas-reineke/format.nvim", + commit = pin_commit('c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7'), config = require("doom.modules.config.doom-format"), disable = disabled_formatter, cmd = { "Format", "FormatWrite" }, @@ -476,6 +522,7 @@ packer.startup(function(use) local disabled_linter = is_plugin_disabled("linter") use({ "mfussenegger/nvim-lint", + commit = pin_commit('b1467a01f48736b309e0e274c032b69051740c08'), config = require("doom.modules.config.doom-lint"), disable = disabled_linter, module = "lint", @@ -485,6 +532,7 @@ packer.startup(function(use) local disabled_indent_lines = is_plugin_disabled("indentlines") use({ "lukas-reineke/indent-blankline.nvim", + commit = pin_commit('252797e7a96fa4f7c6ccdcdff3f488fdd48b1d09'), config = require("doom.modules.config.doom-blankline"), disable = disabled_indent_lines, event = "ColorScheme", @@ -494,6 +542,7 @@ packer.startup(function(use) local disabled_editorconfig = is_plugin_disabled("editorconfig") use({ "editorconfig/editorconfig-vim", + commit = pin_commit('3078cd10b28904e57d878c0d0dab42aa0a9fdc89'), disable = disabled_editorconfig, }) @@ -502,6 +551,7 @@ packer.startup(function(use) local disabled_kommentary = is_plugin_disabled("kommentary") use({ "b3nj5m1n/kommentary", + commit = pin_commit('8f1cd74ad28de7d7c4fda5d8e8557ff240904b42'), disable = disabled_kommentary, event = "BufWinEnter", }) @@ -510,11 +560,13 @@ packer.startup(function(use) -- Lua 5.1 docs use({ "milisims/nvim-luaref", + commit = pin_commit('dc40d606549db7df1a6e23efa743c90c178333d4'), disable = disabled_contrib, }) -- LibUV docs use({ "nanotee/luv-vimdocs", + commit = pin_commit('ddcd5ef0100e66da0d4a709391a9b3e9453f19a1'), disable = disabled_contrib, }) @@ -525,6 +577,7 @@ packer.startup(function(use) local disabled_colorizer = is_plugin_disabled("colorizer") use({ "norcalli/nvim-colorizer.lua", + commit = pin_commit('36c610a9717cc9ec426a07c8e6bf3b3abcb139d6'), config = require("doom.modules.config.doom-colorizer"), disable = disabled_colorizer, event = "ColorScheme", @@ -535,6 +588,7 @@ packer.startup(function(use) local disabled_restclient = is_plugin_disabled("restclient") use({ "NTBBloodbath/rest.nvim", + commit = pin_commit('5130e59f680df56f22bd8cc41da422f9a05580c5'), requires = "plenary.nvim", config = function() require("rest-nvim").setup() @@ -546,6 +600,7 @@ packer.startup(function(use) local disabled_range_highlight = is_plugin_disabled("range-highlight") use({ "winston0410/range-highlight.nvim", + commit = pin_commit('8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9'), requires = { { "winston0410/cmd-parser.nvim", module = "cmd-parser" }, }, @@ -559,6 +614,7 @@ packer.startup(function(use) local disabled_firenvim = is_plugin_disabled("firenvim") use({ "glacambre/firenvim", + commit = pin_commit('eb3abef4520d17dbd9957f5d23ada74b853133e4'), disable = disabled_firenvim, run = function() vim.fn["firenvim#install"](0) @@ -569,6 +625,7 @@ packer.startup(function(use) local disabled_todo = is_plugin_disabled("todo_comments") use({ "folke/todo-comments.nvim", + commit = pin_commit('9983edc5ef38c7a035c17c85f60ee13dbd75dcc8'), requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), disable = disabled_todo, @@ -578,6 +635,7 @@ packer.startup(function(use) local disabled_trouble = is_plugin_disabled("trouble") use({ "folke/trouble.nvim", + commit = pin_commit('756f09de113a775ab16ba6d26c090616b40a999d'), cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" }, requires = "kyazdani42/nvim-web-devicons", config = require("doom.modules.config.doom-trouble"), @@ -587,6 +645,7 @@ packer.startup(function(use) local disabled_superman = is_plugin_disabled("superman") use({ "jez/vim-superman", + commit = pin_commit('19d307446576d9118625c5d9d3c7a4c9bec5571a'), cmd = "SuperMan", disable = disabled_superman, }) From 57b309f94d88daff89794c5cb17a1d2ab3c447da Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 30 Oct 2021 15:40:26 +1100 Subject: [PATCH 228/290] Added pinned commit for nvim-treesitter --- lua/doom/modules/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index b16fda1be..7329321da 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -61,6 +61,7 @@ packer.startup(function(use) -- Tree-Sitter use({ "nvim-treesitter/nvim-treesitter", + commit = vim.fn.has("nvim-0.6.0") == 1 and pin_commit('fe4e4aa286ba14e949948ef6e826d69c63048cdb') or pin_commit('47cfda2c6711077625c90902d7722238a8294982'), opt = true, run = ":TSUpdate", branch = vim.fn.has("nvim-0.6.0") == 1 and "master" or "0.5-compat", From 8a44c1bdeb2e933753635865e401f6e21c6e3cdd Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 30 Oct 2021 15:43:11 +1100 Subject: [PATCH 229/290] Skip dependencies that don't follow structure exactly --- contribute/update_dependencies.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contribute/update_dependencies.sh b/contribute/update_dependencies.sh index c0f95c805..638c0a2eb 100755 --- a/contribute/update_dependencies.sh +++ b/contribute/update_dependencies.sh @@ -9,7 +9,7 @@ index=0 repo_regex='"([^"]+)"' -pin_commit_regex='pin_commit[(][^()]*[)]' +pin_commit_regex='commit = pin_commit[(][^()]*[)]' repo='' latest_commit='' @@ -49,10 +49,10 @@ while read -r line; do if [[ $index -eq 2 ]]; then # if [ ! -z "$repo" ] && [ ! -z "$latest_commit" ] && [[ $line =~ $pin_commit_regex ]]; then line_number=`echo $line | awk -F "-" '{print $1}'` - sed -r -i -- "${line_number}s/pin_commit[(][^()]*[)]/pin_commit('${latest_commit}')/" "../lua/doom/modules/init.lua" + sed -r -i -- "${line_number}s/commit = pin_commit[(][^()]*[)]/commit = pin_commit('${latest_commit}')/" "../lua/doom/modules/init.lua" echo " - Updated to $latest_commit" else - echo " - ERROR: Did not update $repo because \`commit = pin_commit('...')\` was not immediately after the repo name." + echo " - ERROR: Did not update $repo because \`commit = pin_commit('...')\` was not immediately after the repo name or there is custom logic for determining the pinned commit. Please update this entry manually." fi fi From 63e2ad59f26d2acb889c70d69ed8e29ff69519dc Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 30 Oct 2021 16:11:06 +1100 Subject: [PATCH 230/290] Hardcoded branch specific commit shas --- lua/doom/modules/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 7329321da..7a05aa245 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -8,7 +8,7 @@ local use_floating_win_packer = require("doom.core.config").config.doom.use_floa -- Freeze dependencies and helper function for clean code local freeze_dependencies = require("doom.core.config").config.doom.freeze_dependencies -local pin_commit = function(commit_sha) freeze_dependencies and commit_sha or nil end +local pin_commit = function(commit_sha) return freeze_dependencies and commit_sha or nil end ---- Packer Bootstrap --------------------------- ------------------------------------------------- @@ -94,7 +94,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", - commit = pin_commit('592fb0c9c220ca53238e6de7685c3151fe3a3085'), + commit = pin_commit('2fdce1aaf542d930df92d394e646f9bafe4e41a3'), branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, @@ -445,7 +445,7 @@ packer.startup(function(use) -- Manage Language serverss with ease. use({ "MordechaiHadad/nvim-lspmanager", - commit = pin_commit('9d0ecc5010bca0a78624e99bfffb64cab5ae390f'), + commit = pin_commit('817998fb83ad8c05e9a315d0a6d25fddae56fe23'), branch = "dev", config = require("doom.modules.config.doom-lspmanager"), disable = disabled_lsp, From 45b09dcc3e582d0d6523b47abf09723152f039df Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sun, 31 Oct 2021 15:13:13 +1100 Subject: [PATCH 231/290] Pinned dependencies to commit --- lua/doom/modules/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 7a05aa245..52142c5c0 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -394,6 +394,7 @@ packer.startup(function(use) requires = { { "L3MON4D3/LuaSnip", + commit = pin_commit('a54b21aee0423dbdce121c858ad6a88a58ef6e0f'), event = "BufReadPre", wants = "friendly-snippets", config = require("doom.modules.config.doom-luasnip"), @@ -402,6 +403,7 @@ packer.startup(function(use) }, { "windwp/nvim-autopairs", + commit = pin_commit('e6b1870cd2e319f467f99188f99b1c3efc5824d2'), config = require("doom.modules.config.doom-autopairs"), disable = disabled_autopairs, event = "BufReadPre", From 5fb39ad13ced9917881e33493b613b981a80f308 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sun, 31 Oct 2021 15:33:07 +1100 Subject: [PATCH 232/290] Added optional GITHUB_API_KEY --- contribute/update_dependencies.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/contribute/update_dependencies.sh b/contribute/update_dependencies.sh index 638c0a2eb..73e53ec27 100755 --- a/contribute/update_dependencies.sh +++ b/contribute/update_dependencies.sh @@ -24,14 +24,22 @@ while read -r line; do # Sometimes the github api requests will fail, in which case we need to re-try after a delay. while [ -z "$latest_commit" ]; do - # Get the commit sha from github - api_result=`curl -s \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/$repo/commits?per_page=1` - - is_array=`echo $api_result | jq -r 'if type=="array" then "yes" else "no" end'` + # Get the commit sha from github, use GITHUB_API_KEY if provided + # GITHUB_API_KEY in this instance is an OAuth2 token + # https://docs.github.com/en/developers/apps/building-oauth-apps + if [ -z GITHUB_API_KEY ]; then + api_result=`curl -s \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/$repo/commits?per_page=1` + else + api_result=`curl -s \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authentication: token $GITHUB_API_KEY" \ + https://api.github.com/repos/$repo/commits?per_page=1` + fi # If there's an error, log it and wait 30 seconds + is_array=`echo $api_result | jq -r 'if type=="array" then "yes" else "no" end'` if [ "$is_array" = "no" ]; then echo "- Github API Error: $( echo "$api_result" | jq -r .message )" echo "- Waiting 30 seconds before trying again..." @@ -46,7 +54,8 @@ while read -r line; do fi fi - if [[ $index -eq 2 ]]; then # + # Update the pinned commit if possible + if [[ $index -eq 2 ]]; then if [ ! -z "$repo" ] && [ ! -z "$latest_commit" ] && [[ $line =~ $pin_commit_regex ]]; then line_number=`echo $line | awk -F "-" '{print $1}'` sed -r -i -- "${line_number}s/commit = pin_commit[(][^()]*[)]/commit = pin_commit('${latest_commit}')/" "../lua/doom/modules/init.lua" From 02c9d44662ece73d6863dbb871c562cf8d177f1e Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 4 Nov 2021 12:50:50 +1100 Subject: [PATCH 233/290] Documented ./update_dependencies.sh in contribute/folder --- contribute/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/contribute/README.md b/contribute/README.md index bf3cae045..809570fe6 100644 --- a/contribute/README.md +++ b/contribute/README.md @@ -37,3 +37,22 @@ These are the folders used by this docker image, they will be auto generated whe `contribute/doom-nvim-contrib/` - Git worktree for doom-nvim contributions `contribute/local-share-nvim/` - Stores the data from `~/.local/share/nvim/` `contribute/workspace/` - Directory to store test files and project that you want to test your changes upon + +## Pinned Dependencies `./update_dependencies.sh` + +This script parses the `lua/doom/modules/init.lua` file and pins each plugin to the latest commit in the default branch. +We should update these dependencies with each release of doom-nvim, and test everything working together to ensure a stable experience for users. +Pinned/frozen dependencies can be disabled using the `freeze_dependencies` configuration option in `doom_config.lua`. + +### How to use + +Run the following command in the root of the neovim folder. +```bash +cd contribute && ./update_dependencies.sh` +``` + +### Issues +- The `commit = pin_commit(...)` line must be immediately after the package name +- It does not work if the dependency also has the `branch = '...'` option. These will have to be updated manually. +- It does not work if there is custom logic for determining pinned commits (such as depending on neovim version). These will have to be updated manually. +- Github API ratelimits requests, you can specify a GITHUB_API_KEY environment variable (docs)[https://docs.github.com/en/developers/apps/building-oauth-apps], or you can use a VPN to change IP addresses. From 3c4ee03cc0000fe7d524a3ecff2ef29b6353f97b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 4 Nov 2021 01:53:50 +0000 Subject: [PATCH 234/290] chore: format source code --- lua/doom/modules/init.lua | 122 ++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 52142c5c0..364a5fda9 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -8,7 +8,9 @@ local use_floating_win_packer = require("doom.core.config").config.doom.use_floa -- Freeze dependencies and helper function for clean code local freeze_dependencies = require("doom.core.config").config.doom.freeze_dependencies -local pin_commit = function(commit_sha) return freeze_dependencies and commit_sha or nil end +local pin_commit = function(commit_sha) + return freeze_dependencies and commit_sha or nil +end ---- Packer Bootstrap --------------------------- ------------------------------------------------- @@ -61,7 +63,9 @@ packer.startup(function(use) -- Tree-Sitter use({ "nvim-treesitter/nvim-treesitter", - commit = vim.fn.has("nvim-0.6.0") == 1 and pin_commit('fe4e4aa286ba14e949948ef6e826d69c63048cdb') or pin_commit('47cfda2c6711077625c90902d7722238a8294982'), + commit = vim.fn.has("nvim-0.6.0") == 1 and pin_commit( + "fe4e4aa286ba14e949948ef6e826d69c63048cdb" + ) or pin_commit("47cfda2c6711077625c90902d7722238a8294982"), opt = true, run = ":TSUpdate", branch = vim.fn.has("nvim-0.6.0") == 1 and "master" or "0.5-compat", @@ -69,24 +73,24 @@ packer.startup(function(use) }) use({ "JoosepAlviste/nvim-ts-context-commentstring", - commit = pin_commit('a2283cfc9f4aa892349004153ab54dfe8911241c'), + commit = pin_commit("a2283cfc9f4aa892349004153ab54dfe8911241c"), after = "nvim-treesitter", }) use({ "nvim-treesitter/nvim-tree-docs", - commit = pin_commit('10a49cef11fee8b2f7bd9f6e4d118caa3d43b28e'), + commit = pin_commit("10a49cef11fee8b2f7bd9f6e4d118caa3d43b28e"), after = "nvim-treesitter", }) use({ "windwp/nvim-ts-autotag", - commit = pin_commit('80d427af7b898768c8d8538663d52dee133da86f'), + commit = pin_commit("80d427af7b898768c8d8538663d52dee133da86f"), after = "nvim-treesitter", }) -- Aniseed, required by some treesitter modules use({ "Olical/aniseed", - commit = pin_commit('4bb3a4c1a1e329ebefa7ff022f7b3947770f7f26'), + commit = pin_commit("4bb3a4c1a1e329ebefa7ff022f7b3947770f7f26"), module_pattern = "aniseed", }) @@ -94,7 +98,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", - commit = pin_commit('2fdce1aaf542d930df92d394e646f9bafe4e41a3'), + commit = pin_commit("2fdce1aaf542d930df92d394e646f9bafe4e41a3"), branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, @@ -105,7 +109,7 @@ packer.startup(function(use) local disabled_sessions = is_plugin_disabled("auto-session") use({ "folke/persistence.nvim", - commit = pin_commit('77cf5a6ee162013b97237ff25450080401849f85'), + commit = pin_commit("77cf5a6ee162013b97237ff25450080401849f85"), config = require("doom.modules.config.doom-persistence"), -- event = "VimEnter", disable = disabled_sessions, @@ -118,7 +122,7 @@ packer.startup(function(use) local disabled_dashboard = is_plugin_disabled("dashboard") use({ "glepnir/dashboard-nvim", - commit = pin_commit('ba98ab86487b8eda3b0934b5423759944b5f7ebd'), + commit = pin_commit("ba98ab86487b8eda3b0934b5423759944b5f7ebd"), config = require("doom.modules.config.doom-dashboard"), disable = disabled_dashboard, }) @@ -127,14 +131,14 @@ packer.startup(function(use) local disabled_doom_themes = is_plugin_disabled("doom-themes") use({ "GustavoPrietoP/doom-themes.nvim", - commit = pin_commit('03d417d3eab71c320744f8da22251715ba6cee53'), + commit = pin_commit("03d417d3eab71c320744f8da22251715ba6cee53"), disable = disabled_doom_themes, }) -- Development icons use({ "kyazdani42/nvim-web-devicons", - commit = pin_commit('ee101462d127ed6a5561ce9ce92bfded87d7d478'), + commit = pin_commit("ee101462d127ed6a5561ce9ce92bfded87d7d478"), module = "nvim-web-devicons", }) @@ -143,7 +147,7 @@ packer.startup(function(use) and require("doom.core.config").config.doom.use_netrw use({ "kyazdani42/nvim-tree.lua", - commit = pin_commit('c4ecf4416bc0a5f5b2ffacc18476a776953f9e03'), + commit = pin_commit("c4ecf4416bc0a5f5b2ffacc18476a776953f9e03"), requires = "nvim-web-devicons", config = require("doom.modules.config.doom-tree"), disable = disabled_tree, @@ -161,7 +165,7 @@ packer.startup(function(use) local disabled_ranger = is_plugin_disabled("ranger") use({ "francoiscabrol/ranger.vim", - commit = pin_commit('91e82debdf566dfaf47df3aef0a5fd823cedf41c'), + commit = pin_commit("91e82debdf566dfaf47df3aef0a5fd823cedf41c"), requires = "rbgrouleff/bclose.vim", disable = disabled_ranger, }) @@ -171,7 +175,7 @@ packer.startup(function(use) local disabled_statusline = is_plugin_disabled("statusline") use({ "NTBBloodbath/galaxyline.nvim", - commit = pin_commit('7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d'), + commit = pin_commit("7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d"), config = require("doom.modules.config.doom-eviline"), disable = disabled_statusline, }) @@ -181,7 +185,7 @@ packer.startup(function(use) local disabled_tabline = is_plugin_disabled("tabline") use({ "akinsho/bufferline.nvim", - commit = pin_commit('58e8d9b7c9aaf603f1093f808628b5a8f03493af'), + commit = pin_commit("58e8d9b7c9aaf603f1093f808628b5a8f03493af"), config = require("doom.modules.config.doom-bufferline"), disable = disabled_tabline, event = "BufWinEnter", @@ -192,7 +196,7 @@ packer.startup(function(use) local disabled_terminal = is_plugin_disabled("terminal") use({ "akinsho/toggleterm.nvim", - commit = pin_commit('9cdc5e9bb2affb25af5d4bda930738144193bd36'), + commit = pin_commit("9cdc5e9bb2affb25af5d4bda930738144193bd36"), config = require("doom.modules.config.doom-toggleterm"), disable = disabled_terminal, module = { "toggleterm", "toggleterm.terminal" }, @@ -204,7 +208,7 @@ packer.startup(function(use) local disabled_outline = is_plugin_disabled("symbols") use({ "simrat39/symbols-outline.nvim", - commit = pin_commit('552b67993ed959993279e0b0f8a1da9f3c5e6fc0'), + commit = pin_commit("552b67993ed959993279e0b0f8a1da9f3c5e6fc0"), config = require("doom.modules.config.doom-symbols"), disable = disabled_outline, cmd = { @@ -219,7 +223,7 @@ packer.startup(function(use) local disabled_minimap = is_plugin_disabled("minimap") use({ "wfxr/minimap.vim", - commit = pin_commit('5c54258d34b8ae4be70a8fbc09b400eb7be0bee8'), + commit = pin_commit("5c54258d34b8ae4be70a8fbc09b400eb7be0bee8"), disable = disabled_minimap, cmd = { "Minimap", @@ -234,7 +238,7 @@ packer.startup(function(use) local disabled_whichkey = is_plugin_disabled("which-key") use({ "folke/which-key.nvim", - commit = pin_commit('d3032b6d3e0adb667975170f626cb693bfc66baa'), + commit = pin_commit("d3032b6d3e0adb667975170f626cb693bfc66baa"), opt = true, config = require("doom.modules.config.doom-whichkey"), disable = disabled_whichkey, @@ -244,7 +248,7 @@ packer.startup(function(use) local disabled_show_registers = is_plugin_disabled("show_registers") use({ "tversteeg/registers.nvim", - commit = pin_commit('4d1f3525c6f9be4297e99e6aed515af3677d7241'), + commit = pin_commit("4d1f3525c6f9be4297e99e6aed515af3677d7241"), disable = disabled_show_registers, }) @@ -252,7 +256,7 @@ packer.startup(function(use) local disabled_zen = is_plugin_disabled("zen") use({ "Pocco81/TrueZen.nvim", - commit = pin_commit('508b977d71650da5c9243698614a9a1416f116d4'), + commit = pin_commit("508b977d71650da5c9243698614a9a1416f116d4"), config = require("doom.modules.config.doom-zen"), disable = disabled_zen, module = "true-zen", @@ -263,7 +267,7 @@ packer.startup(function(use) local disabled_illuminate = is_plugin_disabled("illuminated") use({ "RRethy/vim-illuminate", - commit = pin_commit('084b012ce5bc1bf302b69eb73562146afe0a9756'), + commit = pin_commit("084b012ce5bc1bf302b69eb73562146afe0a9756"), setup = function() vim.g.Illuminate_ftblacklist = { "help", @@ -285,19 +289,19 @@ packer.startup(function(use) -----]]--------------[[----- use({ "nvim-lua/plenary.nvim", - commit = pin_commit('96e821e8001c21bc904d3c15aa96a70c11462c5f'), + commit = pin_commit("96e821e8001c21bc904d3c15aa96a70c11462c5f"), module = "plenary", }) use({ "nvim-lua/popup.nvim", - commit = pin_commit('f91d80973f80025d4ed00380f2e06c669dfda49d'), + commit = pin_commit("f91d80973f80025d4ed00380f2e06c669dfda49d"), module = "popup", }) local disabled_telescope = is_plugin_disabled("telescope") use({ "nvim-telescope/telescope.nvim", - commit = pin_commit('3b9ac8edba8c1b4053c7f6ac8a4e78969cec66dd'), + commit = pin_commit("3b9ac8edba8c1b4053c7f6ac8a4e78969cec66dd"), cmd = "Telescope", module = "telescope", requires = { @@ -309,7 +313,7 @@ packer.startup(function(use) }) use({ "lazytanuki/nvim-mapper", - commit = pin_commit('e11e852bafa41a4a2c160fcd2d38779add423db9'), + commit = pin_commit("e11e852bafa41a4a2c160fcd2d38779add423db9"), config = function() local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep require("nvim-mapper").setup({ @@ -336,7 +340,7 @@ packer.startup(function(use) local disabled_gitsigns = is_plugin_disabled("gitsigns") use({ "lewis6991/gitsigns.nvim", - commit = pin_commit('d12442a924dc431467149f1fcb33e1c648116803'), + commit = pin_commit("d12442a924dc431467149f1fcb33e1c648116803"), config = require("doom.modules.config.doom-gitsigns"), disable = disabled_gitsigns, requires = "plenary.nvim", @@ -347,7 +351,7 @@ packer.startup(function(use) local disabled_neogit = is_plugin_disabled("neogit") use({ "TimUntersberger/neogit", - commit = pin_commit('f214200d71391dfc5763769ca1120e3aa5902c2d'), + commit = pin_commit("f214200d71391dfc5763769ca1120e3aa5902c2d"), config = function() require("neogit").setup({}) end, @@ -360,7 +364,7 @@ packer.startup(function(use) local disabled_lazygit = is_plugin_disabled("lazygit") use({ "kdheepak/lazygit.nvim", - commit = pin_commit('b1ebb53902a4f5d8c565f7485d4e57d937f89b91'), + commit = pin_commit("b1ebb53902a4f5d8c565f7485d4e57d937f89b91"), requires = "plenary.nvim", disable = disabled_lazygit, cmd = { "LazyGit", "LazyGitConfig" }, @@ -373,7 +377,7 @@ packer.startup(function(use) -- Built-in LSP Config use({ "neovim/nvim-lspconfig", - commit = pin_commit('9314d0a8da0f5ccd700d8a1fa699949a95971420'), + commit = pin_commit("9314d0a8da0f5ccd700d8a1fa699949a95971420"), config = require("doom.modules.config.doom-lspconfig"), disable = disabled_lsp, }) @@ -389,12 +393,12 @@ packer.startup(function(use) -- can be disabled to use your own completion plugin use({ "hrsh7th/nvim-cmp", - commit = pin_commit('669803b9ffb31b3963afb4f05c1622fc48ab65cb'), + commit = pin_commit("669803b9ffb31b3963afb4f05c1622fc48ab65cb"), wants = { "LuaSnip" }, requires = { { "L3MON4D3/LuaSnip", - commit = pin_commit('a54b21aee0423dbdce121c858ad6a88a58ef6e0f'), + commit = pin_commit("a54b21aee0423dbdce121c858ad6a88a58ef6e0f"), event = "BufReadPre", wants = "friendly-snippets", config = require("doom.modules.config.doom-luasnip"), @@ -403,7 +407,7 @@ packer.startup(function(use) }, { "windwp/nvim-autopairs", - commit = pin_commit('e6b1870cd2e319f467f99188f99b1c3efc5824d2'), + commit = pin_commit("e6b1870cd2e319f467f99188f99b1c3efc5824d2"), config = require("doom.modules.config.doom-autopairs"), disable = disabled_autopairs, event = "BufReadPre", @@ -415,31 +419,31 @@ packer.startup(function(use) }) use({ "hrsh7th/cmp-nvim-lua", - commit = pin_commit('d276254e7198ab7d00f117e88e223b4bd8c02d21'), + commit = pin_commit("d276254e7198ab7d00f117e88e223b4bd8c02d21"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-nvim-lsp", - commit = pin_commit('accbe6d97548d8d3471c04d512d36fa61d0e4be8'), + commit = pin_commit("accbe6d97548d8d3471c04d512d36fa61d0e4be8"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-path", - commit = pin_commit('97661b00232a2fe145fe48e295875bc3299ed1f7'), + commit = pin_commit("97661b00232a2fe145fe48e295875bc3299ed1f7"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-buffer", - commit = pin_commit('5dde5430757696be4169ad409210cf5088554ed6'), + commit = pin_commit("5dde5430757696be4169ad409210cf5088554ed6"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "saadparwaiz1/cmp_luasnip", - commit = pin_commit('16832bb50e760223a403ffa3042859845dd9ef9d'), + commit = pin_commit("16832bb50e760223a403ffa3042859845dd9ef9d"), disable = disabled_lsp, after = "nvim-cmp", }) @@ -447,7 +451,7 @@ packer.startup(function(use) -- Manage Language serverss with ease. use({ "MordechaiHadad/nvim-lspmanager", - commit = pin_commit('817998fb83ad8c05e9a315d0a6d25fddae56fe23'), + commit = pin_commit("817998fb83ad8c05e9a315d0a6d25fddae56fe23"), branch = "dev", config = require("doom.modules.config.doom-lspmanager"), disable = disabled_lsp, @@ -456,7 +460,7 @@ packer.startup(function(use) -- Show function signature when you type use({ "ray-x/lsp_signature.nvim", - commit = pin_commit('6469c55ce7afc8cdfb6d0b6b3fbfd331bcc26410'), + commit = pin_commit("6469c55ce7afc8cdfb6d0b6b3fbfd331bcc26410"), config = require("doom.modules.config.doom-lsp-signature"), after = "nvim-lspconfig", event = "InsertEnter", @@ -465,7 +469,7 @@ packer.startup(function(use) -- Setup for Lua development in Neovim use({ "folke/lua-dev.nvim", - commit = pin_commit('6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0'), + commit = pin_commit("6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0"), disable = disabled_lsp, module = "lua-dev", }) @@ -476,14 +480,14 @@ packer.startup(function(use) local disabled_dap = is_plugin_disabled("dap") use({ "mfussenegger/nvim-dap", - commit = pin_commit('dd778f65dc95323f781f291fb7c5bf3c17d057b1'), + commit = pin_commit("dd778f65dc95323f781f291fb7c5bf3c17d057b1"), disable = disabled_dap, event = "BufWinEnter", }) use({ "rcarriga/nvim-dap-ui", - commit = pin_commit('547635e7ba1dace13189386c98c3c7b064d585c4'), + commit = pin_commit("547635e7ba1dace13189386c98c3c7b064d585c4"), config = require("doom.modules.config.doom-dap-ui"), disable = disabled_dap, after = "nvim-dap", @@ -491,7 +495,7 @@ packer.startup(function(use) use({ "Pocco81/DAPInstall.nvim", - commit = pin_commit('b95e9ad32f1c45855b9965b545c86e82d8a827ac'), + commit = pin_commit("b95e9ad32f1c45855b9965b545c86e82d8a827ac"), config = require("doom.modules.config.doom-dap-install"), disable = disabled_dap, after = "nvim-dap", @@ -505,7 +509,7 @@ packer.startup(function(use) local disabled_suda = is_plugin_disabled("suda") use({ "lambdalisue/suda.vim", - commit = pin_commit('0290c93c148a14eab2b661a1933003d86436f6ec'), + commit = pin_commit("0290c93c148a14eab2b661a1933003d86436f6ec"), disable = disabled_suda, cmd = { "SudaRead", "SudaWrite" }, }) @@ -515,7 +519,7 @@ packer.startup(function(use) local disabled_formatter = is_plugin_disabled("formatter") use({ "lukas-reineke/format.nvim", - commit = pin_commit('c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7'), + commit = pin_commit("c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7"), config = require("doom.modules.config.doom-format"), disable = disabled_formatter, cmd = { "Format", "FormatWrite" }, @@ -525,7 +529,7 @@ packer.startup(function(use) local disabled_linter = is_plugin_disabled("linter") use({ "mfussenegger/nvim-lint", - commit = pin_commit('b1467a01f48736b309e0e274c032b69051740c08'), + commit = pin_commit("b1467a01f48736b309e0e274c032b69051740c08"), config = require("doom.modules.config.doom-lint"), disable = disabled_linter, module = "lint", @@ -535,7 +539,7 @@ packer.startup(function(use) local disabled_indent_lines = is_plugin_disabled("indentlines") use({ "lukas-reineke/indent-blankline.nvim", - commit = pin_commit('252797e7a96fa4f7c6ccdcdff3f488fdd48b1d09'), + commit = pin_commit("252797e7a96fa4f7c6ccdcdff3f488fdd48b1d09"), config = require("doom.modules.config.doom-blankline"), disable = disabled_indent_lines, event = "ColorScheme", @@ -545,7 +549,7 @@ packer.startup(function(use) local disabled_editorconfig = is_plugin_disabled("editorconfig") use({ "editorconfig/editorconfig-vim", - commit = pin_commit('3078cd10b28904e57d878c0d0dab42aa0a9fdc89'), + commit = pin_commit("3078cd10b28904e57d878c0d0dab42aa0a9fdc89"), disable = disabled_editorconfig, }) @@ -554,7 +558,7 @@ packer.startup(function(use) local disabled_kommentary = is_plugin_disabled("kommentary") use({ "b3nj5m1n/kommentary", - commit = pin_commit('8f1cd74ad28de7d7c4fda5d8e8557ff240904b42'), + commit = pin_commit("8f1cd74ad28de7d7c4fda5d8e8557ff240904b42"), disable = disabled_kommentary, event = "BufWinEnter", }) @@ -563,13 +567,13 @@ packer.startup(function(use) -- Lua 5.1 docs use({ "milisims/nvim-luaref", - commit = pin_commit('dc40d606549db7df1a6e23efa743c90c178333d4'), + commit = pin_commit("dc40d606549db7df1a6e23efa743c90c178333d4"), disable = disabled_contrib, }) -- LibUV docs use({ "nanotee/luv-vimdocs", - commit = pin_commit('ddcd5ef0100e66da0d4a709391a9b3e9453f19a1'), + commit = pin_commit("ddcd5ef0100e66da0d4a709391a9b3e9453f19a1"), disable = disabled_contrib, }) @@ -580,7 +584,7 @@ packer.startup(function(use) local disabled_colorizer = is_plugin_disabled("colorizer") use({ "norcalli/nvim-colorizer.lua", - commit = pin_commit('36c610a9717cc9ec426a07c8e6bf3b3abcb139d6'), + commit = pin_commit("36c610a9717cc9ec426a07c8e6bf3b3abcb139d6"), config = require("doom.modules.config.doom-colorizer"), disable = disabled_colorizer, event = "ColorScheme", @@ -591,7 +595,7 @@ packer.startup(function(use) local disabled_restclient = is_plugin_disabled("restclient") use({ "NTBBloodbath/rest.nvim", - commit = pin_commit('5130e59f680df56f22bd8cc41da422f9a05580c5'), + commit = pin_commit("5130e59f680df56f22bd8cc41da422f9a05580c5"), requires = "plenary.nvim", config = function() require("rest-nvim").setup() @@ -603,7 +607,7 @@ packer.startup(function(use) local disabled_range_highlight = is_plugin_disabled("range-highlight") use({ "winston0410/range-highlight.nvim", - commit = pin_commit('8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9'), + commit = pin_commit("8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9"), requires = { { "winston0410/cmd-parser.nvim", module = "cmd-parser" }, }, @@ -617,7 +621,7 @@ packer.startup(function(use) local disabled_firenvim = is_plugin_disabled("firenvim") use({ "glacambre/firenvim", - commit = pin_commit('eb3abef4520d17dbd9957f5d23ada74b853133e4'), + commit = pin_commit("eb3abef4520d17dbd9957f5d23ada74b853133e4"), disable = disabled_firenvim, run = function() vim.fn["firenvim#install"](0) @@ -628,7 +632,7 @@ packer.startup(function(use) local disabled_todo = is_plugin_disabled("todo_comments") use({ "folke/todo-comments.nvim", - commit = pin_commit('9983edc5ef38c7a035c17c85f60ee13dbd75dcc8'), + commit = pin_commit("9983edc5ef38c7a035c17c85f60ee13dbd75dcc8"), requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), disable = disabled_todo, @@ -638,7 +642,7 @@ packer.startup(function(use) local disabled_trouble = is_plugin_disabled("trouble") use({ "folke/trouble.nvim", - commit = pin_commit('756f09de113a775ab16ba6d26c090616b40a999d'), + commit = pin_commit("756f09de113a775ab16ba6d26c090616b40a999d"), cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" }, requires = "kyazdani42/nvim-web-devicons", config = require("doom.modules.config.doom-trouble"), @@ -648,7 +652,7 @@ packer.startup(function(use) local disabled_superman = is_plugin_disabled("superman") use({ "jez/vim-superman", - commit = pin_commit('19d307446576d9118625c5d9d3c7a4c9bec5571a'), + commit = pin_commit("19d307446576d9118625c5d9d3c7a4c9bec5571a"), cmd = "SuperMan", disable = disabled_superman, }) From 0473ee5ca07d713a7f56f6306483e9b3973e6484 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Nov 2021 22:16:16 +1100 Subject: [PATCH 235/290] Fixed install/uninstall fighting between LSPs and added support for multiple LSP overrides --- docs/getting_started.md | 16 +++- lua/doom/modules/config/doom-lspmanager.lua | 94 ++++++++++----------- 2 files changed, 56 insertions(+), 54 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 5fa0ff4ba..b2827c874 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -504,7 +504,7 @@ can use the packer's `config` field, e.g. [Language Server Protocols](https://microsoft.github.io/language-server-protocol/) is installed as a plugin. To easily install language servers and without having to do it system-wide or having to -manually configure servers, Doom Nvim makes use of [kabouzeid/nvim-lspinstall](https://github.com/kabouzeid/nvim-lspinstall). +manually configure servers, Doom Nvim makes use of [MordechaiHadad/nvim-lspmanager](https://github.com/MordechaiHadad/nvim-lspmanager). To enable the language server for a certain programming language and automatically install it, just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`, @@ -518,10 +518,18 @@ local doom = { } ``` -> **NOTE**: You can see a list of currently supported languages at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall#bundled-installers). +You can also override or add additional LSPs for a language using the `+lsp(OVERRIDE)` syntax. -> **NOTE**: If you want a different language server, you can override the name using the following syntax `+lsp(OVERRIDE_LSP_NAME)` -Where `OVERRIDE_LSP_NAME` is a different option at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall). +```lua +local doom = { + langs = { + 'html +lsp(html, tailwindcss)' -- Enable extra LSPs for a language + 'vue +lsp(volar)' -- Or override the default + } +} +``` + +> **NOTE**: You can see a list of currently supported languages at [bundled installers](https://github.com/MordechaiHadad/nvim-lspmanager#supported-language-servers). ### Binding keys diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index e762f4570..f817170fe 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -61,64 +61,57 @@ return function() local installed_servers = lspmanager.installed_servers() local available_servers = lspmanager.available_servers() + print("Installed servers") + for _, s in ipairs(installed_servers) do + print(s) + end + local modules = require("doom.core.config.modules").modules local langs = modules.langs + -- Find all LSPs that need to be installed + local ensure_installed = {} for _, lang in ipairs(langs) do - local lang_str = lang - lang = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") - if utils.has_key(servers, lang) then - local lsp_name = servers[lang][1] - - -- Allow overriding of LSP using `+lsp(OVERRIDE_LSP_NAME)` syntax - local lsp_override = lang_str:match("+lsp%((%a+)%)") - if lsp_override ~= nil then - lsp_name = lsp_override - - -- Uninstall the default LSP to avoid conflicts - if utils.has_value(installed_servers, lsp_name) then - log.warn( - "Uninstalling " - .. lang - .. " (" - .. lsp_name - .. ") " - .. " LSP due to " - .. lsp_override - .. " LSP being supplied in config. If you want to revert back to " - .. lsp_name - .. " LSP you will have to manually uninstall " - .. lsp_override - .. "." - ) - lspmanager.uninstall_server(lsp_name) - end - end - -- If the +lsp flag exists and the language server is not installed yet - if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lsp_name)) then - -- Try to install the server only if there is a server available for - -- the language, oterwise raise a warning - if utils.has_value(available_servers, lsp_name) then - lspmanager.install(lsp_name) - else - if lsp_override ~= nil then - log.warn( - 'The LSP override supplied in "' - .. lang_str - .. '" does not exist, please remove "(' - .. lsp_name - .. ')"' - ) + -- Lang name used for key in servers table + local lang_name = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + -- Get LSP override +lsp() if it exists + local lsp_override = lang:match("+lsp%((.+)%)") + -- Array of lsps to ensure are installed + local lang_lsps = lsp_override ~= nil + and vim.split(lsp_override, ',') + or servers[lang_name] ~= nil + and servers[lang_name] + or nil + + local should_install_lsp = lang:find('+lsp') + + -- Save all lsps to ensure_installed + if should_install_lsp then + if lang_lsps ~= nil then + for _, lsp_name in ipairs(lang_lsps) do + local trimmed_lsp_name = vim.trim(lsp_name) + if utils.has_value(ensure_installed, trimmed_lsp_name) == false then + table.insert(ensure_installed, trimmed_lsp_name) end end + else + log.error("The language \"" .. lang .. '\" does not have an LSP, please remove the "+lsp" flag.') end - else - if lang_str:find("%+lsp") then - log.warn( - "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' - ) - end + end + end + + -- Uninstall all LSPs that shouldn't be installed + for i, server in ipairs(available_servers) do + if utils.has_value(ensure_installed, server) == false and utils.has_value(installed_servers, server) then + lspmanager.uninstall(server) + end + end + + -- Install all LSPs that should be installed + for i, server in ipairs(ensure_installed) do + if utils.has_value(installed_servers, server) == false then + lspmanager.install(server) end end end @@ -160,6 +153,7 @@ return function() local installed_servers = lspmanager.installed_servers() for _, server in pairs(installed_servers) do + print('Setting up server '..server) -- Configure sumneko for neovim lua development if server == "sumneko_lua" then nvim_lsp.sumneko_lua.setup(lua_lsp) From 11de4908d486f441a4328d035da2d0d11d7239bc Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Nov 2021 22:17:57 +1100 Subject: [PATCH 236/290] Cleaned up print statements --- lua/doom/modules/config/doom-lspmanager.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index f817170fe..6dfb4aac0 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -61,11 +61,6 @@ return function() local installed_servers = lspmanager.installed_servers() local available_servers = lspmanager.available_servers() - print("Installed servers") - for _, s in ipairs(installed_servers) do - print(s) - end - local modules = require("doom.core.config.modules").modules local langs = modules.langs @@ -153,7 +148,6 @@ return function() local installed_servers = lspmanager.installed_servers() for _, server in pairs(installed_servers) do - print('Setting up server '..server) -- Configure sumneko for neovim lua development if server == "sumneko_lua" then nvim_lsp.sumneko_lua.setup(lua_lsp) From 0e254f54e68cbfb4bba81cfc3bff35315152012e Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Nov 2021 23:06:24 +1100 Subject: [PATCH 237/290] Addressed linter issues and added +lsp to config --- lua/doom/modules/config/doom-lspmanager.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index 6dfb4aac0..37858532b 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -24,6 +24,7 @@ return function() elixir = { "elixirls" }, haskell = { "hls" }, vue = { "vuels" }, + config = { "jsonls" } } -- Snippets support @@ -73,10 +74,10 @@ return function() -- Get LSP override +lsp() if it exists local lsp_override = lang:match("+lsp%((.+)%)") -- Array of lsps to ensure are installed - local lang_lsps = lsp_override ~= nil + local lang_lsps = lsp_override ~= nil and vim.split(lsp_override, ',') - or servers[lang_name] ~= nil - and servers[lang_name] + or servers[lang_name] ~= nil + and servers[lang_name] or nil local should_install_lsp = lang:find('+lsp') @@ -97,14 +98,14 @@ return function() end -- Uninstall all LSPs that shouldn't be installed - for i, server in ipairs(available_servers) do + for _, server in ipairs(available_servers) do if utils.has_value(ensure_installed, server) == false and utils.has_value(installed_servers, server) then lspmanager.uninstall(server) end end -- Install all LSPs that should be installed - for i, server in ipairs(ensure_installed) do + for _, server in ipairs(ensure_installed) do if utils.has_value(installed_servers, server) == false then lspmanager.install(server) end From 329c19f25fa1f385a72fb8e0963a49c1cddac7f0 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 4 Nov 2021 16:14:20 +1100 Subject: [PATCH 238/290] Only uninstall default LSPs for LSP manager --- lua/doom/modules/config/doom-lspmanager.lua | 22 +++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index 37858532b..85b58098a 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -60,7 +60,13 @@ return function() -- Load langs from doom_modules and install servers with +lsp flag local function install_servers() local installed_servers = lspmanager.installed_servers() - local available_servers = lspmanager.available_servers() + -- Flatten the array of default servers. Default servers will be automatically uninstalled if no +lsp flag is provided. + local default_servers = {} + for _, lang_servers in pairs(servers) do + for _, lsp_name in ipairs(lang_servers) do + table.insert(default_servers, lsp_name) + end + end local modules = require("doom.core.config.modules").modules local langs = modules.langs @@ -97,17 +103,17 @@ return function() end end - -- Uninstall all LSPs that shouldn't be installed - for _, server in ipairs(available_servers) do - if utils.has_value(ensure_installed, server) == false and utils.has_value(installed_servers, server) then - lspmanager.uninstall(server) + -- Uninstall all (default) LSPs that shouldn't be installed + for _, lsp_name in ipairs(default_servers) do + if utils.has_value(ensure_installed, lsp_name) == false and utils.has_value(installed_servers, lsp_name) then + lspmanager.uninstall(lsp_name) end end -- Install all LSPs that should be installed - for _, server in ipairs(ensure_installed) do - if utils.has_value(installed_servers, server) == false then - lspmanager.install(server) + for _, lsp_name in ipairs(ensure_installed) do + if utils.has_value(installed_servers, lsp_name) == false then + lspmanager.install(lsp_name) end end end From 522bb8edb5c95e13605d5d77e148b969e2145feb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 4 Nov 2021 05:23:44 +0000 Subject: [PATCH 239/290] chore: format source code --- lua/doom/modules/config/doom-lspmanager.lua | 27 ++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lspmanager.lua index 85b58098a..36c88e450 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lspmanager.lua @@ -24,7 +24,7 @@ return function() elixir = { "elixirls" }, haskell = { "hls" }, vue = { "vuels" }, - config = { "jsonls" } + config = { "jsonls" }, } -- Snippets support @@ -74,19 +74,19 @@ return function() -- Find all LSPs that need to be installed local ensure_installed = {} for _, lang in ipairs(langs) do - -- Lang name used for key in servers table - local lang_name = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + local lang_name = lang + :gsub("%s+%+lsp(%(%a+%))", "") + :gsub("%s+%+lsp", "") + :gsub("%s+%+debug", "") -- Get LSP override +lsp() if it exists local lsp_override = lang:match("+lsp%((.+)%)") -- Array of lsps to ensure are installed - local lang_lsps = lsp_override ~= nil - and vim.split(lsp_override, ',') - or servers[lang_name] ~= nil - and servers[lang_name] - or nil + local lang_lsps = lsp_override ~= nil and vim.split(lsp_override, ",") + or servers[lang_name] ~= nil and servers[lang_name] + or nil - local should_install_lsp = lang:find('+lsp') + local should_install_lsp = lang:find("+lsp") -- Save all lsps to ensure_installed if should_install_lsp then @@ -98,14 +98,19 @@ return function() end end else - log.error("The language \"" .. lang .. '\" does not have an LSP, please remove the "+lsp" flag.') + log.error( + 'The language "' .. lang .. '" does not have an LSP, please remove the "+lsp" flag.' + ) end end end -- Uninstall all (default) LSPs that shouldn't be installed for _, lsp_name in ipairs(default_servers) do - if utils.has_value(ensure_installed, lsp_name) == false and utils.has_value(installed_servers, lsp_name) then + if + utils.has_value(ensure_installed, lsp_name) == false + and utils.has_value(installed_servers, lsp_name) + then lspmanager.uninstall(lsp_name) end end From 71483afac0b844fdb54650140d8a966b3cba6b04 Mon Sep 17 00:00:00 2001 From: Benjamin Valpey Date: Thu, 4 Nov 2021 17:11:58 -0400 Subject: [PATCH 240/290] feat: added debugging keybindings (cherry-pick) --- lua/doom/extras/keybindings/leader.lua | 29 +++++++++++++++++++++-- lua/doom/modules/config/doom-whichkey.lua | 3 +++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index cb5ec7ccc..62f878a93 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -742,7 +742,32 @@ mappings.map( ) -- debugging -mappings.map( +utils.map( + "n", + "cdb", + "lua require('dap').toggle_breakpoint()", + opts, + "DAP", + "dap_toggle_brkpt", + "Toggle breakpoint on current line" +) +utils.map( + "n", + "cdc", + "lua require('dap').toggle_breakpoint()", + opts, + "DAP", + "dap_continue", + "Start (or continue) a debug session" +) +utils.map( + "n", + "cdd", + "lua require('dap').disconnect()", + "DAP", + "dap_disconnect", + "End debugging session") +utils.map( "n", "cde", "lua require('dapui').eval()", @@ -751,7 +776,7 @@ mappings.map( "dap_eval", "Evaluate word under cursor" ) -mappings.map( +utils.map( "v", "cds", "lua require('dapui').eval()", diff --git a/lua/doom/modules/config/doom-whichkey.lua b/lua/doom/modules/config/doom-whichkey.lua index 6d347bd46..75dc99d46 100644 --- a/lua/doom/modules/config/doom-whichkey.lua +++ b/lua/doom/modules/config/doom-whichkey.lua @@ -98,6 +98,9 @@ return function() }, ["d"] = { name = "+debug", + ["b"] = { "Toggle breakpoint on current line"}, + ["c"] = { "Start (or continue) a debug session" }, + ["t"] = { "Terminate debug session"}, ["e"] = { "Evaluate word under cursor" }, ["s"] = { "Evaluate selection" }, }, From 5b6e66262952b795b910bf4866a4f73efa56b74a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 5 Nov 2021 15:28:14 +0000 Subject: [PATCH 241/290] chore: format source code --- lua/doom/extras/keybindings/leader.lua | 3 ++- lua/doom/modules/config/doom-whichkey.lua | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index 62f878a93..ec0f45e43 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -766,7 +766,8 @@ utils.map( "lua require('dap').disconnect()", "DAP", "dap_disconnect", - "End debugging session") + "End debugging session" +) utils.map( "n", "cde", diff --git a/lua/doom/modules/config/doom-whichkey.lua b/lua/doom/modules/config/doom-whichkey.lua index 75dc99d46..5f6397459 100644 --- a/lua/doom/modules/config/doom-whichkey.lua +++ b/lua/doom/modules/config/doom-whichkey.lua @@ -98,9 +98,9 @@ return function() }, ["d"] = { name = "+debug", - ["b"] = { "Toggle breakpoint on current line"}, + ["b"] = { "Toggle breakpoint on current line" }, ["c"] = { "Start (or continue) a debug session" }, - ["t"] = { "Terminate debug session"}, + ["t"] = { "Terminate debug session" }, ["e"] = { "Evaluate word under cursor" }, ["s"] = { "Evaluate selection" }, }, From d1d77d72724fb328e427c490037d029f7270093e Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 5 Nov 2021 13:37:35 -0400 Subject: [PATCH 242/290] fix(keybindings): Fixed missing 'opts' param in keybinding (cherry-pick of #227) --- lua/doom/extras/keybindings/leader.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua index ec0f45e43..7fd5b5120 100644 --- a/lua/doom/extras/keybindings/leader.lua +++ b/lua/doom/extras/keybindings/leader.lua @@ -742,7 +742,7 @@ mappings.map( ) -- debugging -utils.map( +mappings.map( "n", "cdb", "lua require('dap').toggle_breakpoint()", @@ -751,24 +751,25 @@ utils.map( "dap_toggle_brkpt", "Toggle breakpoint on current line" ) -utils.map( +mappings.map( "n", "cdc", - "lua require('dap').toggle_breakpoint()", + "lua require('dap').continue()", opts, "DAP", "dap_continue", "Start (or continue) a debug session" ) -utils.map( +mappings.map( "n", "cdd", "lua require('dap').disconnect()", + opts, "DAP", "dap_disconnect", "End debugging session" ) -utils.map( +mappings.map( "n", "cde", "lua require('dapui').eval()", @@ -777,7 +778,7 @@ utils.map( "dap_eval", "Evaluate word under cursor" ) -utils.map( +mappings.map( "v", "cds", "lua require('dapui').eval()", From d72632f29b84e47ee8a4ed6f773206dfb339d8a7 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Fri, 5 Nov 2021 15:20:49 -0400 Subject: [PATCH 243/290] fix: doom-one being applied when other colorscheme is configured --- lua/doom/core/config/ui.lua | 56 +++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua index 1cdd5b39c..bf8679c2b 100644 --- a/lua/doom/core/config/ui.lua +++ b/lua/doom/core/config/ui.lua @@ -39,30 +39,32 @@ end vim.cmd("highlight WhichKeyFloat guibg=" .. config.doom.whichkey_bg) -- Set doom-one colorscheme settings -require("colors.doom-one").setup({ - cursor_coloring = config.doom.doom_one.cursor_coloring, - terminal_colors = config.doom.doom_one.terminal_colors, - italic_comments = config.doom.doom_one.italic_comments, - enable_treesitter = config.doom.doom_one.enable_treesitter, - transparent_background = config.doom.doom_one.transparent_background, - pumblend = { - enable = true, - transparency_amount = config.doom.complete_transparency, - }, - plugins_integrations = { - neorg = true, - barbar = false, - bufferline = true, - gitgutter = false, - gitsigns = true, - telescope = config.doom.doom_one.telescope_highlights, - neogit = true, - nvim_tree = true, - dashboard = true, - startify = false, - whichkey = true, - indent_blankline = true, - vim_illuminate = true, - lspsaga = false, - }, -}) +if config.doom.colorscheme == "doom-one" then + require("colors.doom-one").setup({ + cursor_coloring = config.doom.doom_one.cursor_coloring, + terminal_colors = config.doom.doom_one.terminal_colors, + italic_comments = config.doom.doom_one.italic_comments, + enable_treesitter = config.doom.doom_one.enable_treesitter, + transparent_background = config.doom.doom_one.transparent_background, + pumblend = { + enable = true, + transparency_amount = config.doom.complete_transparency, + }, + plugins_integrations = { + neorg = true, + barbar = false, + bufferline = true, + gitgutter = false, + gitsigns = true, + telescope = config.doom.doom_one.telescope_highlights, + neogit = true, + nvim_tree = true, + dashboard = true, + startify = false, + whichkey = true, + indent_blankline = true, + vim_illuminate = true, + lspsaga = false, + }, + }) +end From 098c1b13dceb58f066edfa50dc3e9c0a58de01ba Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Mon, 8 Nov 2021 17:16:01 -0400 Subject: [PATCH 244/290] feat!: add `enable_numbering` option --- doom_config.lua | 8 +++++++- lua/doom/core/config/init.lua | 8 +++++++- lua/doom/core/settings/init.lua | 12 +++++++----- lua/doom/extras/autocmds/init.lua | 28 +++++++++++++++------------- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index d023a331b..a80ca9b51 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -159,7 +159,13 @@ M.config = { -- @default = true expand_tabs = true, - -- Set numbering + -- Set numbering + -- false : Disable number lines + -- true : Enable number lines + -- @default = true + enable_numbering = true, + + -- Set numbering style -- false : Shows absolute number lines -- true : Shows relative number lines -- @default = true diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index d7c84a49d..c7a31f8e8 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -161,7 +161,13 @@ config.config = { -- @default = true expand_tabs = true, - -- Set numbering + -- Set numbering + -- false : Disable number lines + -- true : Enable number lines + -- @default = true + enable_numbering = true, + + -- Set numbering style -- false : Shows absolute number lines -- true : Shows relative number lines -- @default = true diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index 5576c83e2..8294dff2a 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -107,11 +107,13 @@ settings.load_default_options = function() end -- Set numbering - if config.doom.relative_num then - vim.opt.number = true - vim.opt.relativenumber = true - else - vim.opt.number = true + if config.doom.enable_numbering then + if config.doom.relative_num then + vim.opt.number = true + vim.opt.relativenumber = true + else + vim.opt.number = true + end end -- Enable winwidth diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 707deccc1..826fea5af 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -57,19 +57,21 @@ local autocmds = { }, } --- Set relative numbers -if config.doom.relative_num then - table.insert(autocmds["doom_core"], { - "BufEnter,WinEnter", - "*", - "if &nu | set rnu | endif", - }) -else - table.insert(autocmds["doom_core"], { - "BufEnter,WinEnter", - "*", - "if &nu | set nornu | endif", - }) +-- Set numbering +if config.doom.enable_numbering then + if config.doom.relative_num then + table.insert(autocmds["doom_core"], { + "BufEnter,WinEnter", + "*", + "if &nu | set rnu | endif", + }) + else + table.insert(autocmds["doom_core"], { + "BufEnter,WinEnter", + "*", + "if &nu | set nornu | endif", + }) + end end -- Install plugins on launch From 5f239b6c4e6c9f66edbd5ecb18807324a366ff50 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 8 Nov 2021 21:16:25 +0000 Subject: [PATCH 245/290] chore: format source code --- doom_config.lua | 2 +- lua/doom/core/config/init.lua | 2 +- lua/doom/modules/built-in/info/init.lua | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index a80ca9b51..cc5112bea 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -159,7 +159,7 @@ M.config = { -- @default = true expand_tabs = true, - -- Set numbering + -- Set numbering -- false : Disable number lines -- true : Enable number lines -- @default = true diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index c7a31f8e8..90f109ab5 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -161,7 +161,7 @@ config.config = { -- @default = true expand_tabs = true, - -- Set numbering + -- Set numbering -- false : Disable number lines -- true : Enable number lines -- @default = true diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua index a15fa19a8..1f25a142c 100644 --- a/lua/doom/modules/built-in/info/init.lua +++ b/lua/doom/modules/built-in/info/init.lua @@ -316,8 +316,7 @@ local function get_buffer_info() "%s• %s%s", padding_level[2], "Is parser installed?" .. padding_level[2]:rep(3), - utils.has_value(require("nvim-treesitter.info").installed_parsers(), buffer_ft) - and "yes" + utils.has_value(require("nvim-treesitter.info").installed_parsers(), buffer_ft) and "yes" or "no" ), string.format( From 7f714d06a85c7b86fe683d56738bde2ab27a0023 Mon Sep 17 00:00:00 2001 From: hjalmar jakobsson Date: Tue, 9 Nov 2021 15:06:25 -0500 Subject: [PATCH 246/290] feat(mappings): user defind esc sequences --- doom_config.lua | 4 ++++ lua/doom/core/config/init.lua | 4 ++++ lua/doom/extras/keybindings/core.lua | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index cc5112bea..8ac79ad28 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -233,6 +233,10 @@ M.config = { completion = true, }, + -- sequences used for escaping insert mode + -- @default = { 'jk', 'kj' } + escape_sequences = { 'jk', 'kj' }, + -- Disable or enable Doom autocommands, this can break some configuration options (they will stop working) -- e.g. preserve_edit_pos or autosave -- diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 90f109ab5..1c9f76ebe 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -235,6 +235,10 @@ config.config = { completion = true, }, + -- sequences used for escaping insert mode + -- @default = { 'jk', 'kj' } + escape_sequences = { 'jk', 'kj' }, + -- Disable or enable Doom autocommands, this can break some configuration options (they will stop working) -- e.g. preserve_edit_pos or autosave -- diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua index f7eae77ec..1338709db 100644 --- a/lua/doom/extras/keybindings/core.lua +++ b/lua/doom/extras/keybindings/core.lua @@ -44,8 +44,9 @@ end ---[[-----------------]]--- -- Escape Remaps -- ---]]-----------------[[--- -mappings.map("i", "jk", "", opts, "Editor", "exit_insert", "Exit insert mode") -mappings.map("i", "kj", "", opts, "Editor", "exit_insert_alt", "Exit insert mode") +for _, esc_seq in pairs(config.doom.escape_sequences) do + mappings.map("i", esc_seq, "", opts, "Editor", "exit_insert" .. esc_seq, "Exit insert mode `" .. esc_seq .. "`") +end ---[[-----------------]]--- -- Make inclusive -- From 73c89a28e0b150764f9fd69432b2ccc791f118bb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 23:36:44 +0000 Subject: [PATCH 247/290] chore: format source code --- doom_config.lua | 4 ++-- lua/doom/core/config/init.lua | 4 ++-- lua/doom/extras/keybindings/core.lua | 10 +++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 8ac79ad28..9710cbca4 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -233,9 +233,9 @@ M.config = { completion = true, }, - -- sequences used for escaping insert mode + -- sequences used for escaping insert mode -- @default = { 'jk', 'kj' } - escape_sequences = { 'jk', 'kj' }, + escape_sequences = { "jk", "kj" }, -- Disable or enable Doom autocommands, this can break some configuration options (they will stop working) -- e.g. preserve_edit_pos or autosave diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 1c9f76ebe..3dec06fbc 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -235,9 +235,9 @@ config.config = { completion = true, }, - -- sequences used for escaping insert mode + -- sequences used for escaping insert mode -- @default = { 'jk', 'kj' } - escape_sequences = { 'jk', 'kj' }, + escape_sequences = { "jk", "kj" }, -- Disable or enable Doom autocommands, this can break some configuration options (they will stop working) -- e.g. preserve_edit_pos or autosave diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua index 1338709db..af2daea16 100644 --- a/lua/doom/extras/keybindings/core.lua +++ b/lua/doom/extras/keybindings/core.lua @@ -45,7 +45,15 @@ end -- Escape Remaps -- ---]]-----------------[[--- for _, esc_seq in pairs(config.doom.escape_sequences) do - mappings.map("i", esc_seq, "", opts, "Editor", "exit_insert" .. esc_seq, "Exit insert mode `" .. esc_seq .. "`") + mappings.map( + "i", + esc_seq, + "", + opts, + "Editor", + "exit_insert" .. esc_seq, + "Exit insert mode `" .. esc_seq .. "`" + ) end ---[[-----------------]]--- From ce5438ba5694d4154a5d984ab03e2a0fd96c3cf4 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Tue, 9 Nov 2021 23:41:55 +1100 Subject: [PATCH 248/290] Implement nvim-lsp-installer install/uninstall, added more laps, defered startup, improve user feedback --- README.md | 1 + contribute/Dockerfile | 3 + docs/modules.md | 57 ++++- ...-lspmanager.lua => doom-lsp-installer.lua} | 201 +++++++++++------- lua/doom/modules/init.lua | 7 +- 5 files changed, 184 insertions(+), 85 deletions(-) rename lua/doom/modules/config/{doom-lspmanager.lua => doom-lsp-installer.lua} (56%) diff --git a/README.md b/README.md index 1f6397f27..442f2a127 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Its design is guided by these mantras: - GNU `find` - [ripgrep] 11.0+ or [fd] 7.3.0+ (optional but highly recommended, improves file indexing performance for some commands) - `nodejs` and `npm` (optional, required to use some Language Server Protocols) +- `wget`, `unzip` (optional, required for auto installing LSPs) Doom is comprised of [~40 optional plugins][modules], some of which may have additional dependencies. [Please visit their documentation][modules]. diff --git a/contribute/Dockerfile b/contribute/Dockerfile index 373e78188..abea988a9 100644 --- a/contribute/Dockerfile +++ b/contribute/Dockerfile @@ -24,6 +24,9 @@ RUN pacman -Sy neovim --noconfirm # Install runtime dependencies of doom-nvim RUN pacman -Sy ripgrep nodejs-lts-fermium npm git bash gcc jq --noconfirm +# Required for nvim-lsp-installer +RUN pacman -Sy wget unzip + # Required for watching Doom-nvim-contrib for changes RUN npm i -g chokidar-cli diff --git a/docs/modules.md b/docs/modules.md index e00d58804..9b485fd89 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -118,11 +118,26 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes, by using TSServer. - DAP client: yes. +- **PHP** + - PHP support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: no. - **typescript** - TypeScript support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - - DAP client: no. + - DAP client: yes (via javascript). +- **Svelte** + - Svelte support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: yes (via javascript). +- **Vue** + - Vue support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: yes (via javascript). #### Scripting @@ -131,6 +146,11 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. +- **clojure** + - Clojure support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: no. - **elixir** - Elixir support. - TreeSitter based syntax highlighting: yes. @@ -140,6 +160,11 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no (it has but isn't supported by Doom _yet_, requires extra setup). +- **powershell** + - PowerShell support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: no. - **python** - Python support. - TreeSitter based syntax highlighting: yes. @@ -158,6 +183,11 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: yes (not supported _yet_ by Doom for automatic installation). +- **c_sharp (C#)** + - C# support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: no. - **go** - Golang support. - TreeSitter based syntax highlighting: yes. @@ -173,6 +203,11 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. +- **kotlin** + - Kotlin support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: no. - **rust** - Rust support. - TreeSitter based syntax highlighting: yes. @@ -181,10 +216,22 @@ The currently available flags are the following: #### Configs & DevOps -- **config** - - Configuration languages support (JSON, YAML, TOML). +- **json**/**json5** + - JSON support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. +- **yaml** + - YAML support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. +- **toml** + - TOML support. + - TreeSitter based syntax highlighting: yes. + - LSP: no. +- **xml** + - XML support. - TreeSitter based syntax highlighting: yes. - - LSP: not yet. + - LSP: no. - **dockerfile** - Docker support. - TreeSitter based syntax highlighting: yes. @@ -254,7 +301,7 @@ changes for you! [lsp]: https://github.com/neovim/nvim-lspconfig [compe]: https://github.com/hrsh7th/nvim-compe -[lspinstall]: https://github.com/kabouzeid/nvim-lspinstall +[lsp-installer]: https://github.com/williamboman/nvim-lsp-installer [LuaSnip]: https://github.com/L3MON4D3/LuaSnip [friendly-snippets]: https://github.com/rafamadriz/friendly-snippets diff --git a/lua/doom/modules/config/doom-lspmanager.lua b/lua/doom/modules/config/doom-lsp-installer.lua similarity index 56% rename from lua/doom/modules/config/doom-lspmanager.lua rename to lua/doom/modules/config/doom-lsp-installer.lua index 36c88e450..54ac656e1 100644 --- a/lua/doom/modules/config/doom-lspmanager.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -1,30 +1,63 @@ return function() local log = require("doom.extras.logging") local utils = require("doom.utils") - local nvim_lsp = require("lspconfig") - local lspmanager = require("lspmanager") local is_plugin_disabled = require("doom.utils").is_plugin_disabled + -- Commented out defualt servers don't have treesitter configs local servers = { lua = { "sumneko_lua" }, + ansible = { 'ansiblels' }, angular = { "angularls" }, bash = { "bashls" }, + -- bicep = { 'bicep' }, + c_sharp = { 'omnisharp' }, c = { "clangd" }, cpp = { "clangd" }, - go = { "gopls" }, cmake = { "cmake" }, css = { "cssls" }, + clojure = { 'clojure_lsp' }, + -- codeql = { 'codeqlls' }, + -- deno = { 'denols' }, + -- dlang = { 'serve_d' }, + dockerfile = { 'dockerls' }, + dot = { 'dotls' }, + elixer = { 'elixerls' }, + elm = { 'elmls' }, + ember = { 'ember' }, + fortran = { 'fortls' }, + -- ['f#'] = { 'fsautocomplete' }, + go = { "gopls" }, + graphql = { 'graphql' }, + groovy = { 'groovyls' }, html = { "html" }, - javascript = { "tsserver" }, - typescript = { "tsserver" }, + haskel = { 'hls' }, json = { "jsonls" }, - docker = { "dockerls" }, + json5 = { 'jsonls' }, + java = { 'jdtls' }, + javascript = { "tsserver" }, + kotlin = { 'kotlin_language_server' }, + latex = { 'texlab' }, + ocaml = { 'ocamells' }, + php = { 'phpactor' }, + powershell = { 'powershell_es' }, + -- prisma = { 'prismals' }, + -- puppet = { 'puppet' }, + -- purescript = { 'purescriptls' }, python = { "pyright" }, + -- rescript = { 'rescriptls' }, + -- rome = { 'rome' }, + ruby = { 'solargraph' }, rust = { "rust_analyzer" }, - elixir = { "elixirls" }, - haskell = { "hls" }, + -- solang = { 'solang' }, + -- sorbet = { 'sorbet' }, + svelte = { 'svelte' }, + typescript = { "tsserver" }, + -- vala = { 'valals' }, + vim = { 'vimls' }, vue = { "vuels" }, - config = { "jsonls" }, + xml = { 'lemminx' }, + yaml = { 'yamlls' }, + config = { "jsonls", 'yamlls' }, } -- Snippets support @@ -57,16 +90,38 @@ return function() }, } - -- Load langs from doom_modules and install servers with +lsp flag - local function install_servers() - local installed_servers = lspmanager.installed_servers() - -- Flatten the array of default servers. Default servers will be automatically uninstalled if no +lsp flag is provided. - local default_servers = {} - for _, lang_servers in pairs(servers) do - for _, lsp_name in ipairs(lang_servers) do - table.insert(default_servers, lsp_name) - end + --- Intelligent highlighting of word under cursor + local on_attach + if not is_plugin_disabled("illuminated") and packer_plugins["vim-illuminate"] then + on_attach = function(client) + require("illuminate").on_attach(client) + -- Set underline highlighting for Lsp references + vim.cmd("hi! LspReferenceText cterm=underline gui=underline") + vim.cmd("hi! LspReferenceWrite cterm=underline gui=underline") + vim.cmd("hi! LspReferenceRead cterm=underline gui=underline") end + end + + local lua_lsp = require("lua-dev").setup({ + lspconfig = { + settings = { + Lua = { + workspace = { + preloadFileSize = 200, + }, + diagnostics = { + globals = { "packer_plugins" }, + }, + }, + }, + capabilities = capabilities, + on_attach = on_attach, + }, + }) + + -- Load langs from doom_modules, install servers with +lsp flag and sets up their config + local function setup_servers() + local lsp_installer = require("nvim-lsp-installer") local modules = require("doom.core.config.modules").modules local langs = modules.langs @@ -105,73 +160,67 @@ return function() end end - -- Uninstall all (default) LSPs that shouldn't be installed - for _, lsp_name in ipairs(default_servers) do - if - utils.has_value(ensure_installed, lsp_name) == false - and utils.has_value(installed_servers, lsp_name) - then - lspmanager.uninstall(lsp_name) + -- Flatten the array of default servers. + -- Default servers will be automatically uninstalled if no +lsp flag is provided. + local default_servers = {} + for _, lang_servers in pairs(servers) do + for _, lsp_name in ipairs(lang_servers) do + if not utils.has_value(default_servers, lsp_name) then + table.insert(default_servers, lsp_name) + end end end - + -- Save which servers were installed/uninstalled so this info can be presented to user + local installing_servers = {} + local uninstalling_servers = {} -- Install all LSPs that should be installed - for _, lsp_name in ipairs(ensure_installed) do - if utils.has_value(installed_servers, lsp_name) == false then - lspmanager.install(lsp_name) + for _, lsp_name in ipairs(default_servers) do + local ok, server = lsp_installer.get_server(lsp_name) + if ok then + + if not utils.has_value(ensure_installed, lsp_name) then + if server:is_installed() then + table.insert(uninstalling_servers, lsp_name) + server:uninstall() + end + else + local server_config = server.name == 'sumneko_lua' and lua_lsp or { + capabilities = capabilities, + on_attach = on_attach, + } + -- Setup server once it's ready + server:on_ready(function() + server:setup(server_config) + end) + if not server:is_installed() then + table.insert(installing_servers, lsp_name) + server:install() + end + end end end - end - install_servers() - - --- Intelligent highlighting of w ord under cursor - local on_attach - if not is_plugin_disabled("illuminated") and packer_plugins["vim-illuminate"] then - on_attach = function(client) - require("illuminate").on_attach(client) - -- Set underline highlighting for Lsp references - vim.cmd("hi! LspReferenceText cterm=underline gui=underline") - vim.cmd("hi! LspReferenceWrite cterm=underline gui=underline") - vim.cmd("hi! LspReferenceRead cterm=underline gui=underline") + -- Print intalling/uninstalling information to user on startup + if next(installing_servers) ~= nil or next(uninstalling_servers) ~= nil then + local msg = 'Doom: ' + local installing_count = #installing_servers + if installing_count > 0 then + msg = msg .. 'Installing ' .. installing_count .. ' LSPs. ' + end + local uninstalling_count = #uninstalling_servers + if uninstalling_count > 0 then + msg = msg .. 'Uninstalling ' .. installing_count .. ' LSPs. ' + end + msg = msg .. 'Use :LspInstallInfo to check status. ' + vim.notify(msg) end + end - local lua_lsp = require("lua-dev").setup({ - lspconfig = { - settings = { - Lua = { - workspace = { - preloadFileSize = 200, - }, - diagnostics = { - globals = { "packer_plugins" }, - }, - }, - }, - capabilities = capabilities, - on_attach = on_attach, - }, - }) + -- Defer auto install to unblock startup + vim.defer_fn(function () + setup_servers() + end, 100) - local function setup_servers() - -- Provide the missing :LspInstall - lspmanager.setup() - - local installed_servers = lspmanager.installed_servers() - for _, server in pairs(installed_servers) do - -- Configure sumneko for neovim lua development - if server == "sumneko_lua" then - nvim_lsp.sumneko_lua.setup(lua_lsp) - else - -- Use default settings for all the other language servers - nvim_lsp[server].setup({ - capabilities = capabilities, - on_attach = on_attach, - }) - end - end - end - setup_servers() end diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 364a5fda9..87ecb814b 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -450,10 +450,9 @@ packer.startup(function(use) -- Manage Language serverss with ease. use({ - "MordechaiHadad/nvim-lspmanager", - commit = pin_commit("817998fb83ad8c05e9a315d0a6d25fddae56fe23"), - branch = "dev", - config = require("doom.modules.config.doom-lspmanager"), + "williamboman/nvim-lsp-installer", + commit = pin_commit("35d4b08d60c17b79f8e16e9e66f0d7693c99d612"), + config = require("doom.modules.config.doom-lsp-installer"), disable = disabled_lsp, }) From 8b9ea65533627d881ca294412dac8efd168ccf8c Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sun, 14 Nov 2021 22:26:10 +1100 Subject: [PATCH 249/290] Reduced delay on Lsp startup --- lua/doom/modules/config/doom-lsp-installer.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-lsp-installer.lua b/lua/doom/modules/config/doom-lsp-installer.lua index 54ac656e1..8957ffb08 100644 --- a/lua/doom/modules/config/doom-lsp-installer.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -220,7 +220,7 @@ return function() -- Defer auto install to unblock startup vim.defer_fn(function () setup_servers() - end, 100) + end, 50) end From e8c855f0e3349ab3c9a0984bc87fdd7526d772eb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 14 Nov 2021 20:59:56 +0000 Subject: [PATCH 250/290] chore: format source code --- .../modules/config/doom-lsp-installer.lua | 73 +++++++++---------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/lua/doom/modules/config/doom-lsp-installer.lua b/lua/doom/modules/config/doom-lsp-installer.lua index 8957ffb08..249df17ac 100644 --- a/lua/doom/modules/config/doom-lsp-installer.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -6,58 +6,58 @@ return function() -- Commented out defualt servers don't have treesitter configs local servers = { lua = { "sumneko_lua" }, - ansible = { 'ansiblels' }, + ansible = { "ansiblels" }, angular = { "angularls" }, bash = { "bashls" }, -- bicep = { 'bicep' }, - c_sharp = { 'omnisharp' }, + c_sharp = { "omnisharp" }, c = { "clangd" }, cpp = { "clangd" }, cmake = { "cmake" }, css = { "cssls" }, - clojure = { 'clojure_lsp' }, + clojure = { "clojure_lsp" }, -- codeql = { 'codeqlls' }, -- deno = { 'denols' }, -- dlang = { 'serve_d' }, - dockerfile = { 'dockerls' }, - dot = { 'dotls' }, - elixer = { 'elixerls' }, - elm = { 'elmls' }, - ember = { 'ember' }, - fortran = { 'fortls' }, + dockerfile = { "dockerls" }, + dot = { "dotls" }, + elixer = { "elixerls" }, + elm = { "elmls" }, + ember = { "ember" }, + fortran = { "fortls" }, -- ['f#'] = { 'fsautocomplete' }, go = { "gopls" }, - graphql = { 'graphql' }, - groovy = { 'groovyls' }, + graphql = { "graphql" }, + groovy = { "groovyls" }, html = { "html" }, - haskel = { 'hls' }, + haskel = { "hls" }, json = { "jsonls" }, - json5 = { 'jsonls' }, - java = { 'jdtls' }, + json5 = { "jsonls" }, + java = { "jdtls" }, javascript = { "tsserver" }, - kotlin = { 'kotlin_language_server' }, - latex = { 'texlab' }, - ocaml = { 'ocamells' }, - php = { 'phpactor' }, - powershell = { 'powershell_es' }, + kotlin = { "kotlin_language_server" }, + latex = { "texlab" }, + ocaml = { "ocamells" }, + php = { "phpactor" }, + powershell = { "powershell_es" }, -- prisma = { 'prismals' }, -- puppet = { 'puppet' }, -- purescript = { 'purescriptls' }, python = { "pyright" }, -- rescript = { 'rescriptls' }, -- rome = { 'rome' }, - ruby = { 'solargraph' }, + ruby = { "solargraph" }, rust = { "rust_analyzer" }, -- solang = { 'solang' }, -- sorbet = { 'sorbet' }, - svelte = { 'svelte' }, + svelte = { "svelte" }, typescript = { "tsserver" }, -- vala = { 'valals' }, - vim = { 'vimls' }, + vim = { "vimls" }, vue = { "vuels" }, - xml = { 'lemminx' }, - yaml = { 'yamlls' }, - config = { "jsonls", 'yamlls' }, + xml = { "lemminx" }, + yaml = { "yamlls" }, + config = { "jsonls", "yamlls" }, } -- Snippets support @@ -177,17 +177,17 @@ return function() for _, lsp_name in ipairs(default_servers) do local ok, server = lsp_installer.get_server(lsp_name) if ok then - if not utils.has_value(ensure_installed, lsp_name) then if server:is_installed() then table.insert(uninstalling_servers, lsp_name) server:uninstall() end else - local server_config = server.name == 'sumneko_lua' and lua_lsp or { - capabilities = capabilities, - on_attach = on_attach, - } + local server_config = server.name == "sumneko_lua" and lua_lsp + or { + capabilities = capabilities, + on_attach = on_attach, + } -- Setup server once it's ready server:on_ready(function() server:setup(server_config) @@ -202,25 +202,22 @@ return function() -- Print intalling/uninstalling information to user on startup if next(installing_servers) ~= nil or next(uninstalling_servers) ~= nil then - local msg = 'Doom: ' + local msg = "Doom: " local installing_count = #installing_servers if installing_count > 0 then - msg = msg .. 'Installing ' .. installing_count .. ' LSPs. ' + msg = msg .. "Installing " .. installing_count .. " LSPs. " end local uninstalling_count = #uninstalling_servers if uninstalling_count > 0 then - msg = msg .. 'Uninstalling ' .. installing_count .. ' LSPs. ' + msg = msg .. "Uninstalling " .. installing_count .. " LSPs. " end - msg = msg .. 'Use :LspInstallInfo to check status. ' + msg = msg .. "Use :LspInstallInfo to check status. " vim.notify(msg) end - end -- Defer auto install to unblock startup - vim.defer_fn(function () + vim.defer_fn(function() setup_servers() end, 50) - - end From 4ff59f89e0c1908ecf1348cbc002ef4adb817ea6 Mon Sep 17 00:00:00 2001 From: Connor G Meehan Date: Mon, 15 Nov 2021 08:27:37 +1100 Subject: [PATCH 251/290] chore: update pinned packer commits (#239) Co-authored-by: connorgmeean Co-authored-by: Alejandro --- contribute/update_dependencies.sh | 2 +- lua/doom/modules/init.lua | 108 +++++++++++++++--------------- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/contribute/update_dependencies.sh b/contribute/update_dependencies.sh index 73e53ec27..29c2801c3 100755 --- a/contribute/update_dependencies.sh +++ b/contribute/update_dependencies.sh @@ -67,7 +67,7 @@ while read -r line; do let index+=1 if [[ $line == '--' ]]; then - sleep 5 + sleep 2 index=0 repo='' latest_commit='' diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 87ecb814b..d45e6b842 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -73,24 +73,24 @@ packer.startup(function(use) }) use({ "JoosepAlviste/nvim-ts-context-commentstring", - commit = pin_commit("a2283cfc9f4aa892349004153ab54dfe8911241c"), + commit = pin_commit('ce74852c36008b11dda451bfe6c2ed71c535152b'), after = "nvim-treesitter", }) use({ "nvim-treesitter/nvim-tree-docs", - commit = pin_commit("10a49cef11fee8b2f7bd9f6e4d118caa3d43b28e"), + commit = pin_commit('864c2f5023fa7399aa084fd81c0e2f8dedfd32e3'), after = "nvim-treesitter", }) use({ "windwp/nvim-ts-autotag", - commit = pin_commit("80d427af7b898768c8d8538663d52dee133da86f"), + commit = pin_commit('80d427af7b898768c8d8538663d52dee133da86f'), after = "nvim-treesitter", }) -- Aniseed, required by some treesitter modules use({ "Olical/aniseed", - commit = pin_commit("4bb3a4c1a1e329ebefa7ff022f7b3947770f7f26"), + commit = pin_commit('4bb3a4c1a1e329ebefa7ff022f7b3947770f7f26'), module_pattern = "aniseed", }) @@ -98,7 +98,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", - commit = pin_commit("2fdce1aaf542d930df92d394e646f9bafe4e41a3"), + commit = pin_commit('592fb0c9c220ca53238e6de7685c3151fe3a3085'), branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, @@ -109,7 +109,7 @@ packer.startup(function(use) local disabled_sessions = is_plugin_disabled("auto-session") use({ "folke/persistence.nvim", - commit = pin_commit("77cf5a6ee162013b97237ff25450080401849f85"), + commit = pin_commit('77cf5a6ee162013b97237ff25450080401849f85'), config = require("doom.modules.config.doom-persistence"), -- event = "VimEnter", disable = disabled_sessions, @@ -122,7 +122,7 @@ packer.startup(function(use) local disabled_dashboard = is_plugin_disabled("dashboard") use({ "glepnir/dashboard-nvim", - commit = pin_commit("ba98ab86487b8eda3b0934b5423759944b5f7ebd"), + commit = pin_commit('ba98ab86487b8eda3b0934b5423759944b5f7ebd'), config = require("doom.modules.config.doom-dashboard"), disable = disabled_dashboard, }) @@ -131,14 +131,14 @@ packer.startup(function(use) local disabled_doom_themes = is_plugin_disabled("doom-themes") use({ "GustavoPrietoP/doom-themes.nvim", - commit = pin_commit("03d417d3eab71c320744f8da22251715ba6cee53"), + commit = pin_commit('03d417d3eab71c320744f8da22251715ba6cee53'), disable = disabled_doom_themes, }) -- Development icons use({ "kyazdani42/nvim-web-devicons", - commit = pin_commit("ee101462d127ed6a5561ce9ce92bfded87d7d478"), + commit = pin_commit('f936ff3e1f9d58ec0caf0bd398e9675b54fe292e'), module = "nvim-web-devicons", }) @@ -147,7 +147,7 @@ packer.startup(function(use) and require("doom.core.config").config.doom.use_netrw use({ "kyazdani42/nvim-tree.lua", - commit = pin_commit("c4ecf4416bc0a5f5b2ffacc18476a776953f9e03"), + commit = pin_commit('5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3'), requires = "nvim-web-devicons", config = require("doom.modules.config.doom-tree"), disable = disabled_tree, @@ -165,7 +165,7 @@ packer.startup(function(use) local disabled_ranger = is_plugin_disabled("ranger") use({ "francoiscabrol/ranger.vim", - commit = pin_commit("91e82debdf566dfaf47df3aef0a5fd823cedf41c"), + commit = pin_commit('91e82debdf566dfaf47df3aef0a5fd823cedf41c'), requires = "rbgrouleff/bclose.vim", disable = disabled_ranger, }) @@ -175,7 +175,7 @@ packer.startup(function(use) local disabled_statusline = is_plugin_disabled("statusline") use({ "NTBBloodbath/galaxyline.nvim", - commit = pin_commit("7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d"), + commit = pin_commit('7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d'), config = require("doom.modules.config.doom-eviline"), disable = disabled_statusline, }) @@ -185,7 +185,7 @@ packer.startup(function(use) local disabled_tabline = is_plugin_disabled("tabline") use({ "akinsho/bufferline.nvim", - commit = pin_commit("58e8d9b7c9aaf603f1093f808628b5a8f03493af"), + commit = pin_commit('782fab8a2352e872dc991c42f806dae18e848b2d'), config = require("doom.modules.config.doom-bufferline"), disable = disabled_tabline, event = "BufWinEnter", @@ -196,7 +196,7 @@ packer.startup(function(use) local disabled_terminal = is_plugin_disabled("terminal") use({ "akinsho/toggleterm.nvim", - commit = pin_commit("9cdc5e9bb2affb25af5d4bda930738144193bd36"), + commit = pin_commit('0b6d65d8b45e261bc17176e86abb3f631c88fc1b'), config = require("doom.modules.config.doom-toggleterm"), disable = disabled_terminal, module = { "toggleterm", "toggleterm.terminal" }, @@ -208,7 +208,7 @@ packer.startup(function(use) local disabled_outline = is_plugin_disabled("symbols") use({ "simrat39/symbols-outline.nvim", - commit = pin_commit("552b67993ed959993279e0b0f8a1da9f3c5e6fc0"), + commit = pin_commit('552b67993ed959993279e0b0f8a1da9f3c5e6fc0'), config = require("doom.modules.config.doom-symbols"), disable = disabled_outline, cmd = { @@ -223,7 +223,7 @@ packer.startup(function(use) local disabled_minimap = is_plugin_disabled("minimap") use({ "wfxr/minimap.vim", - commit = pin_commit("5c54258d34b8ae4be70a8fbc09b400eb7be0bee8"), + commit = pin_commit('5c54258d34b8ae4be70a8fbc09b400eb7be0bee8'), disable = disabled_minimap, cmd = { "Minimap", @@ -238,7 +238,7 @@ packer.startup(function(use) local disabled_whichkey = is_plugin_disabled("which-key") use({ "folke/which-key.nvim", - commit = pin_commit("d3032b6d3e0adb667975170f626cb693bfc66baa"), + commit = pin_commit('d3032b6d3e0adb667975170f626cb693bfc66baa'), opt = true, config = require("doom.modules.config.doom-whichkey"), disable = disabled_whichkey, @@ -248,7 +248,7 @@ packer.startup(function(use) local disabled_show_registers = is_plugin_disabled("show_registers") use({ "tversteeg/registers.nvim", - commit = pin_commit("4d1f3525c6f9be4297e99e6aed515af3677d7241"), + commit = pin_commit('4d1f3525c6f9be4297e99e6aed515af3677d7241'), disable = disabled_show_registers, }) @@ -256,7 +256,7 @@ packer.startup(function(use) local disabled_zen = is_plugin_disabled("zen") use({ "Pocco81/TrueZen.nvim", - commit = pin_commit("508b977d71650da5c9243698614a9a1416f116d4"), + commit = pin_commit('508b977d71650da5c9243698614a9a1416f116d4'), config = require("doom.modules.config.doom-zen"), disable = disabled_zen, module = "true-zen", @@ -267,7 +267,7 @@ packer.startup(function(use) local disabled_illuminate = is_plugin_disabled("illuminated") use({ "RRethy/vim-illuminate", - commit = pin_commit("084b012ce5bc1bf302b69eb73562146afe0a9756"), + commit = pin_commit('084b012ce5bc1bf302b69eb73562146afe0a9756'), setup = function() vim.g.Illuminate_ftblacklist = { "help", @@ -289,19 +289,19 @@ packer.startup(function(use) -----]]--------------[[----- use({ "nvim-lua/plenary.nvim", - commit = pin_commit("96e821e8001c21bc904d3c15aa96a70c11462c5f"), + commit = pin_commit('1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac'), module = "plenary", }) use({ "nvim-lua/popup.nvim", - commit = pin_commit("f91d80973f80025d4ed00380f2e06c669dfda49d"), + commit = pin_commit('f91d80973f80025d4ed00380f2e06c669dfda49d'), module = "popup", }) local disabled_telescope = is_plugin_disabled("telescope") use({ "nvim-telescope/telescope.nvim", - commit = pin_commit("3b9ac8edba8c1b4053c7f6ac8a4e78969cec66dd"), + commit = pin_commit('729492406ec3b545c4ecf2beadf7bd30c81e70e4'), cmd = "Telescope", module = "telescope", requires = { @@ -313,7 +313,7 @@ packer.startup(function(use) }) use({ "lazytanuki/nvim-mapper", - commit = pin_commit("e11e852bafa41a4a2c160fcd2d38779add423db9"), + commit = pin_commit('e11e852bafa41a4a2c160fcd2d38779add423db9'), config = function() local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep require("nvim-mapper").setup({ @@ -340,7 +340,7 @@ packer.startup(function(use) local disabled_gitsigns = is_plugin_disabled("gitsigns") use({ "lewis6991/gitsigns.nvim", - commit = pin_commit("d12442a924dc431467149f1fcb33e1c648116803"), + commit = pin_commit('bfc4543262442a336e257d2d9fac16aa1de532a9'), config = require("doom.modules.config.doom-gitsigns"), disable = disabled_gitsigns, requires = "plenary.nvim", @@ -351,7 +351,7 @@ packer.startup(function(use) local disabled_neogit = is_plugin_disabled("neogit") use({ "TimUntersberger/neogit", - commit = pin_commit("f214200d71391dfc5763769ca1120e3aa5902c2d"), + commit = pin_commit('807e4a795dc6c2383b281fc27bd1bc6c197d98cd'), config = function() require("neogit").setup({}) end, @@ -364,7 +364,7 @@ packer.startup(function(use) local disabled_lazygit = is_plugin_disabled("lazygit") use({ "kdheepak/lazygit.nvim", - commit = pin_commit("b1ebb53902a4f5d8c565f7485d4e57d937f89b91"), + commit = pin_commit('bcd111df61abe90b133cb08ea577c02af44ca5ce'), requires = "plenary.nvim", disable = disabled_lazygit, cmd = { "LazyGit", "LazyGitConfig" }, @@ -377,7 +377,7 @@ packer.startup(function(use) -- Built-in LSP Config use({ "neovim/nvim-lspconfig", - commit = pin_commit("9314d0a8da0f5ccd700d8a1fa699949a95971420"), + commit = pin_commit('4191b1fca3bafe759ae5606d19e0f0e54e9fc83b'), config = require("doom.modules.config.doom-lspconfig"), disable = disabled_lsp, }) @@ -393,7 +393,7 @@ packer.startup(function(use) -- can be disabled to use your own completion plugin use({ "hrsh7th/nvim-cmp", - commit = pin_commit("669803b9ffb31b3963afb4f05c1622fc48ab65cb"), + commit = pin_commit('753f5b7c92da0302efffc5ce6780dffe0602bdf3'), wants = { "LuaSnip" }, requires = { { @@ -419,31 +419,31 @@ packer.startup(function(use) }) use({ "hrsh7th/cmp-nvim-lua", - commit = pin_commit("d276254e7198ab7d00f117e88e223b4bd8c02d21"), + commit = pin_commit('d276254e7198ab7d00f117e88e223b4bd8c02d21'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-nvim-lsp", - commit = pin_commit("accbe6d97548d8d3471c04d512d36fa61d0e4be8"), + commit = pin_commit('134117299ff9e34adde30a735cd8ca9cf8f3db81'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-path", - commit = pin_commit("97661b00232a2fe145fe48e295875bc3299ed1f7"), + commit = pin_commit('98ded32b9c4d95aa95af70b9979b767f39073f0e'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-buffer", - commit = pin_commit("5dde5430757696be4169ad409210cf5088554ed6"), + commit = pin_commit('2d85e76c725a389b72067f86fc3c65f3868b9a59'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "saadparwaiz1/cmp_luasnip", - commit = pin_commit("16832bb50e760223a403ffa3042859845dd9ef9d"), + commit = pin_commit('16832bb50e760223a403ffa3042859845dd9ef9d'), disable = disabled_lsp, after = "nvim-cmp", }) @@ -459,7 +459,7 @@ packer.startup(function(use) -- Show function signature when you type use({ "ray-x/lsp_signature.nvim", - commit = pin_commit("6469c55ce7afc8cdfb6d0b6b3fbfd331bcc26410"), + commit = pin_commit('600111e6249bcc948e2b811ef09adf4ea84ebfc1'), config = require("doom.modules.config.doom-lsp-signature"), after = "nvim-lspconfig", event = "InsertEnter", @@ -468,7 +468,7 @@ packer.startup(function(use) -- Setup for Lua development in Neovim use({ "folke/lua-dev.nvim", - commit = pin_commit("6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0"), + commit = pin_commit('6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0'), disable = disabled_lsp, module = "lua-dev", }) @@ -479,14 +479,14 @@ packer.startup(function(use) local disabled_dap = is_plugin_disabled("dap") use({ "mfussenegger/nvim-dap", - commit = pin_commit("dd778f65dc95323f781f291fb7c5bf3c17d057b1"), + commit = pin_commit('1a87456d280e8e308df7983650a5ea2b5a6bfb63'), disable = disabled_dap, event = "BufWinEnter", }) use({ "rcarriga/nvim-dap-ui", - commit = pin_commit("547635e7ba1dace13189386c98c3c7b064d585c4"), + commit = pin_commit('649e0fee4f0b8dc6305dd29065c7623c3dc6a032'), config = require("doom.modules.config.doom-dap-ui"), disable = disabled_dap, after = "nvim-dap", @@ -494,7 +494,7 @@ packer.startup(function(use) use({ "Pocco81/DAPInstall.nvim", - commit = pin_commit("b95e9ad32f1c45855b9965b545c86e82d8a827ac"), + commit = pin_commit('dd09e9dd3a6e29f02ac171515b8a089fb82bb425'), config = require("doom.modules.config.doom-dap-install"), disable = disabled_dap, after = "nvim-dap", @@ -508,7 +508,7 @@ packer.startup(function(use) local disabled_suda = is_plugin_disabled("suda") use({ "lambdalisue/suda.vim", - commit = pin_commit("0290c93c148a14eab2b661a1933003d86436f6ec"), + commit = pin_commit('0290c93c148a14eab2b661a1933003d86436f6ec'), disable = disabled_suda, cmd = { "SudaRead", "SudaWrite" }, }) @@ -518,7 +518,7 @@ packer.startup(function(use) local disabled_formatter = is_plugin_disabled("formatter") use({ "lukas-reineke/format.nvim", - commit = pin_commit("c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7"), + commit = pin_commit('c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7'), config = require("doom.modules.config.doom-format"), disable = disabled_formatter, cmd = { "Format", "FormatWrite" }, @@ -528,7 +528,7 @@ packer.startup(function(use) local disabled_linter = is_plugin_disabled("linter") use({ "mfussenegger/nvim-lint", - commit = pin_commit("b1467a01f48736b309e0e274c032b69051740c08"), + commit = pin_commit('0116b78963fd24643faa34fa1bc02f8d425a73ef'), config = require("doom.modules.config.doom-lint"), disable = disabled_linter, module = "lint", @@ -538,7 +538,7 @@ packer.startup(function(use) local disabled_indent_lines = is_plugin_disabled("indentlines") use({ "lukas-reineke/indent-blankline.nvim", - commit = pin_commit("252797e7a96fa4f7c6ccdcdff3f488fdd48b1d09"), + commit = pin_commit('9f663d31d4ee0672f24cd5b26ca3863665048a25'), config = require("doom.modules.config.doom-blankline"), disable = disabled_indent_lines, event = "ColorScheme", @@ -548,7 +548,7 @@ packer.startup(function(use) local disabled_editorconfig = is_plugin_disabled("editorconfig") use({ "editorconfig/editorconfig-vim", - commit = pin_commit("3078cd10b28904e57d878c0d0dab42aa0a9fdc89"), + commit = pin_commit('3078cd10b28904e57d878c0d0dab42aa0a9fdc89'), disable = disabled_editorconfig, }) @@ -557,7 +557,7 @@ packer.startup(function(use) local disabled_kommentary = is_plugin_disabled("kommentary") use({ "b3nj5m1n/kommentary", - commit = pin_commit("8f1cd74ad28de7d7c4fda5d8e8557ff240904b42"), + commit = pin_commit('8f1cd74ad28de7d7c4fda5d8e8557ff240904b42'), disable = disabled_kommentary, event = "BufWinEnter", }) @@ -566,13 +566,13 @@ packer.startup(function(use) -- Lua 5.1 docs use({ "milisims/nvim-luaref", - commit = pin_commit("dc40d606549db7df1a6e23efa743c90c178333d4"), + commit = pin_commit('dc40d606549db7df1a6e23efa743c90c178333d4'), disable = disabled_contrib, }) -- LibUV docs use({ "nanotee/luv-vimdocs", - commit = pin_commit("ddcd5ef0100e66da0d4a709391a9b3e9453f19a1"), + commit = pin_commit('fb04e1088a21eefcc396d5a5299468d8742d27a2'), disable = disabled_contrib, }) @@ -583,7 +583,7 @@ packer.startup(function(use) local disabled_colorizer = is_plugin_disabled("colorizer") use({ "norcalli/nvim-colorizer.lua", - commit = pin_commit("36c610a9717cc9ec426a07c8e6bf3b3abcb139d6"), + commit = pin_commit('36c610a9717cc9ec426a07c8e6bf3b3abcb139d6'), config = require("doom.modules.config.doom-colorizer"), disable = disabled_colorizer, event = "ColorScheme", @@ -594,7 +594,7 @@ packer.startup(function(use) local disabled_restclient = is_plugin_disabled("restclient") use({ "NTBBloodbath/rest.nvim", - commit = pin_commit("5130e59f680df56f22bd8cc41da422f9a05580c5"), + commit = pin_commit('759bf5b1a8cd15ecf6ecf2407a826d4be6ec3414'), requires = "plenary.nvim", config = function() require("rest-nvim").setup() @@ -606,7 +606,7 @@ packer.startup(function(use) local disabled_range_highlight = is_plugin_disabled("range-highlight") use({ "winston0410/range-highlight.nvim", - commit = pin_commit("8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9"), + commit = pin_commit('8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9'), requires = { { "winston0410/cmd-parser.nvim", module = "cmd-parser" }, }, @@ -620,7 +620,7 @@ packer.startup(function(use) local disabled_firenvim = is_plugin_disabled("firenvim") use({ "glacambre/firenvim", - commit = pin_commit("eb3abef4520d17dbd9957f5d23ada74b853133e4"), + commit = pin_commit('0ff2821cc0a561ac79596f358b26674c87483efa'), disable = disabled_firenvim, run = function() vim.fn["firenvim#install"](0) @@ -631,7 +631,7 @@ packer.startup(function(use) local disabled_todo = is_plugin_disabled("todo_comments") use({ "folke/todo-comments.nvim", - commit = pin_commit("9983edc5ef38c7a035c17c85f60ee13dbd75dcc8"), + commit = pin_commit('9983edc5ef38c7a035c17c85f60ee13dbd75dcc8'), requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), disable = disabled_todo, @@ -641,7 +641,7 @@ packer.startup(function(use) local disabled_trouble = is_plugin_disabled("trouble") use({ "folke/trouble.nvim", - commit = pin_commit("756f09de113a775ab16ba6d26c090616b40a999d"), + commit = pin_commit('756f09de113a775ab16ba6d26c090616b40a999d'), cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" }, requires = "kyazdani42/nvim-web-devicons", config = require("doom.modules.config.doom-trouble"), @@ -651,7 +651,7 @@ packer.startup(function(use) local disabled_superman = is_plugin_disabled("superman") use({ "jez/vim-superman", - commit = pin_commit("19d307446576d9118625c5d9d3c7a4c9bec5571a"), + commit = pin_commit('19d307446576d9118625c5d9d3c7a4c9bec5571a'), cmd = "SuperMan", disable = disabled_superman, }) From ec24915a64002084dc36e40a8443edae94da0702 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 14 Nov 2021 21:27:53 +0000 Subject: [PATCH 252/290] chore: format source code --- lua/doom/modules/init.lua | 108 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index d45e6b842..10ec6e786 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -73,24 +73,24 @@ packer.startup(function(use) }) use({ "JoosepAlviste/nvim-ts-context-commentstring", - commit = pin_commit('ce74852c36008b11dda451bfe6c2ed71c535152b'), + commit = pin_commit("ce74852c36008b11dda451bfe6c2ed71c535152b"), after = "nvim-treesitter", }) use({ "nvim-treesitter/nvim-tree-docs", - commit = pin_commit('864c2f5023fa7399aa084fd81c0e2f8dedfd32e3'), + commit = pin_commit("864c2f5023fa7399aa084fd81c0e2f8dedfd32e3"), after = "nvim-treesitter", }) use({ "windwp/nvim-ts-autotag", - commit = pin_commit('80d427af7b898768c8d8538663d52dee133da86f'), + commit = pin_commit("80d427af7b898768c8d8538663d52dee133da86f"), after = "nvim-treesitter", }) -- Aniseed, required by some treesitter modules use({ "Olical/aniseed", - commit = pin_commit('4bb3a4c1a1e329ebefa7ff022f7b3947770f7f26'), + commit = pin_commit("4bb3a4c1a1e329ebefa7ff022f7b3947770f7f26"), module_pattern = "aniseed", }) @@ -98,7 +98,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", - commit = pin_commit('592fb0c9c220ca53238e6de7685c3151fe3a3085'), + commit = pin_commit("592fb0c9c220ca53238e6de7685c3151fe3a3085"), branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, @@ -109,7 +109,7 @@ packer.startup(function(use) local disabled_sessions = is_plugin_disabled("auto-session") use({ "folke/persistence.nvim", - commit = pin_commit('77cf5a6ee162013b97237ff25450080401849f85'), + commit = pin_commit("77cf5a6ee162013b97237ff25450080401849f85"), config = require("doom.modules.config.doom-persistence"), -- event = "VimEnter", disable = disabled_sessions, @@ -122,7 +122,7 @@ packer.startup(function(use) local disabled_dashboard = is_plugin_disabled("dashboard") use({ "glepnir/dashboard-nvim", - commit = pin_commit('ba98ab86487b8eda3b0934b5423759944b5f7ebd'), + commit = pin_commit("ba98ab86487b8eda3b0934b5423759944b5f7ebd"), config = require("doom.modules.config.doom-dashboard"), disable = disabled_dashboard, }) @@ -131,14 +131,14 @@ packer.startup(function(use) local disabled_doom_themes = is_plugin_disabled("doom-themes") use({ "GustavoPrietoP/doom-themes.nvim", - commit = pin_commit('03d417d3eab71c320744f8da22251715ba6cee53'), + commit = pin_commit("03d417d3eab71c320744f8da22251715ba6cee53"), disable = disabled_doom_themes, }) -- Development icons use({ "kyazdani42/nvim-web-devicons", - commit = pin_commit('f936ff3e1f9d58ec0caf0bd398e9675b54fe292e'), + commit = pin_commit("f936ff3e1f9d58ec0caf0bd398e9675b54fe292e"), module = "nvim-web-devicons", }) @@ -147,7 +147,7 @@ packer.startup(function(use) and require("doom.core.config").config.doom.use_netrw use({ "kyazdani42/nvim-tree.lua", - commit = pin_commit('5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3'), + commit = pin_commit("5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3"), requires = "nvim-web-devicons", config = require("doom.modules.config.doom-tree"), disable = disabled_tree, @@ -165,7 +165,7 @@ packer.startup(function(use) local disabled_ranger = is_plugin_disabled("ranger") use({ "francoiscabrol/ranger.vim", - commit = pin_commit('91e82debdf566dfaf47df3aef0a5fd823cedf41c'), + commit = pin_commit("91e82debdf566dfaf47df3aef0a5fd823cedf41c"), requires = "rbgrouleff/bclose.vim", disable = disabled_ranger, }) @@ -175,7 +175,7 @@ packer.startup(function(use) local disabled_statusline = is_plugin_disabled("statusline") use({ "NTBBloodbath/galaxyline.nvim", - commit = pin_commit('7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d'), + commit = pin_commit("7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d"), config = require("doom.modules.config.doom-eviline"), disable = disabled_statusline, }) @@ -185,7 +185,7 @@ packer.startup(function(use) local disabled_tabline = is_plugin_disabled("tabline") use({ "akinsho/bufferline.nvim", - commit = pin_commit('782fab8a2352e872dc991c42f806dae18e848b2d'), + commit = pin_commit("782fab8a2352e872dc991c42f806dae18e848b2d"), config = require("doom.modules.config.doom-bufferline"), disable = disabled_tabline, event = "BufWinEnter", @@ -196,7 +196,7 @@ packer.startup(function(use) local disabled_terminal = is_plugin_disabled("terminal") use({ "akinsho/toggleterm.nvim", - commit = pin_commit('0b6d65d8b45e261bc17176e86abb3f631c88fc1b'), + commit = pin_commit("0b6d65d8b45e261bc17176e86abb3f631c88fc1b"), config = require("doom.modules.config.doom-toggleterm"), disable = disabled_terminal, module = { "toggleterm", "toggleterm.terminal" }, @@ -208,7 +208,7 @@ packer.startup(function(use) local disabled_outline = is_plugin_disabled("symbols") use({ "simrat39/symbols-outline.nvim", - commit = pin_commit('552b67993ed959993279e0b0f8a1da9f3c5e6fc0'), + commit = pin_commit("552b67993ed959993279e0b0f8a1da9f3c5e6fc0"), config = require("doom.modules.config.doom-symbols"), disable = disabled_outline, cmd = { @@ -223,7 +223,7 @@ packer.startup(function(use) local disabled_minimap = is_plugin_disabled("minimap") use({ "wfxr/minimap.vim", - commit = pin_commit('5c54258d34b8ae4be70a8fbc09b400eb7be0bee8'), + commit = pin_commit("5c54258d34b8ae4be70a8fbc09b400eb7be0bee8"), disable = disabled_minimap, cmd = { "Minimap", @@ -238,7 +238,7 @@ packer.startup(function(use) local disabled_whichkey = is_plugin_disabled("which-key") use({ "folke/which-key.nvim", - commit = pin_commit('d3032b6d3e0adb667975170f626cb693bfc66baa'), + commit = pin_commit("d3032b6d3e0adb667975170f626cb693bfc66baa"), opt = true, config = require("doom.modules.config.doom-whichkey"), disable = disabled_whichkey, @@ -248,7 +248,7 @@ packer.startup(function(use) local disabled_show_registers = is_plugin_disabled("show_registers") use({ "tversteeg/registers.nvim", - commit = pin_commit('4d1f3525c6f9be4297e99e6aed515af3677d7241'), + commit = pin_commit("4d1f3525c6f9be4297e99e6aed515af3677d7241"), disable = disabled_show_registers, }) @@ -256,7 +256,7 @@ packer.startup(function(use) local disabled_zen = is_plugin_disabled("zen") use({ "Pocco81/TrueZen.nvim", - commit = pin_commit('508b977d71650da5c9243698614a9a1416f116d4'), + commit = pin_commit("508b977d71650da5c9243698614a9a1416f116d4"), config = require("doom.modules.config.doom-zen"), disable = disabled_zen, module = "true-zen", @@ -267,7 +267,7 @@ packer.startup(function(use) local disabled_illuminate = is_plugin_disabled("illuminated") use({ "RRethy/vim-illuminate", - commit = pin_commit('084b012ce5bc1bf302b69eb73562146afe0a9756'), + commit = pin_commit("084b012ce5bc1bf302b69eb73562146afe0a9756"), setup = function() vim.g.Illuminate_ftblacklist = { "help", @@ -289,19 +289,19 @@ packer.startup(function(use) -----]]--------------[[----- use({ "nvim-lua/plenary.nvim", - commit = pin_commit('1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac'), + commit = pin_commit("1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac"), module = "plenary", }) use({ "nvim-lua/popup.nvim", - commit = pin_commit('f91d80973f80025d4ed00380f2e06c669dfda49d'), + commit = pin_commit("f91d80973f80025d4ed00380f2e06c669dfda49d"), module = "popup", }) local disabled_telescope = is_plugin_disabled("telescope") use({ "nvim-telescope/telescope.nvim", - commit = pin_commit('729492406ec3b545c4ecf2beadf7bd30c81e70e4'), + commit = pin_commit("729492406ec3b545c4ecf2beadf7bd30c81e70e4"), cmd = "Telescope", module = "telescope", requires = { @@ -313,7 +313,7 @@ packer.startup(function(use) }) use({ "lazytanuki/nvim-mapper", - commit = pin_commit('e11e852bafa41a4a2c160fcd2d38779add423db9'), + commit = pin_commit("e11e852bafa41a4a2c160fcd2d38779add423db9"), config = function() local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep require("nvim-mapper").setup({ @@ -340,7 +340,7 @@ packer.startup(function(use) local disabled_gitsigns = is_plugin_disabled("gitsigns") use({ "lewis6991/gitsigns.nvim", - commit = pin_commit('bfc4543262442a336e257d2d9fac16aa1de532a9'), + commit = pin_commit("bfc4543262442a336e257d2d9fac16aa1de532a9"), config = require("doom.modules.config.doom-gitsigns"), disable = disabled_gitsigns, requires = "plenary.nvim", @@ -351,7 +351,7 @@ packer.startup(function(use) local disabled_neogit = is_plugin_disabled("neogit") use({ "TimUntersberger/neogit", - commit = pin_commit('807e4a795dc6c2383b281fc27bd1bc6c197d98cd'), + commit = pin_commit("807e4a795dc6c2383b281fc27bd1bc6c197d98cd"), config = function() require("neogit").setup({}) end, @@ -364,7 +364,7 @@ packer.startup(function(use) local disabled_lazygit = is_plugin_disabled("lazygit") use({ "kdheepak/lazygit.nvim", - commit = pin_commit('bcd111df61abe90b133cb08ea577c02af44ca5ce'), + commit = pin_commit("bcd111df61abe90b133cb08ea577c02af44ca5ce"), requires = "plenary.nvim", disable = disabled_lazygit, cmd = { "LazyGit", "LazyGitConfig" }, @@ -377,7 +377,7 @@ packer.startup(function(use) -- Built-in LSP Config use({ "neovim/nvim-lspconfig", - commit = pin_commit('4191b1fca3bafe759ae5606d19e0f0e54e9fc83b'), + commit = pin_commit("4191b1fca3bafe759ae5606d19e0f0e54e9fc83b"), config = require("doom.modules.config.doom-lspconfig"), disable = disabled_lsp, }) @@ -393,7 +393,7 @@ packer.startup(function(use) -- can be disabled to use your own completion plugin use({ "hrsh7th/nvim-cmp", - commit = pin_commit('753f5b7c92da0302efffc5ce6780dffe0602bdf3'), + commit = pin_commit("753f5b7c92da0302efffc5ce6780dffe0602bdf3"), wants = { "LuaSnip" }, requires = { { @@ -419,31 +419,31 @@ packer.startup(function(use) }) use({ "hrsh7th/cmp-nvim-lua", - commit = pin_commit('d276254e7198ab7d00f117e88e223b4bd8c02d21'), + commit = pin_commit("d276254e7198ab7d00f117e88e223b4bd8c02d21"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-nvim-lsp", - commit = pin_commit('134117299ff9e34adde30a735cd8ca9cf8f3db81'), + commit = pin_commit("134117299ff9e34adde30a735cd8ca9cf8f3db81"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-path", - commit = pin_commit('98ded32b9c4d95aa95af70b9979b767f39073f0e'), + commit = pin_commit("98ded32b9c4d95aa95af70b9979b767f39073f0e"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-buffer", - commit = pin_commit('2d85e76c725a389b72067f86fc3c65f3868b9a59'), + commit = pin_commit("2d85e76c725a389b72067f86fc3c65f3868b9a59"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "saadparwaiz1/cmp_luasnip", - commit = pin_commit('16832bb50e760223a403ffa3042859845dd9ef9d'), + commit = pin_commit("16832bb50e760223a403ffa3042859845dd9ef9d"), disable = disabled_lsp, after = "nvim-cmp", }) @@ -459,7 +459,7 @@ packer.startup(function(use) -- Show function signature when you type use({ "ray-x/lsp_signature.nvim", - commit = pin_commit('600111e6249bcc948e2b811ef09adf4ea84ebfc1'), + commit = pin_commit("600111e6249bcc948e2b811ef09adf4ea84ebfc1"), config = require("doom.modules.config.doom-lsp-signature"), after = "nvim-lspconfig", event = "InsertEnter", @@ -468,7 +468,7 @@ packer.startup(function(use) -- Setup for Lua development in Neovim use({ "folke/lua-dev.nvim", - commit = pin_commit('6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0'), + commit = pin_commit("6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0"), disable = disabled_lsp, module = "lua-dev", }) @@ -479,14 +479,14 @@ packer.startup(function(use) local disabled_dap = is_plugin_disabled("dap") use({ "mfussenegger/nvim-dap", - commit = pin_commit('1a87456d280e8e308df7983650a5ea2b5a6bfb63'), + commit = pin_commit("1a87456d280e8e308df7983650a5ea2b5a6bfb63"), disable = disabled_dap, event = "BufWinEnter", }) use({ "rcarriga/nvim-dap-ui", - commit = pin_commit('649e0fee4f0b8dc6305dd29065c7623c3dc6a032'), + commit = pin_commit("649e0fee4f0b8dc6305dd29065c7623c3dc6a032"), config = require("doom.modules.config.doom-dap-ui"), disable = disabled_dap, after = "nvim-dap", @@ -494,7 +494,7 @@ packer.startup(function(use) use({ "Pocco81/DAPInstall.nvim", - commit = pin_commit('dd09e9dd3a6e29f02ac171515b8a089fb82bb425'), + commit = pin_commit("dd09e9dd3a6e29f02ac171515b8a089fb82bb425"), config = require("doom.modules.config.doom-dap-install"), disable = disabled_dap, after = "nvim-dap", @@ -508,7 +508,7 @@ packer.startup(function(use) local disabled_suda = is_plugin_disabled("suda") use({ "lambdalisue/suda.vim", - commit = pin_commit('0290c93c148a14eab2b661a1933003d86436f6ec'), + commit = pin_commit("0290c93c148a14eab2b661a1933003d86436f6ec"), disable = disabled_suda, cmd = { "SudaRead", "SudaWrite" }, }) @@ -518,7 +518,7 @@ packer.startup(function(use) local disabled_formatter = is_plugin_disabled("formatter") use({ "lukas-reineke/format.nvim", - commit = pin_commit('c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7'), + commit = pin_commit("c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7"), config = require("doom.modules.config.doom-format"), disable = disabled_formatter, cmd = { "Format", "FormatWrite" }, @@ -528,7 +528,7 @@ packer.startup(function(use) local disabled_linter = is_plugin_disabled("linter") use({ "mfussenegger/nvim-lint", - commit = pin_commit('0116b78963fd24643faa34fa1bc02f8d425a73ef'), + commit = pin_commit("0116b78963fd24643faa34fa1bc02f8d425a73ef"), config = require("doom.modules.config.doom-lint"), disable = disabled_linter, module = "lint", @@ -538,7 +538,7 @@ packer.startup(function(use) local disabled_indent_lines = is_plugin_disabled("indentlines") use({ "lukas-reineke/indent-blankline.nvim", - commit = pin_commit('9f663d31d4ee0672f24cd5b26ca3863665048a25'), + commit = pin_commit("9f663d31d4ee0672f24cd5b26ca3863665048a25"), config = require("doom.modules.config.doom-blankline"), disable = disabled_indent_lines, event = "ColorScheme", @@ -548,7 +548,7 @@ packer.startup(function(use) local disabled_editorconfig = is_plugin_disabled("editorconfig") use({ "editorconfig/editorconfig-vim", - commit = pin_commit('3078cd10b28904e57d878c0d0dab42aa0a9fdc89'), + commit = pin_commit("3078cd10b28904e57d878c0d0dab42aa0a9fdc89"), disable = disabled_editorconfig, }) @@ -557,7 +557,7 @@ packer.startup(function(use) local disabled_kommentary = is_plugin_disabled("kommentary") use({ "b3nj5m1n/kommentary", - commit = pin_commit('8f1cd74ad28de7d7c4fda5d8e8557ff240904b42'), + commit = pin_commit("8f1cd74ad28de7d7c4fda5d8e8557ff240904b42"), disable = disabled_kommentary, event = "BufWinEnter", }) @@ -566,13 +566,13 @@ packer.startup(function(use) -- Lua 5.1 docs use({ "milisims/nvim-luaref", - commit = pin_commit('dc40d606549db7df1a6e23efa743c90c178333d4'), + commit = pin_commit("dc40d606549db7df1a6e23efa743c90c178333d4"), disable = disabled_contrib, }) -- LibUV docs use({ "nanotee/luv-vimdocs", - commit = pin_commit('fb04e1088a21eefcc396d5a5299468d8742d27a2'), + commit = pin_commit("fb04e1088a21eefcc396d5a5299468d8742d27a2"), disable = disabled_contrib, }) @@ -583,7 +583,7 @@ packer.startup(function(use) local disabled_colorizer = is_plugin_disabled("colorizer") use({ "norcalli/nvim-colorizer.lua", - commit = pin_commit('36c610a9717cc9ec426a07c8e6bf3b3abcb139d6'), + commit = pin_commit("36c610a9717cc9ec426a07c8e6bf3b3abcb139d6"), config = require("doom.modules.config.doom-colorizer"), disable = disabled_colorizer, event = "ColorScheme", @@ -594,7 +594,7 @@ packer.startup(function(use) local disabled_restclient = is_plugin_disabled("restclient") use({ "NTBBloodbath/rest.nvim", - commit = pin_commit('759bf5b1a8cd15ecf6ecf2407a826d4be6ec3414'), + commit = pin_commit("759bf5b1a8cd15ecf6ecf2407a826d4be6ec3414"), requires = "plenary.nvim", config = function() require("rest-nvim").setup() @@ -606,7 +606,7 @@ packer.startup(function(use) local disabled_range_highlight = is_plugin_disabled("range-highlight") use({ "winston0410/range-highlight.nvim", - commit = pin_commit('8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9'), + commit = pin_commit("8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9"), requires = { { "winston0410/cmd-parser.nvim", module = "cmd-parser" }, }, @@ -620,7 +620,7 @@ packer.startup(function(use) local disabled_firenvim = is_plugin_disabled("firenvim") use({ "glacambre/firenvim", - commit = pin_commit('0ff2821cc0a561ac79596f358b26674c87483efa'), + commit = pin_commit("0ff2821cc0a561ac79596f358b26674c87483efa"), disable = disabled_firenvim, run = function() vim.fn["firenvim#install"](0) @@ -631,7 +631,7 @@ packer.startup(function(use) local disabled_todo = is_plugin_disabled("todo_comments") use({ "folke/todo-comments.nvim", - commit = pin_commit('9983edc5ef38c7a035c17c85f60ee13dbd75dcc8'), + commit = pin_commit("9983edc5ef38c7a035c17c85f60ee13dbd75dcc8"), requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), disable = disabled_todo, @@ -641,7 +641,7 @@ packer.startup(function(use) local disabled_trouble = is_plugin_disabled("trouble") use({ "folke/trouble.nvim", - commit = pin_commit('756f09de113a775ab16ba6d26c090616b40a999d'), + commit = pin_commit("756f09de113a775ab16ba6d26c090616b40a999d"), cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" }, requires = "kyazdani42/nvim-web-devicons", config = require("doom.modules.config.doom-trouble"), @@ -651,7 +651,7 @@ packer.startup(function(use) local disabled_superman = is_plugin_disabled("superman") use({ "jez/vim-superman", - commit = pin_commit('19d307446576d9118625c5d9d3c7a4c9bec5571a'), + commit = pin_commit("19d307446576d9118625c5d9d3c7a4c9bec5571a"), cmd = "SuperMan", disable = disabled_superman, }) From c84c0d83c6fb98f2161d960311b8e72952663d2b Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 14 Nov 2021 18:07:31 -0400 Subject: [PATCH 253/290] feat: add Scala support (and Metals LSP ootb). Closes #228 --- doom_modules.lua | 1 + .../modules/config/doom-lsp-installer.lua | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doom_modules.lua b/doom_modules.lua index 4e4d50950..7ef434ebb 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -74,6 +74,7 @@ M.modules = { -- "haskell", -- Because Functional programming is fun, isn't it? -- "java", -- Java support -- "rust +lsp", -- Let's get rusty! + -- "scala", -- Java, but good -- "comment", -- Better annotations and comments -- "config", -- Configuration files (JSON, YAML, TOML) diff --git a/lua/doom/modules/config/doom-lsp-installer.lua b/lua/doom/modules/config/doom-lsp-installer.lua index 249df17ac..826708364 100644 --- a/lua/doom/modules/config/doom-lsp-installer.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -59,6 +59,8 @@ return function() yaml = { "yamlls" }, config = { "jsonls", "yamlls" }, } + -- Add out-of-the-box support for Scala metals LSP + local should_setup_scala_lsp = false -- Snippets support local capabilities = vim.lsp.protocol.make_client_capabilities() @@ -153,9 +155,14 @@ return function() end end else - log.error( - 'The language "' .. lang .. '" does not have an LSP, please remove the "+lsp" flag.' - ) + if lang:find("scala") then + -- Enable setup for Scala Metals LSP + should_setup_scala_lsp = true + else + log.error( + 'The language "' .. lang .. '" does not have an LSP, please remove the "+lsp" flag.' + ) + end end end end @@ -200,6 +207,14 @@ return function() end end + -- Setup Scala Metals LSP + if should_setup_scala_lsp then + require("lspconfig").metals.setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + end + -- Print intalling/uninstalling information to user on startup if next(installing_servers) ~= nil or next(uninstalling_servers) ~= nil then local msg = "Doom: " From abd0756f4a34c3f6470f4d88c6850a062dc5ebc7 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 14 Nov 2021 19:32:48 -0400 Subject: [PATCH 254/290] fix: add defaults to scape sequences if not exists --- lua/doom/extras/keybindings/core.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua index af2daea16..30b4ec586 100644 --- a/lua/doom/extras/keybindings/core.lua +++ b/lua/doom/extras/keybindings/core.lua @@ -44,7 +44,7 @@ end ---[[-----------------]]--- -- Escape Remaps -- ---]]-----------------[[--- -for _, esc_seq in pairs(config.doom.escape_sequences) do +for _, esc_seq in pairs(config.doom.escape_sequences or { "jk", "kj" }) do mappings.map( "i", esc_seq, From 7aefbf7f90c016ab0908ad34f7f536218d801d55 Mon Sep 17 00:00:00 2001 From: NTBBloodbath Date: Sun, 14 Nov 2021 19:36:31 -0400 Subject: [PATCH 255/290] refact: rename `enable_numbering` to `disable_numbering` This is to revert breaking changes for existing users after updating to v3.2 --- doom_config.lua | 8 ++++---- lua/doom/core/config/init.lua | 8 ++++---- lua/doom/core/settings/init.lua | 2 +- lua/doom/extras/autocmds/init.lua | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doom_config.lua b/doom_config.lua index 9710cbca4..5b06596bd 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -160,10 +160,10 @@ M.config = { expand_tabs = true, -- Set numbering - -- false : Disable number lines - -- true : Enable number lines - -- @default = true - enable_numbering = true, + -- false : Enable number lines + -- true : Disable number lines + -- @default = false + disable_numbering = false, -- Set numbering style -- false : Shows absolute number lines diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 3dec06fbc..22d48fc8b 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -162,10 +162,10 @@ config.config = { expand_tabs = true, -- Set numbering - -- false : Disable number lines - -- true : Enable number lines - -- @default = true - enable_numbering = true, + -- false : Enable number lines + -- true : Disable number lines + -- @default = false + disable_numbering = false, -- Set numbering style -- false : Shows absolute number lines diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index 8294dff2a..ac95600b2 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -107,7 +107,7 @@ settings.load_default_options = function() end -- Set numbering - if config.doom.enable_numbering then + if not config.doom.disable_numbering then if config.doom.relative_num then vim.opt.number = true vim.opt.relativenumber = true diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 826fea5af..9782eb70a 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -58,7 +58,7 @@ local autocmds = { } -- Set numbering -if config.doom.enable_numbering then +if not config.doom.disable_numbering then if config.doom.relative_num then table.insert(autocmds["doom_core"], { "BufEnter,WinEnter", From 638d75b94ac7e5af09291b7afcaeb715a8c7cd81 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 15 Nov 2021 09:14:22 +1100 Subject: [PATCH 256/290] Fixed pinned packer dependencies that didn't auto update --- lua/doom/modules/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 10ec6e786..b0dd95002 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -64,7 +64,7 @@ packer.startup(function(use) use({ "nvim-treesitter/nvim-treesitter", commit = vim.fn.has("nvim-0.6.0") == 1 and pin_commit( - "fe4e4aa286ba14e949948ef6e826d69c63048cdb" + "a47df48e7d4232fd771f2537a4fb43f582c026c9" ) or pin_commit("47cfda2c6711077625c90902d7722238a8294982"), opt = true, run = ":TSUpdate", @@ -98,7 +98,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", - commit = pin_commit("592fb0c9c220ca53238e6de7685c3151fe3a3085"), + commit = --[[NO AUTO UPDATE]] pin_commit("17602389089d56907bbfc026c3dba19f9d24c2dd"), branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, From c16489a3ee93b318ad03f01c21785e61dfeca1e9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 15 Nov 2021 00:20:55 +0000 Subject: [PATCH 257/290] chore: format source code --- lua/doom/modules/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index b0dd95002..60fd72119 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -98,7 +98,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", - commit = --[[NO AUTO UPDATE]] pin_commit("17602389089d56907bbfc026c3dba19f9d24c2dd"), + commit = --[[NO AUTO UPDATE]]pin_commit("17602389089d56907bbfc026c3dba19f9d24c2dd"), branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, From 456ad3dbeb4c814cb9dfa8950055629841d27d68 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 15 Nov 2021 20:04:52 +1100 Subject: [PATCH 258/290] Fixed Lsp installer override setup/install --- .../modules/config/doom-lsp-installer.lua | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lua/doom/modules/config/doom-lsp-installer.lua b/lua/doom/modules/config/doom-lsp-installer.lua index 826708364..e28b265ec 100644 --- a/lua/doom/modules/config/doom-lsp-installer.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -207,6 +207,26 @@ return function() end end + -- Install and setup non-default LSPs + for _, lsp_name in ipairs(ensure_installed) do + if not utils.has_value(default_servers, lsp_name) then + local ok, server = lsp_installer.get_server(lsp_name) + + if ok then + server:on_ready(function() + server:setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + end) + if not server:is_installed() then + table.insert(installing_servers, lsp_name) + server:install() + end + end + end + end + -- Setup Scala Metals LSP if should_setup_scala_lsp then require("lspconfig").metals.setup({ From 04bbd07e17d75ba9f0eaeff586c85b8bb1c00a5a Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 18 Nov 2021 21:37:15 +1100 Subject: [PATCH 259/290] Fixed :DoomReport not collecting logs --- lua/doom/core/functions/init.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 77304d1bf..41827bb29 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -184,11 +184,13 @@ functions.create_report = function() local today_logs = {} local doom_logs = vim.split(fs.read_file(system.doom_logs), "\n") for _, doom_log in ipairs(doom_logs) do - if - string.find(doom_log, "ERROR " .. log_date_format) - or string.find(doom_log, "WARN " .. log_date_format) - then - table.insert(today_logs, doom_log) + local preinfo = doom_log:match('%[(.+)%]') + if preinfo ~= nil then + local is_current_day = preinfo:find(os.date('%a %d %b')) ~= nil and preinfo:find(os.date('%Y')) ~= nil + local error_or_warn = preinfo:find('ERROR ') or preinfo:find('WARN ') + if error_or_warn and is_current_day then + table.insert(today_logs, doom_log) + end end end From bce1c2bf8a91713a6b8397b9dbfdbc9b1635aff9 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 18 Nov 2021 22:03:00 +1100 Subject: [PATCH 260/290] Removed unused variable --- lua/doom/core/functions/init.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 41827bb29..dc4745179 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -177,8 +177,6 @@ end -- occurs, useful for debugging issues. functions.create_report = function() local date = os.date("%Y-%m-%d %H:%M:%S") - local log_date_format = os.date("%a %d %b %Y") - local created_report, err = xpcall(function() -- Get and save only the warning and error logs from today local today_logs = {} From b13beb3769cccfee2b1d49eb83b760b891dc4ef9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 18 Nov 2021 22:36:58 +0000 Subject: [PATCH 261/290] chore: format source code --- lua/doom/core/functions/init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index dc4745179..8cc3535e8 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -182,10 +182,11 @@ functions.create_report = function() local today_logs = {} local doom_logs = vim.split(fs.read_file(system.doom_logs), "\n") for _, doom_log in ipairs(doom_logs) do - local preinfo = doom_log:match('%[(.+)%]') + local preinfo = doom_log:match("%[(.+)%]") if preinfo ~= nil then - local is_current_day = preinfo:find(os.date('%a %d %b')) ~= nil and preinfo:find(os.date('%Y')) ~= nil - local error_or_warn = preinfo:find('ERROR ') or preinfo:find('WARN ') + local is_current_day = preinfo:find(os.date("%a %d %b")) ~= nil + and preinfo:find(os.date("%Y")) ~= nil + local error_or_warn = preinfo:find("ERROR ") or preinfo:find("WARN ") if error_or_warn and is_current_day then table.insert(today_logs, doom_log) end From e52c5a84d1d89d82413acc535cd1c9647ff9c7e2 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 18 Nov 2021 21:53:25 +1100 Subject: [PATCH 262/290] Fixed errors when fails to auto reload doom-config. --- lua/doom/modules/built-in/reloader/init.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index eb0282808..3a1fcea6f 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -1,6 +1,9 @@ --- @class Reloader local reloader = {} +--- Only show error reloading message once per session +reloader.has_failed_reload = false + local fs = require("doom.utils.fs") local utils = require("doom.utils") local log = require("doom.extras.logging") @@ -28,7 +31,7 @@ local scan_dir = require("plenary.scandir").scan_dir --- Converts a Lua module path into an acceptable Lua module format --- @param module_path string The path to the module ---- @return string +--- @return string|nil local function path_to_lua_module(module_path) local lua_path = string.format("%s%slua", system.doom_root, system.sep) @@ -38,6 +41,10 @@ local function path_to_lua_module(module_path) string.format("%s%s(.*)%%.lua", utils.escape_str(lua_path), system.sep) ) + if module_path == nil then + return nil + end + -- Replace '/' with '.' to follow the common Lua modules format module_path = module_path:gsub(system.sep, ".") @@ -110,6 +117,15 @@ reloader.reload_lua_module = function(mod_path, quiet) mod_path = path_to_lua_module(mod_path) end + -- If doom-nvim fails to reload, warn user once per session + if mod_path == nil then + if reloader.has_failed_reload == false then + log.warn('reloader: Failed to reload doom config because this file is not in nvim config directory. Is your doom nvim config directory symlinked?') + reloader.has_failed_reload = true + end + return + end + -- Get the module from package table local mod = package.loaded[mod_path] From 1339eaae7bbdb57b0f41fc54e0eb697302076e37 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 19 Nov 2021 10:47:03 +1100 Subject: [PATCH 263/290] Cleanup builtin/reloader --- lua/doom/modules/built-in/reloader/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index 3a1fcea6f..e50af69a0 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -41,7 +41,7 @@ local function path_to_lua_module(module_path) string.format("%s%s(.*)%%.lua", utils.escape_str(lua_path), system.sep) ) - if module_path == nil then + if not module_path then return nil end From 44153d21599600975741b770f38266221013879f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 19 Nov 2021 08:23:50 +0000 Subject: [PATCH 264/290] chore: format source code --- lua/doom/modules/built-in/reloader/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua index e50af69a0..f72465aa2 100644 --- a/lua/doom/modules/built-in/reloader/init.lua +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -120,7 +120,9 @@ reloader.reload_lua_module = function(mod_path, quiet) -- If doom-nvim fails to reload, warn user once per session if mod_path == nil then if reloader.has_failed_reload == false then - log.warn('reloader: Failed to reload doom config because this file is not in nvim config directory. Is your doom nvim config directory symlinked?') + log.warn( + "reloader: Failed to reload doom config because this file is not in nvim config directory. Is your doom nvim config directory symlinked?" + ) reloader.has_failed_reload = true end return From abfe29c98a85816b8f05594557900363d9ff66ef Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 18 Nov 2021 19:49:10 +1100 Subject: [PATCH 265/290] Removed GCC override for compiler + added warning messages for Apple clang users --- lua/doom/modules/config/doom-neorg.lua | 19 ++++++++++++++++++ lua/doom/modules/config/doom-treesitter.lua | 22 ++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index ff61bff7a..2561d3de3 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -29,4 +29,23 @@ return function() }, }, }) + + -- If MacOS, check if user is using clang and notify that it has poor compatibility with treesitter + -- WARN: We probably won't need this forever. + vim.defer_fn(function() + local log = require('doom.extras.logging') + -- Matches logic from nvim-treesitter + local compilers = { vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" } + function select_executable(executables) + return vim.tbl_filter(function(c) + return c ~= vim.NIL and vim.fn.executable(c) == 1 + end, executables)[1] + end + local cc = select_executable(compilers) + local version = vim.fn.systemlist(cc .. (cc == "cl" and "" or " --version"))[1] + + if (version:match('Apple clang')) then + log.warn('doom-neorg: clang has poor compatibility compiling treesitter parsers. We recommend using gcc on MacOS, see issue #246 for details.') + end + end, 1000) end diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 99cc2704c..e714d6c4c 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -50,9 +50,6 @@ return function() table.insert(modules.langs, "http") end - -- macos uses wrong c version - require("nvim-treesitter.install").compilers = { "gcc" } - require("nvim-treesitter.configs").setup({ ensure_installed = get_ts_parsers(modules.langs), highlight = { enable = true }, @@ -77,4 +74,23 @@ return function() }, }, }) + + -- If MacOS, check if user is using clang and notify that it has poor compatibility with treesitter + -- WARN: We probably won't need this forever. + vim.defer_fn(function() + local log = require('doom.extras.logging') + -- Matches logic from nvim-treesitter + local compilers = { vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" } + function select_executable(executables) + return vim.tbl_filter(function(c) + return c ~= vim.NIL and vim.fn.executable(c) == 1 + end, executables)[1] + end + local cc = select_executable(compilers) + local version = vim.fn.systemlist(cc .. (cc == "cl" and "" or " --version"))[1] + + if (version:match('Apple clang')) then + log.warn('doom-treesitter: clang has poor compatibility compiling treesitter parsers. We recommend using gcc on MacOS, see issue #246 for details.') + end + end, 1000) end From 6abde88457fb8f7572d603b265b2d3ecd70123a1 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 18 Nov 2021 21:21:31 +1100 Subject: [PATCH 266/290] Made error detection and message platform agnostic --- lua/doom/modules/config/doom-neorg.lua | 4 ++-- lua/doom/modules/config/doom-treesitter.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index 2561d3de3..d52777871 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -44,8 +44,8 @@ return function() local cc = select_executable(compilers) local version = vim.fn.systemlist(cc .. (cc == "cl" and "" or " --version"))[1] - if (version:match('Apple clang')) then - log.warn('doom-neorg: clang has poor compatibility compiling treesitter parsers. We recommend using gcc on MacOS, see issue #246 for details.') + if (version:match('clang')) then + log.warn('doom-neorg: clang has poor compatibility compiling treesitter parsers. We recommend using gcc instead, see issue #246 for details.') end end, 1000) end diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index e714d6c4c..08f6f6ab5 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -89,8 +89,8 @@ return function() local cc = select_executable(compilers) local version = vim.fn.systemlist(cc .. (cc == "cl" and "" or " --version"))[1] - if (version:match('Apple clang')) then - log.warn('doom-treesitter: clang has poor compatibility compiling treesitter parsers. We recommend using gcc on MacOS, see issue #246 for details.') + if (version:match('clang')) then + log.warn('doom-treesitter: clang has poor compatibility compiling treesitter parsers. We recommend using gcc, see issue #246 for details.') end end, 1000) end From eb29bb0bc25885bcad4bbf750c804726e010eb24 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 18 Nov 2021 22:05:09 +1100 Subject: [PATCH 267/290] Addressed luacheck issues --- lua/doom/modules/config/doom-neorg.lua | 2 +- lua/doom/modules/config/doom-treesitter.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index d52777871..46abed5c4 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -36,7 +36,7 @@ return function() local log = require('doom.extras.logging') -- Matches logic from nvim-treesitter local compilers = { vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" } - function select_executable(executables) + local select_executable = function(executables) return vim.tbl_filter(function(c) return c ~= vim.NIL and vim.fn.executable(c) == 1 end, executables)[1] diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 08f6f6ab5..dbe7436c7 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -81,7 +81,7 @@ return function() local log = require('doom.extras.logging') -- Matches logic from nvim-treesitter local compilers = { vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" } - function select_executable(executables) + local select_executable = function(executables) return vim.tbl_filter(function(c) return c ~= vim.NIL and vim.fn.executable(c) == 1 end, executables)[1] From cfeed9e55706d863b6218e61a17f809f2d6c48c4 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 19 Nov 2021 10:43:37 +1100 Subject: [PATCH 268/290] Refactored clang warning, moved logic to utils --- lua/doom/modules/config/doom-neorg.lua | 17 ++++++----------- lua/doom/modules/config/doom-treesitter.lua | 17 ++++++----------- lua/doom/utils/init.lua | 9 +++++++++ 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index 46abed5c4..d61e2d544 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -30,22 +30,17 @@ return function() }, }) - -- If MacOS, check if user is using clang and notify that it has poor compatibility with treesitter - -- WARN: We probably won't need this forever. + -- Check if user is using clang and notify that it has poor compatibility with treesitter + -- WARN: 19/11/2021 | issues: #244, #246 clang compatibility could improve in future vim.defer_fn(function() local log = require('doom.extras.logging') + local utils = require('doom.utils') -- Matches logic from nvim-treesitter - local compilers = { vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" } - local select_executable = function(executables) - return vim.tbl_filter(function(c) - return c ~= vim.NIL and vim.fn.executable(c) == 1 - end, executables)[1] - end - local cc = select_executable(compilers) - local version = vim.fn.systemlist(cc .. (cc == "cl" and "" or " --version"))[1] + local compiler = utils.find_executable_in_path({ vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" }) + local version = vim.fn.systemlist(compiler .. (compiler == "cl" and "" or " --version"))[1] if (version:match('clang')) then - log.warn('doom-neorg: clang has poor compatibility compiling treesitter parsers. We recommend using gcc instead, see issue #246 for details.') + log.warn('doom-neorg: clang has poor compatibility compiling treesitter parsers. We recommend using gcc instead, see issue #246 for details. (https://github.com/NTBBloodbath/doom-nvim/issues/246)') end end, 1000) end diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index dbe7436c7..f0d6af3f1 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -75,22 +75,17 @@ return function() }, }) - -- If MacOS, check if user is using clang and notify that it has poor compatibility with treesitter - -- WARN: We probably won't need this forever. + -- Check if user is using clang and notify that it has poor compatibility with treesitter + -- WARN: 19/11/2021 | issues: #244, #246 clang compatibility could improve in future vim.defer_fn(function() local log = require('doom.extras.logging') + local utils = require('doom.utils') -- Matches logic from nvim-treesitter - local compilers = { vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" } - local select_executable = function(executables) - return vim.tbl_filter(function(c) - return c ~= vim.NIL and vim.fn.executable(c) == 1 - end, executables)[1] - end - local cc = select_executable(compilers) - local version = vim.fn.systemlist(cc .. (cc == "cl" and "" or " --version"))[1] + local compiler = utils.find_executable_in_path({ vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" }) + local version = vim.fn.systemlist(compiler .. (compiler == "cl" and "" or " --version"))[1] if (version:match('clang')) then - log.warn('doom-treesitter: clang has poor compatibility compiling treesitter parsers. We recommend using gcc, see issue #246 for details.') + log.warn('doom-treesitter: clang has poor compatibility compiling treesitter parsers. We recommend using gcc, see issue #246 for details. (https://github.com/NTBBloodbath/doom-nvim/issues/246)') end end, 1000) end diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 793c859fa..20318d367 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -131,4 +131,13 @@ utils.check_plugin = function(plugin_name, path) ) == 1 end +--- Searches for a number of executables in the user's path +--- @param executables table Table of executables to search for +--- @return string|nil First valid executable in table +utils.find_executable_in_path = function (executables) + return vim.tbl_filter(function(c) + return c ~= vim.NIL and vim.fn.executable(c) == 1 + end, executables)[1] +end + return utils From 819eeffb7686f08f994b399db766d7fccd389442 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 19 Nov 2021 10:44:53 +1100 Subject: [PATCH 269/290] Fixed incorrect issue number in comment --- lua/doom/modules/config/doom-neorg.lua | 2 +- lua/doom/modules/config/doom-treesitter.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index d61e2d544..2625f80da 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -31,7 +31,7 @@ return function() }) -- Check if user is using clang and notify that it has poor compatibility with treesitter - -- WARN: 19/11/2021 | issues: #244, #246 clang compatibility could improve in future + -- WARN: 19/11/2021 | issues: #222, #246 clang compatibility could improve in future vim.defer_fn(function() local log = require('doom.extras.logging') local utils = require('doom.utils') diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index f0d6af3f1..8ebbc6186 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -76,7 +76,7 @@ return function() }) -- Check if user is using clang and notify that it has poor compatibility with treesitter - -- WARN: 19/11/2021 | issues: #244, #246 clang compatibility could improve in future + -- WARN: 19/11/2021 | issues: #222, #246 clang compatibility could improve in future vim.defer_fn(function() local log = require('doom.extras.logging') local utils = require('doom.utils') From a7c98dd7ffca3d65f591d36ae4c414da99734414 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 19 Nov 2021 08:27:52 +0000 Subject: [PATCH 270/290] chore: format source code --- lua/doom/modules/config/doom-neorg.lua | 19 ++++++++++++++----- lua/doom/modules/config/doom-treesitter.lua | 19 ++++++++++++++----- lua/doom/utils/init.lua | 2 +- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index 2625f80da..bea69f79b 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -33,14 +33,23 @@ return function() -- Check if user is using clang and notify that it has poor compatibility with treesitter -- WARN: 19/11/2021 | issues: #222, #246 clang compatibility could improve in future vim.defer_fn(function() - local log = require('doom.extras.logging') - local utils = require('doom.utils') + local log = require("doom.extras.logging") + local utils = require("doom.utils") -- Matches logic from nvim-treesitter - local compiler = utils.find_executable_in_path({ vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" }) + local compiler = utils.find_executable_in_path({ + vim.fn.getenv("CC"), + "cc", + "gcc", + "clang", + "cl", + "zig", + }) local version = vim.fn.systemlist(compiler .. (compiler == "cl" and "" or " --version"))[1] - if (version:match('clang')) then - log.warn('doom-neorg: clang has poor compatibility compiling treesitter parsers. We recommend using gcc instead, see issue #246 for details. (https://github.com/NTBBloodbath/doom-nvim/issues/246)') + if version:match("clang") then + log.warn( + "doom-neorg: clang has poor compatibility compiling treesitter parsers. We recommend using gcc instead, see issue #246 for details. (https://github.com/NTBBloodbath/doom-nvim/issues/246)" + ) end end, 1000) end diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 8ebbc6186..f1586adfd 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -78,14 +78,23 @@ return function() -- Check if user is using clang and notify that it has poor compatibility with treesitter -- WARN: 19/11/2021 | issues: #222, #246 clang compatibility could improve in future vim.defer_fn(function() - local log = require('doom.extras.logging') - local utils = require('doom.utils') + local log = require("doom.extras.logging") + local utils = require("doom.utils") -- Matches logic from nvim-treesitter - local compiler = utils.find_executable_in_path({ vim.fn.getenv "CC", "cc", "gcc", "clang", "cl", "zig" }) + local compiler = utils.find_executable_in_path({ + vim.fn.getenv("CC"), + "cc", + "gcc", + "clang", + "cl", + "zig", + }) local version = vim.fn.systemlist(compiler .. (compiler == "cl" and "" or " --version"))[1] - if (version:match('clang')) then - log.warn('doom-treesitter: clang has poor compatibility compiling treesitter parsers. We recommend using gcc, see issue #246 for details. (https://github.com/NTBBloodbath/doom-nvim/issues/246)') + if version:match("clang") then + log.warn( + "doom-treesitter: clang has poor compatibility compiling treesitter parsers. We recommend using gcc, see issue #246 for details. (https://github.com/NTBBloodbath/doom-nvim/issues/246)" + ) end end, 1000) end diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 20318d367..2e82bd0a0 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -134,7 +134,7 @@ end --- Searches for a number of executables in the user's path --- @param executables table Table of executables to search for --- @return string|nil First valid executable in table -utils.find_executable_in_path = function (executables) +utils.find_executable_in_path = function(executables) return vim.tbl_filter(function(c) return c ~= vim.NIL and vim.fn.executable(c) == 1 end, executables)[1] From 1f97354f1be9a0436b3d08ef279c8171e5167fed Mon Sep 17 00:00:00 2001 From: Emmanuel Touzery Date: Sun, 21 Nov 2021 10:05:05 +0100 Subject: [PATCH 271/290] telescope ignore pattern: must escape the '.' --- lua/doom/modules/config/doom-telescope.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/config/doom-telescope.lua b/lua/doom/modules/config/doom-telescope.lua index c644d3427..06e0b1e9e 100644 --- a/lua/doom/modules/config/doom-telescope.lua +++ b/lua/doom/modules/config/doom-telescope.lua @@ -31,7 +31,7 @@ return function() }, }, file_sorter = require("telescope.sorters").get_fuzzy_file, - file_ignore_patterns = { "^.git/", "^node_modules/", "^__pycache__/" }, + file_ignore_patterns = { "^%.git/", "^node_modules/", "^__pycache__/" }, generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, winblend = 0, scroll_strategy = "cycle", From c5eec16a942bab966355bef98d183d73a3e5778b Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 18 Nov 2021 23:03:57 +1100 Subject: [PATCH 272/290] Improve emmylua annotations and comments --- lua/doom/extras/logging/init.lua | 6 +++++- lua/doom/modules/config/doom-cmp.lua | 20 +++++++++++++------ .../modules/config/doom-lsp-installer.lua | 3 +++ lua/doom/modules/config/doom-treesitter.lua | 3 +++ lua/doom/utils/init.lua | 6 +++++- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/lua/doom/extras/logging/init.lua b/lua/doom/extras/logging/init.lua index fed606c70..9f71306a5 100644 --- a/lua/doom/extras/logging/init.lua +++ b/lua/doom/extras/logging/init.lua @@ -10,6 +10,7 @@ ----------------------------------------------------------- local system = require("doom.core.system") +local round = require("doom.utils").round -- logging defaults to "info" level local logging_level = "info" @@ -64,6 +65,9 @@ local log = {} local unpack = unpack or table.unpack +--- Sets up self +--- @param config table +--- @param standalone boolean log.new = function(config, standalone) config = vim.tbl_deep_extend("force", default_config, config) @@ -86,7 +90,7 @@ log.new = function(config, standalone) x = x / increment return (x > 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)) * increment end - + -- Concatenates tables into a string, handling numbers and dumping tables local make_string = function(...) local t = {} for i = 1, select("#", ...) do diff --git a/lua/doom/modules/config/doom-cmp.lua b/lua/doom/modules/config/doom-cmp.lua index 2b76e9230..43302d21f 100644 --- a/lua/doom/modules/config/doom-cmp.lua +++ b/lua/doom/modules/config/doom-cmp.lua @@ -29,13 +29,21 @@ return function() Operator = "  ", TypeParameter = "  ", } - local function get_kind(kind_type) + --- Given an LSP item kind, returns a nerdfont icon + --- @param kind_type string LSP item kind + --- @return string Nerdfont Icon + local function get_kind_icon(kind_type) return kind_icons[kind_type] end - local function t(str) + --- Wraps nvim_replace_termcodes + --- @param str string + --- @return string + local function replace_termcodes(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end + --- Helper function to check what behaviour to use + --- @return boolean local function check_backspace() local col = vim.fn.col(".") - 1 return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") @@ -50,7 +58,7 @@ return function() }, formatting = { format = function(entry, item) - item.kind = string.format("%s %s", get_kind(item.kind), item.kind) + item.kind = string.format("%s %s", get_kind_icon(item.kind), item.kind) item.menu = ({ nvim_lsp = "[LSP]", luasnip = "[Snp]", @@ -82,9 +90,9 @@ return function() if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then - vim.fn.feedkeys(t("luasnip-expand-or-jump"), "") + vim.fn.feedkeys(replace_termcodes("luasnip-expand-or-jump"), "") elseif check_backspace() then - vim.fn.feedkeys(t(""), "n") + vim.fn.feedkeys(replace_termcodes(""), "n") else fallback() end @@ -96,7 +104,7 @@ return function() if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then - vim.fn.feedkeys(t("luasnip-jump-prev"), "") + vim.fn.feedkeys(replace_termcodes("luasnip-jump-prev"), "") else fallback() end diff --git a/lua/doom/modules/config/doom-lsp-installer.lua b/lua/doom/modules/config/doom-lsp-installer.lua index e28b265ec..828be2eed 100644 --- a/lua/doom/modules/config/doom-lsp-installer.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -188,6 +188,7 @@ return function() if server:is_installed() then table.insert(uninstalling_servers, lsp_name) server:uninstall() + log.info('doom-lsp-installer: Uninstalling server ' .. lsp_name .. '.') end else local server_config = server.name == "sumneko_lua" and lua_lsp @@ -202,6 +203,7 @@ return function() if not server:is_installed() then table.insert(installing_servers, lsp_name) server:install() + log.info('doom-lsp-installer: Installing server ' .. lsp_name .. '.') end end end @@ -222,6 +224,7 @@ return function() if not server:is_installed() then table.insert(installing_servers, lsp_name) server:install() + log.info('doom-lsp-installer: Installing server ' .. lsp_name .. '.') end end end diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index f1586adfd..1ca8c1417 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -3,6 +3,9 @@ return function() local modules = require("doom.core.config.modules").modules local is_plugin_disabled = require("doom.utils").is_plugin_disabled + --- Returns treesitter parsers from doom_modules.langs + --- @param languages table + --- @return table local function get_ts_parsers(languages) local langs = {} diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 2e82bd0a0..7997a96cc 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -13,9 +13,10 @@ local system = require("doom.core.system") --- Doom Nvim version utils.doom_version = "3.2.0-beta2" + --- For autocommands, extracted from --- https://github.com/norcalli/nvim_utils ---- +--- @param definitions table> utils.create_augroups = function(definitions) for group_name, definition in pairs(definitions) do vim.api.nvim_command("augroup " .. group_name) @@ -35,6 +36,9 @@ utils.is_empty = function(str) return str == "" or str == nil end +--- Escapes a string +--- @param str string String to escape +--- @return string utils.escape_str = function(str) local escape_patterns = { "%^", From 10e2732a7afb101c24200a008f00b6919e90f1b1 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 18 Nov 2021 23:04:12 +1100 Subject: [PATCH 273/290] Move round helper function into utils --- lua/doom/extras/logging/init.lua | 13 ++++--------- lua/doom/utils/init.lua | 9 +++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lua/doom/extras/logging/init.lua b/lua/doom/extras/logging/init.lua index 9f71306a5..6107c01fb 100644 --- a/lua/doom/extras/logging/init.lua +++ b/lua/doom/extras/logging/init.lua @@ -56,8 +56,8 @@ local default_config = { { name = "fatal", hl = "ErrorMsg" }, }, - -- Can limit the number of decimals displayed for floats - float_precision = 0.01, + -- Can limit the number of decimals places for floats + decimal_places = 2, } -- {{{ NO NEED TO CHANGE @@ -85,19 +85,14 @@ log.new = function(config, standalone) levels[v.name] = i end - local round = function(x, increment) - increment = increment or 1 - x = x / increment - return (x > 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)) * increment - end -- Concatenates tables into a string, handling numbers and dumping tables local make_string = function(...) local t = {} for i = 1, select("#", ...) do local x = select(i, ...) - if type(x) == "number" and config.float_precision then - x = tostring(round(x, config.float_precision)) + if type(x) == "number" and config.decimal_places then + x = tostring(round(x, config.decimal_places)) elseif type(x) == "table" then x = vim.inspect(x) else diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 7997a96cc..19cc0212c 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -135,6 +135,15 @@ utils.check_plugin = function(plugin_name, path) ) == 1 end +--- Rounds a number, optionally to the nearest decimal place +--- @param num number - Value to round +--- @param decimalplace |number - Number of decimal places +--- @return number +utils.round = function(num, decimalplace) + local mult = 10^(decimalplace or 0) + return math.floor(num * mult + 0.5)/mult +end + --- Searches for a number of executables in the user's path --- @param executables table Table of executables to search for --- @return string|nil First valid executable in table From 98a3f4dadeee5456123f687d4cf6429bc8abc951 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 18 Nov 2021 23:10:24 +1100 Subject: [PATCH 274/290] Address luacheck issues --- lua/doom/utils/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 19cc0212c..3c459071d 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -37,7 +37,7 @@ utils.is_empty = function(str) end --- Escapes a string ---- @param str string String to escape +--- @param str string String to escape --- @return string utils.escape_str = function(str) local escape_patterns = { @@ -137,7 +137,7 @@ end --- Rounds a number, optionally to the nearest decimal place --- @param num number - Value to round ---- @param decimalplace |number - Number of decimal places +--- @param decimalplace number|nil - Number of decimal places --- @return number utils.round = function(num, decimalplace) local mult = 10^(decimalplace or 0) From 7c9b44f1c1e34340580e3855a6d6db4aef22729f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 21 Nov 2021 23:57:45 +0000 Subject: [PATCH 275/290] chore: format source code --- lua/doom/modules/config/doom-lsp-installer.lua | 6 +++--- lua/doom/utils/init.lua | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lua/doom/modules/config/doom-lsp-installer.lua b/lua/doom/modules/config/doom-lsp-installer.lua index 828be2eed..0d05a542b 100644 --- a/lua/doom/modules/config/doom-lsp-installer.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -188,7 +188,7 @@ return function() if server:is_installed() then table.insert(uninstalling_servers, lsp_name) server:uninstall() - log.info('doom-lsp-installer: Uninstalling server ' .. lsp_name .. '.') + log.info("doom-lsp-installer: Uninstalling server " .. lsp_name .. ".") end else local server_config = server.name == "sumneko_lua" and lua_lsp @@ -203,7 +203,7 @@ return function() if not server:is_installed() then table.insert(installing_servers, lsp_name) server:install() - log.info('doom-lsp-installer: Installing server ' .. lsp_name .. '.') + log.info("doom-lsp-installer: Installing server " .. lsp_name .. ".") end end end @@ -224,7 +224,7 @@ return function() if not server:is_installed() then table.insert(installing_servers, lsp_name) server:install() - log.info('doom-lsp-installer: Installing server ' .. lsp_name .. '.') + log.info("doom-lsp-installer: Installing server " .. lsp_name .. ".") end end end diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 3c459071d..c4cf4b68d 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -13,7 +13,6 @@ local system = require("doom.core.system") --- Doom Nvim version utils.doom_version = "3.2.0-beta2" - --- For autocommands, extracted from --- https://github.com/norcalli/nvim_utils --- @param definitions table> @@ -140,8 +139,8 @@ end --- @param decimalplace number|nil - Number of decimal places --- @return number utils.round = function(num, decimalplace) - local mult = 10^(decimalplace or 0) - return math.floor(num * mult + 0.5)/mult + local mult = 10 ^ (decimalplace or 0) + return math.floor(num * mult + 0.5) / mult end --- Searches for a number of executables in the user's path From d4a048d0f5f3b6c685e85fce5022df1acf674dec Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 20 Nov 2021 14:25:41 +1100 Subject: [PATCH 276/290] Added bug report and feature request issue templates --- .github/ISSUE_TEMPLATE/BUG_REPORT.md | 47 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 23 +++++++++++ 2 files changed, 70 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/BUG_REPORT.md create mode 100644 .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md new file mode 100644 index 000000000..602cdd459 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -0,0 +1,47 @@ +--- +name: 🐞 Bug +about: File a bug/issue +title: '[BUG] ' +labels: 'scope: bug' +assignees: '' +--- + +<!-- +Note: Please search to see if an issue already exists for the bug you encountered. +--> + +### Current Behavior: +<!-- A concise description of what you're experiencing. --> + +### Expected Behavior: +<!-- A concise description of what you expected to happen. --> + +### Steps To Reproduce: +<!-- +Example: steps to reproduce the behavior: +1. In this environment... +2. With this config... +3. Run '...' +4. See error... +--> + +### Logs + +<details> +<summary>Check Health Output</summary> + +<!-- Run `:checkhealth` and paste output here ** --> + +</details> + +<details> +<summary>Doom Report Output</summary> + +<!-- Run `:DoomReport` and copy the contents of `~/.local/share/nvim/doom_report.md` --> + +</details> + +### Anything else: +<!-- +Links? References? Screenshots? Anything that will give us more context about the issue that you are encountering! +--> diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md new file mode 100644 index 000000000..7bf27214a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -0,0 +1,23 @@ +--- +name: 💡 Feature Request +about: File a feature request +title: '[FEATURE REQUEST] <title>' +labels: 'scope: enhancement' +assignees: '' +--- + +### What is the feature, what would you like to be able to do? +<!-- Provide a clear and concise description of what you want to happen. --> + +### What is the use case, why do you want this feature? +<!-- Provide a clear and concise description of why this feature would help you or other users. --> + +### Possible Implementation (if applicable) +<!-- If you have an idea of how this could be built, add it here. --> + +### Additional context +<!-- + Is there anything else you can add about the proposal? + You might want to link to related issues here, if you haven't already. +--> + From 292492fc1a3df7020dc698343b1b111a8fd6ce40 Mon Sep 17 00:00:00 2001 From: connorgmeean <a@cgm.codes> Date: Sat, 20 Nov 2021 14:31:56 +1100 Subject: [PATCH 277/290] Added a question template --- .github/ISSUE_TEMPLATE/QUESTION.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/QUESTION.md diff --git a/.github/ISSUE_TEMPLATE/QUESTION.md b/.github/ISSUE_TEMPLATE/QUESTION.md new file mode 100644 index 000000000..144ab3e06 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/QUESTION.md @@ -0,0 +1,13 @@ +--- +name: ❓ Question +about: Ask a question +title: '[QUESTION] <title>' +labels: 'scope: question' +assignees: '' +--- + +- [ ] I have searched open and closed issues for this question + +<!-- We also have a discord channel which is also a great place to ask questions --> + + From 99c6cd7d58baa23eb93693f896ae01b968321095 Mon Sep 17 00:00:00 2001 From: connorgmeean <a@cgm.codes> Date: Sat, 20 Nov 2021 14:41:21 +1100 Subject: [PATCH 278/290] Added pull request template --- .github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md new file mode 100644 index 000000000..1acc6add4 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md @@ -0,0 +1,22 @@ +### Description + +<!-- A summary of your changes and the reasoning/motivation for making these changes. --> +<!-- If changes are complex, describe how you implemented / solved this issue --> + +<!-- Link the issue this PR fixes or addresses if relevant --> +Fixes # (issue) + +### Type of change + +<!-- Please delete options that are not relevant. --> + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +### Checklist + +- [ ] I have checked [contributing guidelines](https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/contributing.md#contributing-code) +- [ ] I have tested my code +- [ ] I have updated the documentation (if necessary) From 29834fde0530035a6dcf505dea57779bf9c2178e Mon Sep 17 00:00:00 2001 From: connorgmeean <a@cgm.codes> Date: Sun, 21 Nov 2021 12:22:45 +1100 Subject: [PATCH 279/290] Wording change --- .github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md index 1acc6add4..64cf9d734 100644 --- a/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md @@ -4,7 +4,7 @@ <!-- If changes are complex, describe how you implemented / solved this issue --> <!-- Link the issue this PR fixes or addresses if relevant --> -Fixes # (issue) +Related issue: # (issue_number) ### Type of change From 5f4ff518e1debb4876fe7907ad65e797de756b26 Mon Sep 17 00:00:00 2001 From: connorgmeean <a@cgm.codes> Date: Mon, 22 Nov 2021 17:26:46 +1100 Subject: [PATCH 280/290] Added discord link to template --- .github/ISSUE_TEMPLATE/QUESTION.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/QUESTION.md b/.github/ISSUE_TEMPLATE/QUESTION.md index 144ab3e06..0c4720424 100644 --- a/.github/ISSUE_TEMPLATE/QUESTION.md +++ b/.github/ISSUE_TEMPLATE/QUESTION.md @@ -8,6 +8,8 @@ assignees: '' - [ ] I have searched open and closed issues for this question -<!-- We also have a discord channel which is also a great place to ask questions --> +<!-- We also have a discord channel which is also a great place to ask questions + https://discord.gg/xhvBM45zBf +--> From 5d1784ff4665b21f1984679c610af3dd4d750892 Mon Sep 17 00:00:00 2001 From: NTBBloodbath <bloodbathalchemist@protonmail.com> Date: Wed, 24 Nov 2021 06:20:14 -0400 Subject: [PATCH 281/290] =?UTF-8?q?chore:=20bump=20Doom=20version=20\(`3.2?= =?UTF-8?q?.0-beta2`=20=E2=86=92=20`3.2.0`\)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/doom/utils/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index c4cf4b68d..97ca68d4c 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -11,7 +11,7 @@ local system = require("doom.core.system") -------------------- HELPERS -------------------- --- Doom Nvim version -utils.doom_version = "3.2.0-beta2" +utils.doom_version = "3.2.0" --- For autocommands, extracted from --- https://github.com/norcalli/nvim_utils From eff32423350ed70538c86030770b4615a290aa46 Mon Sep 17 00:00:00 2001 From: NTBBloodbath <bloodbathalchemist@protonmail.com> Date: Wed, 24 Nov 2021 06:36:09 -0400 Subject: [PATCH 282/290] refact(treesitter): do not add http parser manually, it got merged a few weeks ago --- lua/doom/modules/config/doom-treesitter.lua | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 1ca8c1417..99ff91390 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -41,14 +41,6 @@ return function() table.insert(modules.langs, "norg") end - -- Set up treesitter for HTTP - parser_configs.http = { - install_info = { - url = "https://github.com/NTBBloodbath/tree-sitter-http", - files = { "src/parser.c" }, - branch = "main", - }, - } if packer_plugins and packer_plugins["rest.nvim"] then table.insert(modules.langs, "http") end From b0bd5bbf201a7f860bf4fdefb27b09a353eb18a6 Mon Sep 17 00:00:00 2001 From: connorgmeean <a@cgm.codes> Date: Wed, 24 Nov 2021 21:41:36 +1100 Subject: [PATCH 283/290] chore: Updated commit shas for pinned dependencies --- lua/doom/modules/init.lua | 112 +++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 60fd72119..0d621ade7 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -64,7 +64,7 @@ packer.startup(function(use) use({ "nvim-treesitter/nvim-treesitter", commit = vim.fn.has("nvim-0.6.0") == 1 and pin_commit( - "a47df48e7d4232fd771f2537a4fb43f582c026c9" + "afed686e6a8fc1035475d8c56c1b5ff252c346e5" ) or pin_commit("47cfda2c6711077625c90902d7722238a8294982"), opt = true, run = ":TSUpdate", @@ -73,24 +73,24 @@ packer.startup(function(use) }) use({ "JoosepAlviste/nvim-ts-context-commentstring", - commit = pin_commit("ce74852c36008b11dda451bfe6c2ed71c535152b"), + commit = pin_commit('9f5e422e1030e7073e593ad32c5354aa0bcb0176'), after = "nvim-treesitter", }) use({ "nvim-treesitter/nvim-tree-docs", - commit = pin_commit("864c2f5023fa7399aa084fd81c0e2f8dedfd32e3"), + commit = pin_commit('15135bd18c8f0c4d67dd1b36d3b2cd64579aab6f'), after = "nvim-treesitter", }) use({ "windwp/nvim-ts-autotag", - commit = pin_commit("80d427af7b898768c8d8538663d52dee133da86f"), + commit = pin_commit('80d427af7b898768c8d8538663d52dee133da86f'), after = "nvim-treesitter", }) -- Aniseed, required by some treesitter modules use({ "Olical/aniseed", - commit = pin_commit("4bb3a4c1a1e329ebefa7ff022f7b3947770f7f26"), + commit = pin_commit('9c8f2cd17d454a38b11cedd323579b579ee27f9c'), module_pattern = "aniseed", }) @@ -98,7 +98,7 @@ packer.startup(function(use) local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", - commit = --[[NO AUTO UPDATE]]pin_commit("17602389089d56907bbfc026c3dba19f9d24c2dd"), + commit = --[[NO AUTO UPDATE]]pin_commit("3b4d5bcd0f85b15d99183c7d29e0eb1c5f88350b"), branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, @@ -109,7 +109,7 @@ packer.startup(function(use) local disabled_sessions = is_plugin_disabled("auto-session") use({ "folke/persistence.nvim", - commit = pin_commit("77cf5a6ee162013b97237ff25450080401849f85"), + commit = pin_commit('77cf5a6ee162013b97237ff25450080401849f85'), config = require("doom.modules.config.doom-persistence"), -- event = "VimEnter", disable = disabled_sessions, @@ -122,7 +122,7 @@ packer.startup(function(use) local disabled_dashboard = is_plugin_disabled("dashboard") use({ "glepnir/dashboard-nvim", - commit = pin_commit("ba98ab86487b8eda3b0934b5423759944b5f7ebd"), + commit = pin_commit('ba98ab86487b8eda3b0934b5423759944b5f7ebd'), config = require("doom.modules.config.doom-dashboard"), disable = disabled_dashboard, }) @@ -131,14 +131,14 @@ packer.startup(function(use) local disabled_doom_themes = is_plugin_disabled("doom-themes") use({ "GustavoPrietoP/doom-themes.nvim", - commit = pin_commit("03d417d3eab71c320744f8da22251715ba6cee53"), + commit = pin_commit('03d417d3eab71c320744f8da22251715ba6cee53'), disable = disabled_doom_themes, }) -- Development icons use({ "kyazdani42/nvim-web-devicons", - commit = pin_commit("f936ff3e1f9d58ec0caf0bd398e9675b54fe292e"), + commit = pin_commit('8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb'), module = "nvim-web-devicons", }) @@ -147,7 +147,7 @@ packer.startup(function(use) and require("doom.core.config").config.doom.use_netrw use({ "kyazdani42/nvim-tree.lua", - commit = pin_commit("5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3"), + commit = pin_commit('5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3'), requires = "nvim-web-devicons", config = require("doom.modules.config.doom-tree"), disable = disabled_tree, @@ -165,7 +165,7 @@ packer.startup(function(use) local disabled_ranger = is_plugin_disabled("ranger") use({ "francoiscabrol/ranger.vim", - commit = pin_commit("91e82debdf566dfaf47df3aef0a5fd823cedf41c"), + commit = pin_commit('91e82debdf566dfaf47df3aef0a5fd823cedf41c'), requires = "rbgrouleff/bclose.vim", disable = disabled_ranger, }) @@ -175,7 +175,7 @@ packer.startup(function(use) local disabled_statusline = is_plugin_disabled("statusline") use({ "NTBBloodbath/galaxyline.nvim", - commit = pin_commit("7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d"), + commit = pin_commit('7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d'), config = require("doom.modules.config.doom-eviline"), disable = disabled_statusline, }) @@ -185,7 +185,7 @@ packer.startup(function(use) local disabled_tabline = is_plugin_disabled("tabline") use({ "akinsho/bufferline.nvim", - commit = pin_commit("782fab8a2352e872dc991c42f806dae18e848b2d"), + commit = pin_commit('463637a3ac86dcaacbcd47aa608f53aaad749696'), config = require("doom.modules.config.doom-bufferline"), disable = disabled_tabline, event = "BufWinEnter", @@ -196,7 +196,7 @@ packer.startup(function(use) local disabled_terminal = is_plugin_disabled("terminal") use({ "akinsho/toggleterm.nvim", - commit = pin_commit("0b6d65d8b45e261bc17176e86abb3f631c88fc1b"), + commit = pin_commit('ff168c8218b963cc7fc9d80b684d840488839bb5'), config = require("doom.modules.config.doom-toggleterm"), disable = disabled_terminal, module = { "toggleterm", "toggleterm.terminal" }, @@ -208,7 +208,7 @@ packer.startup(function(use) local disabled_outline = is_plugin_disabled("symbols") use({ "simrat39/symbols-outline.nvim", - commit = pin_commit("552b67993ed959993279e0b0f8a1da9f3c5e6fc0"), + commit = pin_commit('552b67993ed959993279e0b0f8a1da9f3c5e6fc0'), config = require("doom.modules.config.doom-symbols"), disable = disabled_outline, cmd = { @@ -223,7 +223,7 @@ packer.startup(function(use) local disabled_minimap = is_plugin_disabled("minimap") use({ "wfxr/minimap.vim", - commit = pin_commit("5c54258d34b8ae4be70a8fbc09b400eb7be0bee8"), + commit = pin_commit('35c0dd759938459d866aba1bdf0f1fc0b670ed61'), disable = disabled_minimap, cmd = { "Minimap", @@ -238,7 +238,7 @@ packer.startup(function(use) local disabled_whichkey = is_plugin_disabled("which-key") use({ "folke/which-key.nvim", - commit = pin_commit("d3032b6d3e0adb667975170f626cb693bfc66baa"), + commit = pin_commit('d3032b6d3e0adb667975170f626cb693bfc66baa'), opt = true, config = require("doom.modules.config.doom-whichkey"), disable = disabled_whichkey, @@ -248,7 +248,7 @@ packer.startup(function(use) local disabled_show_registers = is_plugin_disabled("show_registers") use({ "tversteeg/registers.nvim", - commit = pin_commit("4d1f3525c6f9be4297e99e6aed515af3677d7241"), + commit = pin_commit('4d1f3525c6f9be4297e99e6aed515af3677d7241'), disable = disabled_show_registers, }) @@ -256,7 +256,7 @@ packer.startup(function(use) local disabled_zen = is_plugin_disabled("zen") use({ "Pocco81/TrueZen.nvim", - commit = pin_commit("508b977d71650da5c9243698614a9a1416f116d4"), + commit = pin_commit('508b977d71650da5c9243698614a9a1416f116d4'), config = require("doom.modules.config.doom-zen"), disable = disabled_zen, module = "true-zen", @@ -267,7 +267,7 @@ packer.startup(function(use) local disabled_illuminate = is_plugin_disabled("illuminated") use({ "RRethy/vim-illuminate", - commit = pin_commit("084b012ce5bc1bf302b69eb73562146afe0a9756"), + commit = pin_commit('2beae0581caa66cf8c09fad7c7c557f92d49d2bd'), setup = function() vim.g.Illuminate_ftblacklist = { "help", @@ -289,19 +289,19 @@ packer.startup(function(use) -----]]--------------[[----- use({ "nvim-lua/plenary.nvim", - commit = pin_commit("1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac"), + commit = pin_commit('1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac'), module = "plenary", }) use({ "nvim-lua/popup.nvim", - commit = pin_commit("f91d80973f80025d4ed00380f2e06c669dfda49d"), + commit = pin_commit('b7404d35d5d3548a82149238289fa71f7f6de4ac'), module = "popup", }) local disabled_telescope = is_plugin_disabled("telescope") use({ "nvim-telescope/telescope.nvim", - commit = pin_commit("729492406ec3b545c4ecf2beadf7bd30c81e70e4"), + commit = pin_commit('1c57cc6140644695f0d9bd71b63de45feeca6ae7'), cmd = "Telescope", module = "telescope", requires = { @@ -313,7 +313,7 @@ packer.startup(function(use) }) use({ "lazytanuki/nvim-mapper", - commit = pin_commit("e11e852bafa41a4a2c160fcd2d38779add423db9"), + commit = pin_commit('e11e852bafa41a4a2c160fcd2d38779add423db9'), config = function() local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep require("nvim-mapper").setup({ @@ -340,7 +340,7 @@ packer.startup(function(use) local disabled_gitsigns = is_plugin_disabled("gitsigns") use({ "lewis6991/gitsigns.nvim", - commit = pin_commit("bfc4543262442a336e257d2d9fac16aa1de532a9"), + commit = pin_commit('95845ef39ce0a98f68cdfdcf7dd586c5e965acc7'), config = require("doom.modules.config.doom-gitsigns"), disable = disabled_gitsigns, requires = "plenary.nvim", @@ -351,7 +351,7 @@ packer.startup(function(use) local disabled_neogit = is_plugin_disabled("neogit") use({ "TimUntersberger/neogit", - commit = pin_commit("807e4a795dc6c2383b281fc27bd1bc6c197d98cd"), + commit = pin_commit('ab772d21b108127ad6c703f7457c279f5817f379'), config = function() require("neogit").setup({}) end, @@ -364,7 +364,7 @@ packer.startup(function(use) local disabled_lazygit = is_plugin_disabled("lazygit") use({ "kdheepak/lazygit.nvim", - commit = pin_commit("bcd111df61abe90b133cb08ea577c02af44ca5ce"), + commit = pin_commit('497ef5578e15f6c79deef1cad71adedd1c80abd4'), requires = "plenary.nvim", disable = disabled_lazygit, cmd = { "LazyGit", "LazyGitConfig" }, @@ -377,7 +377,7 @@ packer.startup(function(use) -- Built-in LSP Config use({ "neovim/nvim-lspconfig", - commit = pin_commit("4191b1fca3bafe759ae5606d19e0f0e54e9fc83b"), + commit = pin_commit('1cb8583d186d28f2959eac5d74a74dc745fae099'), config = require("doom.modules.config.doom-lspconfig"), disable = disabled_lsp, }) @@ -393,7 +393,7 @@ packer.startup(function(use) -- can be disabled to use your own completion plugin use({ "hrsh7th/nvim-cmp", - commit = pin_commit("753f5b7c92da0302efffc5ce6780dffe0602bdf3"), + commit = pin_commit('2e4270d02843d15510b3549354e238788ca07ca5'), wants = { "LuaSnip" }, requires = { { @@ -419,31 +419,31 @@ packer.startup(function(use) }) use({ "hrsh7th/cmp-nvim-lua", - commit = pin_commit("d276254e7198ab7d00f117e88e223b4bd8c02d21"), + commit = pin_commit('d276254e7198ab7d00f117e88e223b4bd8c02d21'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-nvim-lsp", - commit = pin_commit("134117299ff9e34adde30a735cd8ca9cf8f3db81"), + commit = pin_commit('134117299ff9e34adde30a735cd8ca9cf8f3db81'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-path", - commit = pin_commit("98ded32b9c4d95aa95af70b9979b767f39073f0e"), + commit = pin_commit('81518cf6ae29f5f0c79cd47770ae90ff5225ee13'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-buffer", - commit = pin_commit("2d85e76c725a389b72067f86fc3c65f3868b9a59"), + commit = pin_commit('a706dc69c49110038fe570e5c9c33d6d4f67015b'), disable = disabled_lsp, after = "nvim-cmp", }) use({ "saadparwaiz1/cmp_luasnip", - commit = pin_commit("16832bb50e760223a403ffa3042859845dd9ef9d"), + commit = pin_commit('16832bb50e760223a403ffa3042859845dd9ef9d'), disable = disabled_lsp, after = "nvim-cmp", }) @@ -451,7 +451,7 @@ packer.startup(function(use) -- Manage Language serverss with ease. use({ "williamboman/nvim-lsp-installer", - commit = pin_commit("35d4b08d60c17b79f8e16e9e66f0d7693c99d612"), + commit = pin_commit('bcce5db53b966e2dbd97fc8d1bbfa7db4a405f13'), config = require("doom.modules.config.doom-lsp-installer"), disable = disabled_lsp, }) @@ -459,7 +459,7 @@ packer.startup(function(use) -- Show function signature when you type use({ "ray-x/lsp_signature.nvim", - commit = pin_commit("600111e6249bcc948e2b811ef09adf4ea84ebfc1"), + commit = pin_commit('c7b2b2e14b597c077804ae201f1ec9a7dac76ad0'), config = require("doom.modules.config.doom-lsp-signature"), after = "nvim-lspconfig", event = "InsertEnter", @@ -468,7 +468,7 @@ packer.startup(function(use) -- Setup for Lua development in Neovim use({ "folke/lua-dev.nvim", - commit = pin_commit("6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0"), + commit = pin_commit('6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0'), disable = disabled_lsp, module = "lua-dev", }) @@ -479,14 +479,14 @@ packer.startup(function(use) local disabled_dap = is_plugin_disabled("dap") use({ "mfussenegger/nvim-dap", - commit = pin_commit("1a87456d280e8e308df7983650a5ea2b5a6bfb63"), + commit = pin_commit('4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1'), disable = disabled_dap, event = "BufWinEnter", }) use({ "rcarriga/nvim-dap-ui", - commit = pin_commit("649e0fee4f0b8dc6305dd29065c7623c3dc6a032"), + commit = pin_commit('649e0fee4f0b8dc6305dd29065c7623c3dc6a032'), config = require("doom.modules.config.doom-dap-ui"), disable = disabled_dap, after = "nvim-dap", @@ -494,7 +494,7 @@ packer.startup(function(use) use({ "Pocco81/DAPInstall.nvim", - commit = pin_commit("dd09e9dd3a6e29f02ac171515b8a089fb82bb425"), + commit = pin_commit('dd09e9dd3a6e29f02ac171515b8a089fb82bb425'), config = require("doom.modules.config.doom-dap-install"), disable = disabled_dap, after = "nvim-dap", @@ -508,7 +508,7 @@ packer.startup(function(use) local disabled_suda = is_plugin_disabled("suda") use({ "lambdalisue/suda.vim", - commit = pin_commit("0290c93c148a14eab2b661a1933003d86436f6ec"), + commit = pin_commit('0290c93c148a14eab2b661a1933003d86436f6ec'), disable = disabled_suda, cmd = { "SudaRead", "SudaWrite" }, }) @@ -518,7 +518,7 @@ packer.startup(function(use) local disabled_formatter = is_plugin_disabled("formatter") use({ "lukas-reineke/format.nvim", - commit = pin_commit("c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7"), + commit = pin_commit('c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7'), config = require("doom.modules.config.doom-format"), disable = disabled_formatter, cmd = { "Format", "FormatWrite" }, @@ -528,7 +528,7 @@ packer.startup(function(use) local disabled_linter = is_plugin_disabled("linter") use({ "mfussenegger/nvim-lint", - commit = pin_commit("0116b78963fd24643faa34fa1bc02f8d425a73ef"), + commit = pin_commit('c3c8a247fda421b0db1f2cbf50ab4340ba0ffc61'), config = require("doom.modules.config.doom-lint"), disable = disabled_linter, module = "lint", @@ -538,7 +538,7 @@ packer.startup(function(use) local disabled_indent_lines = is_plugin_disabled("indentlines") use({ "lukas-reineke/indent-blankline.nvim", - commit = pin_commit("9f663d31d4ee0672f24cd5b26ca3863665048a25"), + commit = pin_commit('caf7f61e94525bbd97e32f118efd6c0722430616'), config = require("doom.modules.config.doom-blankline"), disable = disabled_indent_lines, event = "ColorScheme", @@ -548,7 +548,7 @@ packer.startup(function(use) local disabled_editorconfig = is_plugin_disabled("editorconfig") use({ "editorconfig/editorconfig-vim", - commit = pin_commit("3078cd10b28904e57d878c0d0dab42aa0a9fdc89"), + commit = pin_commit('3078cd10b28904e57d878c0d0dab42aa0a9fdc89'), disable = disabled_editorconfig, }) @@ -557,7 +557,7 @@ packer.startup(function(use) local disabled_kommentary = is_plugin_disabled("kommentary") use({ "b3nj5m1n/kommentary", - commit = pin_commit("8f1cd74ad28de7d7c4fda5d8e8557ff240904b42"), + commit = pin_commit('8f1cd74ad28de7d7c4fda5d8e8557ff240904b42'), disable = disabled_kommentary, event = "BufWinEnter", }) @@ -566,13 +566,13 @@ packer.startup(function(use) -- Lua 5.1 docs use({ "milisims/nvim-luaref", - commit = pin_commit("dc40d606549db7df1a6e23efa743c90c178333d4"), + commit = pin_commit('dc40d606549db7df1a6e23efa743c90c178333d4'), disable = disabled_contrib, }) -- LibUV docs use({ "nanotee/luv-vimdocs", - commit = pin_commit("fb04e1088a21eefcc396d5a5299468d8742d27a2"), + commit = pin_commit('fb04e1088a21eefcc396d5a5299468d8742d27a2'), disable = disabled_contrib, }) @@ -583,7 +583,7 @@ packer.startup(function(use) local disabled_colorizer = is_plugin_disabled("colorizer") use({ "norcalli/nvim-colorizer.lua", - commit = pin_commit("36c610a9717cc9ec426a07c8e6bf3b3abcb139d6"), + commit = pin_commit('36c610a9717cc9ec426a07c8e6bf3b3abcb139d6'), config = require("doom.modules.config.doom-colorizer"), disable = disabled_colorizer, event = "ColorScheme", @@ -594,7 +594,7 @@ packer.startup(function(use) local disabled_restclient = is_plugin_disabled("restclient") use({ "NTBBloodbath/rest.nvim", - commit = pin_commit("759bf5b1a8cd15ecf6ecf2407a826d4be6ec3414"), + commit = pin_commit('e1c34175ee0b2293e8b9c06c11f2fc63f4262918'), requires = "plenary.nvim", config = function() require("rest-nvim").setup() @@ -606,7 +606,7 @@ packer.startup(function(use) local disabled_range_highlight = is_plugin_disabled("range-highlight") use({ "winston0410/range-highlight.nvim", - commit = pin_commit("8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9"), + commit = pin_commit('8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9'), requires = { { "winston0410/cmd-parser.nvim", module = "cmd-parser" }, }, @@ -620,7 +620,7 @@ packer.startup(function(use) local disabled_firenvim = is_plugin_disabled("firenvim") use({ "glacambre/firenvim", - commit = pin_commit("0ff2821cc0a561ac79596f358b26674c87483efa"), + commit = pin_commit('7320a805f51b4cf03de4e3b30088838d3f84adda'), disable = disabled_firenvim, run = function() vim.fn["firenvim#install"](0) @@ -631,7 +631,7 @@ packer.startup(function(use) local disabled_todo = is_plugin_disabled("todo_comments") use({ "folke/todo-comments.nvim", - commit = pin_commit("9983edc5ef38c7a035c17c85f60ee13dbd75dcc8"), + commit = pin_commit('9983edc5ef38c7a035c17c85f60ee13dbd75dcc8'), requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), disable = disabled_todo, @@ -641,7 +641,7 @@ packer.startup(function(use) local disabled_trouble = is_plugin_disabled("trouble") use({ "folke/trouble.nvim", - commit = pin_commit("756f09de113a775ab16ba6d26c090616b40a999d"), + commit = pin_commit('756f09de113a775ab16ba6d26c090616b40a999d'), cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" }, requires = "kyazdani42/nvim-web-devicons", config = require("doom.modules.config.doom-trouble"), @@ -651,7 +651,7 @@ packer.startup(function(use) local disabled_superman = is_plugin_disabled("superman") use({ "jez/vim-superman", - commit = pin_commit("19d307446576d9118625c5d9d3c7a4c9bec5571a"), + commit = pin_commit('19d307446576d9118625c5d9d3c7a4c9bec5571a'), cmd = "SuperMan", disable = disabled_superman, }) From 600a6cc83226ca8870aa6e20781ba4d296007884 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 24 Nov 2021 10:42:58 +0000 Subject: [PATCH 284/290] chore: format source code --- lua/doom/modules/init.lua | 108 +++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 0d621ade7..ebe99c206 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -73,24 +73,24 @@ packer.startup(function(use) }) use({ "JoosepAlviste/nvim-ts-context-commentstring", - commit = pin_commit('9f5e422e1030e7073e593ad32c5354aa0bcb0176'), + commit = pin_commit("9f5e422e1030e7073e593ad32c5354aa0bcb0176"), after = "nvim-treesitter", }) use({ "nvim-treesitter/nvim-tree-docs", - commit = pin_commit('15135bd18c8f0c4d67dd1b36d3b2cd64579aab6f'), + commit = pin_commit("15135bd18c8f0c4d67dd1b36d3b2cd64579aab6f"), after = "nvim-treesitter", }) use({ "windwp/nvim-ts-autotag", - commit = pin_commit('80d427af7b898768c8d8538663d52dee133da86f'), + commit = pin_commit("80d427af7b898768c8d8538663d52dee133da86f"), after = "nvim-treesitter", }) -- Aniseed, required by some treesitter modules use({ "Olical/aniseed", - commit = pin_commit('9c8f2cd17d454a38b11cedd323579b579ee27f9c'), + commit = pin_commit("9c8f2cd17d454a38b11cedd323579b579ee27f9c"), module_pattern = "aniseed", }) @@ -109,7 +109,7 @@ packer.startup(function(use) local disabled_sessions = is_plugin_disabled("auto-session") use({ "folke/persistence.nvim", - commit = pin_commit('77cf5a6ee162013b97237ff25450080401849f85'), + commit = pin_commit("77cf5a6ee162013b97237ff25450080401849f85"), config = require("doom.modules.config.doom-persistence"), -- event = "VimEnter", disable = disabled_sessions, @@ -122,7 +122,7 @@ packer.startup(function(use) local disabled_dashboard = is_plugin_disabled("dashboard") use({ "glepnir/dashboard-nvim", - commit = pin_commit('ba98ab86487b8eda3b0934b5423759944b5f7ebd'), + commit = pin_commit("ba98ab86487b8eda3b0934b5423759944b5f7ebd"), config = require("doom.modules.config.doom-dashboard"), disable = disabled_dashboard, }) @@ -131,14 +131,14 @@ packer.startup(function(use) local disabled_doom_themes = is_plugin_disabled("doom-themes") use({ "GustavoPrietoP/doom-themes.nvim", - commit = pin_commit('03d417d3eab71c320744f8da22251715ba6cee53'), + commit = pin_commit("03d417d3eab71c320744f8da22251715ba6cee53"), disable = disabled_doom_themes, }) -- Development icons use({ "kyazdani42/nvim-web-devicons", - commit = pin_commit('8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb'), + commit = pin_commit("8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb"), module = "nvim-web-devicons", }) @@ -147,7 +147,7 @@ packer.startup(function(use) and require("doom.core.config").config.doom.use_netrw use({ "kyazdani42/nvim-tree.lua", - commit = pin_commit('5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3'), + commit = pin_commit("5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3"), requires = "nvim-web-devicons", config = require("doom.modules.config.doom-tree"), disable = disabled_tree, @@ -165,7 +165,7 @@ packer.startup(function(use) local disabled_ranger = is_plugin_disabled("ranger") use({ "francoiscabrol/ranger.vim", - commit = pin_commit('91e82debdf566dfaf47df3aef0a5fd823cedf41c'), + commit = pin_commit("91e82debdf566dfaf47df3aef0a5fd823cedf41c"), requires = "rbgrouleff/bclose.vim", disable = disabled_ranger, }) @@ -175,7 +175,7 @@ packer.startup(function(use) local disabled_statusline = is_plugin_disabled("statusline") use({ "NTBBloodbath/galaxyline.nvim", - commit = pin_commit('7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d'), + commit = pin_commit("7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d"), config = require("doom.modules.config.doom-eviline"), disable = disabled_statusline, }) @@ -185,7 +185,7 @@ packer.startup(function(use) local disabled_tabline = is_plugin_disabled("tabline") use({ "akinsho/bufferline.nvim", - commit = pin_commit('463637a3ac86dcaacbcd47aa608f53aaad749696'), + commit = pin_commit("463637a3ac86dcaacbcd47aa608f53aaad749696"), config = require("doom.modules.config.doom-bufferline"), disable = disabled_tabline, event = "BufWinEnter", @@ -196,7 +196,7 @@ packer.startup(function(use) local disabled_terminal = is_plugin_disabled("terminal") use({ "akinsho/toggleterm.nvim", - commit = pin_commit('ff168c8218b963cc7fc9d80b684d840488839bb5'), + commit = pin_commit("ff168c8218b963cc7fc9d80b684d840488839bb5"), config = require("doom.modules.config.doom-toggleterm"), disable = disabled_terminal, module = { "toggleterm", "toggleterm.terminal" }, @@ -208,7 +208,7 @@ packer.startup(function(use) local disabled_outline = is_plugin_disabled("symbols") use({ "simrat39/symbols-outline.nvim", - commit = pin_commit('552b67993ed959993279e0b0f8a1da9f3c5e6fc0'), + commit = pin_commit("552b67993ed959993279e0b0f8a1da9f3c5e6fc0"), config = require("doom.modules.config.doom-symbols"), disable = disabled_outline, cmd = { @@ -223,7 +223,7 @@ packer.startup(function(use) local disabled_minimap = is_plugin_disabled("minimap") use({ "wfxr/minimap.vim", - commit = pin_commit('35c0dd759938459d866aba1bdf0f1fc0b670ed61'), + commit = pin_commit("35c0dd759938459d866aba1bdf0f1fc0b670ed61"), disable = disabled_minimap, cmd = { "Minimap", @@ -238,7 +238,7 @@ packer.startup(function(use) local disabled_whichkey = is_plugin_disabled("which-key") use({ "folke/which-key.nvim", - commit = pin_commit('d3032b6d3e0adb667975170f626cb693bfc66baa'), + commit = pin_commit("d3032b6d3e0adb667975170f626cb693bfc66baa"), opt = true, config = require("doom.modules.config.doom-whichkey"), disable = disabled_whichkey, @@ -248,7 +248,7 @@ packer.startup(function(use) local disabled_show_registers = is_plugin_disabled("show_registers") use({ "tversteeg/registers.nvim", - commit = pin_commit('4d1f3525c6f9be4297e99e6aed515af3677d7241'), + commit = pin_commit("4d1f3525c6f9be4297e99e6aed515af3677d7241"), disable = disabled_show_registers, }) @@ -256,7 +256,7 @@ packer.startup(function(use) local disabled_zen = is_plugin_disabled("zen") use({ "Pocco81/TrueZen.nvim", - commit = pin_commit('508b977d71650da5c9243698614a9a1416f116d4'), + commit = pin_commit("508b977d71650da5c9243698614a9a1416f116d4"), config = require("doom.modules.config.doom-zen"), disable = disabled_zen, module = "true-zen", @@ -267,7 +267,7 @@ packer.startup(function(use) local disabled_illuminate = is_plugin_disabled("illuminated") use({ "RRethy/vim-illuminate", - commit = pin_commit('2beae0581caa66cf8c09fad7c7c557f92d49d2bd'), + commit = pin_commit("2beae0581caa66cf8c09fad7c7c557f92d49d2bd"), setup = function() vim.g.Illuminate_ftblacklist = { "help", @@ -289,19 +289,19 @@ packer.startup(function(use) -----]]--------------[[----- use({ "nvim-lua/plenary.nvim", - commit = pin_commit('1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac'), + commit = pin_commit("1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac"), module = "plenary", }) use({ "nvim-lua/popup.nvim", - commit = pin_commit('b7404d35d5d3548a82149238289fa71f7f6de4ac'), + commit = pin_commit("b7404d35d5d3548a82149238289fa71f7f6de4ac"), module = "popup", }) local disabled_telescope = is_plugin_disabled("telescope") use({ "nvim-telescope/telescope.nvim", - commit = pin_commit('1c57cc6140644695f0d9bd71b63de45feeca6ae7'), + commit = pin_commit("1c57cc6140644695f0d9bd71b63de45feeca6ae7"), cmd = "Telescope", module = "telescope", requires = { @@ -313,7 +313,7 @@ packer.startup(function(use) }) use({ "lazytanuki/nvim-mapper", - commit = pin_commit('e11e852bafa41a4a2c160fcd2d38779add423db9'), + commit = pin_commit("e11e852bafa41a4a2c160fcd2d38779add423db9"), config = function() local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep require("nvim-mapper").setup({ @@ -340,7 +340,7 @@ packer.startup(function(use) local disabled_gitsigns = is_plugin_disabled("gitsigns") use({ "lewis6991/gitsigns.nvim", - commit = pin_commit('95845ef39ce0a98f68cdfdcf7dd586c5e965acc7'), + commit = pin_commit("95845ef39ce0a98f68cdfdcf7dd586c5e965acc7"), config = require("doom.modules.config.doom-gitsigns"), disable = disabled_gitsigns, requires = "plenary.nvim", @@ -351,7 +351,7 @@ packer.startup(function(use) local disabled_neogit = is_plugin_disabled("neogit") use({ "TimUntersberger/neogit", - commit = pin_commit('ab772d21b108127ad6c703f7457c279f5817f379'), + commit = pin_commit("ab772d21b108127ad6c703f7457c279f5817f379"), config = function() require("neogit").setup({}) end, @@ -364,7 +364,7 @@ packer.startup(function(use) local disabled_lazygit = is_plugin_disabled("lazygit") use({ "kdheepak/lazygit.nvim", - commit = pin_commit('497ef5578e15f6c79deef1cad71adedd1c80abd4'), + commit = pin_commit("497ef5578e15f6c79deef1cad71adedd1c80abd4"), requires = "plenary.nvim", disable = disabled_lazygit, cmd = { "LazyGit", "LazyGitConfig" }, @@ -377,7 +377,7 @@ packer.startup(function(use) -- Built-in LSP Config use({ "neovim/nvim-lspconfig", - commit = pin_commit('1cb8583d186d28f2959eac5d74a74dc745fae099'), + commit = pin_commit("1cb8583d186d28f2959eac5d74a74dc745fae099"), config = require("doom.modules.config.doom-lspconfig"), disable = disabled_lsp, }) @@ -393,7 +393,7 @@ packer.startup(function(use) -- can be disabled to use your own completion plugin use({ "hrsh7th/nvim-cmp", - commit = pin_commit('2e4270d02843d15510b3549354e238788ca07ca5'), + commit = pin_commit("2e4270d02843d15510b3549354e238788ca07ca5"), wants = { "LuaSnip" }, requires = { { @@ -419,31 +419,31 @@ packer.startup(function(use) }) use({ "hrsh7th/cmp-nvim-lua", - commit = pin_commit('d276254e7198ab7d00f117e88e223b4bd8c02d21'), + commit = pin_commit("d276254e7198ab7d00f117e88e223b4bd8c02d21"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-nvim-lsp", - commit = pin_commit('134117299ff9e34adde30a735cd8ca9cf8f3db81'), + commit = pin_commit("134117299ff9e34adde30a735cd8ca9cf8f3db81"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-path", - commit = pin_commit('81518cf6ae29f5f0c79cd47770ae90ff5225ee13'), + commit = pin_commit("81518cf6ae29f5f0c79cd47770ae90ff5225ee13"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "hrsh7th/cmp-buffer", - commit = pin_commit('a706dc69c49110038fe570e5c9c33d6d4f67015b'), + commit = pin_commit("a706dc69c49110038fe570e5c9c33d6d4f67015b"), disable = disabled_lsp, after = "nvim-cmp", }) use({ "saadparwaiz1/cmp_luasnip", - commit = pin_commit('16832bb50e760223a403ffa3042859845dd9ef9d'), + commit = pin_commit("16832bb50e760223a403ffa3042859845dd9ef9d"), disable = disabled_lsp, after = "nvim-cmp", }) @@ -451,7 +451,7 @@ packer.startup(function(use) -- Manage Language serverss with ease. use({ "williamboman/nvim-lsp-installer", - commit = pin_commit('bcce5db53b966e2dbd97fc8d1bbfa7db4a405f13'), + commit = pin_commit("bcce5db53b966e2dbd97fc8d1bbfa7db4a405f13"), config = require("doom.modules.config.doom-lsp-installer"), disable = disabled_lsp, }) @@ -459,7 +459,7 @@ packer.startup(function(use) -- Show function signature when you type use({ "ray-x/lsp_signature.nvim", - commit = pin_commit('c7b2b2e14b597c077804ae201f1ec9a7dac76ad0'), + commit = pin_commit("c7b2b2e14b597c077804ae201f1ec9a7dac76ad0"), config = require("doom.modules.config.doom-lsp-signature"), after = "nvim-lspconfig", event = "InsertEnter", @@ -468,7 +468,7 @@ packer.startup(function(use) -- Setup for Lua development in Neovim use({ "folke/lua-dev.nvim", - commit = pin_commit('6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0'), + commit = pin_commit("6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0"), disable = disabled_lsp, module = "lua-dev", }) @@ -479,14 +479,14 @@ packer.startup(function(use) local disabled_dap = is_plugin_disabled("dap") use({ "mfussenegger/nvim-dap", - commit = pin_commit('4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1'), + commit = pin_commit("4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1"), disable = disabled_dap, event = "BufWinEnter", }) use({ "rcarriga/nvim-dap-ui", - commit = pin_commit('649e0fee4f0b8dc6305dd29065c7623c3dc6a032'), + commit = pin_commit("649e0fee4f0b8dc6305dd29065c7623c3dc6a032"), config = require("doom.modules.config.doom-dap-ui"), disable = disabled_dap, after = "nvim-dap", @@ -494,7 +494,7 @@ packer.startup(function(use) use({ "Pocco81/DAPInstall.nvim", - commit = pin_commit('dd09e9dd3a6e29f02ac171515b8a089fb82bb425'), + commit = pin_commit("dd09e9dd3a6e29f02ac171515b8a089fb82bb425"), config = require("doom.modules.config.doom-dap-install"), disable = disabled_dap, after = "nvim-dap", @@ -508,7 +508,7 @@ packer.startup(function(use) local disabled_suda = is_plugin_disabled("suda") use({ "lambdalisue/suda.vim", - commit = pin_commit('0290c93c148a14eab2b661a1933003d86436f6ec'), + commit = pin_commit("0290c93c148a14eab2b661a1933003d86436f6ec"), disable = disabled_suda, cmd = { "SudaRead", "SudaWrite" }, }) @@ -518,7 +518,7 @@ packer.startup(function(use) local disabled_formatter = is_plugin_disabled("formatter") use({ "lukas-reineke/format.nvim", - commit = pin_commit('c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7'), + commit = pin_commit("c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7"), config = require("doom.modules.config.doom-format"), disable = disabled_formatter, cmd = { "Format", "FormatWrite" }, @@ -528,7 +528,7 @@ packer.startup(function(use) local disabled_linter = is_plugin_disabled("linter") use({ "mfussenegger/nvim-lint", - commit = pin_commit('c3c8a247fda421b0db1f2cbf50ab4340ba0ffc61'), + commit = pin_commit("c3c8a247fda421b0db1f2cbf50ab4340ba0ffc61"), config = require("doom.modules.config.doom-lint"), disable = disabled_linter, module = "lint", @@ -538,7 +538,7 @@ packer.startup(function(use) local disabled_indent_lines = is_plugin_disabled("indentlines") use({ "lukas-reineke/indent-blankline.nvim", - commit = pin_commit('caf7f61e94525bbd97e32f118efd6c0722430616'), + commit = pin_commit("caf7f61e94525bbd97e32f118efd6c0722430616"), config = require("doom.modules.config.doom-blankline"), disable = disabled_indent_lines, event = "ColorScheme", @@ -548,7 +548,7 @@ packer.startup(function(use) local disabled_editorconfig = is_plugin_disabled("editorconfig") use({ "editorconfig/editorconfig-vim", - commit = pin_commit('3078cd10b28904e57d878c0d0dab42aa0a9fdc89'), + commit = pin_commit("3078cd10b28904e57d878c0d0dab42aa0a9fdc89"), disable = disabled_editorconfig, }) @@ -557,7 +557,7 @@ packer.startup(function(use) local disabled_kommentary = is_plugin_disabled("kommentary") use({ "b3nj5m1n/kommentary", - commit = pin_commit('8f1cd74ad28de7d7c4fda5d8e8557ff240904b42'), + commit = pin_commit("8f1cd74ad28de7d7c4fda5d8e8557ff240904b42"), disable = disabled_kommentary, event = "BufWinEnter", }) @@ -566,13 +566,13 @@ packer.startup(function(use) -- Lua 5.1 docs use({ "milisims/nvim-luaref", - commit = pin_commit('dc40d606549db7df1a6e23efa743c90c178333d4'), + commit = pin_commit("dc40d606549db7df1a6e23efa743c90c178333d4"), disable = disabled_contrib, }) -- LibUV docs use({ "nanotee/luv-vimdocs", - commit = pin_commit('fb04e1088a21eefcc396d5a5299468d8742d27a2'), + commit = pin_commit("fb04e1088a21eefcc396d5a5299468d8742d27a2"), disable = disabled_contrib, }) @@ -583,7 +583,7 @@ packer.startup(function(use) local disabled_colorizer = is_plugin_disabled("colorizer") use({ "norcalli/nvim-colorizer.lua", - commit = pin_commit('36c610a9717cc9ec426a07c8e6bf3b3abcb139d6'), + commit = pin_commit("36c610a9717cc9ec426a07c8e6bf3b3abcb139d6"), config = require("doom.modules.config.doom-colorizer"), disable = disabled_colorizer, event = "ColorScheme", @@ -594,7 +594,7 @@ packer.startup(function(use) local disabled_restclient = is_plugin_disabled("restclient") use({ "NTBBloodbath/rest.nvim", - commit = pin_commit('e1c34175ee0b2293e8b9c06c11f2fc63f4262918'), + commit = pin_commit("e1c34175ee0b2293e8b9c06c11f2fc63f4262918"), requires = "plenary.nvim", config = function() require("rest-nvim").setup() @@ -606,7 +606,7 @@ packer.startup(function(use) local disabled_range_highlight = is_plugin_disabled("range-highlight") use({ "winston0410/range-highlight.nvim", - commit = pin_commit('8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9'), + commit = pin_commit("8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9"), requires = { { "winston0410/cmd-parser.nvim", module = "cmd-parser" }, }, @@ -620,7 +620,7 @@ packer.startup(function(use) local disabled_firenvim = is_plugin_disabled("firenvim") use({ "glacambre/firenvim", - commit = pin_commit('7320a805f51b4cf03de4e3b30088838d3f84adda'), + commit = pin_commit("7320a805f51b4cf03de4e3b30088838d3f84adda"), disable = disabled_firenvim, run = function() vim.fn["firenvim#install"](0) @@ -631,7 +631,7 @@ packer.startup(function(use) local disabled_todo = is_plugin_disabled("todo_comments") use({ "folke/todo-comments.nvim", - commit = pin_commit('9983edc5ef38c7a035c17c85f60ee13dbd75dcc8'), + commit = pin_commit("9983edc5ef38c7a035c17c85f60ee13dbd75dcc8"), requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), disable = disabled_todo, @@ -641,7 +641,7 @@ packer.startup(function(use) local disabled_trouble = is_plugin_disabled("trouble") use({ "folke/trouble.nvim", - commit = pin_commit('756f09de113a775ab16ba6d26c090616b40a999d'), + commit = pin_commit("756f09de113a775ab16ba6d26c090616b40a999d"), cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" }, requires = "kyazdani42/nvim-web-devicons", config = require("doom.modules.config.doom-trouble"), @@ -651,7 +651,7 @@ packer.startup(function(use) local disabled_superman = is_plugin_disabled("superman") use({ "jez/vim-superman", - commit = pin_commit('19d307446576d9118625c5d9d3c7a4c9bec5571a'), + commit = pin_commit("19d307446576d9118625c5d9d3c7a4c9bec5571a"), cmd = "SuperMan", disable = disabled_superman, }) From 6662003885a8bd3502e33af4f8b1163c4f1ced0d Mon Sep 17 00:00:00 2001 From: NTBBloodbath <bloodbathalchemist@protonmail.com> Date: Sun, 28 Nov 2021 04:35:39 -0400 Subject: [PATCH 285/290] docs: update CHANGELOG.md for 3.2 release (not finished yet) --- CHANGELOG.md | 76 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a00de69e..0430c323a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,76 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.2.0] - 2021-11-24 + +### Added + +- Install http tree-sitter parser if `rest.nvim` plugin is enabled +- New languages in `doom_modules.lua` file +- New `contrib` entry in `doom_modules.lua` file, contrib module enables some documentation plugins +- Add `~/.config/nvim/doc` to neorg workspaces +- Add `statusline_show_file_path` option in `doom_config.lua` file +- Implement `keybinds_mdoules` option in `doom_config.lua`, enable or disable Doom keybindings modules as you wish + - Modularize keybindings +- Add extra field to custom functions in order to choose if the function should be ran on startup or if should be a global function +- Add modeline in `doom_config.lua` file [#139](https://github.com/NTBBloodbath/doom-nvim/pull/139) +- Ignore editor artifacts [#141](https://github.com/NTBBloodbath/doom-nvim/pull/141) +- Improve debugging messages +- Better error catching +- New plugins + - `nvim-lint`, async linter + - `vim-illuminate`, highlight word under cursor +- New commands + - `DoomManual`, open Doom user manual + - `DoomReport`, create a Doom crash report + - `DoomConfigs`, open a prompt to edit Doom configuration files + - `DoomConfigsReload`, Reload Doom custom mappings, autocommands, etc + - `DoomInfo`, display a informational dashboard +- New keybinds + - `<leader>di`, display a informational dashboard +- New built-in plugins + - `info`, show an useful informational dashboard + +### Changed + +- Update doom-one colorscheme +- Replace built-in Neovim `.txt` docs with Neorg-based docs +- Refact configuration files handling [#108](https://github.com/NTBBloodbath/doom-nvim/pull/108) +- Invert Doom Lua modules loading order, in that way we will load Neovim configurations first +- Plugins + - Lazy-load more plugins + - Enable `neorg` by default + - Replace [nvim-compe](https://github.com/hrsh7th/nvim-compe) with [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) [#119](https://github.com/NTBBloodbath/doom-nvim/pull/119) + - Replace [nvim-lspinstall](https://github.com/kabouzeid/nvim-lspinstall) with [nvim-lsp-installer](https://github.com/williamboman/nvim-lsp-installer) + - Use NTBBloodbath's galaxyline fork + - Update `gitsigns` configurations + - Update `nvim-tree` configurations + - Update `bufferline` configurations + - Update `dap-ui` configurations [#114](https://github.com/NTBBloodbath/doom-nvim/pull/114) + - Update `neorg` tree-sitter parser files + - Use `,o` as neorg leader instead of `<leader>o` + - Drop a line from Doom logo in dashboard [#140](https://github.com/NTBBloodbath/doom-nvim/pull/140) + - Small statusline improvements for small windows + +### Fixed + +- Disable indent lines in norg files +- Proper conditional for enabling undodir +- Add missing entries for disabling certain plugins +- Update some plugins links +- Make sure plugins are loaded in a correct order [#120](https://github.com/NTBBloodbath/doom-nvim/pull/120) +- Remove non-neeeded `bufdo e`. Fixes [#127](https://github.com/NTBBloodbath/doom-nvim/issues/127) +- Do not try to load `which-key.nvim` plugin if not installed. Fixes [#124](https://github.com/NTBBloodbath/doom-nvim/issues/124) +- Bufferline was not being loaded sometimes +- Run `BufEnter` autocommand after loading tree-sitter, fixes concealing on norg files + +### Removed + +- Selene linter comments and references [#106](https://github.com/NTBBloodbath/doom-nvim/pull/106) +- Do not disable syntax highlighting on launch. Closes [#131](https://github.com/NTBBloodbath/doom-nvim/issues/131) +- Remove some built-in Neovim plugins loading logic to allow them to be used +- Remove shada logic, we do not really need to temporarily disable it + ## [3.1.2] - 2021-10-01 ### Changed @@ -51,7 +121,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `SPC - d - l` keybinding for manually reload configurations - Windows support (note that some plugins does not work well on Windows and that's not a doom issue!) - `SPC - d - s` keybinding now offers a live preview for the colorschemes -- `tsx` treesitter parser is now installed alongside with the typescript one, see [#84](https://github.com/NTBBloodbath/doom-nvim/issues/84) +- `tsx` tree-sitter parser is now installed alongside with the typescript one, see [#84](https://github.com/NTBBloodbath/doom-nvim/issues/84) - Allow to override default keymappings - Quick save with `SPC - v / m` - Jump keybindings on which-key @@ -60,7 +130,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - You can now add your doom-nvim configurations to your dotfiles without having to use submodules! See [#79](https://github.com/NTBBloodbath/doom-nvim/issues/79) - Plugins: - - New plugin: treesitter companion plugins (autotag, docs, etc) + - New plugin: tree-sitter companion plugins (autotag, docs, etc) - New plugin: nvim-mapper, a keybindings cheatsheet - New plugin: DAP (Debugging Adapter Protocol) support - New plugin: trouble, better quickfix window @@ -102,7 +172,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Plugins: - Occasional bug with autosessions - Properly lazy-load TrueZen - - Use GCC compiler for haskell treesitter parser + - Use GCC compiler for haskell tree-sitter parser - bufferline will not be shown when: 1. Only one buffer is opened 2. While being in the dashboard From 206f7cbf447789a3fee5244c1033629ba6c3a78b Mon Sep 17 00:00:00 2001 From: NTBBloodbath <bloodbathalchemist@protonmail.com> Date: Fri, 10 Dec 2021 00:42:24 -0400 Subject: [PATCH 286/290] docs(CHANGELOG): finish 3.2 changelog entry (yes, we just made a bible) --- CHANGELOG.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0430c323a..b6c61e044 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,18 +11,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Completely reload Doom after updating +- Hot reload plugins configurations +- Run `PackerCompile` on exit when Doom modulesor userplugins files were modified +- Automatically install or uninstall plugins on save in plugins files +- Improve debugging messages +- Better error catching - Install http tree-sitter parser if `rest.nvim` plugin is enabled - New languages in `doom_modules.lua` file - New `contrib` entry in `doom_modules.lua` file, contrib module enables some documentation plugins - Add `~/.config/nvim/doc` to neorg workspaces - Add `statusline_show_file_path` option in `doom_config.lua` file +- Add Scala language server support out of the box (Metals) +- Override LSP using `+lsp(LSP_NAME)` syntax + - Use several LSPs using `+lsp(LSP_NAME, ANOTHER_LSP_NAME)` syntax +- Improve `netrw` look and feel +- Add `use_netrw` configuration option, decide if Doom sshoulduse netrw or nvim-tree as the file explorer - Implement `keybinds_mdoules` option in `doom_config.lua`, enable or disable Doom keybindings modules as you wish - Modularize keybindings - Add extra field to custom functions in order to choose if the function should be ran on startup or if should be a global function - Add modeline in `doom_config.lua` file [#139](https://github.com/NTBBloodbath/doom-nvim/pull/139) - Ignore editor artifacts [#141](https://github.com/NTBBloodbath/doom-nvim/pull/141) -- Improve debugging messages -- Better error catching +- Use a better syntax for Neovim folds +- Add `escape_str` function to utils module +- Add GTD (Getting Things Done) setup in Neorg +- Use `q` to quickly exit Neovim in dashboard +- Stay in visual mode after indenting a selection with `<` or `>` +- Add keybindings for `lsp_rename` functionality (`<leader>clr`) +- Add an option to turn off folding +- Improve statusline look and feel, show filetype + active language servers +- Add helper script for contributors to setup and run a docker image and create a git worktree +- Add helper script for contributors to update Doom plugins commits pins +- Provide workaround for `clang` users who run into treesitter complation issues +- Add debugging keybindings +- Add `disable_numbering` confiugration option +- Add user defined ESC sequences in `doom_config` file - New plugins - `nvim-lint`, async linter - `vim-illuminate`, highlight word under cursor @@ -30,21 +53,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `DoomManual`, open Doom user manual - `DoomReport`, create a Doom crash report - `DoomConfigs`, open a prompt to edit Doom configuration files - - `DoomConfigsReload`, Reload Doom custom mappings, autocommands, etc + - `DoomConfigsReload`, reload Doom custom mappings, autocommands, etc - `DoomInfo`, display a informational dashboard + - `DoomReload`, hot reload Doom Nvim - New keybinds - `<leader>di`, display a informational dashboard + - `<leader>t` section to tweak editor behaviors like numbering and spelling - New built-in plugins - `info`, show an useful informational dashboard + - `async`, run async system commands (e.g. running Git) + - `reloader`, reload Lua modules on the fly ### Changed +- General cleanup +- `:DoomUpdate` is now asynchronous, keep coding while Doom updates itself! - Update doom-one colorscheme +- Reduce delay on LSP startup - Replace built-in Neovim `.txt` docs with Neorg-based docs - Refact configuration files handling [#108](https://github.com/NTBBloodbath/doom-nvim/pull/108) - Invert Doom Lua modules loading order, in that way we will load Neovim configurations first +- Use `xpcall` instead of `pcall` in all modules to provide a better tracback in case of an error +- Rename all our Lua modules tables from `M` to a more logical name, e.g. `system` for system module +- Improve EmmyLua annotations and comments +- Fragment utilities module + - `fs`, filesystem utilities + - `mappings`, mappings utilities + - `modules`, Lua modules utilities - Plugins + - Pin plugins to a certain commit to improve stability - Lazy-load more plugins + - Do not lazy-load nvim-mapper - Enable `neorg` by default - Replace [nvim-compe](https://github.com/hrsh7th/nvim-compe) with [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) [#119](https://github.com/NTBBloodbath/doom-nvim/pull/119) - Replace [nvim-lspinstall](https://github.com/kabouzeid/nvim-lspinstall) with [nvim-lsp-installer](https://github.com/williamboman/nvim-lsp-installer) @@ -64,11 +103,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Proper conditional for enabling undodir - Add missing entries for disabling certain plugins - Update some plugins links +- Fix DAP auto installation +- Fix telescope indexing `.git` directory +- Fix Doom not respecting `CC` environment variable +- Fix `:DoomReport` command not including `warning`/`error` logs +- Provide Neovim 0.6 LSP API changes +- Proper precedence in paths to source Doom configuration files +- Proper example for custom options in `doom_config` file - Make sure plugins are loaded in a correct order [#120](https://github.com/NTBBloodbath/doom-nvim/pull/120) - Remove non-neeeded `bufdo e`. Fixes [#127](https://github.com/NTBBloodbath/doom-nvim/issues/127) - Do not try to load `which-key.nvim` plugin if not installed. Fixes [#124](https://github.com/NTBBloodbath/doom-nvim/issues/124) - Bufferline was not being loaded sometimes - Run `BufEnter` autocommand after loading tree-sitter, fixes concealing on norg files +- Properly fallback to doom-one, better logging messages in UI module +- Use `0.5-compat` branch for TreeSitter when using Neovim 0.5.x +- Use `package.loaded` to check toggleterm existence in built-in modules ### Removed From ecbe51ed99110c34d9d7340233b5ea805283fa66 Mon Sep 17 00:00:00 2001 From: connorgmeean <a@cgm.codes> Date: Fri, 10 Dec 2021 15:25:11 +1100 Subject: [PATCH 287/290] revert: Use `vim.fn.inputlist` instead of `vim.ui` for edit config prompt (0.5 compatibility) This reverts commit 86076ecc5c1b0ecd8c84799472613a24f23ba76f. # Conflicts: # lua/doom/core/functions/init.lua --- lua/doom/core/functions/init.lua | 48 ++++++++++++++------------------ 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 8cc3535e8..81ff9e329 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -463,33 +463,27 @@ functions.rollback_doom = function() end -- edit_config creates a prompt to modify a doom configuration file -functions.edit_config = function() - vim.ui.select( - { "doom_config.lua", "doom_modules.lua", "doom_userplugins.lua" }, - { prompt = "Select a configuration file to edit:" }, - function(_, selected_config_idx) - local direction = config.doom.vertical_split and "vert " or "" - local open_command = config.doom.new_file_split and "split" or "edit" - - if selected_config_idx == 1 then - vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config").source)) - elseif selected_config_idx == 2 then - vim.cmd( - ("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source) - ) - elseif selected_config_idx == 3 then - vim.cmd( - ("%s%s %s"):format( - direction, - open_command, - require("doom.core.config.userplugins").source - ) - ) - elseif selected_config_idx == nil then - log.error("Invalid option selected") - end - end - ) +M.edit_config = function() + local selected_config = tonumber(vim.fn.inputlist({ + "Select a configuration file to edit:", + "1. doom_config.lua", + "2. doom_modules.lua", + "3. doom_userplugins.lua", + })) + local direction = config.doom.vertical_split and "vert " or "" + local open_command = config.doom.new_file_split and "split" or "edit" + + if selected_config == 1 then + vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config").source)) + elseif selected_config == 2 then + vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source)) + elseif selected_config == 3 then + vim.cmd( + ("%s%s %s"):format(direction, open_command, require("doom.core.config.userplugins").source) + ) + elseif selected_config ~= 0 then + log.error("Invalid option selected.") + end end -- followings are called from lua/doom/extras/keybindings/leader.lua From e6b30f9282a580342db1b697c9f1e5d879a575e1 Mon Sep 17 00:00:00 2001 From: NTBBloodbath <bloodbathalchemist@protonmail.com> Date: Fri, 10 Dec 2021 00:45:33 -0400 Subject: [PATCH 288/290] fix(whichkey): add missing entry for `<leader>clr` keybind --- lua/doom/modules/config/doom-whichkey.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/doom/modules/config/doom-whichkey.lua b/lua/doom/modules/config/doom-whichkey.lua index 5f6397459..e6f633158 100644 --- a/lua/doom/modules/config/doom-whichkey.lua +++ b/lua/doom/modules/config/doom-whichkey.lua @@ -111,6 +111,7 @@ return function() ["d"] = { "Show type definition" }, ["l"] = { "Show line diagnostics" }, ["q"] = { "Diagnostics into location list" }, + ["r"] = { "Rename symbol under cursor" }, }, }, ["d"] = { From f4af91a5a4dcab5d952de365d9a99ff8b913c10e Mon Sep 17 00:00:00 2001 From: NTBBloodbath <bloodbathalchemist@protonmail.com> Date: Fri, 10 Dec 2021 00:50:11 -0400 Subject: [PATCH 289/290] fix(CHANGELOG): add missing link to 3.2.0 release --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6c61e044..a2ea97353 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -676,7 +676,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial stable release -[unreleased]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.2...develop +[unreleased]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.2.0...develop +[3.2.0]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.2...v3.2.0 [3.1.2]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.1...v3.1.2 [3.1.1]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.0...v3.1.1 [3.1.0]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.0.13...v3.1.0 From 5631ee317556d0c15bb321a55847abdb86d6fafc Mon Sep 17 00:00:00 2001 From: NTBBloodbath <bloodbathalchemist@protonmail.com> Date: Fri, 10 Dec 2021 18:09:26 -0400 Subject: [PATCH 290/290] fix(functions): proper module name --- lua/doom/core/functions/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 81ff9e329..ac88f863f 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -463,7 +463,7 @@ functions.rollback_doom = function() end -- edit_config creates a prompt to modify a doom configuration file -M.edit_config = function() +functions.edit_config = function() local selected_config = tonumber(vim.fn.inputlist({ "Select a configuration file to edit:", "1. doom_config.lua",