From ae35bbbe37fa0278a1e77f773284c68330156260 Mon Sep 17 00:00:00 2001 From: Mandar Vaze Date: Thu, 10 Feb 2022 17:27:19 +0530 Subject: [PATCH 01/73] Updated default Doom Nvim root directory unless using cheovim, default Doom Nvim root directory is `$HOME/.config/nvim/` NOT `$HOME/.config/doom-nvim/` --- 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 05040c6f9..4bb527c17 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -350,7 +350,7 @@ a previous release (for main branch) or a previous commit (for development branc 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). +Doom Nvim root directory (`$HOME/.config/nvim/` by default). ### doom_modules.lua From e4b4e26e72a3025412f9f93bf40717b8d544e227 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 10 Feb 2022 23:37:29 +1100 Subject: [PATCH 02/73] fix: Updated CHANGELOG, removed references to 0.5 --- CHANGELOG.md | 5 +++++ doc/doom_nvim.norg | 6 ------ docs/faq.md | 9 --------- docs/getting_started.md | 4 ++-- lua/doom/core/config/init.lua | 4 ++-- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ea97353..054bda579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.3.0] +- Removed support for Neovim 0.5 +- Fixed bug where the Dashboard would show instead of piped contents +- Updated pinned dependencies to latest versions solving quite a few smaller and undocumented bugs. + ## [3.2.0] - 2021-11-24 ### Added diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index c94f01e96..ad52a3d61 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -33,7 +33,6 @@ -> [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?) --> [Workaround](#Workaround) ---> [Missing nvim help documentation](#Missing nvim help documentation) -> [Acknowledgements](#Acknowledgements) @@ -617,11 +616,6 @@ 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. - ** Workaround *** Missing nvim help documentation Since Doom Nvim extensively uses delayed loading of packages, their help documentation may not diff --git a/docs/faq.md b/docs/faq.md index c44878f83..286747943 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -7,15 +7,6 @@ Doom Nvim is intended for all types of Vimmer who want a stable and efficient development environment without spending a lot of time setting everything up. -### Why does Doom Nvim only support Neovim 0.5+? - -Doom Nvim doesn't support Neovim versions lower than the current stable (0.5) due to: - -- some features would be lost -- Not all Lua plugins have good alternatives in Vimscript, so the experience - would not be the same -- performance would not be the same as Lua cannot be used - ### How to version control Doom Nvim? Doom Nvim makes use of an internal variable called `doom_configs_root` that points diff --git a/docs/getting_started.md b/docs/getting_started.md index 05040c6f9..73a7e0f25 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -5,7 +5,7 @@ This is what you will have installed by the end of this section: - Git 2.23+ -- Neovim 0.5.0+ (Neovim 0.4.x not supported, see [faq](./faq.md#why-does-doom-nvim-only-support-neovim-05) to know why) +- Neovim 0.6.0+ - GNU Find - **Optional**: ripgrep 11.0+ (highly recommended) - **Optional**: fd 7.3.0+ (known as `fd-find` on Debian, Ubuntu & derivates), @@ -213,7 +213,7 @@ choco install nodejs ### Doom Nvim -With Neovim v0.5.0 and Doom's dependencies installed, next is to install +With Neovim v0.6.0 and Doom's dependencies installed, next is to install Doom Nvim itself. > **IMPORTANT**: if you don't have a patched nerd font then you will need to diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 22d48fc8b..f5776e36f 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -15,8 +15,8 @@ log.debug("Loading Doom config module ...") -- 1. Running Vim instead of Neovim -- 2. Running Neovim 0.4 or below if vim.fn.has("nvim") == 1 then - if vim.fn.has("nvim-0.5") ~= 1 then - log.fatal("Doom Nvim requires Neovim 0.5.0, please update it") + if vim.fn.has("nvim-0.6") ~= 1 then + log.fatal("Doom Nvim requires Neovim 0.6.0, please update it") end else log.fatal("Doom Nvim does not have support for Vim, please use it with Neovim instead") From 667b4eee0986546482f429c4b38eaaeb22306fdf Mon Sep 17 00:00:00 2001 From: Danny Kirkham Date: Sat, 26 Feb 2022 23:51:19 +0000 Subject: [PATCH 03/73] Remove outdated MacPorts statement This states that MacPorts only has Neovim 0.4 but right now it has the latest version (0.6.1). I've removed the statement https://ports.macports.org/port/neovim/ --- docs/getting_started.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index e5b823e02..241d071ba 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -77,8 +77,6 @@ brew install neovim --HEAD nvim --version ``` -MacPorts currently only has Neovim v0.4.4 - #### On Windows ##### [Chocolatey](https://community.chocolatey.org/) From ab3a03c331bcdd2879b8f34967610187d529fefb Mon Sep 17 00:00:00 2001 From: Pierce Bartine Date: Tue, 22 Feb 2022 23:51:27 -0800 Subject: [PATCH 04/73] feat(modules): Add Terraform support --- doom_modules.lua | 1 + lua/doom/modules/config/doom-lsp-installer.lua | 1 + lua/doom/modules/config/doom-treesitter.lua | 3 +++ 3 files changed, 5 insertions(+) diff --git a/doom_modules.lua b/doom_modules.lua index 7ef434ebb..acc86d5eb 100644 --- a/doom_modules.lua +++ b/doom_modules.lua @@ -79,6 +79,7 @@ M.modules = { -- "comment", -- Better annotations and comments -- "config", -- Configuration files (JSON, YAML, TOML) -- "dockerfile", -- Do you like containers, right? + -- "terraform", -- Terraform and HCL support }, utilities = { -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit diff --git a/lua/doom/modules/config/doom-lsp-installer.lua b/lua/doom/modules/config/doom-lsp-installer.lua index 0d05a542b..5880a0eb6 100644 --- a/lua/doom/modules/config/doom-lsp-installer.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -51,6 +51,7 @@ return function() -- solang = { 'solang' }, -- sorbet = { 'sorbet' }, svelte = { "svelte" }, + terraform = { "terraformls" }, typescript = { "tsserver" }, -- vala = { 'valals' }, vim = { "vimls" }, diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 0d6010f39..ab4c1632e 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -15,6 +15,9 @@ return function() table.insert(langs, "json") table.insert(langs, "yaml") table.insert(langs, "toml") + -- If the lang is Terraform then add parser for HCL + elseif lang:find("terraform") then + table.insert(langs, "hcl") else lang = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") table.insert(langs, lang) From 8b102c2c8f3986c1ae79d14fa76c3500bdd6c7c0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 28 Feb 2022 08:27:49 +0000 Subject: [PATCH 05/73] 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 ab4c1632e..4f30ced97 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -15,7 +15,7 @@ return function() table.insert(langs, "json") table.insert(langs, "yaml") table.insert(langs, "toml") - -- If the lang is Terraform then add parser for HCL + -- If the lang is Terraform then add parser for HCL elseif lang:find("terraform") then table.insert(langs, "hcl") else From 5464cb92ec79ff9a811b0496c5eab2e52d7d3a10 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Wed, 2 Mar 2022 18:12:23 +1100 Subject: [PATCH 06/73] fix: Unused variable in doom.extra.autocommands --- lua/doom/extras/autocmds/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index dbbe9a407..1bec35afe 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -166,7 +166,6 @@ end -- Show line diagnostics on hover if not config.doom.enable_lsp_virtual_text then - local show_diagnostics_function = "" table.insert(autocmds["doom_extras"], { "CursorHold,CursorHoldI", "", From a913738af2eebd2a6b2a94a153eac198b845fd22 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Wed, 16 Mar 2022 08:39:09 +1100 Subject: [PATCH 07/73] fix(telescope): Strange indentation behaviour in results --- lua/doom/modules/config/doom-telescope.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/doom/modules/config/doom-telescope.lua b/lua/doom/modules/config/doom-telescope.lua index 06e0b1e9e..60069608d 100644 --- a/lua/doom/modules/config/doom-telescope.lua +++ b/lua/doom/modules/config/doom-telescope.lua @@ -19,7 +19,6 @@ return function() sorting_strategy = "descending", layout_strategy = "horizontal", prompt_prefix = "  ", - selection_caret = " ", layout_config = { width = 0.75, preview_cutoff = 120, From f7c0e55339a1882abfb11528d5ed241ca4b44d4e Mon Sep 17 00:00:00 2001 From: Ilkka Poutanen Date: Sat, 2 Apr 2022 14:38:12 +0300 Subject: [PATCH 08/73] Fix typo in lsp-installer config for elixir --- 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 0d05a542b..c556f1343 100644 --- a/lua/doom/modules/config/doom-lsp-installer.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -21,7 +21,7 @@ return function() -- dlang = { 'serve_d' }, dockerfile = { "dockerls" }, dot = { "dotls" }, - elixer = { "elixerls" }, + elixir = { "elixirls" }, elm = { "elmls" }, ember = { "ember" }, fortran = { "fortls" }, From d0348485130c9bf8b2a09fe7a5513139357889b5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 3 Apr 2022 03:01:59 +0000 Subject: [PATCH 09/73] chore: format source code --- lua/doom/modules/config/doom-lspconfig.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index 6a32f830a..f615d70bb 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -33,12 +33,11 @@ return function() }) end - lsp.handlers["textDocument/publishDiagnostics"] = - lsp.with(lsp.diagnostic.on_publish_diagnostics, { - 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, - }) + lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, { + 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, + }) -- Border for lsp_popups lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "single", From 32d888f8902ac0d22ff65181f7df5b84237b8cb8 Mon Sep 17 00:00:00 2001 From: Ilkka Poutanen Date: Sat, 2 Apr 2022 14:38:12 +0300 Subject: [PATCH 10/73] Fix typo in lsp-installer config for elixir --- 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 5880a0eb6..97271f141 100644 --- a/lua/doom/modules/config/doom-lsp-installer.lua +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -21,7 +21,7 @@ return function() -- dlang = { 'serve_d' }, dockerfile = { "dockerls" }, dot = { "dotls" }, - elixer = { "elixerls" }, + elixir = { "elixirls" }, elm = { "elmls" }, ember = { "ember" }, fortran = { "fortls" }, From 9e93d6d0e3c9d46909d1797d8ef49a005a02286a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 6 Apr 2022 08:42:08 +0000 Subject: [PATCH 11/73] chore: format source code --- lua/doom/modules/config/doom-lspconfig.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index 6a32f830a..f615d70bb 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -33,12 +33,11 @@ return function() }) end - lsp.handlers["textDocument/publishDiagnostics"] = - lsp.with(lsp.diagnostic.on_publish_diagnostics, { - 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, - }) + lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, { + 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, + }) -- Border for lsp_popups lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "single", From 74947a08a6f6b447e77b1f7dd2fb5cf47166b34f Mon Sep 17 00:00:00 2001 From: oeyoews Date: Wed, 22 Jun 2022 08:00:18 +0800 Subject: [PATCH 12/73] fix(core): small typo in modules.lua (#348) --- lua/doom/core/config/modules.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua index dfd2f8d62..99371dce6 100644 --- a/lua/doom/core/config/modules.lua +++ b/lua/doom/core/config/modules.lua @@ -70,7 +70,7 @@ modules.modules = { utilities = { -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit -- "neogit", -- Magit for Neovim - "range-highlight", -- hightlights ranges you have entered in commandline + "range-highlight", -- highlights ranges you have entered in commandline -- "suda", -- Write and read files without sudo permissions }, web = { From 744ece692ccf5ca648cfb08dfe4767ffc406f579 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 22 Jun 2022 00:00:32 +0000 Subject: [PATCH 13/73] chore: format source code --- lua/doom/modules/config/doom-lspconfig.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index f615d70bb..6a32f830a 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -33,11 +33,12 @@ return function() }) end - lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, { - 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, - }) + lsp.handlers["textDocument/publishDiagnostics"] = + lsp.with(lsp.diagnostic.on_publish_diagnostics, { + 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, + }) -- Border for lsp_popups lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "single", From fa25e1d88c8f15730bd78206e11bb4ae9d12c4b7 Mon Sep 17 00:00:00 2001 From: oeyoews Date: Wed, 22 Jun 2022 08:01:02 +0800 Subject: [PATCH 14/73] fix(core): small typo core/init.lua (#347) --- lua/doom/core/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index fb544585e..6578c05bf 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -13,7 +13,7 @@ for i = 1, #core_modules, 1 do if core_modules[i] == "settings" then -- Neovim configurations, e.g. shiftwidth require("doom.core.settings").load_default_options() - -- User-defined settings (global variables, mappings, ect) + -- User-defined settings (global variables, mappings, etc) require("doom.core.settings").custom_options() -- Doom Nvim custom commands require("doom.core.settings").doom_commands() From 539a1e4e91e049e61567993830e66609043dc756 Mon Sep 17 00:00:00 2001 From: Chaz <13462818+cleong14@users.noreply.github.com> Date: Thu, 23 Jun 2022 21:53:01 -1000 Subject: [PATCH 15/73] fix(dashboard): Lua refactor (Bug Fixes) - changes made following [`dashboard-nvim`](https://github.com/glepnir/dashboard-nvim) Vimscript -> Lua rewrite - add `local db = require("dashboard")` - rewrite (Vimscript) `vim.g.dashboard_custom_section` -> (Lua) `db.custom_center` - rewrite (Vimscript) `vim.g.dashboard_custom_footer` -> (Lua) `db.custom_footer` - rewrite (Vimscript) `vim.g.dashboard_custom_header` -> (Lua) `db.custom_header` - fix `custom_header` support for when user sets `config.doom.dashboard_custom_header` - fix/update header colors (highlight groups) --- lua/doom/modules/config/doom-dashboard.lua | 133 +++++++++++++-------- 1 file changed, 82 insertions(+), 51 deletions(-) diff --git a/lua/doom/modules/config/doom-dashboard.lua b/lua/doom/modules/config/doom-dashboard.lua index 430ea3ff5..181d493a3 100644 --- a/lua/doom/modules/config/doom-dashboard.lua +++ b/lua/doom/modules/config/doom-dashboard.lua @@ -1,74 +1,105 @@ return function() local config = require("doom.core.config").config + -- require [dashboard-nvim](https://github.com/glepnir/dashboard-nvim) + local db = require("dashboard") vim.g.dashboard_session_directory = require("doom.core.system").doom_root .. "/sessions" vim.g.dashboard_default_executive = "telescope" - vim.g.dashboard_custom_section = { - a = { - description = { " Load Last Session SPC s r" }, - command = "lua require('persistence').load({ last = true })", + -- Custom Center + db.custom_center = { + { + icon = " ", + desc = "Load Last Session ", + shortcut = "SPC s r", + action = "lua require('persistence').load({ last = true })" }, - b = { - description = { " Recently Opened Files SPC f r" }, - command = "Telescope oldfiles", + { + icon = " ", + desc = "Recently Opened Files ", + shortcut = "SPC f r", + action = "lua require('telescope.builtin').oldfiles()" }, - c = { - description = { " Jump to Bookmark SPC s m" }, - command = "Telescope marks", + { + icon = " ", + desc = "Jump to Bookmark ", + shortcut = "SPC s m", + action = "lua require('telescope.builtin').marks()" }, - d = { - description = { " Find File SPC f f" }, - command = "Telescope find_files", + { + icon = " ", + desc = "Find File ", + shortcut = "SPC f f", + action = "lua require('telescope.builtin').find_files()" }, - e = { - description = { " Find Word SPC s g" }, - command = "Telescope live_grep", + { + icon = " ", + desc = "Find Word ", + shortcut = "SPC f g", + action = "lua require('telescope.builtin').live_grep()" }, - f = { - description = { " Open Private Configuration SPC d c" }, - command = 'lua require("doom.core.functions").edit_config()', + { + icon = " ", + desc = "Open Private Configuration ", + shortcut = "SPC d c", + action = "lua require('doom.core.functions').edit_config()" }, - g = { - description = { " Open Documentation SPC d d" }, - command = 'lua require("doom.core.functions").open_docs()', + { + icon = " ", + desc = "Open Documentation ", + shortcut = "SPC d d", + action = "lua require('doom.core.functions').open_docs()" }, } - vim.g.dashboard_custom_footer = { + -- Custom Footer + db.custom_footer = { + "", -- add 'newline' padding between `custom_center` and `custom_footer` "Doom Nvim loaded in " .. vim.fn.printf( "%.3f", vim.fn.reltimefloat(vim.fn.reltime(vim.g.start_time)) ) .. " seconds.", } - vim.g.dashboard_custom_header = vim.tbl_isempty(config.doom.dashboard_custom_header) - and { - " ", - "================= =============== =============== ======== ========", - "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //", - "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||", - "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||", - "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||", - "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||", - "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||", - "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||", - "||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||", - "|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||", - "|| `' || || `' || || `' || || | \\ / | ||", - "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||", - "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||", - "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||", - "|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||", - "||.==' _-' `' | /==.||", - "==' _-' N E O V I M \\/ `==", - "\\ _-' `-_ /", - " `'' ``' ", - } - or config.doom.dashboard_custom_header + -- always show tabline & statusline + db.hide_tabline = false + db.hide_statusline = false + + -- Custom Header (default) + db.custom_header = { + " ", + "================= =============== =============== ======== ========", + "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //", + "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||", + "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||", + "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||", + "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||", + "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||", + "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||", + "||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||", + "|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||", + "|| `' || || `' || || `' || || | \\ / | ||", + "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||", + "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||", + "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||", + "|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||", + "||.==' _-' `' | /==.||", + "==' _-' N E O V I M \\/ `==", + "\\ _-' `-_ /", + " `'' ``' ", + } + + -- overwrite the default `custom_header` if the user sets `config.doom.dashboard_custom_header` + local next = next + if next(config.doom.dashboard_custom_header) ~= nil then + -- user has set `config.doom.dashboard_custom_header` + db.custom_header = config.doom.dashboard_custom_header + end + -- Header color - vim.cmd("hi! dashboardHeader guifg=" .. config.doom.dashboard_custom_colors.header_color) - vim.cmd("hi! dashboardCenter guifg=" .. config.doom.dashboard_custom_colors.center_color) - vim.cmd("hi! dashboardShortcut guifg=" .. config.doom.dashboard_custom_colors.shortcut_color) - vim.cmd("hi! dashboardFooter guifg=" .. config.doom.dashboard_custom_colors.footer_color) + vim.cmd("hi! DashboardHeader guifg=" .. config.doom.dashboard_custom_colors.header_color) + vim.cmd("hi! DashboardCenter guifg=" .. config.doom.dashboard_custom_colors.center_color) + vim.cmd("hi! DashboardCenterIcon guifg=" .. config.doom.dashboard_custom_colors.center_color) + vim.cmd("hi! DashboardShortCut guifg=" .. config.doom.dashboard_custom_colors.shortcut_color) + vim.cmd("hi! DashboardFooter guifg=" .. config.doom.dashboard_custom_colors.footer_color) end From 26faf37b7a1d285a0dd7c8fe60b171e94dd05e89 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 24 Jun 2022 07:53:19 +0000 Subject: [PATCH 16/73] chore: format source code --- lua/doom/modules/config/doom-dashboard.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/doom/modules/config/doom-dashboard.lua b/lua/doom/modules/config/doom-dashboard.lua index 181d493a3..781ecd818 100644 --- a/lua/doom/modules/config/doom-dashboard.lua +++ b/lua/doom/modules/config/doom-dashboard.lua @@ -12,49 +12,49 @@ return function() icon = " ", desc = "Load Last Session ", shortcut = "SPC s r", - action = "lua require('persistence').load({ last = true })" + action = "lua require('persistence').load({ last = true })", }, { icon = " ", desc = "Recently Opened Files ", shortcut = "SPC f r", - action = "lua require('telescope.builtin').oldfiles()" + action = "lua require('telescope.builtin').oldfiles()", }, { icon = " ", desc = "Jump to Bookmark ", shortcut = "SPC s m", - action = "lua require('telescope.builtin').marks()" + action = "lua require('telescope.builtin').marks()", }, { icon = " ", desc = "Find File ", shortcut = "SPC f f", - action = "lua require('telescope.builtin').find_files()" + action = "lua require('telescope.builtin').find_files()", }, { icon = " ", desc = "Find Word ", shortcut = "SPC f g", - action = "lua require('telescope.builtin').live_grep()" + action = "lua require('telescope.builtin').live_grep()", }, { icon = " ", desc = "Open Private Configuration ", shortcut = "SPC d c", - action = "lua require('doom.core.functions').edit_config()" + action = "lua require('doom.core.functions').edit_config()", }, { icon = " ", desc = "Open Documentation ", shortcut = "SPC d d", - action = "lua require('doom.core.functions').open_docs()" + action = "lua require('doom.core.functions').open_docs()", }, } -- Custom Footer db.custom_footer = { - "", -- add 'newline' padding between `custom_center` and `custom_footer` + "", -- add 'newline' padding between `custom_center` and `custom_footer` "Doom Nvim loaded in " .. vim.fn.printf( "%.3f", vim.fn.reltimefloat(vim.fn.reltime(vim.g.start_time)) From bac4bd19a36e3af055e1682e0cd9cb648614f4dc Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Tue, 5 Jul 2022 11:01:47 +1000 Subject: [PATCH 17/73] fix(lsp): Fixed auto_install lsp not starting. (related to `is_module_enabled` refactor). --- lua/doom/modules/langs/utils.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/langs/utils.lua b/lua/doom/modules/langs/utils.lua index 5c218d4cd..99f900ee2 100644 --- a/lua/doom/modules/langs/utils.lua +++ b/lua/doom/modules/langs/utils.lua @@ -74,7 +74,7 @@ module.use_lsp = function(lsp_name, options) end -- Auto install if possible - if utils.is_module_enabled('auto_install') and not opts.no_installer then + if utils.is_module_enabled('features', 'auto_install') and not opts.no_installer then local lsp_installer = require("nvim-lsp-installer.servers") local server_available, server = lsp_installer.get_server(lsp_name) if server_available then From 69894c98bc808a38b88729d4aae6e7c8ee191450 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 14 Jul 2022 18:39:08 +1000 Subject: [PATCH 18/73] feat(core): Add `DoomStarted` autocmd that executes after config loads --- lua/doom/core/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index 28368907d..b55bf237b 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -45,7 +45,6 @@ utils.safe_require("doom.core.ui") -- Set some extra commands utils.safe_require("doom.core.commands") - -- Load Doom modules. local modules = utils.safe_require("doom.core.modules") modules.start() @@ -53,4 +52,9 @@ modules.load_modules() modules.handle_user_config() modules.try_sync() +-- Execute autocommand for user to hook custom config into +vim.api.nvim_exec_autocmds("User", { + pattern = "DoomStarted", +}) + -- vim: fdm=marker From 455b4f83da76dbb9dc81bc6283fe7ec5576a842a Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 14 Jul 2022 19:39:57 +1000 Subject: [PATCH 19/73] feat(modules,repl): Added `repl` module. --- lua/doom/modules/features/repl/init.lua | 76 +++++++++++++++++++++++++ modules.lua | 1 + 2 files changed, 77 insertions(+) create mode 100644 lua/doom/modules/features/repl/init.lua diff --git a/lua/doom/modules/features/repl/init.lua b/lua/doom/modules/features/repl/init.lua new file mode 100644 index 000000000..c9126ddbb --- /dev/null +++ b/lua/doom/modules/features/repl/init.lua @@ -0,0 +1,76 @@ +local repl = {} + +repl.settings = { + config = { + -- If iron should expose `(...)` mappings for the plugins + should_map_plug = false, + -- Whether a repl should be discarded or not + scratch_repl = true, + -- Your repl definitions come here + repl_definition = { + sh = { + command = { "zsh" }, + }, + }, + position = "right", + size = 20, + }, + -- Iron doesn't set keymaps by default anymore. Set them here + -- or use `should_map_plug = true` and map from you vim files + keymaps = { + send_motion = "rc", + visual_send = "rc", + send_file = "rf", + send_line = "rl", + -- send_mark = "sm", + -- mark_motion = "mc", + -- mark_visual = "mc", + -- remove_mark = "md", + cr = "s", + interrupt = "s", + exit = "sq", + clear = "cl", + }, + -- If the highlight is on, you can change how it looks + -- For the available options, check nvim_set_hl + highlight = { + italic = true, + }, +} + +repl.packages = { + ["iron.nvim"] = { + "hkupty/iron.nvim", + commit = "8fe71532ff25020970b0d216c22525f92097d573", + }, +} + +repl.configs = { + ["iron.nvim"] = function() + local iron = require("iron.core") + + local settings = vim.tbl_deep_extend("force", {}, doom.features.repl.settings) + settings.config.repl_open_command = require("iron.view").curry[settings.config.position]( + settings.config.size + ) + + iron.setup(settings) + end, +} +repl.binds = { + { + "r", + name = "+repl", + { + { "r", "IronRepl", name = "Repl" }, + { "f", "", name = "Send file" }, + { "s", "", name = "Send line" }, + { "c", "", name = "Send visual / motion" }, + { "i", "", name = "Interupt repl" }, + { "", "", name = "Enter" }, + { "C", "", name = "Clear" }, + }, + }, +} + +return repl diff --git a/modules.lua b/modules.lua index 0065ab2ce..e2b020654 100644 --- a/modules.lua +++ b/modules.lua @@ -42,6 +42,7 @@ return { -- Tools -- "dap", -- Debug code through neovim + "repl", -- Interactive REPL in neovim "explorer", -- An enhanced filetree explorer -- "firenvim", -- Embed neovim in your browser -- "lazygit", -- Lazy git integration From e62053c9ed919ae4576eb4c3e2dd5f80d7a6c0bd Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 14 Jul 2022 19:40:31 +1000 Subject: [PATCH 20/73] chore,clean: Stylua cleanup entire project --- lua/doom/core/config.lua | 7 +- lua/doom/core/doom_global.lua | 26 ++- lua/doom/core/functions.lua | 8 +- lua/doom/core/modules.lua | 14 +- lua/doom/modules/core/reloader/init.lua | 6 +- lua/doom/modules/core/treesitter/init.lua | 12 +- lua/doom/modules/core/updater/init.lua | 26 +-- .../modules/features/annotations/init.lua | 16 +- .../modules/features/auto_session/init.lua | 2 +- lua/doom/modules/features/autopairs/init.lua | 33 ++-- lua/doom/modules/features/dap/init.lua | 164 +++++++++--------- lua/doom/modules/features/dashboard/init.lua | 12 +- .../modules/features/indentlines/init.lua | 12 +- lua/doom/modules/features/lsp/init.lua | 16 +- .../modules/features/lsp_progress/init.lua | 3 +- lua/doom/modules/features/minimap/init.lua | 3 +- lua/doom/modules/features/neorg/init.lua | 16 +- lua/doom/modules/features/netrw/init.lua | 30 ++-- lua/doom/modules/features/projects/init.lua | 6 +- lua/doom/modules/features/restclient/init.lua | 3 +- lua/doom/modules/features/statusline/init.lua | 2 +- lua/doom/modules/features/symbols/init.lua | 4 +- lua/doom/modules/features/tabline/init.lua | 1 - .../modules/features/todo_comments/init.lua | 2 - lua/doom/modules/features/zen/init.lua | 5 +- lua/doom/modules/langs/bash/init.lua | 7 +- lua/doom/modules/langs/c_sharp/init.lua | 16 +- lua/doom/modules/langs/config/init.lua | 23 ++- lua/doom/modules/langs/fish/init.lua | 7 +- lua/doom/modules/langs/glsl/init.lua | 9 +- lua/doom/modules/langs/go/init.lua | 7 +- lua/doom/modules/langs/haskell/init.lua | 13 +- lua/doom/modules/langs/java/init.lua | 7 +- lua/doom/modules/langs/javascript/init.lua | 2 +- lua/doom/modules/langs/kotlin/init.lua | 6 +- lua/doom/modules/langs/markdown/init.lua | 3 +- lua/doom/modules/langs/python/init.lua | 7 +- lua/doom/modules/langs/rust/init.lua | 9 +- lua/doom/modules/langs/svelte/init.lua | 4 +- lua/doom/modules/langs/tailwindcss/init.lua | 12 +- lua/doom/modules/langs/terraform/init.lua | 7 +- lua/doom/modules/langs/typescript/init.lua | 9 +- lua/doom/modules/langs/utils.lua | 31 ++-- lua/doom/modules/langs/vue/init.lua | 2 +- lua/doom/services/keymaps.lua | 2 +- .../tools/docs/keybind_doc_integration.lua | 36 ++-- lua/doom/utils/init.lua | 34 ++-- lua/user/modules/char_counter/init.lua | 104 ++++++----- 48 files changed, 412 insertions(+), 374 deletions(-) diff --git a/lua/doom/core/config.lua b/lua/doom/core/config.lua index 0a8996673..9f02826df 100644 --- a/lua/doom/core/config.lua +++ b/lua/doom/core/config.lua @@ -10,7 +10,6 @@ local filename = "config.lua" config.source = nil - --- Entry point to bootstrap doom-nvim. config.load = function() -- Set vim defaults on first load. To override these, the user can just @@ -68,18 +67,17 @@ config.load = function() -- Iterate over each module and save it to the doom global object for section_name, section_modules in pairs(enabled_modules) do for _, module_name in pairs(section_modules) do - -- If the section is `user` resolves from `lua/user/modules` local search_paths = { ("user.modules.%s.%s"):format(section_name, module_name), - ("doom.modules.%s.%s"):format(section_name, module_name) + ("doom.modules.%s.%s"):format(section_name, module_name), } local ok, result for _, path in ipairs(search_paths) do ok, result = xpcall(require, debug.traceback, path) if ok then - break; + break end end if ok then @@ -134,7 +132,6 @@ config.load = function() vim.g.mapleader = doom.leader_key end - -- Path cases: -- 1. stdpath('config')/../doom-nvim/config.lua -- 2. stdpath('config')/config.lua diff --git a/lua/doom/core/doom_global.lua b/lua/doom/core/doom_global.lua index c7e8d463f..f2b4b9099 100644 --- a/lua/doom/core/doom_global.lua +++ b/lua/doom/core/doom_global.lua @@ -44,14 +44,13 @@ -- From here on, we have a hidden global `_doom` that holds state the user -- shouldn't mess with. -_G._doom = { -} +_G._doom = {} --- Global object doom = { -- Leader key for keybinds -- @default = ' ' - leader_key = ' ', + leader_key = " ", -- Pins plugins to a commit sha to prevent breaking changes -- @default = true @@ -214,10 +213,10 @@ doom = { --- ) ---@vararg DoomPackage[]|string[] Packages to install use_package = function(...) - local arg = {...} + local arg = { ... } -- Get table of packages via git repository name - local packages_to_add = vim.tbl_map(function (t) - return type(t) == 'string' and t or t[1] + local packages_to_add = vim.tbl_map(function(t) + return type(t) == "string" and t or t[1] end, arg) -- Predicate returns false if the package needs to be overriden @@ -248,10 +247,10 @@ doom = { --- --- @vararg DoomAutocmd|DoomAutocmd[] Autocommands to setup use_autocmd = function(...) - local arg = {...} + local arg = { ... } for _, autocmd in ipairs(arg) do - if type(autocmd[1]) == 'string' and type(autocmd[2]) == 'string' then - local key = string.format('%s-%s', autocmd[1], autocmd[2]) + if type(autocmd[1]) == "string" and type(autocmd[2]) == "string" then + local key = string.format("%s-%s", autocmd[1], autocmd[2]) doom.autocmds[key] = autocmd elseif autocmd ~= nil then doom.use_autocmd(unpack(autocmd)) @@ -275,10 +274,10 @@ doom = { --- }) ---@vararg DoomCmd|DoomCmd[] Commands to bind use_cmd = function(...) - local arg = {...} + local arg = { ... } for _, cmd in ipairs(arg) do if type(cmd[1]) == "string" then - doom.cmds[cmd[1]] = cmd; + doom.cmds[cmd[1]] = cmd elseif cmd ~= nil then doom.use_cmd(unpack(cmd)) end @@ -301,13 +300,12 @@ doom = { --- }) ---@vararg DoomKeybind|DoomKeybind[] use_keybind = function(...) - local arg = {...} + local arg = { ... } for _, bind in ipairs(arg) do table.insert(doom.binds, bind) end end, - -- This is where modules are stored. -- The entire data structure will be stored in modules[module_name] = {} -- The key (`user` vs `modules` vs `langs`) cooresponds with the section in @@ -316,7 +314,7 @@ doom = { core = {}, features = {}, langs = {}, - } + }, } -- Maintain backwards compatibility + provide a shorthand way to access modules doom.core = doom.modules.core diff --git a/lua/doom/core/functions.lua b/lua/doom/core/functions.lua index 819b4c599..fd97b1a42 100644 --- a/lua/doom/core/functions.lua +++ b/lua/doom/core/functions.lua @@ -39,7 +39,7 @@ functions.open_docs = function() 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}) + vim.fn.cursor({ 12, 1 }) end) -- Set local documentation options vim.opt_local.modified = false @@ -209,7 +209,11 @@ functions.change_number = function() vim.opt.number = false vim.opt.relativenumber = false end - print("number=%s, relativenumber=%s", utils.bool2str(vim.opt.number), utils.bool2str(vim.opt.relativenumber)) + print( + "number=%s, relativenumber=%s", + utils.bool2str(vim.opt.number), + utils.bool2str(vim.opt.relativenumber) + ) end -- Toggle spell. diff --git a/lua/doom/core/modules.lua b/lua/doom/core/modules.lua index 7f92b2bb0..14f106b76 100644 --- a/lua/doom/core/modules.lua +++ b/lua/doom/core/modules.lua @@ -19,13 +19,13 @@ modules.source = utils.find_config(filename) -- Merge core modules (can't be disabled) with user enabled modules local core_modules = { core = { - 'doom', - 'nest', - 'treesitter', - 'reloader', - } + "doom", + "nest", + "treesitter", + "reloader", + }, } -modules.enabled_modules = vim.tbl_deep_extend('keep', core_modules, dofile(modules.source)) +modules.enabled_modules = vim.tbl_deep_extend("keep", core_modules, dofile(modules.source)) local system = require("doom.core.system") @@ -113,7 +113,7 @@ local keymaps_service = require("doom.services.keymaps") modules.load_modules = function() local use = require("packer").use -- Handle the Modules - for section_name, _ in pairs(doom.modules) do + for section_name, _ in pairs(doom.modules) do for module_name, module in pairs(doom[section_name]) do -- Import dependencies with packer from module.packages if module.packages then diff --git a/lua/doom/modules/core/reloader/init.lua b/lua/doom/modules/core/reloader/init.lua index 6633c261d..da3c22184 100644 --- a/lua/doom/modules/core/reloader/init.lua +++ b/lua/doom/modules/core/reloader/init.lua @@ -170,10 +170,7 @@ reloader.autocmds = function() -- RELOAD DOOM ON SAVE if reloader.settings.reload_on_save then - table.insert( - autocmds, - { "BufWritePost", "*/doom/**/*.lua,*/user/**/*.lua", reloader.reload } - ) + table.insert(autocmds, { "BufWritePost", "*/doom/**/*.lua,*/user/**/*.lua", reloader.reload }) table.insert(autocmds, { "BufWritePost", "*/modules.lua,*/config.lua", @@ -189,4 +186,3 @@ reloader.autocmds = function() end return reloader - diff --git a/lua/doom/modules/core/treesitter/init.lua b/lua/doom/modules/core/treesitter/init.lua index 62b2158e2..4a02c3cd6 100644 --- a/lua/doom/modules/core/treesitter/init.lua +++ b/lua/doom/modules/core/treesitter/init.lua @@ -61,11 +61,13 @@ treesitter.packages = { treesitter.configs = {} treesitter.configs["nvim-treesitter"] = function() local is_module_enabled = require("doom.utils").is_module_enabled - require("nvim-treesitter.configs").setup(vim.tbl_deep_extend("force", doom.core.treesitter.settings.treesitter, { - autopairs = { - enable = is_module_enabled("features", "autopairs"), - }, - })) + require("nvim-treesitter.configs").setup( + vim.tbl_deep_extend("force", doom.core.treesitter.settings.treesitter, { + autopairs = { + enable = is_module_enabled("features", "autopairs"), + }, + }) + ) -- 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 diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index 6b8e11e63..c5ec3db15 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -94,7 +94,11 @@ end updater._is_version_newer = function(curr, alternate) return curr.major < alternate.major or (curr.major == alternate.major and curr.minor < alternate.minor) - or (curr.major == alternate.major and curr.minor == alternate.minor and curr.patch < alternate.patch) + or ( + curr.major == alternate.major + and curr.minor == alternate.minor + and curr.patch < alternate.patch + ) end --- Checks for updates and notifys user if a new version is available @@ -147,15 +151,17 @@ updater._checkout_version = function(version) log.info("Attempting to checkout " .. tag_string) local Job = require("plenary.job") - Job:new({ - command = "git", - args = { "merge", tag_string }, - cwd = updater._cwd, - on_exit = function(j, return_val) - print(vim.inspect(j:result()) .. vim.inspect(return_val)) - log.info(( "updater: Updated to v%s."):format(version_string)) - end, - }):start() + Job + :new({ + command = "git", + args = { "merge", tag_string }, + cwd = updater._cwd, + on_exit = function(j, return_val) + print(vim.inspect(j:result()) .. vim.inspect(return_val)) + log.info(("updater: Updated to v%s."):format(version_string)) + end, + }) + :start() end updater.cmds = { diff --git a/lua/doom/modules/features/annotations/init.lua b/lua/doom/modules/features/annotations/init.lua index e90ee432c..edb5144c9 100644 --- a/lua/doom/modules/features/annotations/init.lua +++ b/lua/doom/modules/features/annotations/init.lua @@ -30,9 +30,19 @@ annotations.configs["neogen"] = function() end annotations.binds = { - { 'c', name = '+code', { - { 'g', function() require('neogen').generate() end, name = 'Generate annotations'} - }} + { + "c", + name = "+code", + { + { + "g", + function() + require("neogen").generate() + end, + name = "Generate annotations", + }, + }, + }, } return annotations diff --git a/lua/doom/modules/features/auto_session/init.lua b/lua/doom/modules/features/auto_session/init.lua index d0efd22a6..7aa87db22 100644 --- a/lua/doom/modules/features/auto_session/init.lua +++ b/lua/doom/modules/features/auto_session/init.lua @@ -8,7 +8,7 @@ auto_session.packages = { ["persistence.nvim"] = { "folke/persistence.nvim", commit = "77cf5a6ee162013b97237ff25450080401849f85", - module = 'persistence', + module = "persistence", }, } diff --git a/lua/doom/modules/features/autopairs/init.lua b/lua/doom/modules/features/autopairs/init.lua index 84a272a7b..c8aa48498 100644 --- a/lua/doom/modules/features/autopairs/init.lua +++ b/lua/doom/modules/features/autopairs/init.lua @@ -16,20 +16,31 @@ autopairs.packages = { autopairs.configs = {} autopairs.configs["nvim-autopairs"] = function() - require("nvim-autopairs").setup(vim.tbl_deep_extend("force", doom.features.autopairs.settings, { check_ts = true })) + require("nvim-autopairs").setup( + vim.tbl_deep_extend("force", doom.features.autopairs.settings, { check_ts = true }) + ) end autopairs.binds = { - "", name = "+prefix", { - { "t", name = "+tweak", { - { "p", function() - local autopairs_plugin = require('nvim-autopairs') - if autopairs_plugin.state.disabled then - autopairs_plugin.enable() - else - autopairs_plugin.disable() - end - end, name = "Toggle autopairs" }, + "", + name = "+prefix", + { + { + "t", + name = "+tweak", + { + { + "p", + function() + local autopairs_plugin = require("nvim-autopairs") + if autopairs_plugin.state.disabled then + autopairs_plugin.enable() + else + autopairs_plugin.disable() + end + end, + name = "Toggle autopairs", + }, }, }, }, diff --git a/lua/doom/modules/features/dap/init.lua b/lua/doom/modules/features/dap/init.lua index 0406b4d1c..0c00cd92e 100644 --- a/lua/doom/modules/features/dap/init.lua +++ b/lua/doom/modules/features/dap/init.lua @@ -65,105 +65,105 @@ dap.configs["nvim-dap-ui"] = function() end dap.binds = { - "", - name = "+prefix", + "", + name = "+prefix", + { { + "d", + name = "+debug", { - "d", - name = "+debug", { + "c", + function() + require("dap").continue() + end, + name = "Continue/Start", + }, + { + "d", + function() + require("dap").disconnect() + end, + name = "Disconnect", + }, + { + "e", + function() + require("dapui").eval() + end, + name = "Evaluate", + }, + { + mode = "v", { - "c", - function() - require("dap").continue() - end, - name = "Continue/Start", - }, - { - "d", - function() - require("dap").disconnect() - end, - name = "Disconnect", - }, - { - "e", - function() - require("dapui").eval() - end, - name = "Evaluate", - }, - { - mode = "v", { - { - "e", - function() - require("dapui").eval() - end, - name = "Evaluate", - }, + "e", + function() + require("dapui").eval() + end, + name = "Evaluate", }, }, + }, + { + "b", + name = "+breakpoint", { - "b", - name = "+breakpoint", { - { - "b", - function() - require("dap").toggle_breakpoint() - end, - name = "Toggle breakpoint", - }, - { - "c", - function() - vim.fn.inputsave() - local condition = vim.fn.input("Condition: ") - vim.fn.inputrestore() - require("dap").toggle_breakpoint(condition) - end, - name = "Toggle", - }, - { - "h", - function() - vim.fn.inputsave() - local number = vim.fn.input("Hit number: ") - vim.fn.inputrestore() - require("dap").toggle_breakpoint(nil, number) - end, - name = "Hit number", - }, - { - "l", - function() - vim.fn.inputsave() - local msg = vim.fn.input("Message: ") - vim.fn.inputrestore() - require("dap").toggle_breakpoint(nil, nil, msg) - end, - name = "Log", - }, + "b", + function() + require("dap").toggle_breakpoint() + end, + name = "Toggle breakpoint", + }, + { + "c", + function() + vim.fn.inputsave() + local condition = vim.fn.input("Condition: ") + vim.fn.inputrestore() + require("dap").toggle_breakpoint(condition) + end, + name = "Toggle", + }, + { + "h", + function() + vim.fn.inputsave() + local number = vim.fn.input("Hit number: ") + vim.fn.inputrestore() + require("dap").toggle_breakpoint(nil, number) + end, + name = "Hit number", + }, + { + "l", + function() + vim.fn.inputsave() + local msg = vim.fn.input("Message: ") + vim.fn.inputrestore() + require("dap").toggle_breakpoint(nil, nil, msg) + end, + name = "Log", }, }, }, }, + }, + { + "o", + name = "+open", { - "o", - name = "+open", { - { - "d", - function() - require("dapui").toggle() - end, - name = "Debugger", - }, + "d", + function() + require("dapui").toggle() + end, + name = "Debugger", }, }, }, - } + }, +} return dap diff --git a/lua/doom/modules/features/dashboard/init.lua b/lua/doom/modules/features/dashboard/init.lua index c4bbd0e65..af7e01323 100644 --- a/lua/doom/modules/features/dashboard/init.lua +++ b/lua/doom/modules/features/dashboard/init.lua @@ -6,31 +6,31 @@ dashboard.settings = { icon = " ", desc = "Recently Opened Files ", shortcut = "SPC f r", - action = "Telescope oldfiles" + action = "Telescope oldfiles", }, { icon = " ", desc = "Jump to Bookmark ", shortcut = "SPC s m", - action = "Telescope marks" + action = "Telescope marks", }, { icon = " ", desc = "Open Configuration ", shortcut = "SPC D c", - action = "e " .. require("doom.core.config").source + action = "e " .. require("doom.core.config").source, }, { icon = " ", desc = "Open Modules ", shortcut = "SPC D m", - action = "e " .. require("doom.core.modules").source + action = "e " .. require("doom.core.modules").source, }, { icon = " ", desc = "Open Documentation ", shortcut = "SPC D d", - action = "lua require('doom.core.functions').open_docs()" + action = "lua require('doom.core.functions').open_docs()", }, }, header = { @@ -90,7 +90,7 @@ dashboard.configs["dashboard-nvim"] = function() icon = " ", desc = "Load Last Session ", shortcut = "SPC s r", - action = "lua require('persistence').load({ last = true })" + action = "lua require('persistence').load({ last = true })", } end diff --git a/lua/doom/modules/features/indentlines/init.lua b/lua/doom/modules/features/indentlines/init.lua index 90e6a3324..1181171e9 100644 --- a/lua/doom/modules/features/indentlines/init.lua +++ b/lua/doom/modules/features/indentlines/init.lua @@ -18,11 +18,13 @@ indentlines.packages = { indentlines.configs = {} indentlines.configs["indent-blankline.nvim"] = function() - require("indent_blankline").setup(vim.tbl_deep_extend("force", doom.features.indentlines.settings, { - -- To remove indent lines, remove the module. Having the module and - -- disabling it makes no sense. - enabled = true, - })) + require("indent_blankline").setup( + vim.tbl_deep_extend("force", doom.features.indentlines.settings, { + -- To remove indent lines, remove the module. Having the module and + -- disabling it makes no sense. + enabled = true, + }) + ) end return indentlines diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index 8cc06627b..41381e965 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -88,7 +88,7 @@ lsp.settings = { "sort_text", "length", "order", - } + }, } local is_module_enabled = require("doom.utils").is_module_enabled @@ -221,7 +221,7 @@ lsp.configs["nvim-cmp"] = function() -- Fetch the comparators from cmp local comparators = require("cmp.config.compare") - doom.features.lsp.settings.sorting = vim.tbl_map(function (comparator) + doom.features.lsp.settings.sorting = vim.tbl_map(function(comparator) return comparators[comparator] end, doom.features.lsp.settings.sorting) @@ -292,11 +292,13 @@ lsp.configs["nvim-cmp"] = function() end lsp.configs["lsp_signature.nvim"] = function() -- Signature help - require("lsp_signature").setup(vim.tbl_deep_extend("force", doom.features.lsp.settings.signature, { - handler_opts = { - border = doom.border_style, - }, - })) + require("lsp_signature").setup( + vim.tbl_deep_extend("force", doom.features.lsp.settings.signature, { + handler_opts = { + border = doom.border_style, + }, + }) + ) end lsp.binds = { diff --git a/lua/doom/modules/features/lsp_progress/init.lua b/lua/doom/modules/features/lsp_progress/init.lua index 26f97468b..3aa872aae 100644 --- a/lua/doom/modules/features/lsp_progress/init.lua +++ b/lua/doom/modules/features/lsp_progress/init.lua @@ -1,7 +1,6 @@ local fidget = {} -fidget.settings = { -} +fidget.settings = {} fidget.packages = { ["fidget.nvim"] = { diff --git a/lua/doom/modules/features/minimap/init.lua b/lua/doom/modules/features/minimap/init.lua index d9908ef0f..8c9b86e6d 100644 --- a/lua/doom/modules/features/minimap/init.lua +++ b/lua/doom/modules/features/minimap/init.lua @@ -17,7 +17,6 @@ minimap.packages = { }, } - minimap.configs = {} minimap.binds = { @@ -34,7 +33,7 @@ minimap.binds = { }, }, }, - } + }, } return minimap diff --git a/lua/doom/modules/features/neorg/init.lua b/lua/doom/modules/features/neorg/init.lua index 3fa8449aa..6c4d6dbca 100644 --- a/lua/doom/modules/features/neorg/init.lua +++ b/lua/doom/modules/features/neorg/init.lua @@ -44,7 +44,7 @@ neorg.packages = { "nvim-neorg/neorg", commit = "c0ebefa516aa9e93431f0a55e033db0dec072857", after = "nvim-treesitter", - } + }, } neorg.configs = {} @@ -65,22 +65,22 @@ neorg.autocmds = { install_info = { url = "https://github.com/nvim-neorg/tree-sitter-norg", files = { "src/parser.c", "src/scanner.cc" }, - branch = "main" - } + branch = "main", + }, } parsers.norg_meta = { install_info = { url = "https://github.com/nvim-neorg/tree-sitter-norg-meta", files = { "src/parser.c" }, - branch = "main" - } + branch = "main", + }, } parsers.norg_table = { install_info = { url = "https://github.com/nvim-neorg/tree-sitter-norg-table", files = { "src/parser.c" }, - branch = "main" - } + branch = "main", + }, } vim.defer_fn(function() @@ -90,7 +90,7 @@ neorg.autocmds = { ensure_installed("norg_table") end, 0) end, - } + }, } return neorg diff --git a/lua/doom/modules/features/netrw/init.lua b/lua/doom/modules/features/netrw/init.lua index 298c09b8a..fb3a8a52e 100644 --- a/lua/doom/modules/features/netrw/init.lua +++ b/lua/doom/modules/features/netrw/init.lua @@ -247,19 +247,29 @@ end local netrw = {} netrw.autocmds = { - { "FileType", "netrw", function() - draw_icons() - netrw_maps() - end}, - { "TextChanged", "*", function() - draw_icons() - end} + { + "FileType", + "netrw", + function() + draw_icons() + netrw_maps() + end, + }, + { + "TextChanged", + "*", + function() + draw_icons() + end, + }, } netrw.binds = { - 'o', name = '+open/close', { - { 'e', ':Lexplore', name = 'Explorer' } - } + "o", + name = "+open/close", + { + { "e", ":Lexplore", name = "Explorer" }, + }, } return netrw diff --git a/lua/doom/modules/features/projects/init.lua b/lua/doom/modules/features/projects/init.lua index 2f1dc0602..a7e833b12 100644 --- a/lua/doom/modules/features/projects/init.lua +++ b/lua/doom/modules/features/projects/init.lua @@ -1,6 +1,6 @@ local projects = {} -projects.settings ={ +projects.settings = { -- Manual mode doesn't automatically change your root directory, so you have -- the option to manually do so using `:ProjectRoot` command. manual_mode = false, @@ -47,11 +47,11 @@ projects.configs = {} projects.configs["project.nvim"] = function() require("project_nvim").setup(doom.features.projects.settings) - table.insert(doom.features.telescope.settings.extensions, 'projects') + table.insert(doom.features.telescope.settings.extensions, "projects") end projects.binds = { - { 'fp', 'Telescope projects', name = 'Switch project' } + { "fp", "Telescope projects", name = "Switch project" }, } return projects diff --git a/lua/doom/modules/features/restclient/init.lua b/lua/doom/modules/features/restclient/init.lua index 9e1c175c0..1203f3c1c 100644 --- a/lua/doom/modules/features/restclient/init.lua +++ b/lua/doom/modules/features/restclient/init.lua @@ -14,7 +14,6 @@ restclient.packages = { }, } - restclient.configs = {} restclient.configs["rest.nvim"] = function() require("rest-nvim").setup(doom.features.restclient.settings) @@ -34,7 +33,7 @@ restclient.binds = { }, }, }, - } + }, } return restclient diff --git a/lua/doom/modules/features/statusline/init.lua b/lua/doom/modules/features/statusline/init.lua index 7d0d21db3..833d1a98c 100644 --- a/lua/doom/modules/features/statusline/init.lua +++ b/lua/doom/modules/features/statusline/init.lua @@ -429,7 +429,7 @@ statusline.configs["heirline.nvim"] = function() require("heirline").setup(heirline_config) end -statusline.try_refresh = function () +statusline.try_refresh = function() xpcall(doom.modules.features.statusline.configs["heirline.nvim"], debug.traceback) end diff --git a/lua/doom/modules/features/symbols/init.lua b/lua/doom/modules/features/symbols/init.lua index 66e54b2ad..7ed13996a 100644 --- a/lua/doom/modules/features/symbols/init.lua +++ b/lua/doom/modules/features/symbols/init.lua @@ -29,8 +29,6 @@ symbols.packages = { }, } - - symbols.configs = {} symbols.configs["symbols_outline.nvim"] = function() vim.g.symbols_outline = doom.features.symbols.settings @@ -50,7 +48,7 @@ symbols.binds = { }, }, }, - } + }, } return symbols diff --git a/lua/doom/modules/features/tabline/init.lua b/lua/doom/modules/features/tabline/init.lua index 568bdd9ae..f3d20e2ea 100644 --- a/lua/doom/modules/features/tabline/init.lua +++ b/lua/doom/modules/features/tabline/init.lua @@ -138,7 +138,6 @@ tabline.packages = { }, } - tabline.configs = {} tabline.configs["bufferline.nvim"] = function() require("bufferline").setup(doom.features.tabline.settings) diff --git a/lua/doom/modules/features/todo_comments/init.lua b/lua/doom/modules/features/todo_comments/init.lua index 25ec22273..02e7a03d5 100644 --- a/lua/doom/modules/features/todo_comments/init.lua +++ b/lua/doom/modules/features/todo_comments/init.lua @@ -9,8 +9,6 @@ todo_comments.packages = { }, } - - todo_comments.configs = {} todo_comments.configs["todo-comments.nvim"] = function() require("todo-comments").setup(doom.features.todo_comments.settings) diff --git a/lua/doom/modules/features/zen/init.lua b/lua/doom/modules/features/zen/init.lua index 034672d36..6d76f60bb 100644 --- a/lua/doom/modules/features/zen/init.lua +++ b/lua/doom/modules/features/zen/init.lua @@ -57,7 +57,6 @@ zen.packages = { }, } - zen.configs = {} zen.configs["TrueZen.nvim"] = function() require("true-zen").setup(doom.features.zen.settings) @@ -66,8 +65,8 @@ end zen.binds = { { "", ":TZAtaraxis", name = "Enter Nirvana" }, { "t", name = "+tweaks", { - { "z", ":TZAtaraxis", name = 'Toggle Zen' } - } } + { "z", ":TZAtaraxis", name = "Toggle Zen" }, + } }, } return zen diff --git a/lua/doom/modules/langs/bash/init.lua b/lua/doom/modules/langs/bash/init.lua index 5e6cbff20..f6b6b97f5 100644 --- a/lua/doom/modules/langs/bash/init.lua +++ b/lua/doom/modules/langs/bash/init.lua @@ -1,7 +1,7 @@ local bash = {} bash.settings = { - language_server_name = 'bashls', + language_server_name = "bashls", } bash.autocmds = { @@ -9,7 +9,7 @@ bash.autocmds = { "BufWinEnter", "*.sh", function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") langs_utils.use_lsp(doom.langs.bash.settings.language_server_name) vim.defer_fn(function() @@ -21,10 +21,9 @@ bash.autocmds = { local null_ls = require("null-ls") langs_utils.use_null_ls_source({ - null_ls.builtins.formatting.shfmt + null_ls.builtins.formatting.shfmt, }) end - end, once = true, }, diff --git a/lua/doom/modules/langs/c_sharp/init.lua b/lua/doom/modules/langs/c_sharp/init.lua index cbdd642ee..33e192e4a 100644 --- a/lua/doom/modules/langs/c_sharp/init.lua +++ b/lua/doom/modules/langs/c_sharp/init.lua @@ -1,7 +1,7 @@ local c_sharp = {} c_sharp.settings = { - language_server_name = 'omnisharp', + language_server_name = "omnisharp", } c_sharp.autocmds = { @@ -9,16 +9,16 @@ c_sharp.autocmds = { "BufWinEnter", "*.cs", function() - local langs_utils = require('doom.modules.langs.utils') - local lsp_util = require 'lspconfig.util'; + local langs_utils = require("doom.modules.langs.utils") + local lsp_util = require("lspconfig.util") langs_utils.use_lsp(doom.langs.c_sharp.settings.language_server_name, { config = { root_dir = function(fname) - return lsp_util.root_pattern '*.sln'(fname) - or lsp_util.root_pattern '*.csproj'(fname) - or lsp_util.root_pattern 'ProjectSettings'(fname) -- Add support for unity projects - end - } + return lsp_util.root_pattern("*.sln")(fname) + or lsp_util.root_pattern("*.csproj")(fname) + or lsp_util.root_pattern("ProjectSettings")(fname) -- Add support for unity projects + end, + }, }) require("nvim-treesitter.install").ensure_installed("c_sharp") diff --git a/lua/doom/modules/langs/config/init.lua b/lua/doom/modules/langs/config/init.lua index 851eb9793..db7cf817c 100644 --- a/lua/doom/modules/langs/config/init.lua +++ b/lua/doom/modules/langs/config/init.lua @@ -4,12 +4,12 @@ local config = {} config.settings = { json_schemas = { - '.eslintrc', - 'package.json', - 'prettierrc.json', - 'tsconfig.json' + ".eslintrc", + "package.json", + "prettierrc.json", + "tsconfig.json", }, - json_language_server_name = 'jsonls', + json_language_server_name = "jsonls", -- toml_language_server_name = 'taplo', -- Currently broken -- yaml_language_server_name = 'yamlls', -- Currently broken } @@ -18,22 +18,22 @@ config.packages = { ["SchemaStore.nvim"] = { "b0o/SchemaStore.nvim", commit = "442b79a05eea082f22273e59dd3da365e7077aa2", - ft = { "json", "yaml", "toml" } + ft = { "json", "yaml", "toml" }, }, } config.configs = {} config.configs["SchemaStore.nvim"] = function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") langs_utils.use_lsp(doom.langs.config.settings.json_language_server_name, { config = { settings = { json = { - schemas = require('schemastore').json.schemas { + schemas = require("schemastore").json.schemas({ select = doom.langs.config.settings.json_schemas, - }, + }), }, }, - } + }, }) end @@ -42,7 +42,7 @@ config.autocmds = { "BufWinEnter", "*.json,*.yaml,*.toml", function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") -- langs_utils.use_lsp(doom.langs.config.settings.toml_language_server_name) -- langs_utils.use_lsp(doom.langs.config.settings.yaml_language_server_name) @@ -60,7 +60,6 @@ config.autocmds = { null_ls.builtins.diagnostics.jsonlint, }) end - end, once = true, }, diff --git a/lua/doom/modules/langs/fish/init.lua b/lua/doom/modules/langs/fish/init.lua index fad8614dd..a7c597957 100644 --- a/lua/doom/modules/langs/fish/init.lua +++ b/lua/doom/modules/langs/fish/init.lua @@ -1,8 +1,6 @@ local fish = {} -fish.settings = { - -} +fish.settings = {} fish.autocmds = { { "BufWinEnter", @@ -13,13 +11,12 @@ fish.autocmds = { -- Setup null-ls if doom.features.linter then local null_ls = require("null-ls") - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") langs_utils.use_null_ls_source({ null_ls.builtins.formatting.fish_indent, null_ls.builtins.diagnostics.fish, }) end - end, once = true, }, diff --git a/lua/doom/modules/langs/glsl/init.lua b/lua/doom/modules/langs/glsl/init.lua index 9a6f9c0a1..f2e227db8 100644 --- a/lua/doom/modules/langs/glsl/init.lua +++ b/lua/doom/modules/langs/glsl/init.lua @@ -1,7 +1,6 @@ local glsl = {} -glsl.settings = { -} +glsl.settings = {} glsl.autocmds = { { @@ -9,7 +8,7 @@ glsl.autocmds = { "glsl", function() pcall(function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") require("nvim-treesitter.install").ensure_installed("glsl") @@ -18,7 +17,7 @@ glsl.autocmds = { local null_ls = require("null-ls") langs_utils.use_null_ls_source({ - null_ls.builtins.formatting.shfmt + null_ls.builtins.formatting.shfmt, }) end end) @@ -29,7 +28,7 @@ glsl.autocmds = { "BufWinEnter", "*.glsl,*.vs,*.fs,*.frag,*.vert", function() - vim.bo.filetype = 'glsl' + vim.bo.filetype = "glsl" end, }, } diff --git a/lua/doom/modules/langs/go/init.lua b/lua/doom/modules/langs/go/init.lua index 859fab374..c5edfe647 100644 --- a/lua/doom/modules/langs/go/init.lua +++ b/lua/doom/modules/langs/go/init.lua @@ -1,7 +1,7 @@ local go = {} go.settings = { - language_server_name = 'gopls', + language_server_name = "gopls", } go.autocmds = { @@ -9,7 +9,7 @@ go.autocmds = { "BufWinEnter", "*.go", function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") langs_utils.use_lsp(doom.langs.go.settings.language_server_name) require("nvim-treesitter.install").ensure_installed("go") @@ -19,10 +19,9 @@ go.autocmds = { local null_ls = require("null-ls") langs_utils.use_null_ls_source({ - null_ls.builtins.diagnostics.golangci_lint + null_ls.builtins.diagnostics.golangci_lint, }) end - end, once = true, }, diff --git a/lua/doom/modules/langs/haskell/init.lua b/lua/doom/modules/langs/haskell/init.lua index ff87107d8..1baff2429 100644 --- a/lua/doom/modules/langs/haskell/init.lua +++ b/lua/doom/modules/langs/haskell/init.lua @@ -1,7 +1,7 @@ local haskell = {} haskell.settings = { - language_server_name = 'hls', + language_server_name = "hls", } haskell.autocmds = { @@ -9,15 +9,15 @@ haskell.autocmds = { "BufWinEnter", "*.hs", function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") langs_utils.use_lsp(doom.langs.haskell.settings.language_server_name) - local parser_config = require "nvim-treesitter.parsers".get_parser_configs() + local parser_config = require("nvim-treesitter.parsers").get_parser_configs() parser_config.haskell = { install_info = { url = "https://github.com/tree-sitter/tree-sitter-haskell", - files = {"src/parser.c", "src/scanner.c"} - } + files = { "src/parser.c", "src/scanner.c" }, + }, } require("nvim-treesitter.install").ensure_installed("haskell") @@ -26,10 +26,9 @@ haskell.autocmds = { local null_ls = require("null-ls") langs_utils.use_null_ls_source({ - null_ls.builtins.formatting.fouremolu + null_ls.builtins.formatting.fouremolu, }) end - end, once = true, }, diff --git a/lua/doom/modules/langs/java/init.lua b/lua/doom/modules/langs/java/init.lua index b96754ada..1018514da 100644 --- a/lua/doom/modules/langs/java/init.lua +++ b/lua/doom/modules/langs/java/init.lua @@ -1,7 +1,7 @@ local java = {} java.settings = { - language_server_name = 'jdtls', + language_server_name = "jdtls", } java.autocmds = { @@ -9,7 +9,7 @@ java.autocmds = { "BufWinEnter", "*.java", function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") langs_utils.use_lsp(doom.langs.java.settings.language_server_name) require("nvim-treesitter.install").ensure_installed("java") @@ -19,10 +19,9 @@ java.autocmds = { local null_ls = require("null-ls") langs_utils.use_null_ls_source({ - null_ls.builtins.formatting.google_java_format + null_ls.builtins.formatting.google_java_format, }) end - end, once = true, }, diff --git a/lua/doom/modules/langs/javascript/init.lua b/lua/doom/modules/langs/javascript/init.lua index a9aa4baa7..c0ca5192e 100644 --- a/lua/doom/modules/langs/javascript/init.lua +++ b/lua/doom/modules/langs/javascript/init.lua @@ -1,3 +1,3 @@ -- Because javascript and typescript use the same tooling, -- this module is just an alias for the typescript module. -return require('doom.modules.langs.typescript') +return require("doom.modules.langs.typescript") diff --git a/lua/doom/modules/langs/kotlin/init.lua b/lua/doom/modules/langs/kotlin/init.lua index e0805ba72..c9fb8080c 100644 --- a/lua/doom/modules/langs/kotlin/init.lua +++ b/lua/doom/modules/langs/kotlin/init.lua @@ -1,7 +1,7 @@ local kotlin = {} kotlin.settings = { - language_server_name = 'kotlin_language_server', + language_server_name = "kotlin_language_server", } kotlin.autocmds = { @@ -9,7 +9,7 @@ kotlin.autocmds = { "BufWinEnter", "*.kt,*.kts", function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") langs_utils.use_lsp(doom.langs.kotlin.settings.language_server_name) require("nvim-treesitter.install").ensure_installed("kotlin") @@ -18,7 +18,7 @@ kotlin.autocmds = { local null_ls = require("null-ls") langs_utils.use_null_ls_source({ - null_ls.builtins.formatting.ktlint + null_ls.builtins.formatting.ktlint, }) end end, diff --git a/lua/doom/modules/langs/markdown/init.lua b/lua/doom/modules/langs/markdown/init.lua index b214e49f9..caf89aae3 100644 --- a/lua/doom/modules/langs/markdown/init.lua +++ b/lua/doom/modules/langs/markdown/init.lua @@ -1,7 +1,6 @@ local markdown = {} -markdown.settings = { -} +markdown.settings = {} markdown.autocmds = { { diff --git a/lua/doom/modules/langs/python/init.lua b/lua/doom/modules/langs/python/init.lua index 4a417ff76..2a8937ee0 100644 --- a/lua/doom/modules/langs/python/init.lua +++ b/lua/doom/modules/langs/python/init.lua @@ -1,7 +1,7 @@ local python = {} python.settings = { - language_server_name = 'pyright', + language_server_name = "pyright", } python.autocmds = { @@ -9,7 +9,7 @@ python.autocmds = { "BufWinEnter", "*.py", function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") langs_utils.use_lsp(doom.langs.python.settings.language_server_name) require("nvim-treesitter.install").ensure_installed("python") @@ -20,10 +20,9 @@ python.autocmds = { langs_utils.use_null_ls_source({ null_ls.builtins.formatting.black, - null_ls.builtins.diagnostics.mypy + null_ls.builtins.diagnostics.mypy, }) end - end, once = true, }, diff --git a/lua/doom/modules/langs/rust/init.lua b/lua/doom/modules/langs/rust/init.lua index 967f4eaee..42dab8fae 100644 --- a/lua/doom/modules/langs/rust/init.lua +++ b/lua/doom/modules/langs/rust/init.lua @@ -1,16 +1,15 @@ local rust = {} -rust.settings = { -} +rust.settings = {} rust.autocmds = { { "BufWinEnter", "*.rs", function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") - langs_utils.use_lsp('rust_analyzer') + langs_utils.use_lsp("rust_analyzer") require("nvim-treesitter.install").ensure_installed("rust") @@ -18,7 +17,7 @@ rust.autocmds = { if doom.features.linter then local null_ls = require("null-ls") langs_utils.use_null_ls_source({ - null_ls.builtins.formatting.rustfmt + null_ls.builtins.formatting.rustfmt, }) end end, diff --git a/lua/doom/modules/langs/svelte/init.lua b/lua/doom/modules/langs/svelte/init.lua index 437df7649..07c723d76 100644 --- a/lua/doom/modules/langs/svelte/init.lua +++ b/lua/doom/modules/langs/svelte/init.lua @@ -1,7 +1,7 @@ local svelte = {} svelte.settings = { - language_server_name = 'svelte', + language_server_name = "svelte", } svelte.autocmds = { @@ -9,7 +9,7 @@ svelte.autocmds = { "BufWinEnter", "*.svelte", function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") langs_utils.use_lsp(doom.langs.svelte.settings.language_server_name) vim.defer_fn(function() diff --git a/lua/doom/modules/langs/tailwindcss/init.lua b/lua/doom/modules/langs/tailwindcss/init.lua index c529f00b7..1f1c49d3a 100644 --- a/lua/doom/modules/langs/tailwindcss/init.lua +++ b/lua/doom/modules/langs/tailwindcss/init.lua @@ -1,18 +1,17 @@ -local utils = require('doom.utils'); +local utils = require("doom.utils") local tailwindcss = {} -tailwindcss.settings = { -} +tailwindcss.settings = {} tailwindcss.autocmds = { { "BufWinEnter", "*.css,*.scss,*.vue,*.html,*.svelte,*.jsx,*.tsx", utils.make_run_once_function(function() - local langs_utils = require('doom.modules.langs.utils') + local langs_utils = require("doom.modules.langs.utils") - langs_utils.use_lsp('tailwindcss') + langs_utils.use_lsp("tailwindcss") vim.defer_fn(function() require("nvim-treesitter.install").ensure_installed("css") @@ -23,10 +22,9 @@ tailwindcss.autocmds = { local null_ls = require("null-ls") langs_utils.use_null_ls_source({ - null_ls.builtins.formatting.rustywind + null_ls.builtins.formatting.rustywind, }) end - end), once = true, }, diff --git a/lua/doom/modules/langs/terraform/init.lua b/lua/doom/modules/langs/terraform/init.lua index 1ae622e6c..df7cd37a6 100644 --- a/lua/doom/modules/langs/terraform/init.lua +++ b/lua/doom/modules/langs/terraform/init.lua @@ -1,15 +1,14 @@ local terraform = {} -terraform.settings = { -} +terraform.settings = {} terraform.autocmds = { { "FileType", "terraform", function() - local langs_utils = require('doom.modules.langs.utils') - langs_utils.use_lsp('terraformls') + local langs_utils = require("doom.modules.langs.utils") + langs_utils.use_lsp("terraformls") local ts_install = require("nvim-treesitter.install") ts_install.ensure_installed("hcl") diff --git a/lua/doom/modules/langs/typescript/init.lua b/lua/doom/modules/langs/typescript/init.lua index 1395560c0..a42d44f8b 100644 --- a/lua/doom/modules/langs/typescript/init.lua +++ b/lua/doom/modules/langs/typescript/init.lua @@ -1,17 +1,16 @@ -local utils = require('doom.utils'); +local utils = require("doom.utils") local typescript = {} -typescript.settings = { -} +typescript.settings = {} typescript.autocmds = { { "BufWinEnter", "*.js,*.jsx,*.ts,*.tsx", utils.make_run_once_function(function() - local langs_utils = require('doom.modules.langs.utils') - langs_utils.use_lsp('tsserver') + local langs_utils = require("doom.modules.langs.utils") + langs_utils.use_lsp("tsserver") vim.defer_fn(function() local ts_install = require("nvim-treesitter.install") diff --git a/lua/doom/modules/langs/utils.lua b/lua/doom/modules/langs/utils.lua index 99f900ee2..3dc698fa1 100644 --- a/lua/doom/modules/langs/utils.lua +++ b/lua/doom/modules/langs/utils.lua @@ -1,4 +1,4 @@ -local log = require('doom.utils.logging') +local log = require("doom.utils.logging") local module = {} @@ -10,24 +10,31 @@ module.use_null_ls_source = function(sources) local null_ls = require("null-ls") for _, source in ipairs(sources) do -- Generate a unique key from the name/methods - local methods = type(source.method) == 'string' and source.method or table.concat(source.method, ' ') + local methods = type(source.method) == "string" and source.method + or table.concat(source.method, " ") local key = source.name .. methods -- If it's unique, register it if not registered_sources[key] then registered_sources[key] = source null_ls.register(source) else - log.warn(string.format('Attempted to register a duplicate null_ls source. ( %s with methods %s).', source.name, methods)) + log.warn( + string.format( + "Attempted to register a duplicate null_ls source. ( %s with methods %s).", + source.name, + methods + ) + ) end end end module.use_lsp = function(lsp_name, options) - local utils = require('doom.utils') + local utils = require("doom.utils") if not utils.is_module_enabled("features", "lsp") then return end - local lsp = require('lspconfig') + local lsp = require("lspconfig") local lsp_configs = require("lspconfig.configs") local opts = options or {} @@ -43,29 +50,31 @@ module.use_lsp = function(lsp_name, options) if utils.is_module_enabled("features", "illuminate") then table.insert(on_attach_functions, utils.illuminate_attach) end - if (opts.config and opts.config.on_attach) then + if opts.config and opts.config.on_attach then table.insert(on_attach_functions, opts.config.on_attach) end local capabilities_config = { capabilities = module.get_capabilities(), - on_attach = function (client) + on_attach = function(client) for _, handler in ipairs(on_attach_functions) do handler(client) end - end + end, } -- Start server and bind to buffers local start_lsp = function(server) - local final_config = vim.tbl_deep_extend('keep', opts.config or {}, capabilities_config) + local final_config = vim.tbl_deep_extend("keep", opts.config or {}, capabilities_config) if server and not is_custom_config then -- If using lsp-installer server:setup(final_config) else lsp[config_name].setup(final_config) local lsp_config_server = lsp[config_name] if lsp_config_server.manager then - local buffer_handler = lsp_config_server.filetypes and lsp_config_server.manager.try_add_wrapper or lsp_config_server.manager.try_add + local buffer_handler = lsp_config_server.filetypes + and lsp_config_server.manager.try_add_wrapper + or lsp_config_server.manager.try_add for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do buffer_handler(bufnr) end @@ -74,7 +83,7 @@ module.use_lsp = function(lsp_name, options) end -- Auto install if possible - if utils.is_module_enabled('features', 'auto_install') and not opts.no_installer then + if utils.is_module_enabled("features", "auto_install") and not opts.no_installer then local lsp_installer = require("nvim-lsp-installer.servers") local server_available, server = lsp_installer.get_server(lsp_name) if server_available then diff --git a/lua/doom/modules/langs/vue/init.lua b/lua/doom/modules/langs/vue/init.lua index 6090e68a1..3edbe4cb6 100644 --- a/lua/doom/modules/langs/vue/init.lua +++ b/lua/doom/modules/langs/vue/init.lua @@ -108,7 +108,7 @@ vue.autocmds = { -- Contains base configuration necessary for volar to start local base_config = { default_config = { - cmd = { 'vue-language-server', '--stdio' }, + cmd = { "vue-language-server", "--stdio" }, -- cmd = volar.document_config.default_config.cmd, root_dir = volar_root_dir, on_new_config = on_new_config, diff --git a/lua/doom/services/keymaps.lua b/lua/doom/services/keymaps.lua index e9d42dc08..0a325d291 100644 --- a/lua/doom/services/keymaps.lua +++ b/lua/doom/services/keymaps.lua @@ -147,7 +147,7 @@ default_integration.handler = function(node, node_settings) local buffer = (node_settings.buffer == true) and 0 or node_settings.buffer local options = vim.tbl_extend("force", { - buffer = buffer + buffer = buffer, }, node_settings.options) vim.keymap.set(sanitizedMode, node.lhs, node.rhs, options) end diff --git a/lua/doom/tools/docs/keybind_doc_integration.lua b/lua/doom/tools/docs/keybind_doc_integration.lua index a7157ee74..19c7be439 100644 --- a/lua/doom/tools/docs/keybind_doc_integration.lua +++ b/lua/doom/tools/docs/keybind_doc_integration.lua @@ -16,20 +16,20 @@ --- @type NestIntegration local module = {} -module.name = 'keybind_doc_integration'; +module.name = "keybind_doc_integration" module.data = {} --- @param node NestIntegrationNode --- @param node_settings NestSettings -module.handler = function (node) +module.handler = function(node) -- If node.rhs is a table, this is a group of keymaps, if it is a string then it is a keymap - local is_keymap_group = type(node.rhs) == 'table' + local is_keymap_group = type(node.rhs) == "table" if not is_keymap_group then local row = {} for _, key in ipairs(module.keys) do - table.insert(row, node[key] or 'unset') + table.insert(row, node[key] or "unset") end table.insert(module.data, row) end @@ -39,7 +39,7 @@ module.set_table_fields = function(cols) module.keys = {} module.header = {} module.data = {} - for _, col in ipairs(cols)do + for _, col in ipairs(cols) do table.insert(module.keys, col.key) table.insert(module.header, col.name) end @@ -55,11 +55,11 @@ module.get_rows = function() end local pad_left = function(string, length, char) - local c = char or ' ' + local c = char or " " local current_length = string.len(string) local difference = length - current_length if difference > 0 then - for _=1,difference do + for _ = 1, difference do string = c .. string end end @@ -76,7 +76,9 @@ local get_max_lengths = function(rows) for _, row in ipairs(rows) do for index, cell in ipairs(row) do - print(index .. '| ' .. cell .. ' length is ' .. string.len(cell) .. ' vs ' .. max_lengths[index]) + print( + index .. "| " .. cell .. " length is " .. string.len(cell) .. " vs " .. max_lengths[index] + ) max_lengths[index] = math.max(max_lengths[index], string.len(cell)) end end @@ -89,19 +91,19 @@ module.print_markdown = function() local result = {} -- Print header line and divider - local header_line = '|' - local divider_line = '|' + local header_line = "|" + local divider_line = "|" for index, cell in ipairs(module.header) do - header_line = header_line .. string.format(' %s |', pad_left(cell, max_lengths[index])) - divider_line = divider_line .. string.format(' %s |', pad_left('', max_lengths[index], '-')) + header_line = header_line .. string.format(" %s |", pad_left(cell, max_lengths[index])) + divider_line = divider_line .. string.format(" %s |", pad_left("", max_lengths[index], "-")) end table.insert(result, header_line) table.insert(result, divider_line) for _, row in ipairs(module.data) do - local line = '|' + local line = "|" for index, cell in ipairs(row) do - line = line .. string.format(' %s |', pad_left(cell, max_lengths[index])) + line = line .. string.format(" %s |", pad_left(cell, max_lengths[index])) end table.insert(result, line) end @@ -113,8 +115,6 @@ module.print_markdown = function() return result end -module.clear = function() -end - -return module; +module.clear = function() end +return module diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 462ff838a..8e56f9d29 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -9,7 +9,12 @@ utils.version = { minor = 0, patch = 0, } -utils.doom_version = string.format("%d.%d.%d", utils.version.major, utils.version.minor, utils.version.patch) +utils.doom_version = string.format( + "%d.%d.%d", + utils.version.major, + utils.version.minor, + utils.version.patch +) -- Finds `filename` (where it is a doom config file). utils.find_config = function(filename) @@ -58,18 +63,12 @@ end --- Wraps lua's require function in an xpcall and logs errors. ---@param path string ---@return any -utils.safe_require = function (path) +utils.safe_require = function(path) local log = require("doom.utils.logging") log.debug(string.format("Doom: loading '%s'... ", path)) local ok, result = xpcall(require, debug.traceback, path) if not ok and result then - log.error( - string.format( - "There was an error requiring '%s'. Traceback:\n%s", - path, - result - ) - ) + log.error(string.format("There was an error requiring '%s'. Traceback:\n%s", path, result)) return nil else log.debug(string.format("Successfully loaded '%s' module", path)) @@ -98,10 +97,8 @@ end -- @param action string|function The action to execute when the cmd is entered. utils.make_cmd = function(cmd_name, action) local cmd = "command! " .. cmd_name .. " " - cmd = type(action) == "function" - and cmd .. utils.commandify_function(action) - or cmd .. action - vim.cmd(cmd) + cmd = type(action) == "function" and cmd .. utils.commandify_function(action) or cmd .. action + vim.cmd(cmd) end utils.make_autocmd = function(event, pattern, action, group, nested, once) @@ -121,9 +118,7 @@ utils.make_autocmd = function(event, pattern, action, group, nested, once) cmd = cmd .. "++once " end - cmd = type(action) == "function" - and cmd .. utils.commandify_function(action) - or cmd .. action + cmd = type(action) == "function" and cmd .. utils.commandify_function(action) or cmd .. action vim.cmd(cmd) end @@ -143,7 +138,7 @@ utils.make_augroup = function(group_name, cmds, existing_group) end end -utils.get_sysname = function () +utils.get_sysname = function() return vim.loop.os_uname().sysname end @@ -207,8 +202,7 @@ end utils.is_module_enabled = function(section, plugin) local modules = require("doom.core.modules").enabled_modules - return modules[section] - and vim.tbl_contains(modules[section], plugin) + return modules[section] and vim.tbl_contains(modules[section], plugin) end local modules_list_cache = {} @@ -225,7 +219,7 @@ utils.get_all_modules_as_list = function() all_modules[k].name = section_name end end - modules_list_cache = table.sort(all_modules, function (a, b) + modules_list_cache = table.sort(all_modules, function(a, b) return (a.priority or 100) < (b.priority or 100) end) return modules_list_cache diff --git a/lua/user/modules/char_counter/init.lua b/lua/user/modules/char_counter/init.lua index 1433c007b..1b8634c1a 100644 --- a/lua/user/modules/char_counter/init.lua +++ b/lua/user/modules/char_counter/init.lua @@ -2,7 +2,7 @@ local char_counter = {} char_counter.settings = { popup = { - position = '50%', + position = "50%", size = { width = 80, height = 40, @@ -20,21 +20,21 @@ char_counter.settings = { buf_options = { modifiable = true, readonly = true, - } - } + }, + }, } char_counter.packages = { ["nui.nvim"] = { "MunifTanjim/nui.nvim", cmd = { "CountPrint" }, - } + }, } char_counter.configs = { ["nui.nvim"] = function() vim.notify("char_counter: nui.nvim loaded", "info") - end + end, } char_counter._insert_enter_char_count = nil @@ -49,49 +49,71 @@ char_counter._get_current_buffer_char_count = function() end char_counter.autocmds = { - { "InsertEnter", "*", function () - -- Only operate on normal file buffers - print(("buftype: %s"):format(vim.bo.buftype)) - if vim.bo.buftype == "" then - -- Store current char count - char_counter._insert_enter_char_count = char_counter._get_current_buffer_char_count() - end - end}, - { "InsertLeave", "*", function () - -- Only operate on normal file buffers - if vim.bo.buftype == "" and char_counter._insert_enter_char_count then - -- Find the amount of chars added or removed - local new_count = char_counter._get_current_buffer_char_count() - local diff = new_count - char_counter._insert_enter_char_count - print(new_count, diff) - -- Add the difference to the accumulated total - char_counter._accumulated_difference = char_counter._accumulated_difference + diff - print(('Accumulated difference %s'):format(char_counter._accumulated_difference)) - end - end}, + { + "InsertEnter", + "*", + function() + -- Only operate on normal file buffers + print(("buftype: %s"):format(vim.bo.buftype)) + if vim.bo.buftype == "" then + -- Store current char count + char_counter._insert_enter_char_count = char_counter._get_current_buffer_char_count() + end + end, + }, + { + "InsertLeave", + "*", + function() + -- Only operate on normal file buffers + if vim.bo.buftype == "" and char_counter._insert_enter_char_count then + -- Find the amount of chars added or removed + local new_count = char_counter._get_current_buffer_char_count() + local diff = new_count - char_counter._insert_enter_char_count + print(new_count, diff) + -- Add the difference to the accumulated total + char_counter._accumulated_difference = char_counter._accumulated_difference + diff + print(("Accumulated difference %s"):format(char_counter._accumulated_difference)) + end + end, + }, } char_counter.cmds = { - { "CountPrint", function () - local Popup = require('nui.popup') - local popup = Popup(char_counter.settings.popup) - popup:mount() - popup:map("n", "", function() popup:unmount() end) + { + "CountPrint", + function() + local Popup = require("nui.popup") + local popup = Popup(char_counter.settings.popup) + popup:mount() + popup:map("n", "", function() + popup:unmount() + end) - local msg = ("char_counter: You have typed %s characters since I started counting."):format(char_counter._accumulated_difference) - vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, { msg }) - end}, - { "CountReset", function () - char_counter._accumulated_difference = 0 - vim.notify("char_counter: Reset count!", "info") - end} + local msg = ("char_counter: You have typed %s characters since I started counting."):format( + char_counter._accumulated_difference + ) + vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, { msg }) + end, + }, + { + "CountReset", + function() + char_counter._accumulated_difference = 0 + vim.notify("char_counter: Reset count!", "info") + end, + }, } char_counter.binds = { - { 'i', name = '+info', { -- Adds a new `whichkey` folder called `+info` - { 'c', ':CountPrint', name = 'Print new chars' }, -- Binds `:CountPrint` to `ic` - { 'r', ':CountReset', name = 'Reset char count' } -- Binds `:CountPrint` to `ic` - } } + { + "i", + name = "+info", + { -- Adds a new `whichkey` folder called `+info` + { "c", ":CountPrint", name = "Print new chars" }, -- Binds `:CountPrint` to `ic` + { "r", ":CountReset", name = "Reset char count" }, -- Binds `:CountPrint` to `ic` + }, + }, } return char_counter From fbb005cc9eeaa80896d8306b402a6b707448a356 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 14 Jul 2022 22:37:10 +1000 Subject: [PATCH 21/73] feat(langs,bash): Added null-ls shellcheck diagnostics. --- lua/doom/modules/langs/bash/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/doom/modules/langs/bash/init.lua b/lua/doom/modules/langs/bash/init.lua index f6b6b97f5..ec8ba9db2 100644 --- a/lua/doom/modules/langs/bash/init.lua +++ b/lua/doom/modules/langs/bash/init.lua @@ -22,6 +22,8 @@ bash.autocmds = { langs_utils.use_null_ls_source({ null_ls.builtins.formatting.shfmt, + null_ls.builtins.code_actions.shellcheck, + null_ls.builtins.diagnostics.shellcheck, }) end end, From 54a009f1b199331bf03288ea35f6dca3d220ba06 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Thu, 14 Jul 2022 23:48:36 +1000 Subject: [PATCH 22/73] feat(tools): Add install script. --- README.md | 14 +++- contribute/install.sh | 164 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 1 deletion(-) create mode 100755 contribute/install.sh diff --git a/README.md b/README.md index aefc07c8e..0b46b09ea 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,19 @@ Some of the defining features that make this project unique are: ## Install -TODO: Add install docs here +### Mac OS / Linux + +```bash +bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/next/contribute/install.sh) +``` + +### Manual (Mac OS / Linux) + +1. Clone doom-nvim to ~/.config/nvim + - `git clone https://github.com/NTBBloodbath/doom-nvim.git ${XDG_CONFIG_HOME:-$HOME/.config}/nvim` +2. (optional) Checkout the latest stable version in a new branch called `my-config` so the auto-updater works. + - `git checkout tags/$(git tag -l --sort -version:refname | head -n 1) -b my-config` + - ℹ️ The auto-updater will be broken without this step but you're free to check updates using the `:CheckUpdate` (TODO: Implement) command and manage updates manually. ## Configuring diff --git a/contribute/install.sh b/contribute/install.sh new file mode 100755 index 000000000..a47010c7a --- /dev/null +++ b/contribute/install.sh @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +declare -r XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" +declare -r XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" +declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" + +DOOM_REPO_URL="https://github.com/NTBBloodbath/doom-nvim" +declare -r DOOM_CONFIG_DIR="${DOOM_CONFIG_DIR:-"$XDG_CONFIG_HOME/nvim"}" + +declare BASEDIR +BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +BASEDIR="$(dirname -- "$(dirname -- "$BASEDIR")")" +readonly BASEDIR + +RED=$(tput setaf 1) +YELLOW=$(tput setaf 3) +GREEN=$(tput setaf 2) +NC=$(tput sgr0) # No Color + +function help() { + echo "Usage: install.sh []" + echo "Automatically installs doom-nvim to your machine." + echo "" + echo "Options:" + echo " -h, --help Print this message" + echo " -y, --yes Skip all prompts" +} + +declare -a system_dependencies=("nvim" "git" "node" "npm" "fd;optional" "rg;optional" "wgeto;optional" "unzip;optional") +declare -a npm_dependencies=("tree-sitter") + +function banner() { + echo " " + echo "================= =============== =============== ======== ========" + echo "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //" + echo "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||" + echo "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||" + echo "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||" + echo "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||" + echo "||. . || ||-' || || \`-|| || . .|| ||. . || ||-' || || \`|\\_ . .|. .||" + echo "|| . _|| || || || || ||_ . || || . _|| || || || |\\ \`-_/| . ||" + echo "||_-' || .|/ || || \\|. || \`-_|| ||_-' || .|/ || || | \\ / |-_.||" + echo "|| ||_-' || || \`-_|| || || ||_-' || || | \\ / | \`||" + echo "|| \`' || || \`' || || \`' || || | \\ / | ||" + echo "|| .===' \`===. .==='.\`===. .===' /==. | \\/ | ||" + echo "|| .==' \\_|-_ \`===. .===' _|_ \`===. .===' _-|/ \`== \\/ | ||" + echo "|| .==' _-' \`-_ \`=' _-' \`-_ \`=' _-' \`-_ /| \\/ | ||" + echo "|| .==' _-' \`-__\\._-' \`-_./__-' \`' |. /| | ||" + echo "||.==' _-' \`' | /==.||" + echo "==' _-' N E O V I M \\/ \`==" + echo "\\ _-' \`-_ /" + echo " \`'' \`\`' " +} + +function executable_exists () { + if ! command -v "$1" &>/dev/null; then + return 0 + fi + return 1 +} + +function check_dependency_group () { + local dependency_group_name=$1 + local install_message=$2 + shift + shift + echo "Checking $dependency_group_name dependencies..." + local missing_dependencies=0 + for i in "$@"; do + local split_result=("${i//;/ }") + local executable="${split_result[0]}" + local optional=${split_result[1]} + + executable_exists "${executable}" + local dependency_status=$? + + if [ $dependency_status -eq 1 ]; then + echo "$GREEN [*]$NC Found \"$executable\"." + else + missing_dependencies=1 + if [ "$optional" = "optional" ]; then + echo "$YELLOW [ ]$NC Could not find optional dependency \"$executable\"." + else + echo "$RED [ ]$NC Could not find dependency \"$executable\"." + fi + fi + done + + if [ $missing_dependencies -eq 1 ]; then + echo "Missing dependencies detected. Optional dependencies can be ignored but may be necessary for some modules." + echo "$install_message" + fi + echo " " +} + +function backup_existing_config() { + if [ -d "$DOOM_CONFIG_DIR" ]; then + echo "${YELLOW}Warning:$NC There is already a config at $DOOM_CONFIG_DIR." + echo " " + echo "Do you want to continue installing doom-nvim? (y/n)" + echo "Note: The old config will be backed up to ${XDG_CONFIG_HOME}/nvim-old" + read -p "" -n 1 -r + echo # (optional) move to a new line + if [[ $REPLY =~ ^[Yy]$ ]]; then + # If nvim-old directory doesn`t exist, move `nvim/` to `nvim-old/' + if [ ! -d "${XDG_CONFIG_HOME}/nvim-old" ]; then + mv "${XDG_CONFIG_HOME}/nvim" "${XDG_CONFIG_HOME}/nvim-old" + else + # If it already exists try placing it in `nvim-old-1/` then `nvim-old-2/` (up until 10) + local i=1 + local has_found_directory=0 + while [[ $has_found_directory -eq 0 && $i -lt 10 ]]; do + i=$((i+1)) + has_found_directory=$([ -d "${XDG_CONFIG_HOME}/nvim-old-${i}" ]) + done + + if [[ $has_found_directory -eq 1 ]]; then + mv "${XDG_CONFIG_HOME}/nvim" "${XDG_CONFIG_HOME}/nvim-old-${i}" + fi + fi + fi + fi + echo " " +} + +function install_doom_nvim() { + echo "Cloning..." + # TODO: Remove `--branch next` for release. + git clone --branch next "$DOOM_REPO_URL" "${DOOM_CONFIG_DIR}" + cd "${DOOM_CONFIG_DIR}" || exit + # Setup user with their own custom branch + git checkout -b my-config + + # Checkout the latest version if there are no uncommitted changes + # NOTE: There shouldn't ever be uncommitted changes on a freshly cloned repo + # but I still don't want to risk the possibility of destroying someone's code. + local is_dirty=0 + git diff-index --quiet HEAD -- || is_dirty=1; + + if [ $is_dirty -eq 0 ]; then + local tag + tag="$(git tag -l --sort -version:refname | head -n 1)" + git reset --hard "$tag" + echo "${GREEN}Installed doom-nvim ${tag}!" + else + echo "${GREEN}Installed doom-nvim!" + echo "${YELLOW}Warn: Could not checkout latest tag due to uncommitted changes. \`:DoomUpdate\` command may not work." + fi + +} + +function main() { + banner + + check_dependency_group "system" "Install missing dependencies using your operating system's package manager (brew/pacman/apt-get/dnf/...)." "${system_dependencies[@]}" + check_dependency_group "npm" "Install missing dependencies using npm/yarn/pnpm." "${npm_dependencies[@]}" + + backup_existing_config + install_doom_nvim + + echo "Run \`nvim\` in your terminal to start doom-nvim." +} + +main "$@" From 39a13f1a5693e548eb58f8f017960191c153211c Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 15 Jul 2022 00:15:10 +1000 Subject: [PATCH 23/73] refact: Renamed helper tools folder`contribute/` to `tools/` --- README.md | 2 +- docs/contributing.md | 8 +- {contribute => tools}/Dockerfile | 0 {contribute => tools}/README.md | 16 +- {contribute => tools}/_docker_entry.sh | 0 {contribute => tools}/install.sh | 0 .../plugin/packer_compiled.lua | 203 ++++++++++++++++++ ...m%.config%nvim%lua%doom%modules%config.vim | 37 ++++ .../sessions/%home%doom%.config%nvim.vim | 47 ++++ .../%home%doom%workspace%neonz-ar-launch.vim | 52 +++++ .../sessions/%home%doom%workspace.vim | 48 +++++ {contribute => tools}/start_docker.sh | 0 {contribute => tools}/update_dependencies.sh | 0 13 files changed, 400 insertions(+), 13 deletions(-) rename {contribute => tools}/Dockerfile (100%) rename {contribute => tools}/README.md (79%) rename {contribute => tools}/_docker_entry.sh (100%) rename {contribute => tools}/install.sh (100%) create mode 100644 tools/local-share-nvim/plugin/packer_compiled.lua create mode 100644 tools/local-share-nvim/sessions/%home%doom%.config%nvim%lua%doom%modules%config.vim create mode 100644 tools/local-share-nvim/sessions/%home%doom%.config%nvim.vim create mode 100644 tools/local-share-nvim/sessions/%home%doom%workspace%neonz-ar-launch.vim create mode 100644 tools/local-share-nvim/sessions/%home%doom%workspace.vim rename {contribute => tools}/start_docker.sh (100%) rename {contribute => tools}/update_dependencies.sh (100%) diff --git a/README.md b/README.md index 0b46b09ea..4596a3f63 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Some of the defining features that make this project unique are: ### Mac OS / Linux ```bash -bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/next/contribute/install.sh) +bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/next/tools/install.sh) ``` ### Manual (Mac OS / Linux) diff --git a/docs/contributing.md b/docs/contributing.md index 6f025a9f4..3d588522d 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -32,7 +32,7 @@ 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). +> Alternatively you can setup an isolated dev environment for contributing using our docker image [here](../tools/README.md#doom-contrib-docker-image-start_dockersh). ## Reporting issues @@ -121,10 +121,10 @@ your pull request :) ### Tools -A range of tools for contributors are currently housed in the `contribute/` folder. -Read the detailed [documentation](../contribute/README.md). +A range of tools for contributors are currently housed in the `tools/` folder. +Read the detailed [documentation](../tools/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. + - [`tools/start_docker.sh`](../tools/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. diff --git a/contribute/Dockerfile b/tools/Dockerfile similarity index 100% rename from contribute/Dockerfile rename to tools/Dockerfile diff --git a/contribute/README.md b/tools/README.md similarity index 79% rename from contribute/README.md rename to tools/README.md index 809570fe6..d0a8224c7 100644 --- a/contribute/README.md +++ b/tools/README.md @@ -1,6 +1,6 @@ # Contributing Tools for Doom Neovim -This directory stores various tools and automations to help contributors or develpers of doom-nvim. +This directory stores various tools and automations to help contributors or develpers of doom-nvim. ## Doom Contrib Docker Image `./start_docker.sh` @@ -19,13 +19,13 @@ options: -h Shows this help menu ``` -The script will start an instance of neovim that uses `./contribute/doom-nvim-contrib/` for configuration. +The script will start an instance of neovim that uses `./tools/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. - - This worktree will be placed in the `contribute/doom-nvim-contrib` folder inside of this repository. + - This worktree will be placed in the `tools/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. @@ -34,13 +34,13 @@ You will then be able to start making changes within `doom-nvim-contrib` without These are the folders used by this docker image, they will be auto generated when `./start_docker.sh` is run -`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 +`tools/doom-nvim-contrib/` - Git worktree for doom-nvim contributions +`tools/local-share-nvim/` - Stores the data from `~/.local/share/nvim/` +`tools/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. +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`. @@ -48,7 +48,7 @@ Pinned/frozen dependencies can be disabled using the `freeze_dependencies` confi Run the following command in the root of the neovim folder. ```bash -cd contribute && ./update_dependencies.sh` +cd tools && ./update_dependencies.sh` ``` ### Issues diff --git a/contribute/_docker_entry.sh b/tools/_docker_entry.sh similarity index 100% rename from contribute/_docker_entry.sh rename to tools/_docker_entry.sh diff --git a/contribute/install.sh b/tools/install.sh similarity index 100% rename from contribute/install.sh rename to tools/install.sh diff --git a/tools/local-share-nvim/plugin/packer_compiled.lua b/tools/local-share-nvim/plugin/packer_compiled.lua new file mode 100644 index 000000000..259aac165 --- /dev/null +++ b/tools/local-share-nvim/plugin/packer_compiled.lua @@ -0,0 +1,203 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + + local time + local profile_info + local should_profile = true + if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end + else + time = function(chunk, start) end + end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + + _G._packer = _G._packer or {} + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/doom/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?.lua;/home/doom/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?/init.lua;/home/doom/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?.lua;/home/doom/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/doom/.cache/nvim/packer_hererocks/2.0.5/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + aniseed = { + config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, + loaded = false, + needs_bufread = true, + only_cond = false, + path = "/home/doom/.local/share/nvim/site/pack/packer/opt/aniseed", + url = "https://github.com/Olical/aniseed" + }, + ["nest.nvim"] = { + config = { "\27LJ\1\2\1\0\0\6\0\v\0\0284\0\0\0%\1\1\0>\0\2\0027\1\2\0004\2\0\0%\3\3\0>\2\2\0027\3\4\0024\4\0\0%\5\5\0>\4\2\0=\3\0\1\16\3\1\0%\4\6\0>\3\2\2\14\0\3\0T\3\64\3\0\0%\4\a\0>\3\2\0027\4\4\2\16\5\3\0>\4\2\0017\3\b\0024\4\t\0007\4\n\4>\3\2\1G\0\1\0\nbinds\tdoom\17applyKeymaps\31nest.integrations.whichkey\rwhichkey\29nest.integrations.mapper\venable\tnest\23is_plugin_disabled\15doom.utils\frequire\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, + load_after = {}, + loaded = true, + needs_bufread = false, + path = "/home/doom/.local/share/nvim/site/pack/packer/opt/nest.nvim", + url = "https://github.com/LuigiPiucco/nest.nvim" + }, + ["nvim-mapper"] = { + after = { "nest.nvim" }, + loaded = true, + only_config = true + }, + ["nvim-tree-docs"] = { + config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, + load_after = {}, + loaded = false, + needs_bufread = false, + path = "/home/doom/.local/share/nvim/site/pack/packer/opt/nvim-tree-docs", + url = "https://github.com/nvim-treesitter/nvim-tree-docs" + }, + ["nvim-treesitter"] = { + after = { "nvim-ts-autotag", "nvim-ts-context-commentstring", "nvim-tree-docs" }, + loaded = true, + only_config = true + }, + ["nvim-ts-autotag"] = { + config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, + load_after = {}, + loaded = false, + needs_bufread = false, + path = "/home/doom/.local/share/nvim/site/pack/packer/opt/nvim-ts-autotag", + url = "https://github.com/windwp/nvim-ts-autotag" + }, + ["nvim-ts-context-commentstring"] = { + config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, + load_after = {}, + loaded = false, + needs_bufread = false, + path = "/home/doom/.local/share/nvim/site/pack/packer/opt/nvim-ts-context-commentstring", + url = "https://github.com/JoosepAlviste/nvim-ts-context-commentstring" + }, + ["packer.nvim"] = { + config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, + loaded = false, + needs_bufread = false, + path = "/home/doom/.local/share/nvim/site/pack/packer/opt/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + ["plenary.nvim"] = { + config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/doom/.local/share/nvim/site/pack/packer/opt/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, + ["popup.nvim"] = { + config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, + loaded = false, + needs_bufread = false, + only_cond = false, + path = "/home/doom/.local/share/nvim/site/pack/packer/opt/popup.nvim", + url = "https://github.com/nvim-lua/popup.nvim" + } +} + +time([[Defining packer_plugins]], false) +local module_lazy_loads = { + ["^plenary"] = "plenary.nvim", + ["^popup"] = "popup.nvim", + aniseed = "aniseed" +} +local lazy_load_called = {['packer.load'] = true} +local function lazy_load_module(module_name) + local to_load = {} + if lazy_load_called[module_name] then return nil end + lazy_load_called[module_name] = true + for module_pat, plugin_name in pairs(module_lazy_loads) do + if not _G.packer_plugins[plugin_name].loaded and string.match(module_name, module_pat) then + to_load[#to_load + 1] = plugin_name + end + end + + if #to_load > 0 then + require('packer.load')(to_load, {module = module_name}, _G.packer_plugins) + local loaded_mod = package.loaded[module_name] + if loaded_mod then + return function(modname) return loaded_mod end + end + end +end + +if not vim.g.packer_custom_loader_enabled then + table.insert(package.loaders, 1, lazy_load_module) + vim.g.packer_custom_loader_enabled = true +end + +-- Config for: nvim-mapper +time([[Config for nvim-mapper]], true) +try_loadstring("\27LJ\1\2V\0\0\2\0\6\0\t4\0\0\0%\1\1\0>\0\2\0027\0\2\0004\1\3\0007\1\4\0017\1\5\1>\0\2\1G\0\1\0\vmapper\tcore\tdoom\nsetup\16nvim-mapper\frequire\0", "config", "nvim-mapper") +try_loadstring("\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "config", "nvim-mapper") +time([[Config for nvim-mapper]], false) +-- Config for: nvim-treesitter +time([[Config for nvim-treesitter]], true) +try_loadstring("\27LJ\1\2\3\0\0\a\0\17\0%4\0\0\0%\1\1\0>\0\2\0024\1\0\0%\2\2\0>\1\2\0027\2\3\0013\3\b\0004\4\4\0007\4\5\0047\4\6\4%\5\a\0>\4\2\2;\4\1\3>\2\2\0024\3\4\0007\3\5\0037\3\t\3\16\4\2\0\a\2\n\0T\5\2%\5\v\0T\6\1%\5\f\0$\4\5\4>\3\2\0028\3\1\3\16\5\3\0007\4\r\3%\6\14\0>\4\3\2\15\0\4\0T\5\37\4\15\0%\5\16\0>\4\2\1G\0\1\0\1doom-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)\twarn\nclang\nmatch\15 --version\5\acl\15systemlist\1\a\0\0\0\acc\bgcc\nclang\acl\bzig\aCC\vgetenv\afn\bvim\28find_executable_in_path\15doom.utils\23doom.utils.logging\frequire\2\1\0\t\0\17\0\0304\0\0\0%\1\1\0>\0\2\0027\0\2\0004\1\0\0%\2\3\0>\1\2\0027\1\4\0014\2\5\0007\2\6\2%\3\a\0004\4\b\0007\4\t\0047\4\n\0043\5\14\0003\6\f\0\16\a\0\0%\b\v\0>\a\2\2\17\a\a\0:\a\r\6:\6\v\5>\2\4\0=\1\0\0014\1\5\0007\1\15\0011\2\16\0'\3\3>\1\3\1G\0\1\0\0\rdefer_fn\1\0\0\venable\1\0\0\14autopairs\15treesitter\tcore\tdoom\nforce\20tbl_deep_extend\bvim\nsetup\28nvim-treesitter.configs\23is_plugin_disabled\15doom.utils\frequire\0", "config", "nvim-treesitter") +try_loadstring("\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "config", "nvim-treesitter") +time([[Config for nvim-treesitter]], false) +-- Load plugins in order defined by `after` +time([[Sequenced loading]], true) +vim.cmd [[ packadd nest.nvim ]] + +-- Config for: nest.nvim +try_loadstring("\27LJ\1\2\1\0\0\6\0\v\0\0284\0\0\0%\1\1\0>\0\2\0027\1\2\0004\2\0\0%\3\3\0>\2\2\0027\3\4\0024\4\0\0%\5\5\0>\4\2\0=\3\0\1\16\3\1\0%\4\6\0>\3\2\2\14\0\3\0T\3\64\3\0\0%\4\a\0>\3\2\0027\4\4\2\16\5\3\0>\4\2\0017\3\b\0024\4\t\0007\4\n\4>\3\2\1G\0\1\0\nbinds\tdoom\17applyKeymaps\31nest.integrations.whichkey\rwhichkey\29nest.integrations.mapper\venable\tnest\23is_plugin_disabled\15doom.utils\frequire\0", "config", "nest.nvim") +try_loadstring("\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "config", "nest.nvim") + +time([[Sequenced loading]], false) +if should_profile then save_profiles() end + +end) + +if not no_errors then + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end diff --git a/tools/local-share-nvim/sessions/%home%doom%.config%nvim%lua%doom%modules%config.vim b/tools/local-share-nvim/sessions/%home%doom%.config%nvim%lua%doom%modules%config.vim new file mode 100644 index 000000000..c49b7c230 --- /dev/null +++ b/tools/local-share-nvim/sessions/%home%doom%.config%nvim%lua%doom%modules%config.vim @@ -0,0 +1,37 @@ +let SessionLoad = 1 +let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 +let v:this_session=expand(":p") +silent only +silent tabonly +cd ~/.config/nvim/lua/doom/modules/config +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +set shortmess=aoO +badd +0 doom-whichkey.lua +argglobal +%argdel +$argadd doom-whichkey.lua +edit doom-whichkey.lua +argglobal +let s:l = 17 - ((16 * winheight(0) + 11) / 23) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 17 +normal! 019| +tabnext 1 +if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0&& getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 shortmess=ifncaTFstOolxI +let s:sx = expand(":p:r")."x.vim" +if filereadable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &g:so = s:so_save | let &g:siso = s:siso_save +set hlsearch +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/tools/local-share-nvim/sessions/%home%doom%.config%nvim.vim b/tools/local-share-nvim/sessions/%home%doom%.config%nvim.vim new file mode 100644 index 000000000..d5ec156fa --- /dev/null +++ b/tools/local-share-nvim/sessions/%home%doom%.config%nvim.vim @@ -0,0 +1,47 @@ +let SessionLoad = 1 +let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 +let v:this_session=expand(":p") +silent only +silent tabonly +cd ~/.config/nvim +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +set shortmess=aoO +badd +1 doom_modules.lua +argglobal +%argdel +$argadd doom_modules.lua +edit doom_modules.lua +argglobal +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let &fdl = &fdl +let s:l = 1 - ((0 * winheight(0) + 19) / 39) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 1 +normal! 0 +tabnext 1 +if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0&& getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 shortmess=ifncaTFstOolxI +let s:sx = expand(":p:r")."x.vim" +if filereadable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &g:so = s:so_save | let &g:siso = s:siso_save +set hlsearch +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/tools/local-share-nvim/sessions/%home%doom%workspace%neonz-ar-launch.vim b/tools/local-share-nvim/sessions/%home%doom%workspace%neonz-ar-launch.vim new file mode 100644 index 000000000..b01d96cd7 --- /dev/null +++ b/tools/local-share-nvim/sessions/%home%doom%workspace%neonz-ar-launch.vim @@ -0,0 +1,52 @@ +let SessionLoad = 1 +let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 +let v:this_session=expand(":p") +silent only +silent tabonly +cd ~/workspace/neonz-ar-launch +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +set shortmess=aoO +badd +5 src/App.vue +badd +5 src/views/Home.vue +badd +23 ~/workspace/neonz-ar-launch/src/components/NeonzLauncher.vue +badd +44 ~/workspace/neonz-ar-launch/src/stores/WalletStore.ts +argglobal +%argdel +$argadd src/App.vue +edit ~/workspace/neonz-ar-launch/src/components/NeonzLauncher.vue +argglobal +balt ~/workspace/neonz-ar-launch/src/stores/WalletStore.ts +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let &fdl = &fdl +let s:l = 23 - ((22 * winheight(0) + 27) / 54) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 23 +normal! 021| +tabnext 1 +if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0&& getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 shortmess=ifncaTFstOolxI +let s:sx = expand(":p:r")."x.vim" +if filereadable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &g:so = s:so_save | let &g:siso = s:siso_save +set hlsearch +nohlsearch +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/tools/local-share-nvim/sessions/%home%doom%workspace.vim b/tools/local-share-nvim/sessions/%home%doom%workspace.vim new file mode 100644 index 000000000..1394b43b8 --- /dev/null +++ b/tools/local-share-nvim/sessions/%home%doom%workspace.vim @@ -0,0 +1,48 @@ +let SessionLoad = 1 +let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 +let v:this_session=expand(":p") +silent only +silent tabonly +cd ~/workspace +if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' + let s:wipebuf = bufnr('%') +endif +set shortmess=aoO +badd +1 file.js +argglobal +%argdel +$argadd file.js +edit file.js +argglobal +setlocal fdm=manual +setlocal fde=0 +setlocal fmr={{{,}}} +setlocal fdi=# +setlocal fdl=0 +setlocal fml=1 +setlocal fdn=20 +setlocal fen +silent! normal! zE +let &fdl = &fdl +let s:l = 1 - ((0 * winheight(0) + 11) / 23) +if s:l < 1 | let s:l = 1 | endif +keepjumps exe s:l +normal! zt +keepjumps 1 +normal! 0 +tabnext 1 +if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0&& getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' + silent exe 'bwipe ' . s:wipebuf +endif +unlet! s:wipebuf +set winheight=1 winwidth=20 shortmess=ifncaTFstOolxI +let s:sx = expand(":p:r")."x.vim" +if filereadable(s:sx) + exe "source " . fnameescape(s:sx) +endif +let &g:so = s:so_save | let &g:siso = s:siso_save +set hlsearch +nohlsearch +doautoall SessionLoadPost +unlet SessionLoad +" vim: set ft=vim : diff --git a/contribute/start_docker.sh b/tools/start_docker.sh similarity index 100% rename from contribute/start_docker.sh rename to tools/start_docker.sh diff --git a/contribute/update_dependencies.sh b/tools/update_dependencies.sh similarity index 100% rename from contribute/update_dependencies.sh rename to tools/update_dependencies.sh From 7a737db0e2166940e2d8754320f89a975d3c4b66 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 15 Jul 2022 00:30:50 +1000 Subject: [PATCH 24/73] fix(tools): Minor tweaks and fixes in install script. --- tools/install.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index a47010c7a..9f3d340b7 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -26,7 +26,7 @@ function help() { echo " -y, --yes Skip all prompts" } -declare -a system_dependencies=("nvim" "git" "node" "npm" "fd;optional" "rg;optional" "wgeto;optional" "unzip;optional") +declare -a system_dependencies=("nvim" "git" "node" "npm" "fd;optional" "rg;optional" "wget;optional" "unzip;optional") declare -a npm_dependencies=("tree-sitter") function banner() { @@ -67,7 +67,9 @@ function check_dependency_group () { echo "Checking $dependency_group_name dependencies..." local missing_dependencies=0 for i in "$@"; do - local split_result=("${i//;/ }") + # The recommended changes break the string splitting + # shellcheck disable=2206 + local split_result=(${i//;/ }) local executable="${split_result[0]}" local optional=${split_result[1]} @@ -99,12 +101,14 @@ function backup_existing_config() { echo " " echo "Do you want to continue installing doom-nvim? (y/n)" echo "Note: The old config will be backed up to ${XDG_CONFIG_HOME}/nvim-old" + echo " " read -p "" -n 1 -r - echo # (optional) move to a new line + echo " " # (optional) move to a new line if [[ $REPLY =~ ^[Yy]$ ]]; then # If nvim-old directory doesn`t exist, move `nvim/` to `nvim-old/' if [ ! -d "${XDG_CONFIG_HOME}/nvim-old" ]; then mv "${XDG_CONFIG_HOME}/nvim" "${XDG_CONFIG_HOME}/nvim-old" + echo "Moved old config from \`${XDG_CONFIG_HOME}/nvim\` to \`${XDG_CONFIG_HOME}/nvim-old\`" else # If it already exists try placing it in `nvim-old-1/` then `nvim-old-2/` (up until 10) local i=1 @@ -116,6 +120,7 @@ function backup_existing_config() { if [[ $has_found_directory -eq 1 ]]; then mv "${XDG_CONFIG_HOME}/nvim" "${XDG_CONFIG_HOME}/nvim-old-${i}" + echo "Moved old config from \`${XDG_CONFIG_HOME}/nvim\` to \`${XDG_CONFIG_HOME}/nvim-old-${i}\`" fi fi fi @@ -137,6 +142,7 @@ function install_doom_nvim() { local is_dirty=0 git diff-index --quiet HEAD -- || is_dirty=1; + echo " " if [ $is_dirty -eq 0 ]; then local tag tag="$(git tag -l --sort -version:refname | head -n 1)" From 59981c17885d8c1188585b178a4d85223a64bec8 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 15 Jul 2022 20:58:41 +1000 Subject: [PATCH 25/73] feat(core): Add `global_statusline` option --- lua/doom/core/config.lua | 5 +++++ lua/doom/core/doom_global.lua | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lua/doom/core/config.lua b/lua/doom/core/config.lua index 9f02826df..04a4ca150 100644 --- a/lua/doom/core/config.lua +++ b/lua/doom/core/config.lua @@ -129,6 +129,11 @@ config.load = function() vim.opt.undofile = false vim.opt.undodir = nil end + + if doom.global_statusline then + vim.opt.laststatus = 3 + end + vim.g.mapleader = doom.leader_key end diff --git a/lua/doom/core/doom_global.lua b/lua/doom/core/doom_global.lua index f2b4b9099..25c652f21 100644 --- a/lua/doom/core/doom_global.lua +++ b/lua/doom/core/doom_global.lua @@ -48,6 +48,10 @@ _G._doom = {} --- Global object doom = { + -- Use the global statusline + -- @default = true + global_statusline = true, + -- Leader key for keybinds -- @default = ' ' leader_key = " ", From 285753aefbbb811ffc0c499e369c437590daafaf Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 13:28:49 +1000 Subject: [PATCH 26/73] feat: Implement and enable `updater` module. --- lua/doom/core/modules.lua | 1 + lua/doom/modules/core/updater/init.lua | 327 ++++++++++++++++--------- 2 files changed, 210 insertions(+), 118 deletions(-) diff --git a/lua/doom/core/modules.lua b/lua/doom/core/modules.lua index 14f106b76..4312ced36 100644 --- a/lua/doom/core/modules.lua +++ b/lua/doom/core/modules.lua @@ -23,6 +23,7 @@ local core_modules = { "nest", "treesitter", "reloader", + "updater", }, } modules.enabled_modules = vim.tbl_deep_extend("keep", core_modules, dofile(modules.source)) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index c5ec3db15..41db9ba9d 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -29,153 +29,244 @@ updater.packages = { }, } +updater.settings = { + unstable = false, +} + updater._cwd = vim.fn.stdpath("config") --- Using git and plenary jobs gets a list of all available versions to update to ---@param callback function Handler to receive the list of versions -updater._fetch_versions = function(callback) - local versions = {} +updater._pull_tags = function(callback) local Job = require("plenary.job") - local job = Job:new({ - command = "git", - args = { "fetch", "--tags", "--all" }, - cwd = updater._cwd, - }) + local job = Job + :new({ + command = "git", + args = { "fetch", "--tags", "--all" }, + cwd = updater._cwd, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error pulling tags... \n\n " .. vim.inspect(j.result())) + end + callback(j:result()) + end, + }) + :start() +end - job:and_then(Job:new({ - command = "git", - args = { "log", "--no-walk", "--tags", '--pretty="%d %s"' }, - cwd = updater._cwd, - on_exit = function(j, err_code) - if err_code ~= 0 then - callback(nil, "Git error when fetching tags" .. j:result()) - return - end +--- Gets the current commit sha or error +---@param callback function(commit_sha, error_string) +updater._get_commit_sha = function(callback) + local Job = require("plenary.job") - local result = "" - for _, l in ipairs(j:result()) do - result = result .. l .. "\n" - local tag = l:match("%((.-)[%),]") - local v = tag:gsub("%a", ""):gsub("[:%c%s]", "") - local major, minor, patch = unpack(vim.split(v, "%.")) - - table.insert(versions, { - message = l, - major = tonumber(major), - minor = tonumber(minor), - patch = tonumber(patch), - }) - end - callback(versions) - end, - })) - job:start() + Job + :new({ + command = "git", + args = { "rev-parse", "HEAD" }, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error getting current commit... \n\n" .. vim.inspect(j:result())) + return + end + local result = j:result() + if #result == 1 then + callback(result[1]) + else + callback(nil, "Error getting current commit... No output.") + end + end, + }) + :start() end ---- Gets the latest version from a list of versions ----@param versions DoomVersion[] List of versions from _fetch_versions ----@return DoomVersion the latest version from the list -updater._get_latest_from_versions = function(versions) - local latest = nil - for _, v in ipairs(versions) do - if latest == nil then - latest = v - elseif updater._is_version_newer(latest, v) then - latest = v - end - end - return latest +--- Gets all version tags as a table of strings +---@param callback function(all_versions, error_string) +updater._get_all_versions = function(callback) + local Job = require("plenary.job") + Job + :new({ + command = "git", + args = { "tag", "-l", "--sort", "-version:refname", "--merged", commit_sha }, + cwd = updater._cwd, + on_exit = function(j, err_code) + ---@param version string + local filter_develop_predicate = function(version) + if not updater.settings.unstable and version:match("alpha") or version:match("beta") then + return false + end + return true + end + local result = vim.tbl_filter(filter_develop_predicate, j:result()) + callback(result) + end, + }) + :start() end ---- Check if alternate version is newer than another version ----@param curr DoomVersion The base/current version ----@param alternate DoomVersion The alternate version to compare ----@return boolean True if alternate is newer than curr -updater._is_version_newer = function(curr, alternate) - return curr.major < alternate.major - or (curr.major == alternate.major and curr.minor < alternate.minor) - or ( - curr.major == alternate.major - and curr.minor == alternate.minor - and curr.patch < alternate.patch - ) +--- Using a commit sha, finds the first version tag in commit history +---@param commit_sha string +---@param callback function(version_tag, error_string) +updater._get_last_version_for_commit = function(commit_sha, callback) + local Job = require("plenary.job") + Job + :new({ + command = "git", + args = { "tag", "-l", "--sort", "-version:refname", "--merged", commit_sha }, + cwd = updater._cwd, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error getting current version... \n\n " .. vim.inspect(j:result())) + return + end + local result = j:result() + if #result > 1 then + callback(result[1]) + else + callback(nil, "Error getting current version... No output.") + end + end, + }) + :start() end ---- Checks for updates and notifys user if a new version is available -updater._check_updates = function() - print("Check updates") - updater._fetch_versions(function(versions, err) - print(vim.inspect(versions)) - local log = require("doom.utils.logging") - print("Handling check updates with versions") - if err then - log.error(("reloader: Failed to check for updates: %s."):format(err)) +--- Gets the current version and the latest upstream version +---@param callback function(current_version, latest_version, error_string) +updater._fetch_current_and_latest_version = function(callback) + updater._pull_tags(function(result, error) + if error then + callback(nil, nil, error) return end - local utils = require("doom.utils") - local latest = updater._get_latest_from_versions(versions) - if updater._is_version_newer(utils.version, latest) then - local s = ( - "updater: New version of doom-nvim available(v%d.%d.%d). Run `:DoomUpdate` to update." - ):format(latest.major, latest.minor, latest.patch) - log.warn(s) - else - log.warn("updater: No new version detected, up to date.") - end - end) -end + updater._get_commit_sha(function(commit_sha, error) + if error then + callback(nil, nil, error) + return + end ---- Checks for updates and updates if a new version is available. -updater._update = function() - updater._fetch_versions(function(versions, err) - if err then - local log = require("doom.utils.logging") - log.error(("reloader: Failed to check for updates: %s."):format(err)) - return - end - local utils = require("doom.utils") - local latest = updater._get_latest_from_versions(versions) - if updater._is_version_newer(utils.version, latest) then - updater._checkout_version(latest) - end + local cur_version, all_versions = nil, nil + local try_compare_updates = function() + if cur_version and all_versions then + -- Find How many versions behind we are + if #all_versions > 1 then + callback(cur_version, all_versions[1]) + return + else + callback(nil, nil, "Error getting latest version. The versions list is empty!") + end + end + end + + updater._get_last_version_for_commit(commit_sha, function(version) + cur_version = version + try_compare_updates() + end) + + updater._get_all_versions(function(all) + all_versions = all + try_compare_updates() + end) + end) end) end ---- Checks out doom-nvim to a specific version, used by update but can also be used to rollback. ----@param version DoomVersion -updater._checkout_version = function(version) - local version_string = ("%d.%d.%d"):format(version.major, version.minor, version.patch) - local tag_string = "tags/v" .. version_string - +--- Entry point for `:DoomCheckUpdates`, fetches new tags, compares with current version and notifies results +updater._check_updates = function() local log = require("doom.utils.logging") - log.info("Attempting to checkout " .. tag_string) + vim.notify("updater: Checking updates...") + + updater._fetch_current_and_latest_version(function(current_version, latest_version, error) + vim.defer_fn(function() + if error then + log.error(("updater: Error checking updates... %s"):format(error)) + return + end + if current_version == latest_version then + vim.notify(("updater: You are up to date! (%s)"):format(current_version)) + else + vim.notify( + ( + "updater: There is a new version (%s). You are currently on %s. Run `:DoomUpdate` to update." + ):format(latest_version, current_version) + ) + end + end, 0) + end) +end + +--- Attempts to merge a version into the current branch, fails if working tree is dirty +---@param target_version string +---@param callback function(error_string) +updater._try_merge_version = function(target_version, callback) local Job = require("plenary.job") - Job + + local merge_job = Job :new({ command = "git", - args = { "merge", tag_string }, + args = { "merge", target_version}, cwd = updater._cwd, - on_exit = function(j, return_val) - print(vim.inspect(j:result()) .. vim.inspect(return_val)) - log.info(("updater: Updated to v%s."):format(version_string)) + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error merging " .. target_version .. "... \n\n " .. vim.inspect(j:result())) + return + end + callback(nil) end, }) - :start() + + Job:new({ + command = "git", + args = { "diff", "--quiet" }, + cwd = updater._cwd, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(("Tried to update to new version %s but could not due to uncommitted changes. Please commit or stash your changes before trying again."):format(target_version)) + else + merge_job:start() + end + end + }):start() +end + +--- Entry point for `:DoomUpdate`, fetches new tags, compares with current version and attempts to merge new tags into current branch +updater._try_update = function() + local log = require("doom.utils.logging") + log.info("updater: Checking updates...") + + updater._fetch_current_and_latest_version(function(current_version, latest_version, error) + vim.defer_fn(function() + if error then + log.error(("updater: Error checking updates... %s"):format(error)) + return + end + + if current_version == latest_version then + vim.notify(("updater: You are up to date! (%s)"):format(current_version)) + else + updater._try_merge_version(latest_version, function (error) + if (error) then + log.error(("updater: Error updating... %s"):format(error)) + else + log.info(("updater: Updated to version %s! Check the changelog at https://github.com/NTBBloodbath/doom-nvim/releases/tag/%s"):format(latest_version)) + end + end) + end + end, 0) + end) end updater.cmds = { - -- { - -- "DoomUpdate", - -- function() - -- updater._update() - -- end, - -- }, - -- { - -- "DoomCheckUpdates", - -- function() - -- updater._check_updates() - -- end, - -- }, + { + "DoomUpdate", + function() + updater._try_update() + end, + }, + { + "DoomCheckUpdates", + function() + updater._check_updates() + end, + }, } return updater From a7e6710874e763e034220b52e46827277ff7363d Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 13:29:30 +1000 Subject: [PATCH 27/73] feat(repl): Add `` keybinds to evaluate under cursor. --- lua/doom/modules/features/repl/init.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lua/doom/modules/features/repl/init.lua b/lua/doom/modules/features/repl/init.lua index c9126ddbb..f1825e9f4 100644 --- a/lua/doom/modules/features/repl/init.lua +++ b/lua/doom/modules/features/repl/init.lua @@ -71,6 +71,24 @@ repl.binds = { { "C", "", name = "Clear" }, }, }, + { + "", + function() + local iron = require("iron.core") + iron.send_line() + end, + name = "Repl send line", + mode = "n", + }, + { + "", + function() + local iron = require("iron.core") + iron.visual_send() + end, + name = "Repl visual send", + mode = "v", + }, } return repl From 4cbd76a398f4e976f9b5a82095627971f0332e78 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 13:34:18 +1000 Subject: [PATCH 28/73] fix(updater): Fixed not getting new tags --- lua/doom/modules/core/updater/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index 41db9ba9d..4ca78beaf 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -86,7 +86,7 @@ updater._get_all_versions = function(callback) Job :new({ command = "git", - args = { "tag", "-l", "--sort", "-version:refname", "--merged", commit_sha }, + args = { "tag", "-l", "--sort", "-version:refname" }, cwd = updater._cwd, on_exit = function(j, err_code) ---@param version string From ed9816c5f6ef02b86e81ced50fabd1a6394cf565 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 13:48:46 +1000 Subject: [PATCH 29/73] docs: Update modules info README --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 4596a3f63..6c022b992 100644 --- a/README.md +++ b/README.md @@ -80,10 +80,9 @@ Doom nvim is configured by enabling modules in the `modules.lua` file and then t #### What is a module? A module is a collection of packages, autocommands, keybinds and functions that add new capabilities or functionality to Doom Nvim. -We organise modules into 3 categories: +We organise modules into 2 categories: - `features` extend the abilities of Doom Nvim by adding new functionality. - `langs` add support for new languages. -- `user` (**optional**) You can create and enable your own modules without modifying the Doom Nvim source code (read more)[#TODO:]. #### Enabing/disabling modules From 1732ca6ba42b54d4b8ae490ee6f7dd2c9b83a114 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 13:48:59 +1000 Subject: [PATCH 30/73] docs: Re-order readme content. --- README.md | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 6c022b992..ad07aaebf 100644 --- a/README.md +++ b/README.md @@ -18,29 +18,6 @@ ---- - -- [Doom Nvim](#doom-nvim) - * [What is Doom Nvim?](#what-is-doom-nvim-) - * [Install](#install) - * [Configuring](#configuring) - + [Enabling features: `modules.lua`](#-moduleslua-) - - [What is a module?](#what-is-a-module-) - - [Enabing/disabling modules](#enabing-disabling-modules) - - [All modules](#all-modules) - + [Configuring and personalising: `config.lua`](#-configlua-) - - [Modifying neovim and doom options](#modifying-neovim-and-doom-options) - * [Adding plugins](#adding-plugins) - * [Adding Keybinds](#adding-keybinds) - * [Adding autocommands](#adding-autocommands) - * [Adding commands](#adding-commands) - - [Overriding module defaults](#overriding-module-defaults) - * [FAQ](#faq) - * [Contributing](#contributing) - * [Contributors](#contributors) - ---- - ## What is Doom Nvim? Doom Nvim is a Neovim interpretation of the [doom-emacs](https://github.com/hlissner/doom-emacs) framework, adapted to Vim philosophy. @@ -72,6 +49,29 @@ bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/next/too - `git checkout tags/$(git tag -l --sort -version:refname | head -n 1) -b my-config` - ℹ️ The auto-updater will be broken without this step but you're free to check updates using the `:CheckUpdate` (TODO: Implement) command and manage updates manually. +--- + +- [Doom Nvim](#doom-nvim) + * [What is Doom Nvim?](#what-is-doom-nvim-) + * [Install](#install) + * [Configuring](#configuring) + + [Enabling features: `modules.lua`](#-moduleslua-) + - [What is a module?](#what-is-a-module-) + - [Enabing/disabling modules](#enabing-disabling-modules) + - [All modules](#all-modules) + + [Configuring and personalising: `config.lua`](#-configlua-) + - [Modifying neovim and doom options](#modifying-neovim-and-doom-options) + * [Adding plugins](#adding-plugins) + * [Adding Keybinds](#adding-keybinds) + * [Adding autocommands](#adding-autocommands) + * [Adding commands](#adding-commands) + - [Overriding module defaults](#overriding-module-defaults) + * [FAQ](#faq) + * [Contributing](#contributing) + * [Contributors](#contributors) + +--- + ## Configuring Doom nvim is configured by enabling modules in the `modules.lua` file and then tweaking, overriding or adding new packages, keybinds and more within the `config.lua` module. From 5021a2d5c86d2ada0d681cb7a582b994fee61728 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 13:58:59 +1000 Subject: [PATCH 31/73] fix(updater): Fixed not notifying user of status. --- lua/doom/modules/core/updater/init.lua | 65 +++++++++++++++----------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index 4ca78beaf..60423d35b 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -200,38 +200,43 @@ end updater._try_merge_version = function(target_version, callback) local Job = require("plenary.job") - local merge_job = Job + local merge_job = Job:new({ + command = "git", + args = { "merge", target_version }, + cwd = updater._cwd, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error merging " .. target_version .. "... \n\n " .. vim.inspect(j:result())) + return + end + callback(nil) + end, + }) + + Job :new({ command = "git", - args = { "merge", target_version}, + args = { "diff", "--quiet" }, cwd = updater._cwd, on_exit = function(j, exit_code) if exit_code ~= 0 then - callback(nil, "Error merging " .. target_version .. "... \n\n " .. vim.inspect(j:result())) - return + callback( + ( + "Tried to update to new version %s but could not due to uncommitted changes. Please commit or stash your changes before trying again." + ):format(target_version) + ) + else + merge_job:start() end - callback(nil) end, }) - - Job:new({ - command = "git", - args = { "diff", "--quiet" }, - cwd = updater._cwd, - on_exit = function(j, exit_code) - if exit_code ~= 0 then - callback(("Tried to update to new version %s but could not due to uncommitted changes. Please commit or stash your changes before trying again."):format(target_version)) - else - merge_job:start() - end - end - }):start() + :start() end --- Entry point for `:DoomUpdate`, fetches new tags, compares with current version and attempts to merge new tags into current branch updater._try_update = function() local log = require("doom.utils.logging") - log.info("updater: Checking updates...") + vim.notify("updater: Attempting to update...") updater._fetch_current_and_latest_version(function(current_version, latest_version, error) vim.defer_fn(function() @@ -241,14 +246,22 @@ updater._try_update = function() end if current_version == latest_version then - vim.notify(("updater: You are up to date! (%s)"):format(current_version)) + vim.notify( + ("updater: You are already using the latest version! (%s)"):format(current_version) + ) else - updater._try_merge_version(latest_version, function (error) - if (error) then - log.error(("updater: Error updating... %s"):format(error)) - else - log.info(("updater: Updated to version %s! Check the changelog at https://github.com/NTBBloodbath/doom-nvim/releases/tag/%s"):format(latest_version)) - end + updater._try_merge_version(latest_version, function(error) + vim.defer_fn(function() + if error then + log.error(("updater: Error updating... %s"):format(error)) + else + vim.notify( + ( + "updater: Updated to version %s! Check the changelog at https://github.com/NTBBloodbath/doom-nvim/releases/tag/%s" + ):format(latest_version, latest_version) + ) + end + end, 0) end) end end, 0) From e1653e86625a1c72367c25f94cf9e95afd0f6840 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 14:14:46 +1000 Subject: [PATCH 32/73] clean(updater): Address stylua issues --- lua/doom/modules/core/updater/init.lua | 123 +++++++++++++++++-------- 1 file changed, 87 insertions(+), 36 deletions(-) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index 60423d35b..55d084bea 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -39,7 +39,7 @@ updater._cwd = vim.fn.stdpath("config") ---@param callback function Handler to receive the list of versions updater._pull_tags = function(callback) local Job = require("plenary.job") - local job = Job + Job :new({ command = "git", args = { "fetch", "--tags", "--all" }, @@ -79,6 +79,13 @@ updater._get_commit_sha = function(callback) :start() end +--- Given a version string, checks if it's an alpha/beta version +---@param version string +---@return boolean +local is_version_unstable = function(version) + return version:match("alpha") ~= nil or version:match("beta") ~= nil +end + --- Gets all version tags as a table of strings ---@param callback function(all_versions, error_string) updater._get_all_versions = function(callback) @@ -88,10 +95,10 @@ updater._get_all_versions = function(callback) command = "git", args = { "tag", "-l", "--sort", "-version:refname" }, cwd = updater._cwd, - on_exit = function(j, err_code) + on_exit = function(j) ---@param version string local filter_develop_predicate = function(version) - if not updater.settings.unstable and version:match("alpha") or version:match("beta") then + if not updater.settings.unstable and is_version_unstable(version) then return false end return true @@ -132,14 +139,14 @@ end --- Gets the current version and the latest upstream version ---@param callback function(current_version, latest_version, error_string) updater._fetch_current_and_latest_version = function(callback) - updater._pull_tags(function(result, error) - if error then - callback(nil, nil, error) + updater._pull_tags(function(_, pull_tags_error) + if pull_tags_error then + callback(nil, nil, pull_tags_error) return end - updater._get_commit_sha(function(commit_sha, error) - if error then - callback(nil, nil, error) + updater._get_commit_sha(function(commit_sha, commit_sha_error) + if commit_sha_error then + callback(nil, nil, commit_sha_error) return end @@ -218,7 +225,7 @@ updater._try_merge_version = function(target_version, callback) command = "git", args = { "diff", "--quiet" }, cwd = updater._cwd, - on_exit = function(j, exit_code) + on_exit = function(_, exit_code) if exit_code ~= 0 then callback( ( @@ -233,38 +240,82 @@ updater._try_merge_version = function(target_version, callback) :start() end +--- Gets the name of the current working branch +---@param callback function(branch_name, error) +updater._get_branch_name = function(callback) + local Job = require("plenary.job") + Job + :new({ + command = "git", + args = { "rev-parse", "--symbolic-full-name", "--abbrev-ref", "HEAD" }, + cwd = updater._cwd, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error getting branch name... \n\n " .. vim.inspect(j:result())) + return + end + local result = j:result() + if #result > 1 then + callback(result[1]) + else + callback(nil, "Error getting branch name... No output.") + end + end, + }) + :start() +end + --- Entry point for `:DoomUpdate`, fetches new tags, compares with current version and attempts to merge new tags into current branch updater._try_update = function() local log = require("doom.utils.logging") vim.notify("updater: Attempting to update...") - updater._fetch_current_and_latest_version(function(current_version, latest_version, error) - vim.defer_fn(function() - if error then - log.error(("updater: Error checking updates... %s"):format(error)) - return - end + updater._get_branch_name(function(branch_name, error) + -- Ensure user is not in main/next branch + local error_message = nil + if error then + error_message = error + elseif branch_name == "next" or branch_name == "main" then + error_message = "You cannot use `:DoomUpdate` from within the `main` branch. Please make a new branch for your custom config (`git checkout -b my-config`)." + end - if current_version == latest_version then - vim.notify( - ("updater: You are already using the latest version! (%s)"):format(current_version) - ) - else - updater._try_merge_version(latest_version, function(error) - vim.defer_fn(function() - if error then - log.error(("updater: Error updating... %s"):format(error)) - else - vim.notify( - ( - "updater: Updated to version %s! Check the changelog at https://github.com/NTBBloodbath/doom-nvim/releases/tag/%s" - ):format(latest_version, latest_version) - ) - end - end, 0) - end) - end - end, 0) + if error_message then + vim.defer_fn(function() + log.error(("updater: %s"):format(error_message)) + end, 0) + return + end + + updater._fetch_current_and_latest_version(function(current_version, latest_version, get_version_error) + vim.defer_fn(function() + if get_version_error then + log.error(("updater: Error checking updates... %s"):format(get_version_error)) + return + end + + if current_version == latest_version then + vim.notify( + ("updater: You are already using the latest version! (%s)"):format(current_version) + ) + else + -- Attempt to merge new version into user's custom config branch + updater._try_merge_version(latest_version, function(merge_error) + vim.defer_fn(function() + if merge_error then + log.error(("updater: Error updating... %s"):format(merge_error)) + else + local message = ("updater: Updated to version %s!"):format(latest_version) + -- Only print changelog info if it's a stable release + if not is_version_unstable(latest_version) then + message = message .. (" Check the changelog at https://github.com/NTBBloodbath/doom-nvim/releases/tag/%s"):format(latest_version) + end + vim.notify(message) + end + end, 0) + end) + end + end, 0) + end) end) end From b323a0946574150e5638e1f789115ee84fade340 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 14:15:12 +1000 Subject: [PATCH 33/73] chore: Format --- lua/doom/modules/core/updater/init.lua | 64 ++++++++++++++------------ 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index 55d084bea..ad29681e2 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -276,7 +276,8 @@ updater._try_update = function() if error then error_message = error elseif branch_name == "next" or branch_name == "main" then - error_message = "You cannot use `:DoomUpdate` from within the `main` branch. Please make a new branch for your custom config (`git checkout -b my-config`)." + error_message = + "You cannot use `:DoomUpdate` from within the `main` branch. Please make a new branch for your custom config (`git checkout -b my-config`)." end if error_message then @@ -286,36 +287,41 @@ updater._try_update = function() return end - updater._fetch_current_and_latest_version(function(current_version, latest_version, get_version_error) - vim.defer_fn(function() - if get_version_error then - log.error(("updater: Error checking updates... %s"):format(get_version_error)) - return - end + updater._fetch_current_and_latest_version( + function(current_version, latest_version, get_version_error) + vim.defer_fn(function() + if get_version_error then + log.error(("updater: Error checking updates... %s"):format(get_version_error)) + return + end - if current_version == latest_version then - vim.notify( - ("updater: You are already using the latest version! (%s)"):format(current_version) - ) - else - -- Attempt to merge new version into user's custom config branch - updater._try_merge_version(latest_version, function(merge_error) - vim.defer_fn(function() - if merge_error then - log.error(("updater: Error updating... %s"):format(merge_error)) - else - local message = ("updater: Updated to version %s!"):format(latest_version) - -- Only print changelog info if it's a stable release - if not is_version_unstable(latest_version) then - message = message .. (" Check the changelog at https://github.com/NTBBloodbath/doom-nvim/releases/tag/%s"):format(latest_version) + if current_version == latest_version then + vim.notify( + ("updater: You are already using the latest version! (%s)"):format(current_version) + ) + else + -- Attempt to merge new version into user's custom config branch + updater._try_merge_version(latest_version, function(merge_error) + vim.defer_fn(function() + if merge_error then + log.error(("updater: Error updating... %s"):format(merge_error)) + else + local message = ("updater: Updated to version %s!"):format(latest_version) + -- Only print changelog info if it's a stable release + if not is_version_unstable(latest_version) then + message = message + .. ( + " Check the changelog at https://github.com/NTBBloodbath/doom-nvim/releases/tag/%s" + ):format(latest_version) + end + vim.notify(message) end - vim.notify(message) - end - end, 0) - end) - end - end, 0) - end) + end, 0) + end) + end + end, 0) + end + ) end) end From 24584b66c53bea7f9a23abcc166ace65af832457 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 14:26:45 +1000 Subject: [PATCH 34/73] fix(updater): Fixed not showing error on merge conflict. --- lua/doom/modules/core/updater/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index ad29681e2..d7876a9df 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -213,7 +213,12 @@ updater._try_merge_version = function(target_version, callback) cwd = updater._cwd, on_exit = function(j, exit_code) if exit_code ~= 0 then - callback(nil, "Error merging " .. target_version .. "... \n\n " .. vim.inspect(j:result())) + callback( + "Error merging " + .. target_version + .. ". You may have to resolve the merge conflict manually... \n\n " + .. vim.inspect(table.concat(j:result(), "\n")) + ) return end callback(nil) From 844e303a38bb783dff2d5104fd0166a3401d2312 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 14:30:09 +1000 Subject: [PATCH 35/73] fix(updater): Off by 1 error breaking updates --- lua/doom/modules/core/updater/init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index d7876a9df..ee32b8421 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -126,7 +126,7 @@ updater._get_last_version_for_commit = function(commit_sha, callback) return end local result = j:result() - if #result > 1 then + if #result > 0 then callback(result[1]) else callback(nil, "Error getting current version... No output.") @@ -154,7 +154,7 @@ updater._fetch_current_and_latest_version = function(callback) local try_compare_updates = function() if cur_version and all_versions then -- Find How many versions behind we are - if #all_versions > 1 then + if #all_versions > 0 then callback(cur_version, all_versions[1]) return else @@ -252,7 +252,7 @@ updater._get_branch_name = function(callback) Job :new({ command = "git", - args = { "rev-parse", "--symbolic-full-name", "--abbrev-ref", "HEAD" }, + args = { "symbolic-ref", "--short", "-q", "HEAD" }, cwd = updater._cwd, on_exit = function(j, exit_code) if exit_code ~= 0 then @@ -260,7 +260,7 @@ updater._get_branch_name = function(callback) return end local result = j:result() - if #result > 1 then + if #result > 0 then callback(result[1]) else callback(nil, "Error getting branch name... No output.") @@ -277,6 +277,7 @@ updater._try_update = function() updater._get_branch_name(function(branch_name, error) -- Ensure user is not in main/next branch + print(branch_name) local error_message = nil if error then error_message = error From 779c8e276f34aeaf63bc65655e9bddf0ee1f15df Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 14:35:06 +1000 Subject: [PATCH 36/73] fix,docs: Broken links in index --- README.md | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index ad07aaebf..c0aa23ddb 100644 --- a/README.md +++ b/README.md @@ -51,24 +51,21 @@ bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/next/too --- -- [Doom Nvim](#doom-nvim) - * [What is Doom Nvim?](#what-is-doom-nvim-) - * [Install](#install) - * [Configuring](#configuring) - + [Enabling features: `modules.lua`](#-moduleslua-) - - [What is a module?](#what-is-a-module-) - - [Enabing/disabling modules](#enabing-disabling-modules) - - [All modules](#all-modules) - + [Configuring and personalising: `config.lua`](#-configlua-) - - [Modifying neovim and doom options](#modifying-neovim-and-doom-options) - * [Adding plugins](#adding-plugins) - * [Adding Keybinds](#adding-keybinds) - * [Adding autocommands](#adding-autocommands) - * [Adding commands](#adding-commands) - - [Overriding module defaults](#overriding-module-defaults) - * [FAQ](#faq) - * [Contributing](#contributing) - * [Contributors](#contributors) +- [Configuring](#configuring) +- [Enabling features: `modules.lua`](#enabling-features-moduleslua) + - [What is a module?](#what-is-a-module) + - [Enabing/disabling modules](#enabingdisabling-modules) + - [All modules](#all-modules) +- [Configuring and personalising: `config.lua`](#configuring-and-personalising-configlua) + - [Modifying neovim and doom options](#modifying-neovim-and-doom-options) + * [Adding plugins](#adding-plugins) + * [Adding keybinds](#adding-keybinds) + * [Adding autocommands](#adding-autocommands) + * [Adding commands](#adding-commands) + - [Overriding module defaults](#overriding-module-defaults) +- [FAQ](#faq) +- [Contributing](#contributing) +- [Contributors](#contributors) --- From d77fee20bcc2a65f41ba60407788ddeed633c464 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 14:49:32 +1000 Subject: [PATCH 37/73] fix(reloader): Only show `:PackerCompile` message once. --- lua/doom/modules/core/reloader/init.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lua/doom/modules/core/reloader/init.lua b/lua/doom/modules/core/reloader/init.lua index da3c22184..5d51a07fc 100644 --- a/lua/doom/modules/core/reloader/init.lua +++ b/lua/doom/modules/core/reloader/init.lua @@ -1,3 +1,6 @@ +-- Store state that persists between reloads here. +_G._doom_reloader = _G._doom_reloader ~= nil and _G._doom_reloader or {} + local reloader = {} --- Only show error reloading message once per session @@ -119,11 +122,14 @@ reloader._reload_doom = function() return t[1] end, doom.packages) local needs_install = vim.deep_equal(modules, old_modules) - and vim.deep_equal(packages, old_packages) + and vim.deep_equal(packages, old_packages) if needs_install then - log.warn( - "reloader: If you made changes to the config of a plugin, run `:PackerCompile` to execute these changes." - ) + if not _G._doom_reloader._has_shown_packer_compile_message then + log.warn( + "reloader: You will have to run `:PackerCompile` before changes to plugin configs take effect." + ) + _G._doom_reloader._has_shown_packer_compile_message = true + end else log.warn("reloader: Run `:PackerSync` to install and configure new plugins.") end @@ -145,8 +151,8 @@ reloader.reload = function() log.info( "Reloaded Doom in " - .. vim.fn.printf("%.3f", vim.fn.reltimefloat(vim.fn.reltime(reload_time))) - .. " seconds" + .. vim.fn.printf("%.3f", vim.fn.reltimefloat(vim.fn.reltime(reload_time))) + .. " seconds" ) end From da227bd53b12c4f52a60b36890fc4df7ce4e2ebe Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 16 Jul 2022 15:03:50 +1000 Subject: [PATCH 38/73] fix(updater): Filter out all versions that are < v4.x.x --- lua/doom/modules/core/updater/init.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index ee32b8421..c420e427b 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -97,13 +97,14 @@ updater._get_all_versions = function(callback) cwd = updater._cwd, on_exit = function(j) ---@param version string - local filter_develop_predicate = function(version) - if not updater.settings.unstable and is_version_unstable(version) then + local filter_predicate = function(version) + local is_unsupported = version:match("^1") or version:match("v2") or version:match("v3") + if is_unsupported or (not updater.settings.unstable and is_version_unstable(version)) then return false end return true end - local result = vim.tbl_filter(filter_develop_predicate, j:result()) + local result = vim.tbl_filter(filter_predicate, j:result()) callback(result) end, }) @@ -277,7 +278,6 @@ updater._try_update = function() updater._get_branch_name(function(branch_name, error) -- Ensure user is not in main/next branch - print(branch_name) local error_message = nil if error then error_message = error From 35bc003b8c284b14960f9f88a6562004063f175a Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sun, 17 Jul 2022 11:00:22 +1000 Subject: [PATCH 39/73] feat(core): Check updates on startup --- init.lua | 7 +++++++ lua/doom/modules/core/updater/init.lua | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 346afe517..adfdfe83f 100644 --- a/init.lua +++ b/init.lua @@ -14,3 +14,10 @@ vim.opt.runtimepath:append(vim.fn.stdpath("data")) -- Load the doom-nvim framework require("doom.core") + +vim.defer_fn(function() + -- Check for updates + if doom.check_updates and doom.core.updater then + doom.core.updater.check_updates(true) + end +end, 0) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index c420e427b..cb3255052 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -178,9 +178,12 @@ updater._fetch_current_and_latest_version = function(callback) end --- Entry point for `:DoomCheckUpdates`, fetches new tags, compares with current version and notifies results -updater._check_updates = function() +---@param quiet boolean When enabled, disable all but error / needs update messages +updater.check_updates = function(quiet) local log = require("doom.utils.logging") - vim.notify("updater: Checking updates...") + if not quiet then + vim.notify("updater: Checking updates...") + end updater._fetch_current_and_latest_version(function(current_version, latest_version, error) vim.defer_fn(function() @@ -190,7 +193,9 @@ updater._check_updates = function() end if current_version == latest_version then - vim.notify(("updater: You are up to date! (%s)"):format(current_version)) + if not quiet then + vim.notify(("updater: You are up to date! (%s)"):format(current_version)) + end else vim.notify( ( @@ -341,7 +346,7 @@ updater.cmds = { { "DoomCheckUpdates", function() - updater._check_updates() + updater.check_updates() end, }, } From 2e6b55d4ac7cabc75ae75f36a5bb365e0f78662c Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sun, 17 Jul 2022 11:02:36 +1000 Subject: [PATCH 40/73] clean(updater): Added missing parameter --- lua/doom/modules/core/updater/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index cb3255052..6bc680b8d 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -346,7 +346,7 @@ updater.cmds = { { "DoomCheckUpdates", function() - updater.check_updates() + updater.check_updates(false) end, }, } From dc6411ad071b19f138ee7f179cff651546f46a15 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sun, 17 Jul 2022 12:24:49 +1000 Subject: [PATCH 41/73] docs: Fixups/tweaks README, `modules.md` and `modules.lua` --- README.md | 46 +++++++++++++++++++++++++++++++++------------- docs/modules.md | 4 +++- modules.lua | 1 + 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index c0aa23ddb..642a86f33 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/next/too - `git clone https://github.com/NTBBloodbath/doom-nvim.git ${XDG_CONFIG_HOME:-$HOME/.config}/nvim` 2. (optional) Checkout the latest stable version in a new branch called `my-config` so the auto-updater works. - `git checkout tags/$(git tag -l --sort -version:refname | head -n 1) -b my-config` - - ℹ️ The auto-updater will be broken without this step but you're free to check updates using the `:CheckUpdate` (TODO: Implement) command and manage updates manually. + - ℹ️ The auto-updater will be broken without this step but you're free to check updates using the `:DoomCheckUpdates` command and manage updates manually. --- @@ -71,35 +71,48 @@ bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/next/too ## Configuring -Doom nvim is configured by enabling modules in the `modules.lua` file and then tweaking, overriding or adding new packages, keybinds and more within the `config.lua` module. +Doom nvim is configured by enabling modules in the `modules.lua` file and then +tweaking, overriding or adding new packages, keybinds and more within the +`config.lua` module. + +> We recommend creating a custom config branch (the auto install script will +> do this for you) and committing your changes to this branch. The auto updater +> will merge new releases into your config branch for you. ### Enabling features: `modules.lua` #### What is a module? -A module is a collection of packages, autocommands, keybinds and functions that add new capabilities or functionality to Doom Nvim. + +A module is a collection of packages, autocommands, keybinds and functions that +add new capabilities or functionality to Doom Nvim. See what's avaliable in +`modules.lua` and enable the modules that you think you would like. Then restart +`doom-nvim`, run `:PackerSync` and then restart `doom-nvim` again. + We organise modules into 2 categories: - `features` extend the abilities of Doom Nvim by adding new functionality. - `langs` add support for new languages. #### Enabing/disabling modules -You can enable or disable a module by going to `modules.lua` (`Dm`) and commenting or uncommenting the entry. +You can enable or disable a module by going to `modules.lua` (`Dm`) and +commenting or uncommenting the entry. + ```lua -- modules.lua return { + -- `lsp` module is enabled, `telescope is disabled` features = { 'lsp' -- 'telescope' }, + -- `lua` language is enabled, `rust is disabled` langs = { 'lua', -- 'rust', } } ``` -> Here the `lsp` module is enabled but the `telescope` module is disabled, -> similarly the `lua` language is enabled but the `rust` language module is disabled. #### All modules @@ -110,7 +123,8 @@ You can find a full list of modules (here)[./docs/modules.md#all-modules] #### Modifying neovim and doom options -Doom nvim provides a number of config options, including wrapping some of vim's own options. See all available config options (in the API Reference)[./docs/api.md]. +Doom nvim provides a number of config options, including wrapping some of vim's +own options. See all available config options (in the API Reference)[./docs/api.md]. ```lua -- config.lua @@ -122,7 +136,8 @@ doom.indent = 2 -- Sets vim.opt.shiftwith, vim.opt.softtabstop vim.opt.colorcolumn = 120 -- Regular vim options can also be set ``` -> **NOTE:** If you have the `lua` language and `lsp` module enabled all of these options will be autocompleted. +> **NOTE:** If you have the `lua` language and `lsp` module enabled all of these +> options will be autocompleted. ##### Adding plugins @@ -146,7 +161,8 @@ doom.use_package({ ##### Adding Keybinds Additional keybinds can be defined with the `doom.use_keybind()` function. -This is a wrapper around a custom `nest.nvim` implementation and provides the same API. [DOCS](https://github.com/connorgmeehan/nest.nvim/tree/integrations-api#quickstart-guide) +This is a wrapper around a custom `nest.nvim` implementation and provides the +same API. [DOCS](https://github.com/connorgmeehan/nest.nvim/tree/integrations-api#quickstart-guide) ```lua -- config.lua @@ -158,7 +174,8 @@ doom.use_keybind({ }) ``` -> **NOTE:** By providing the `name` field your custom keybinds will show up in `whichkey` and `mapper` if you have those modules enabled. +> **NOTE:** By providing the `name` field your custom keybinds will show up +> in `whichkey` and `mapper` if you have those modules enabled. ##### Adding autocommands @@ -283,10 +300,13 @@ return { The majors changes between v3 and v4 are the following. - `doom_config.lua` renamed to `config.lua` -- Adding custom commands, keybinds and autocommands done using new [`doom.use_*`](#-configlua-) helper functions. -- Adding extra plugins done using new [`doom.use_package`](#adding-plugins) helper function. +- Adding custom commands, keybinds and autocommands done using new [`doom.use_*`](#-configlua-) + helper functions. +- Adding extra plugins done using new [`doom.use_package`](#adding-plugins) helper + function. - `doom_modules.lua` renamed to `modules.lua` -- Many of the modules categories have been combined, there are now only `features` (modifying capabilities of doom-nvim) and `languages` (add support for a language) +- Many of the modules categories have been combined, there are now only `features` + (modifying capabilities of doom-nvim) and `languages` (add support for a language) - Languages `+lsp`, `+formatting`, etc flags are no longer necessary > Because of the durastic changes to the way you configure doom-nvim we recommend diff --git a/docs/modules.md b/docs/modules.md index fe3ff7386..98dbb694e 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -43,11 +43,13 @@ Modules are grouped into 3 categories: ### `core` modules +- [`core`](../lua/doom/modules/core/doom) Contains most of the doom default keybinds, autocommands, etc. - [`treesitter`](../lua/doom/modules/core/treesitter) An incremental parsing system for programming tools. - [`nest`](../lua/doom/modules/core/nest) Used for keybind management, integrates with `whichkey` and `mapper`. +- [`updater`](../lua/doom/modules/core/updater) Checks updates and can automatically pull latest changes. +- [`reloader`](../lua/doom/modules/core/reloader) Allows you to reload and update your config without exiting doom-nvim. ### `features` modules - - **Language related modules** - [`annotations`](../lua/doom/modules/features/annotations) Code annotation generator - [`auto_install`](../lua/doom/modules/features/auto_install) Auto install LSP providers diff --git a/modules.lua b/modules.lua index e2b020654..18d53e582 100644 --- a/modules.lua +++ b/modules.lua @@ -4,6 +4,7 @@ -- what features are being used. -- -- Uncomment a plugin to enable it and comment out to disable and uninstall it. +-- Once done, restart doom-nvim and run `:PackerInstall`. return { features = { From 9da7a3400ea6abe4916f827087b842d97f3bbe1a Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sun, 17 Jul 2022 12:25:05 +1000 Subject: [PATCH 42/73] docs: Update changelog.md Unreleased changes --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 054bda579..8c18fe9c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- `doom_modules.lua` renamed to `modules.lua` +- `doom_config.lua` renamed to `config.lua` +- `doom_userplugins.lua` replaced by the `doom.use_package(...)` helper function. +- refact!: `+lsp` flags for languages are now redundant, all langs have LSP enabled by default. +- refact!: Rewrote doom-nvim internals to simplify code + improve modularity and integrations between modules. + - `modules.lua` now only has two sections: `features` and `langs` + - Modules defined in `lua/doom/modules/SECTION_NAME/MODULE_NAME` + - Each module contains all plugins, config, keybinds, autocommands for a feature or a language. + - Users can override or add new modules by creating a folder in `lua/user/modules/SECTION_NAME/MODULE_NAME` ([implementing custom modules](https://github.com/NTBBloodbath/doom-nvim/docs/modules.md#building-your-own-module)). +- refact!: `config.lua` to define your config programatically / imperatively using new [helper functions](https://github.com/NTBBloodbath/doom-nvim#configuring-and-personalising-configlua). +- feat: Added an install script (clones doom-nvim, checks out a new branch `my-config`). +- feat: Added `repl` module (run code in neovim using [iron.nvim](https://github.com/hkupty/iron.nvim)). +- feat: Added `annotations` module (generate code documentation using [neogen](https://github.com/danymat/neogen)) to replace broken `nvim-tree-docs` plugin. +- feat: Added `projects` module (quickly switch between projects using [project.nvim](https://github.com/ahmedkhalf/project.nvim)). +- feat: Added `lsp_progress` module (shows lsp startup and loading using [fidget.nvim](https://github.com/j-hui/fidget.nvim)) +- refact!: `linter` and `formatter` module merged into one (`linter`). +- refact!: `linter` module to use [null-ls.nvim](https://github.com/jose-elias-alvarez/null-ls.nvim). +- refact: Renamed `kommentary` module to `comment` module, switched to [Comment.nvim](https://github.com/numToStr/Comment.nvim) and fixed keybinds. +- feat: Implemented a `nest.nvim` inspired keymap syntax that integrates with `whichkey` and `nvim-mapper`. +- feat: Added optional [impatient.nvim](lewis6991/impatient.nvim) (`doom.impatient_enabled = true` in `config.lua`). + - WARN: This can create bugs when modifying your config and you'll probably have to run `:LuaCacheClear`. +- refact: Removed `develop` branch, doom-nvim will now use rolling releases with tagged stable versions. +- refact: Auto updating logic moved into core module + - Now requires user to use a custom config branch + - Updating will merge the latest tagged stable version with your custom config branch. +- tweak: Various startup time improvements. + ## [3.3.0] - Removed support for Neovim 0.5 - Fixed bug where the Dashboard would show instead of piped contents From d0ab69e8b9ce8b2a324b4730a26b6eb9783d6149 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Tue, 19 Jul 2022 12:23:28 +1000 Subject: [PATCH 43/73] feat: #361 Re-added missing `doom.clipboard` setting. --- lua/doom/core/config.lua | 5 ++++- lua/doom/core/doom_global.lua | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/doom/core/config.lua b/lua/doom/core/config.lua index 04a4ca150..d5b3c8bcd 100644 --- a/lua/doom/core/config.lua +++ b/lua/doom/core/config.lua @@ -45,7 +45,6 @@ config.load = function() vim.opt.smartindent = true vim.opt.copyindent = true vim.opt.preserveindent = true - vim.opt.clipboard = "unnamedplus" vim.opt.cursorline = true vim.opt.splitright = false vim.opt.splitbelow = true @@ -134,6 +133,10 @@ config.load = function() vim.opt.laststatus = 3 end + if doom.clipboard then + vim.opt.clipboard = "unnamedplus" + end + vim.g.mapleader = doom.leader_key end diff --git a/lua/doom/core/doom_global.lua b/lua/doom/core/doom_global.lua index 25c652f21..839a9149a 100644 --- a/lua/doom/core/doom_global.lua +++ b/lua/doom/core/doom_global.lua @@ -123,6 +123,12 @@ doom = { -- @default = true highlight_yank = true, + -- Use clipboard outside of vim + -- false : won't use third party clipboard + -- true : enables third part clipboard + -- @default = true + clipboard = true, + -- Enable guicolors -- Enables gui colors on GUI versions of Neovim -- @default = true From 9bc7b8a24eadb275a794a9e2eab78655ce92f9c9 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Tue, 19 Jul 2022 12:30:33 +1000 Subject: [PATCH 44/73] feat: #361 Re added missing `doom.max_columns` setting. --- lua/doom/core/config.lua | 5 ++++- lua/doom/core/doom_global.lua | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lua/doom/core/config.lua b/lua/doom/core/config.lua index d5b3c8bcd..e62e3152e 100644 --- a/lua/doom/core/config.lua +++ b/lua/doom/core/config.lua @@ -30,7 +30,6 @@ config.load = function() vim.opt.path = "**" vim.opt.signcolumn = "auto:2-3" vim.opt.foldcolumn = "auto:9" - vim.opt.colorcolumn = "80" vim.opt.formatoptions:append("j") vim.opt.fillchars = { vert = "▕", @@ -133,10 +132,14 @@ config.load = function() vim.opt.laststatus = 3 end + -- Use system clipboard if doom.clipboard then vim.opt.clipboard = "unnamedplus" end + -- Color column + vim.opt.colorcolumn = type(doom.max_columns) == "number" and tostring(doom.max_columns) or "" + vim.g.mapleader = doom.leader_key end diff --git a/lua/doom/core/doom_global.lua b/lua/doom/core/doom_global.lua index 839a9149a..07e972e4e 100644 --- a/lua/doom/core/doom_global.lua +++ b/lua/doom/core/doom_global.lua @@ -154,6 +154,12 @@ doom = { -- @default = false use_floating_win_packer = false, + -- Set max cols + -- Defines the column to show a vertical marker + -- Set to false to disable + -- @default = 80 + max_columns = 80, + -- Default indent size -- @default = 4 indent = 4, From 1f5c51e8534126a9662386239d9a20eec3c12131 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Tue, 19 Jul 2022 12:36:45 +1000 Subject: [PATCH 45/73] feat: #359 Fix `doom.disable_numbering` and `doom.relative_num` options. --- lua/doom/core/config.lua | 6 ++++-- lua/doom/core/doom_global.lua | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lua/doom/core/config.lua b/lua/doom/core/config.lua index e62e3152e..ae6b49cb2 100644 --- a/lua/doom/core/config.lua +++ b/lua/doom/core/config.lua @@ -52,8 +52,6 @@ config.load = function() vim.opt.mouse = "a" vim.opt.wrap = false vim.opt.swapfile = false - vim.opt.number = true - vim.opt.relativenumber = true vim.opt.expandtab = true vim.opt.conceallevel = 0 vim.opt.foldenable = true @@ -140,6 +138,10 @@ config.load = function() -- Color column vim.opt.colorcolumn = type(doom.max_columns) == "number" and tostring(doom.max_columns) or "" + -- Number column + vim.opt.number = not doom.disable_numbering + vim.opt.relativenumber = not doom.disable_numbering and doom.relative_num + vim.g.mapleader = doom.leader_key end diff --git a/lua/doom/core/doom_global.lua b/lua/doom/core/doom_global.lua index 07e972e4e..e0564df58 100644 --- a/lua/doom/core/doom_global.lua +++ b/lua/doom/core/doom_global.lua @@ -89,6 +89,18 @@ doom = { -- @default = false disable_suspension = true, + -- Set numbering + -- false : Enable number lines + -- true : Disable number lines + -- @default = false + disable_numbering = false, + + -- Set numbering style + -- false : Shows absolute number lines + -- true : Shows relative number lines + -- @default = true + relative_num = true, + -- h,l, wrap lines movement_wrap = true, @@ -174,7 +186,7 @@ doom = { -- · error -- · fatal -- @default = 'info' - logging = "warn", + logging = "info", -- Default colorscheme -- @default = doom-one From d802f587d1d9314c4f84ec570936adab5d922d71 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Wed, 20 Jul 2022 12:48:08 +1000 Subject: [PATCH 46/73] feat(langs): Added support for ruby language. --- lua/doom/modules/langs/ruby/init.lua | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 lua/doom/modules/langs/ruby/init.lua diff --git a/lua/doom/modules/langs/ruby/init.lua b/lua/doom/modules/langs/ruby/init.lua new file mode 100644 index 000000000..d0eb2b262 --- /dev/null +++ b/lua/doom/modules/langs/ruby/init.lua @@ -0,0 +1,31 @@ +local ruby = {} + +ruby.settings = { + language_server_name = "solargraph", +} + +ruby.autocmds = { + { + "BufWinEnter", + "*.rb", + function() + local langs_utils = require("doom.modules.langs.utils") + langs_utils.use_lsp(doom.langs.ruby.settings.language_server_name) + + require("nvim-treesitter.install").ensure_installed("ruby") + + -- Setup null-ls + if doom.features.linter then + local null_ls = require("null-ls") + + langs_utils.use_null_ls_source({ + null_ls.builtins.diagnostics.rubocop, + null_ls.builtins.diagnostics.mypy, + }) + end + end, + once = true, + }, +} + +return ruby From 206d73dde693c32cce993d857ee9548c717c1789 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Wed, 20 Jul 2022 12:52:06 +1000 Subject: [PATCH 47/73] fix(ruby): Fixed typo. --- lua/doom/modules/langs/ruby/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/doom/modules/langs/ruby/init.lua b/lua/doom/modules/langs/ruby/init.lua index d0eb2b262..9bb751a61 100644 --- a/lua/doom/modules/langs/ruby/init.lua +++ b/lua/doom/modules/langs/ruby/init.lua @@ -20,7 +20,6 @@ ruby.autocmds = { langs_utils.use_null_ls_source({ null_ls.builtins.diagnostics.rubocop, - null_ls.builtins.diagnostics.mypy, }) end end, From 4a4ea9321e2201934f721c6a142610c9bb74ee3e Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Wed, 20 Jul 2022 17:33:05 +1000 Subject: [PATCH 48/73] fix(langs.terraform): Added `terraform_fmt` null-ls formatter. --- lua/doom/modules/langs/terraform/init.lua | 18 ++++++++++++++---- modules.lua | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lua/doom/modules/langs/terraform/init.lua b/lua/doom/modules/langs/terraform/init.lua index df7cd37a6..18411bad8 100644 --- a/lua/doom/modules/langs/terraform/init.lua +++ b/lua/doom/modules/langs/terraform/init.lua @@ -1,17 +1,27 @@ local terraform = {} -terraform.settings = {} +terraform.settings = { + language_server_name = "terraformls", +} terraform.autocmds = { { - "FileType", - "terraform", + "BufWinEnter", + "*.hcl,*.tf,*.tfvars,*.nomad", function() local langs_utils = require("doom.modules.langs.utils") - langs_utils.use_lsp("terraformls") + langs_utils.use_lsp(doom.langs.terraform.settings.language_server_name) local ts_install = require("nvim-treesitter.install") ts_install.ensure_installed("hcl") + -- + -- Setup null-ls + if doom.features.linter then + local null_ls = require("null-ls") + langs_utils.use_null_ls_source({ + null_ls.builtins.formatting.terraform_fmt, + }) + end end, once = true, }, diff --git a/modules.lua b/modules.lua index 18d53e582..345eaee47 100644 --- a/modules.lua +++ b/modules.lua @@ -80,6 +80,7 @@ return { -- "config", -- JSON, YAML, TOML -- "markdown", + -- "terraform", -- Terraform / hcl files support } } From d29490391a11753c29b1b45cf2a6437c0b11c35d Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Jul 2022 14:04:39 +1000 Subject: [PATCH 49/73] feat(docs): Updated doom help docs --- doc/doom_nvim.norg | 827 ++++++----------------- doc/doom_nvim_modules.norg | 653 ++++++++++++++++++ lua/doom/modules/features/neorg/init.lua | 2 +- 3 files changed, 867 insertions(+), 615 deletions(-) create mode 100644 doc/doom_nvim_modules.norg diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg index ad52a3d61..b1cea0630 100644 --- a/doc/doom_nvim.norg +++ b/doc/doom_nvim.norg @@ -10,626 +10,227 @@ = 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?) - --> [Workaround](#Workaround) - ---> [Missing nvim help documentation](#Missing nvim help documentation) - -> [Acknowledgements](#Acknowledgements) - -> [Contributing](#Contributing) - -> [License](#License) + -> {# Introduction} + -> {# Configuring doom-nvim} + --> {# Modules} + ---> {# Enabling / disabling modules} + ---> {# Custom plugins} + ---> {# Customising the behaviour of modules} + --> {# Config} + ---> {# Adding Plugins} + ---> {# Adding keybinds} + ---> {# Adding commands} + ---> {# Configuring modules} + ---> {# Overriding modules or adding custom modules} + -> {# Contributing} + -> {# 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. - 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. - - 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 - 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. - - *** 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 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 - "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" +Doom Nvim is a Neovim interpretation of the {https://github.com/hlissner/doom-emacs}[doom-emacs] framework, adapted to Vim philosophy. + +Our goal is to provide a configurable, extensible, performant and stable basis for any neovim configuration. +Some of the defining features that make this project unique are: + +- \*Fast\* Rapid startup time without defer_fn, packages are lazy loaded and languages are only configured when opening its relevent file type. +- \*Stable\* Plugins are pinned to commit shas to avoid breaking between updates. +- \*Scalable\* Because of modular architecture you can disable any features you don't use. Your config is as simple or complex as you want it to be. +- \*Configurable\* All modules are 100% overridable and configurable, use a logical structure and have LSP completions. +- \*Extensible\* With a simple api you can easily add, and or contribute, your own modules. +- \*Integrated\* Desgined to handle and setup integrations between plugins for you. For example, whichkey will only show keybinds for + modules you have enabled (and will automatically handle your custom bindings). +* Configuring doom-nvim +** Modules + A module is a collection of packages, autocommands, keybinds and functions + that add new capabilities or functionality to Doom Nvim. We organise modules + into 2 categories: + - `features` extend the abilities of Doom Nvim by adding new functionality. + - `langs` add support for new languages. + +*** Enabling / disabling modules + You can enable or disable a module by going to `modules.lua` (`Dm`) + and commenting or uncommenting the entry. + + @code lua + -- modules.lua + return { + features = { + 'lsp' + -- 'telescope' }, - -- 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). + langs = { + 'lua', + -- 'rust', + } + } + @end - ** Autocompletion - 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. + *NOTE*: after doing changes to your modules you will only need to restart Neovim + and Doom Nvim will automatically handle your changes on here. - 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* │ │ │ - └─────┴────────────────────┴────┴──────┘ +*** Custom plugins + See the documentatition in {| Adding plugins} - 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 [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 - 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 │ - ├──────────────────┼────────────────────────────────────────────────┤ - │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. - 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 - i │ Open Doom Nivm information dashboard │ - ├─────────────────────┼────────────────────────────────────────────────────┤ - │ 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 │ - ├─────────────────────┼────────────────────────────────────────────────────┤ - │ t - - │ Tweak Neovim behavior │ - ├─────────────────────┼────────────────────────────────────────────────────┤ - │ 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 │ - ├─────────────────────┼────────────────────────────────────────────────────┤ - │ 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 │ - ├─────────────────────┼────────────────────────────────────────────────────┤ - │ 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 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` - - *NOTE*: You can also make your own keybindings or override the default ones - 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: - -@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 read 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. - - ** 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 - - All our contributors +*** Customising the behaviour of modules + Sometimes you'll want to edit the default behaviour of the modules, please + see {| Configuring modules}. + +** Config + Doom-nvim provides a number of config options, including easier to use versions of vim's own options. See all available config options in the {| Config API Reference }. + + @code lua + + -- config.lua + + doom.freeze_dependencies = false -- Don't use pinned packer dependencies + doom.logging = 'trace' -- Debug doom internal issues + doom.indent = 2 -- Sets vim.opt.shiftwith, vim.opt.softtabstop, vim.opt.tabstop to 2 + + vim.opt.colorcolumn = 120 -- Regular vim options can also be set + + @end + + > **NOTE:** If you have the `lua` language and `lsp` module enabled all of these options will be autocompleted. + +*** Adding Plugins + Additional packages can be imported with the `doom.use_package()` function. + This is a wrapper around `packer.use()` and provides the same API. {https://github.com/wbthomason/packer.nvim#quickstart}[DOCS] + @code lua + -- config.lua + + -- Simple config + doom.use_package('sainnhe/sonokai', 'EdenEast/nightfox.nvim') + + -- Advanced config + doom.use_package({ + 'rafcamlet/nvim-luapad', + opt = true, + cmd = 'Luapad' + }) + @end + +*** Adding keybinds + Additional keybinds can be defined with the `doom.use_keybind()` function. + This is a wrapper around a custom `nest.nvim` implementation and provides + the same API. {https://github.com/connorgmeehan/nest.nvim/tree/integrations-api#quickstart-guide}[DOCS] + + @code lua + -- config.lua + + doom.use_keybind({ + { 'u', name = '+user', { -- Names this group in whichkey "+user" + { 's', 'Telescope git_status', name = 'Git status' } -- Adds `us` keybind to trigger `Telescope git_status` + }}, + }) + @end + > **NOTE:** By providing the `name` field your custom keybinds will show up in `whichkey` and `mapper` if you have those modules enabled. + + +*** Adding commands + Additional commands can be define with the `doom.use_cmd()` function. + + @code lua + -- config.lua + + -- Bind single + doom.use_cmd( { 'Test', function() print('test') end } ) + + -- Bind multiple + doom.use_cmd({ + { 'Test1', function() print('test1') end }, + { 'Test2', function() print('test2') end }, + }) + @end + + +*** Configuring modules + The settings and config for all modules are also exposed inside of the `doom` global object. + Here you can override the plugin git sources, pre-defined settings, keybinds or autocmds. + + Make sure that the module that you want to configure/override is enabled in `modules.lua` + @code lua + -- modules.lua + return { + features = { + 'whichkey' -- Whichkey module is enabled + } + } + @end + + The same module with be avaliable in your `config.lua` in the `doom.features.module_name` field. + The settings should have autocomplete from sumneko lua lsp. + @code lua + -- config.lua + local whichkey = doom.features.whichkey -- Get the whichkey module + -- You can also access it as `doom.modules.features.whichkey` + + -- Some common settings are exposed in the `.settings` table. + whichkey.settings.window.height.max = 5 + + -- Inspect the existing config + print(vim.inspect(whichkey)) + + -- Add an additional keybind + table.insert(whichkey.binds, { 'u', name = '+user', { + { "wr", function() require("which-key").reset(), name = "Reset whichkey"} + } + }) + -- Replace all keybinds + whichkey.binds = { + { 'u', name = '+user', { + { "wr", function() require("which-key").reset(), name = "Reset whichkey"} + }} + } + + -- Add an additional autocommand + table.insert(whichkey.autocmds, { "event", "aupat", "cmd"}) + -- Replace all autocommands + whichkey.autocmds = { + { "event", "aupat", "cmd"} + } + + -- Modify the plugin source repo, plugins are indexed via the repository name. + whichkey.packages["which-key.nvim"] = { + "myfork/which-key.nvim" + } + -- Provide a different config function, the key has to match the entry in `whichkey.packages` + whichkey.configs["which-key.nvim"] = function () + local wk = require("which-key") + end + + -- Another example with a language module + local lua = doom.langs.lua + + -- Disable lua-dev loading library definitions + lua.settings.dev.library.plugins = false + @end + + +*** Overriding modules or adding custom modules + + It's possible to add your own doom modules or completely replace builtin doom + modules without editing the original files. Doom will first check the `lua/user/modules` + directory if a module exists before loading the default from `lua/doom/modules`. + + As an example, if we wanted to replace the `lua` module in the `langs` section we + would create a new file at `lua/user/modules/langs/lua/init.lua`. + + Alternatively if we wanted to add support for a new language (lets use julia as + an example) we would create a new file at `lua/user/modules/langs/julia/init.lua`. + You would then enable the module in `modules.lua` + + @code lua + --- modules.lua + return { + langs = { + 'julia', + } + } + @end + + > For more info, read the {:./doom_nvim_modules:# Building your own module} docs. * 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 + I really love pull requests and bug reports, please see the {https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/contributing.md}[Contributing Guidelines] on GitHub before contributing. Don't hesitate to tell me my Lua coding style sucks, but please tell me why. @@ -637,6 +238,4 @@ * License Doom Nvim is distributed under GPLv2 license. - -$comment vim:sw=2:ts=2:cole=3:cocu=n:tw=100:norl: diff --git a/doc/doom_nvim_modules.norg b/doc/doom_nvim_modules.norg new file mode 100644 index 000000000..fe93d08b2 --- /dev/null +++ b/doc/doom_nvim_modules.norg @@ -0,0 +1,653 @@ +@document.meta +title: doom_nvim_modules +description: +authors: connormeehan +categories: +created: 2022-07-29 +version: 0.0.11 +@end + += TOC Table of Contents + +* Table of Contents +-> {# Introduction} +-> {# All modules} +-> {# `core` modules} +---> {# `features` modules} +---> {# `langs` modules} +-> {# Configuring modules} +---> {# Quick Guide} +---> {# Advanced guide} +----> {# Module lifecycle} +----> {# Limitations} +-----> {# Direct plugin access} +-----> {# Conditional keybinds and autocommands} +----> {# Module spec} + -> {# Building your own module} +---> {# 1. Setting up} +---> {# 2. Adding autocommands} +---> {# 3. Enabling and testing your module} +---> {# 4. Adding the character counter} +---> {# 5. Adding commands to get and reset the count} +---> {# 6. Adding keybinds} +---> {# 7. Adding and lazyloading a plugin} +---> {# 8. Exposing settings to the user} +---> {# 9. Contributing your module upstream} +---> {# 10. You're done! Final output} +* Introduction + + Doom Nvim consists of around 40 modules and growing. + A Doom Nvim module is a bundle of packages, configurations, autocommands and + binds, organized into a unit that can be toggled easily. + + Modules are grouped into 3 categories: + - `features` (optional, extend doom-nvim with extra capabilities) + - `langs` (optional, add support for a language) + - `core` (cannot be disabled, required for core functionality). + + You can enable or disable doom modules by commenting them out in the `modules.lua` file + (`Dm` or `~/.config/nvim/modules.lua`). + +* All modules +* `core` modules + - [`treesitter`](../lua/doom/modules/core/treesitter) An incremental parsing system for programming tools. + - [`nest`](../lua/doom/modules/core/nest) Used for keybind management, integrates with `whichkey` and `mapper`. + +*** `features` modules + - \*Language related modules\* + -- {@ ../lua/doom/modules/features/annotations/init.lua}[annotations] Add code documents/annotations + -- {@ ../lua/doom/modules/features/auto_install/init.lua}[auto_install] Auto install LSP providers + -- {@ ../lua/doom/modules/features/autopairs/init.lua}[autopairs] Automatically close character pairs + -- {@ ../lua/doom/modules/features/comment/init.lua}[comment] Generate comments in any language. + -- {@ ../lua/doom/modules/features/linter/init.lua}[linter] Format and lint your code + -- {@ ../lua/doom/modules/features/snippets/init.lua}[snippets] Code snippets for all languages + + - **Editor modules** + -- {@ ../lua/doom/modules/features/auto_session/init.lua}[`auto_session`] Return to previous sessions + -- {@ ../lua/doom/modules/features/colorizer/init.lua}[`colorizer`] Show colors in editor + -- {@ ../lua/doom/modules/features/editorconfig/init.lua}[`editorconfig`] .editorconfig file support + -- {@ ../lua/doom/modules/features/gitsigns/init.lua}[`gitsigns`] Show changes near linenumber + -- {@ ../lua/doom/modules/features/illuminate/init.lua}[`illuminate`] Highlight other occurances of the hovered word + -- {@ ../lua/doom/modules/features/indentlines/init.lua}[`indentlines`] Explicitly show indentation + -- {@ ../lua/doom/modules/features/range_highlight/init.lua}[`range_highlight`] Highlight selected range as you type commands + -- {@ ../lua/doom/modules/features/todo_comments/init.lua}[`todo_comments`] Highlights TODO comments and more + - **UI modules** + -- {@ ../lua/doom/modules/features/fidget/init.lua}[`fidget`] Shows LSP loading status + -- {@ ../lua/doom/modules/features/tabline/init.lua}[`tabline`] Tabbed buffer switcher + -- {@ ../lua/doom/modules/features/dashboard/init.lua}[`dashboard`] A pretty dashboard upon opening doom--nvim. + -- {@ ../lua/doom/modules/features/trouble/init.lua}[`trouble`] A pretty diagnostics viewer + -- {@ ../lua/doom/modules/features/minimap/init.lua}[`minimap`] Shows current position in document + -- {@ ../lua/doom/modules/features/whichkey/init.lua}[`whichkey`] An interactive keybind cheatsheet + -- **Tool modules** + -- {@ ../lua/doom/modules/features/dap/init.lua}[`dap`] Debug adapter protocol for neovim + -- {@ ../lua/doom/modules/features/explorer/init.lua}[`explorer`] File explorer in the sidebar + -- {@ ../lua/doom/modules/features/neorg/init.lua}[`neorg`] Organise your life + -- {@ ../lua/doom/modules/features/netrw/init.lua}[`netrw`] Native file explorer in the sidebar + -- {@ ../lua/doom/modules/features/telescope/init.lua}[`telescope`] Search files, text, commands and more + -- {@ ../lua/doom/modules/features/projects/init.lua}[`projects`] Quick project switching + +*** `langs` modules + + - {@ ../lua/doom/modules/langs/lua/init.lua}[`lua`] Lua language support, we recommend keeping this enabled as it also provides LSP completion for all config options. + - {@ ../lua/doom/modules/langs/python/init.lua}[`python`] + - {@ ../lua/doom/modules/langs/bash/init.lua}[`bash`] + - {@ ../lua/doom/modules/langs/javascript/init.lua}[`javascript`] + - {@ ../lua/doom/modules/langs/typescript/init.lua}[`typescript`] + - {@ ../lua/doom/modules/langs/css/init.lua}[`css`] + - {@ ../lua/doom/modules/langs/vue/init.lua}[`vue`] + - {@ ../lua/doom/modules/langs/tailwindcss/init.lua}[`tailwindcss`] + - {@ ../lua/doom/modules/langs/svelte/init.lua}[`svelte`] + - {@ ../lua/doom/modules/langs/rust/init.lua}[`rust`] + - {@ ../lua/doom/modules/langs/cpp/init.lua}[`cpp`] + - {@ ../lua/doom/modules/langs/c_sharp/init.lua}[`c_sharp`] + - {@ ../lua/doom/modules/langs/kotlin/init.lua}[`kotlin`] + - {@ ../lua/doom/modules/langs/java/init.lua}[`java`] + - {@ ../lua/doom/modules/langs/go/init.lua}[`go`] + - {@ ../lua/doom/modules/langs/config/init.lua}[`config`] Adds JSON, YAML, TOML support + - Missing a language? Submit a feature request issue. + +* Configuring modules + +*** Quick Guide + + You can access, override and configure all modules by using the `config.lua` file (`Dc` or `~/.config/nvim/config.lua`). + This is done through the `doom.features` global object. Here we'll use the [`comment`](../lua/doom/modules/features/comment) module as an example. + Compare the source file with the example overrides below. + + @code lua + --- config.lua + + -- Here `comment_module` is just a reference to `../lua/doom/modules/features/comment/init.lua` + local comment_module = doom.features.comment + -- Override default settings (provided by doom-nvim) + comment_module.settings.padding = false + -- Override package source with a fork + comment_module.packages['Comment.nvim'] = { + 'my_fork/Comment.nvim', + module = "Comment" + } + -- If you need more customisability than overriding the settings, you can override the configure function + comment_module.configs["Comment.nvim"] = function () end + -- Replace keybinds + comment_module.binds = { + { "gc", "echo Do something", name = "Comment motion"} + } + @end + + > **NOTE:** If you have the `lua` language module and `lsp` feature module enabled, + all of these properties should be auto completeable. + +*** Advanced guide + +**** Module lifecycle + 1. Doom nvim reads `modules.lua` to determine which modules to load. + 2. Doom loads the config for each module, saves it to `doom.features|doom.langs|doom.core` global object. + 3. User can override the settings for a module in `config.lua` using the `doom.modules` global object. + 4. Doom executes the modules, installing plugins and setting keybinds/autocommands. + +**** Limitations + +***** Direct plugin access + + The main limitation is that plugins are not yet loaded when `config.lua` is executed meaning you + cant have direct access to plugins. We're working on a more concrete solution but for now you can + splice your own custom configure function with the default one. + + @code lua + --- config.lua + + local lsp = doom.langs.lsp + local old_nvim_cmp_config_function = lsp.configs['nvim-cmp'] + lsp.configs['nvim-cmp'] = function() + old_nvim_cmp_config_function() -- Run the default config + local cmp = require("cmp") -- direct access to plugin + end + @end + +***** Conditional keybinds and autocommands + + Sometimes keybinds and autocommands will be conditionally added/disabled depending on if another module + is enabled or if a specific config option is set. In this case we use a function that returns a valid config + instead of a simple table. + + This is not ideal as it's harder to `vim.inspect` the defaults. As a workaround you can `vim.inspect` the returned value. + + @code lua + -- config.lua + + print(type(doom.features.lsp.binds)) -- "table" (not conditional) + print(vim.inspect(doom.features.lsp.binds)) -- Shows config + print(type(doom.features.telescope.binds)) -- "function" (adds extra keybinds if "lsp" module is enabled) + print(vim.inspect(doom.features.telescope.binds())) -- You must execute the function to see the config. + @end + +**** Module spec + + These are the possible fields a module might have. + + @code lua + module.settings: table -- Table of settings that can be tweaked + module.packages: table> -- Table of packer specs + module.configs: table -- Table of plugin config functions relating to the packer specs + module.binds: table|function -> table -- Table of NestConfig or function that returns Table of NestConfig + module.autocmds: table|function -> table -- Table of AutoCmds (see below) or function that returns a table of AutoCmds + @end + + @code lua + local example = {} + + example.settings = {...} -- Doom-nvim provided object to change settings + + -- Stores the packer.nvim config for all of the plugin dependencies + example.packages = { + ["example-plugin.nvim"] = { -- Use the repository name as the key + "GithubUser/example-plugin.nvim", + commit = "..." -- We like to pin plugins to commits to avoid issues upgrading. + } + } + + example.configs = { + ["example-plugin.nvim"] = function() -- key matches `example.packages` entry + require('example-plugin').setup( doom.features.example.settings ) -- Consumes `example.settings` and uses it to config the plugin + end + } + + -- Keybinds are defined using a modified nest.nvim table syntax. + -- https://github.com/connorgmeehan/nest.nvim/tree/integrations-api + example.binds = { + { 'ff', ':Telescope find_files', name = 'Find files'} -- `name = "..."` For `whichkey` and `mapper` integrations + { 'cc', function() print('custom command') end, name = 'Find files' }, -- Can trigger either a `` string or a function + } + + -- If you need conditional keybinds it's recommended you use a function that returns a table instead. + example.binds = function() + local binds = { ... } + if doom.features.other_module then + table.insert(binds, { + 'ff', function() print('this is a conditional keybind') end, name = 'My conditional keybind' + }) + end + return binds + end + + -- Autocmds are defined as a table with the following syntax + -- { "event", "aupat", "command or function" } + -- Example + example.autocmds = { + { "BufWinEnter", "*.js", function() print("I'm in a javascript file now") end } + } + -- Similarly, autocmds can be conditional using a function + example.autocmds = function() + local autocmds = {} + if condition then + table.insert(autocmds, { "BufWinEnter", "*.js", function() print("I'm in a javascript file now") end }) + end + return autocmds + end + @end + +* Building your own module + + I will use an example of implementing a module that counts the number of chars that you've typed. + This module will: + - Use autocommands to count the number of chars in a buffer when you enter insert mode vs when you leave insert mode + - Add it to an accumulated sum + - Provide keybinds + commands to restart or display total count + - Use a plugin to display the results in a popup window + - Include some settings to change the displayed output + +*** 1. Setting up + + > Because modules are implemented as folders with an `init.lua` inside, they must be named after valid folder names. + > Best practices are: + > - Seperate words with an underscore, this is so the plugin can be represented as a lua variable + > - Name the module after the functionality rather than the plugin it uses. + + For our example of adding char counting plugin I will create a folder called `lua/user/modules/features/char_counter/` + and create a new `init.lua` inside of it. + @code lua + -- lua/user/modules/features/char_counter/init.lua + local char_counter = {} + + return char_counter + @end + +*** 2. Adding autocommands + + Autocommands are set using the `module_name.autocmds` field. And follow the structure of + @code lua + module_name.autocmds = { + { "{event}", "{aupat}", "command or function" } + } + + For our example we need to hook into the [InsertEnter](https://neovim.io/doc/user/autocmd.html*InsertEnter) + and [InsertLeave](https://neovim.io/doc/user/autocmd.html*InsertLeave) auto commands. + + @code lua + -- lua/user/modules/features/char_counter/init.lua + char_counter.autocmds = { + { "InsertEnter", "*", function () + print('Entered insert mode') + end}, + { "InsertLeave", "*", function () + print('Exited insert mode') + end}, + } + @end + +*** 3. Enabling and testing your module + + Now you can enable the module in `modules.lua`! Once enabled, restart your doom-nvim instance and check + `:messages` to see if it's printing correctly. + + @code lua + -- modules.lua + return { + features = { + 'char_counter', + }, + } + @end + +*** 4. Adding the character counter + + Because modules are just tables, you can add any properties or functions that you need to the module table. + To implement the character counter we will add a few fields to the module table. Unless you want users to + access these fields we recommend prefixing them with an underscore. + 1. A function that gets the character count of a buffer. + 2. A field to store the character count when we enter insert mode. + 3. A field to store the accumulated count when we exit insert mode. + + We will also check if the [`buftype`](https://neovim.io/doc/user/options.html*'buftype') is empty, this + means we wont count other interactive buffers like terminals, prompts or quick fix lists. + + @code lua + -- lua/user/modules/features/char_counter/init.lua + + local char_counter = {} + + char_counter._insert_enter_char_count = nil + char_counter._accumulated_difference = 0 + char_counter._get_current_buffer_char_count = function() + local lines = vim.api.nvim_buf_line_count(0) + local chars = 0 + for _, line in ipairs(vim.api.nvim_buf_get_lines(0, 0, lines, false)) do + chars = chars + *line + end + return chars + end + + char_counter.autocmds = { + { "InsertEnter", "*", function () + -- Only operate on normal file buffers + print(("buftype: %s"):format(vim.bo.buftype)) + if vim.bo.buftype == "" then + -- Store current char count + char_counter._insert_enter_char_count = char_counter._get_current_buffer_char_count() + end + end}, + { "InsertLeave", "*", function () + -- Only operate on normal file buffers + if vim.bo.buftype == "" and char_counter._insert_enter_char_count then + -- Find the amount of chars added or removed + local new_count = char_counter._get_current_buffer_char_count() + local diff = new_count - char_counter._insert_enter_char_count + print(new_count, diff) + -- Add the difference to the accumulated total + char_counter._accumulated_difference = char_counter._accumulated_difference + diff + print(('Accumulated difference %s'):format(char_counter._accumulated_difference)) + end + end}, + } + + return char_counter + @end + +*** 5. Adding commands to get and reset the count + + Using the `module.cmds` property we can define and expose vim commands to the user. Here we will define a + `:CountPrint` and `:CountReset` command. + + @code lua + -- lua/user/modules/features/char_counter/init.lua + + char_counter.cmds = { + { "CountPrint", function () + local msg = ("char_counter: You have typed %s characters since I started counting."):format(char_counter._accumulated_difference) + vim.notify(msg, "info") + end}, + { "CountReset", function () + char_counter._accumulated_difference = 0 + vim.notify("char_counter: Reset count!", "info") + end} + } + @end + > **NOTE**: Instead of using a function you can also provide a string that will be executed using `vim.cmd` + + Now restart doom nvim and run `:CountPrint` and `:CountReset` to test it out. + +*** 6. Adding keybinds + + Keybinds are provided using the `module.binds` field. We use a modified [nest.nvim]() config that integrates with whichkey and nvim-mapper. You can read more about it [here](https://github.com/connorgmeehan/nest.nvim/tree/integrations-api*quickstart-guide) but generally you should provide the `name` field for all entries so it displays in whichkey. + + @code lua + -- lua/user/modules/features/char_counter/init.lua + + char_counter.binds = { + { 'i', name = '+info', { -- Adds a new `whichkey` folder called `+info` + { 'c', ':CountPrint', name = 'Print new chars' }, -- Binds `:CountPrint` to `ic` + { 'r', ':CountReset', name = 'Reset char count' } -- Binds `:CountPrint` to `ic` + } } + } + @end + > **NOTE**: Instead of a cmd you can also provide a lua function that will be executed when the keybind is triggered. + +*** 7. Adding and lazyloading a plugin + + Plugins are added using the `module.packages` field and are configured using the `module.configs` field. + We use the repository name as a key to connect the plugin to its config function. + The API for `module.packages` is passed to Packer nvim's use function. [DOCS](https://github.com/wbthomason/packer.nvim*specifying-plugins) + + In this example I will add [nui.nvim](https://github.com/MunifTanjim/nui.nvim) to display the results in a popup when + the user uses the `CountPrint` command. + + @code lua + -- lua/user/modules/features/char_counter/init.lua + + -- Add these two fields to `char_counter` at the top of the file. + char_counter.packages = { + ["nui.nvim"] = { + "MunifTanjim/nui.nvim", + cmd = { "CountPrint" } -- Here, nui.nvim wont be loaded until user does the `ic` or `:CountPrint` command. + } + } + + char_counter.configs = { + ["nui.nvim"] = function() + -- Log when nui loads so we can check that it's being lazy loaded correctly + vim.notify("char_counter: nui.nvim loaded", "info") + + -- If your plugin requires a `.setup({ ... config ... })` function, this is where you'd execute it. + + -- WARNING: Because of how Packer compiles plugin configs, this function does not have direct access to `char_counter` table. + -- The only way to access the `char_counter` object is via `doom.features.char_counter` + end + } + + -- Modify `char_counter.cmds` + + char_counter.cmds = { + { "CountPrint", function () + -- We can ensure that nui has loaded due to the `cmd = { "CountPrint" }` in the plugin's config + local Popup = require('nui.popup') + + local popup = Popup({ + position = '50%', + size = { + width = 80, + height = 40, + }, + border = { + padding = { + top = 2, + bottom = 2, + left = 3, + right = 3, + }, + }, + style = "rounded", + enter = true, + buf_options = { + modifiable = true, + readonly = true, + } + }) + popup:mount() + popup:map("n", "", function() popup:unmount() end) + + local msg = ("char_counter: You have typed %s characters since I started counting."):format(char_counter._accumulated_difference) + vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, { msg }) + end}, + { "CountReset", function () + char_counter._accumulated_difference = 0 + vim.notify("char_counter: Reset count!", "info") + end} + } + @end + +*** 8. Exposing settings to the user + + In order to keep doom-nvim flexible, it's best practice to expose settings for the module. A common practice is just to expose the entire config + object. This will allow users to tweak the config in their `config.lua` file without replacing and rewriting all of the logic for a small change. + + + @code lua + -- lua/user/modules/features/char_counter/init.lua + + -- Copy the settings that are passed to the `Popup` function, place them in `char_counter.settings.popup` + char_counter.settings = { + popup = { + position = '50%', + size = { + width = 80, + height = 40, + }, + border = { + padding = { + top = 2, + bottom = 2, + left = 3, + right = 3, + }, + }, + style = "rounded", + enter = true, + buf_options = { + modifiable = true, + readonly = true, + } + } + } + + -- Modify the Popup function + char_counter.cmds = { + { "CountPrint", function () + local Popup = require('nui.popup') + + local popup = Popup(char_counter.settings.popup) -- Configured via the `settings.popup` field. + + popup:mount() + popup:map("n", "", function() popup:unmount() end) + + local msg = ("char_counter: You have typed %s characters since I started counting."):format(char_counter._accumulated_difference) + vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, { msg }) + end}, + { "CountReset", function () + char_counter._accumulated_difference = 0 + vim.notify("char_counter: Reset count!", "info") + end} + } + @end + +*** 9. Contributing your module upstream + + > Builtin modules are loaded from the `lua/doom/modules/` folder. Within this folder there is a `features/`, `langs/` and `core/` directory. + > If you look at [`modules.lua`](../modules.lua) you'll see that the table fields are used to lookup the subfolder. + @code lua + return { + features = { + "lsp" -- Maps to `lua/doom/modules/features/lsp/`, + }, + langs = { + "lua" -- Maps to `lua/doom/modules/langs/lua/` + } + } + @end + + If you would like to contribute your module, just move it from `lua/user/modules/` to + `lua/user/modules//` and create a PR in accordance with our [Contributing Guidelines](./contributing.md). + +*** 10. You're done! Final output + + If you'd just like to look at the end result, or if you're comparing why your implementation didn't work, here is the final working output. + + @code lua + -- lua/user/modules/features/char_counter/init.lua + local char_counter = {} + + char_counter.settings = { + popup = { + position = '50%', + size = { + width = 80, + height = 40, + }, + border = { + padding = { + top = 2, + bottom = 2, + left = 3, + right = 3, + }, + }, + style = "rounded", + enter = true, + buf_options = { + modifiable = true, + readonly = true, + } + } + } + + char_counter.packages = { + ["nui.nvim"] = { + "MunifTanjim/nui.nvim", + cmd = { "CountPrint" } + } + } + + char_counter.configs = { + ["nui.nvim"] = function() + vim.notify("char_counter: nui.nvim loaded", "info") + end + } + + char_counter._insert_enter_char_count = nil + char_counter._accumulated_difference = 0 + char_counter._get_current_buffer_char_count = function() + local lines = vim.api.nvim_buf_line_count(0) + local chars = 0 + for _, line in ipairs(vim.api.nvim_buf_get_lines(0, 0, lines, false)) do + chars = chars + #line + end + return chars + end + + char_counter.autocmds = { + { "InsertEnter", "*", function () + -- Only operate on normal file buffers + print(("buftype: %s"):format(vim.bo.buftype)) + if vim.bo.buftype == "" then + -- Store current char count + char_counter._insert_enter_char_count = char_counter._get_current_buffer_char_count() + end + end}, + { "InsertLeave", "*", function () + -- Only operate on normal file buffers + if vim.bo.buftype == "" and char_counter._insert_enter_char_count then + -- Find the amount of chars added or removed + local new_count = char_counter._get_current_buffer_char_count() + local diff = new_count - char_counter._insert_enter_char_count + print(new_count, diff) + -- Add the difference to the accumulated total + char_counter._accumulated_difference = char_counter._accumulated_difference + diff + print(('Accumulated difference %s'):format(char_counter._accumulated_difference)) + end + end}, + } + + char_counter.cmds = { + { "CountPrint", function () + local Popup = require('nui.popup') + local popup = Popup(char_counter.settings.popup) + popup:mount() + popup:map("n", "", function() popup:unmount() end) + + local msg = ("char_counter: You have typed %s characters since I started counting."):format(char_counter._accumulated_difference) + vim.api.nvim_buf_set_lines(popup.bufnr, 0, 1, false, { msg }) + end}, + { "CountReset", function () + char_counter._accumulated_difference = 0 + vim.notify("char_counter: Reset count!", "info") + end} + } + + char_counter.binds = { + { 'i', name = '+info', { -- Adds a new `whichkey` folder called `+info` + { 'c', ':CountPrint', name = 'Print new chars' }, -- Binds `:CountPrint` to `ic` + { 'r', ':CountReset', name = 'Reset char count' } -- Binds `:CountPrint` to `ic` + } } + } + + return char_counter + @end diff --git a/lua/doom/modules/features/neorg/init.lua b/lua/doom/modules/features/neorg/init.lua index 6c4d6dbca..2a6a6a235 100644 --- a/lua/doom/modules/features/neorg/init.lua +++ b/lua/doom/modules/features/neorg/init.lua @@ -42,7 +42,7 @@ neorg.settings = { neorg.packages = { ["neorg"] = { "nvim-neorg/neorg", - commit = "c0ebefa516aa9e93431f0a55e033db0dec072857", + commit = "2c4305eb32b10710a043380069c5538632160260", after = "nvim-treesitter", }, } From 891d7566cd9bfa7445d689e598abaa68d922e88f Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Jul 2022 14:13:12 +1000 Subject: [PATCH 50/73] feat(tools): Updated autoinstall script to prepare for release --- README.md | 2 +- tools/install.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 642a86f33..8e3684e8f 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Some of the defining features that make this project unique are: ### Mac OS / Linux ```bash -bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/next/tools/install.sh) +bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/main/tools/install.sh) ``` ### Manual (Mac OS / Linux) diff --git a/tools/install.sh b/tools/install.sh index 9f3d340b7..aaf25de43 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -130,8 +130,7 @@ function backup_existing_config() { function install_doom_nvim() { echo "Cloning..." - # TODO: Remove `--branch next` for release. - git clone --branch next "$DOOM_REPO_URL" "${DOOM_CONFIG_DIR}" + git clone "$DOOM_REPO_URL" "${DOOM_CONFIG_DIR}" --depth=10 cd "${DOOM_CONFIG_DIR}" || exit # Setup user with their own custom branch git checkout -b my-config From 57a537ff8e269628a4f2edebd3aa7ac793897be2 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Jul 2022 14:17:46 +1000 Subject: [PATCH 51/73] docs: Add release notice to readme.md and update CHANGELOG.md --- CHANGELOG.md | 2 +- README.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c18fe9c1..73ecac4e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [4.0.0] - `doom_modules.lua` renamed to `modules.lua` - `doom_config.lua` renamed to `config.lua` diff --git a/README.md b/README.md index 8e3684e8f..a78269fe8 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,11 @@ +> Note: Doom nvim v4.0.0 has just been released (29th July 2022). +> This release introduces many changes so feel free to ask questions on the +> discord or in the github discussions page or create an issue ticket and I'll +> solve it as soon as possible. + ## What is Doom Nvim? Doom Nvim is a Neovim interpretation of the [doom-emacs](https://github.com/hlissner/doom-emacs) framework, adapted to Vim philosophy. From 1e16573d4b035b13940d0ce17ded806e6de957df Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Jul 2022 14:23:19 +1000 Subject: [PATCH 52/73] fix(docs): Broken links in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a78269fe8..433ef82dd 100644 --- a/README.md +++ b/README.md @@ -122,14 +122,14 @@ return { #### All modules Doom-nvim currently has 35+ `features` modules and 20+ `langs` modules. -You can find a full list of modules (here)[./docs/modules.md#all-modules] +You can find a full list of modules [here](./docs/modules.md#all-modules) ### Configuring and personalising: `config.lua` #### Modifying neovim and doom options Doom nvim provides a number of config options, including wrapping some of vim's -own options. See all available config options (in the API Reference)[./docs/api.md]. +own options. See all available config options [in the API Reference](./docs/api.md). ```lua -- config.lua From 5a41c6ad8a3dd6a68829281fa42cf4be02cce5c7 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Jul 2022 14:31:02 +1000 Subject: [PATCH 53/73] fix(features.telescope): Broken ` keybind if telescope hasn't loaded yet. --- lua/doom/modules/features/telescope/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/telescope/init.lua b/lua/doom/modules/features/telescope/init.lua index 726e97229..1c3c0e84c 100644 --- a/lua/doom/modules/features/telescope/init.lua +++ b/lua/doom/modules/features/telescope/init.lua @@ -100,7 +100,7 @@ telescope.binds = function() { "`", function() - require("telescope.builtin").find_files({ cwd = vim.fn.expand("%:p:n") }) + vim.cmd(("Telescope find_files cwd=%s"):format(vim.fn.getcwd())) end, name = "Browse cwd", }, From 6d2e9c9124ecfa74ca611711760673e222f589ac Mon Sep 17 00:00:00 2001 From: Luc Chabassier Date: Fri, 29 Jul 2022 06:36:06 +0200 Subject: [PATCH 54/73] fix(logger): Fix when `stdpath('data')` doesn't exist @dwarfmaster #364 --- init.lua | 3 +++ lua/doom/utils/logging.lua | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index adfdfe83f..e4034a849 100644 --- a/init.lua +++ b/init.lua @@ -7,6 +7,9 @@ if vim.fn.has("nvim-0.6.0") ~= 1 then return end +-- Makes sure ~/.local/share/nvim exists, to prevent problems with logging +vim.fn.mkdir(vim.fn.stdpath("data"), 'p') + -- Add ~/.local/share to runtimepath early, such that -- neovim autoloads plugin/packer_compiled.lua along with vimscript, -- before we start using the plugins it lazy-loads. diff --git a/lua/doom/utils/logging.lua b/lua/doom/utils/logging.lua index 0e7c10317..a507193ad 100644 --- a/lua/doom/utils/logging.lua +++ b/lua/doom/utils/logging.lua @@ -111,9 +111,13 @@ log.new = function(config, standalone) -- Output to log file if config.use_file then local fp = io.open(outfile, "a") - local str = string.format("[%-6s%s] %s: %s\n", nameupper, os.date(), lineinfo, msg) - fp:write(str) - fp:close() + if not fp then + vim.cmd(string.format([[echom "Couldn't open log file [%s]"]], outfile)) + else + local str = string.format("[%-6s%s] %s: %s\n", nameupper, os.date(), lineinfo, msg) + fp:write(str) + fp:close() + end end end From 6ba721cc819ef0a038808cf0baf444f346dbc90e Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Jul 2022 15:34:10 +1000 Subject: [PATCH 55/73] feat(docs): Added uninstall docs --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 433ef82dd..c84a3f4ea 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ bash <(curl -s https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/main/too - [FAQ](#faq) - [Contributing](#contributing) - [Contributors](#contributors) +- [Uninstall](#uninstalling) --- @@ -317,6 +318,11 @@ The majors changes between v3 and v4 are the following. > Because of the durastic changes to the way you configure doom-nvim we recommend > starting a new branch and porting your changes across. +## Uninstalling + +To uninstall doom-nvim delete the `.nvim` folder from `$XDG_CONFIG_HOME/nvim` (`rm -r ~/.config/nvim`) +You will also need to delete `packer_compiled.lua` from `$XDG_DATA_HOME/nvim/plugin/packer_compiled` (`rm ~/.local/share/nvim/plugin/packer_compiled.lua`) + ## Contributing For for information please see our [contributing docs](./docs/contributing.md). @@ -349,6 +355,7 @@ Special thanks to these amazing people for helping improve doom (see [emoji key] + From a8fb56b26c2ad468f6a729b2234ac7665c7adacd Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Fri, 29 Jul 2022 16:19:40 +1000 Subject: [PATCH 56/73] chore(deps): Update pinned packer dependencies --- config.lua | 1 + lua/doom/modules/core/doom/init.lua | 4 ++-- lua/doom/modules/core/treesitter/init.lua | 2 +- lua/doom/modules/core/updater/init.lua | 2 +- lua/doom/modules/features/annotations/init.lua | 2 +- lua/doom/modules/features/auto_install/init.lua | 2 +- lua/doom/modules/features/autopairs/init.lua | 2 +- lua/doom/modules/features/comment/init.lua | 2 +- lua/doom/modules/features/dap/init.lua | 4 ++-- lua/doom/modules/features/dashboard/init.lua | 2 +- lua/doom/modules/features/editorconfig/init.lua | 2 +- lua/doom/modules/features/explorer/init.lua | 2 +- lua/doom/modules/features/firenvim/init.lua | 2 +- lua/doom/modules/features/gitsigns/init.lua | 2 +- lua/doom/modules/features/illuminate/init.lua | 2 +- lua/doom/modules/features/indentlines/init.lua | 2 +- lua/doom/modules/features/lazygit/init.lua | 2 +- lua/doom/modules/features/linter/init.lua | 2 +- lua/doom/modules/features/lsp/init.lua | 10 +++++----- lua/doom/modules/features/lsp_progress/init.lua | 2 +- lua/doom/modules/features/minimap/init.lua | 2 +- lua/doom/modules/features/neogit/init.lua | 2 +- lua/doom/modules/features/projects/init.lua | 2 +- lua/doom/modules/features/snippets/init.lua | 2 +- lua/doom/modules/features/statusline/init.lua | 2 +- lua/doom/modules/features/telescope/init.lua | 2 +- lua/doom/modules/features/terminal/init.lua | 2 +- lua/doom/modules/langs/config/init.lua | 2 +- modules.lua | 4 ++-- 29 files changed, 36 insertions(+), 35 deletions(-) diff --git a/config.lua b/config.lua index 29c75de79..b21b46321 100644 --- a/config.lua +++ b/config.lua @@ -41,5 +41,6 @@ -- { "FileType", "javascript", function() print('This is a javascript file') end } -- }) +doom.indent = 2 -- vim: sw=2 sts=2 ts=2 expandtab diff --git a/lua/doom/modules/core/doom/init.lua b/lua/doom/modules/core/doom/init.lua index 4eea90504..5c4c49121 100644 --- a/lua/doom/modules/core/doom/init.lua +++ b/lua/doom/modules/core/doom/init.lua @@ -16,7 +16,7 @@ required.packages = { }, ["plenary.nvim"] = { "nvim-lua/plenary.nvim", - commit = "9c3239bc5f99b85be1123107f7290d16a68f8e64", + commit = "986ad71ae930c7d96e812734540511b4ca838aa2", module = "plenary", }, ["popup.nvim"] = { @@ -26,7 +26,7 @@ required.packages = { }, ["nvim-web-devicons"] = { "kyazdani42/nvim-web-devicons", - commit = "8d2c5337f0a2d0a17de8e751876eeb192b32310e", + commit = "2d02a56189e2bde11edd4712fea16f08a6656944", module = "nvim-web-devicons", }, -- Must include impatient.nvim here, even though it's bootstrapped in diff --git a/lua/doom/modules/core/treesitter/init.lua b/lua/doom/modules/core/treesitter/init.lua index 4a02c3cd6..11797376c 100644 --- a/lua/doom/modules/core/treesitter/init.lua +++ b/lua/doom/modules/core/treesitter/init.lua @@ -42,7 +42,7 @@ treesitter.settings = { treesitter.packages = { ["nvim-treesitter"] = { "nvim-treesitter/nvim-treesitter", - commit = "9e8df1b3ca576eeaca4e8d48e3d67119b32adb99", + commit = "6289410c7a4715d6e7743c4d81cf5d262e90951e", run = ":TSUpdate", branch = "master", }, diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index 6bc680b8d..fb5bb0b91 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -24,7 +24,7 @@ local updater = {} updater.packages = { ["plenary.nvim"] = { "nvim-lua/plenary.nvim", - commit = "9c3239bc5f99b85be1123107f7290d16a68f8e64", + commit = "986ad71ae930c7d96e812734540511b4ca838aa2", module = "plenary", }, } diff --git a/lua/doom/modules/features/annotations/init.lua b/lua/doom/modules/features/annotations/init.lua index edb5144c9..2684bd40f 100644 --- a/lua/doom/modules/features/annotations/init.lua +++ b/lua/doom/modules/features/annotations/init.lua @@ -19,7 +19,7 @@ annotations.settings = { annotations.packages = { ["neogen"] = { "danymat/neogen", - commit = "a4b2fd5ba5ec3cdd9c3c7a5f6868b6c52eea0313", + commit = "c5a0c39753808faa41dea009d41dd686732c6774", after = "nvim-treesitter", }, } diff --git a/lua/doom/modules/features/auto_install/init.lua b/lua/doom/modules/features/auto_install/init.lua index dc4db9227..f71591c7e 100644 --- a/lua/doom/modules/features/auto_install/init.lua +++ b/lua/doom/modules/features/auto_install/init.lua @@ -23,7 +23,7 @@ auto_install.packages = { }, ["nvim-lsp-installer"] = { "williamboman/nvim-lsp-installer", - commit = "effafae44012a6ad3091968ad358531c62925a45", + commit = "b8c168ccb30529a11404e5f71525502ec6288ccf", -- disabled = not is_module_enabled("features", "lsp"), }, } diff --git a/lua/doom/modules/features/autopairs/init.lua b/lua/doom/modules/features/autopairs/init.lua index c8aa48498..0af83847e 100644 --- a/lua/doom/modules/features/autopairs/init.lua +++ b/lua/doom/modules/features/autopairs/init.lua @@ -9,7 +9,7 @@ autopairs.settings = { autopairs.packages = { ["nvim-autopairs"] = { "windwp/nvim-autopairs", - commit = "84cde3547e9a8b16db0bfe523e98e19b7be5148b", + commit = "972a7977e759733dd6721af7bcda7a67e40c010e", event = "BufReadPost", }, } diff --git a/lua/doom/modules/features/comment/init.lua b/lua/doom/modules/features/comment/init.lua index 77dc1d54f..68e23f4e6 100644 --- a/lua/doom/modules/features/comment/init.lua +++ b/lua/doom/modules/features/comment/init.lua @@ -44,7 +44,7 @@ comment.settings = { comment.packages = { ["Comment.nvim"] = { "numToStr/Comment.nvim", - commit = "3c69bab36569d5d0321351ec956fc43a8d409fb0", + commit = "78ab4e9785b6da9b7a539df3bd6f70300dc9482b", module = "Comment", }, } diff --git a/lua/doom/modules/features/dap/init.lua b/lua/doom/modules/features/dap/init.lua index 0c00cd92e..92960c09b 100644 --- a/lua/doom/modules/features/dap/init.lua +++ b/lua/doom/modules/features/dap/init.lua @@ -38,12 +38,12 @@ dap.settings = { dap.packages = { ["nvim-dap"] = { "mfussenegger/nvim-dap", - commit = "014ebd53612cfd42ac8c131e6cec7c194572f21d", + commit = "a13d6cb9ea8f7bbf8dd9c5de9ca2cbee64d2e258", module = "dap", }, ["nvim-dap-ui"] = { "rcarriga/nvim-dap-ui", - commit = "d76d6594374fb54abf2d94d6a320f3fd6e9bb2f7", + commit = "b7b71444128f5aa90e4aee8dbfa36b14afddfb7a", after = { "nvim-dap" }, }, } diff --git a/lua/doom/modules/features/dashboard/init.lua b/lua/doom/modules/features/dashboard/init.lua index af7e01323..1e6752805 100644 --- a/lua/doom/modules/features/dashboard/init.lua +++ b/lua/doom/modules/features/dashboard/init.lua @@ -67,7 +67,7 @@ dashboard.settings = { dashboard.packages = { ["dashboard-nvim"] = { "glepnir/dashboard-nvim", - commit = "883c7953d3e0a45ed0dd0fa05f9d029efdbf3c8a", + commit = "94585fab23f17a9450b85cc04d71f98251579e37", cmd = "Dashboard", opt = true, }, diff --git a/lua/doom/modules/features/editorconfig/init.lua b/lua/doom/modules/features/editorconfig/init.lua index 3feaf20ab..0693a3304 100644 --- a/lua/doom/modules/features/editorconfig/init.lua +++ b/lua/doom/modules/features/editorconfig/init.lua @@ -5,7 +5,7 @@ editorconfig.settings = {} editorconfig.packages = { ["editorconfig-vim"] = { "editorconfig/editorconfig-vim", - commit = "a8e3e66deefb6122f476c27cee505aaae93f7109", + commit = "d354117b72b3b43b75a29b8e816c0f91af10efe9", }, } diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index 10242514f..06fbc85d7 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -94,7 +94,7 @@ explorer.settings = { explorer.packages = { ["nvim-tree.lua"] = { "kyazdani42/nvim-tree.lua", - commit = "bdb6d4a25410da35bbf7ce0dbdaa8d60432bc243", + commit = "7fcb48c852b9d58709169a4dc1ec634fa9ea56f9", cmd = { "NvimTreeClipboard", "NvimTreeClose", diff --git a/lua/doom/modules/features/firenvim/init.lua b/lua/doom/modules/features/firenvim/init.lua index 6bf9ad2db..d2552e3d5 100644 --- a/lua/doom/modules/features/firenvim/init.lua +++ b/lua/doom/modules/features/firenvim/init.lua @@ -25,7 +25,7 @@ firenvim.settings = { firenvim.packages = { ["firenvim"] = { "glacambre/firenvim", - commit = "e90f87872b313df15a06119ddbb84cdf1599657c", + commit = "f679455c294c62eddee86959cfc9f1b1f79fe97d", run = function() vim.fn["firenvim#install"](0) end, diff --git a/lua/doom/modules/features/gitsigns/init.lua b/lua/doom/modules/features/gitsigns/init.lua index 197acd821..9cf983798 100644 --- a/lua/doom/modules/features/gitsigns/init.lua +++ b/lua/doom/modules/features/gitsigns/init.lua @@ -75,7 +75,7 @@ gitsigns.settings = { gitsigns.packages = { ["gitsigns.nvim"] = { "lewis6991/gitsigns.nvim", - commit = "c18e016864c92ecf9775abea1baaa161c28082c3", + commit = "8b817e76b6399634f3f49e682d6e409844241858", }, } diff --git a/lua/doom/modules/features/illuminate/init.lua b/lua/doom/modules/features/illuminate/init.lua index 5c1d6f889..40839005a 100644 --- a/lua/doom/modules/features/illuminate/init.lua +++ b/lua/doom/modules/features/illuminate/init.lua @@ -16,7 +16,7 @@ illuminate.settings = { illuminate.packages = { ["vim-illuminate"] = { "RRethy/vim-illuminate", - commit = "c82e6d04f27a41d7fdcad9be0bce5bb59fcb78e5", + commit = "6bfa5dc069bd4aa8513a3640d0b73392094749be", }, } diff --git a/lua/doom/modules/features/indentlines/init.lua b/lua/doom/modules/features/indentlines/init.lua index 1181171e9..40b75287d 100644 --- a/lua/doom/modules/features/indentlines/init.lua +++ b/lua/doom/modules/features/indentlines/init.lua @@ -11,7 +11,7 @@ indentlines.settings = { indentlines.packages = { ["indent-blankline.nvim"] = { "lukas-reineke/indent-blankline.nvim", - commit = "6177a59552e35dfb69e1493fd68194e673dc3ee2", + commit = "c15bbe9f23d88b5c0b4ca45a446e01a0a3913707", event = "ColorScheme", }, } diff --git a/lua/doom/modules/features/lazygit/init.lua b/lua/doom/modules/features/lazygit/init.lua index 788a21029..0776adabf 100644 --- a/lua/doom/modules/features/lazygit/init.lua +++ b/lua/doom/modules/features/lazygit/init.lua @@ -5,7 +5,7 @@ lazygit.settings = {} lazygit.packages = { ["lazygit.nvim"] = { "kdheepak/lazygit.nvim", - commit = "1f9f372b9fc137b8123d12a78c22a26c0fa78f0a", + commit = "9c73fd69a4c1cb3b3fc35b741ac968e331642600", cmd = { "LazyGit", "LazyGitConfig" }, opt = true, }, diff --git a/lua/doom/modules/features/linter/init.lua b/lua/doom/modules/features/linter/init.lua index 57636db95..d362569cf 100644 --- a/lua/doom/modules/features/linter/init.lua +++ b/lua/doom/modules/features/linter/init.lua @@ -7,7 +7,7 @@ linter.settings = { linter.packages = { ["null-ls.nvim"] = { "jose-elias-alvarez/null-ls.nvim", - commit = "dfdd5fab3c53c30f83c78ea351b9a8f65715a5b7", + commit = "47c04991af80b6acdf08a5db057908b52f4d0699", after = "nvim-lspconfig", }, } diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index 41381e965..49761c121 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -95,12 +95,12 @@ local is_module_enabled = require("doom.utils").is_module_enabled lsp.packages = { ["nvim-lspconfig"] = { "neovim/nvim-lspconfig", - commit = "4eac16e87f24ad26738e632446e29766e87141ae", + commit = "60f2993b9661d9844cee3bebdbd1b5860577eb3c", module = "lspconfig", }, ["nvim-cmp"] = { "hrsh7th/nvim-cmp", - commit = "15c7bf7c0dfb7c75eb526c53f9574633c13dc22d", + commit = "706371f1300e7c0acb98b346f80dad2dd9b5f679", after = is_module_enabled("features", "snippets") and "LuaSnip" or nil, }, ["cmp-nvim-lua"] = { @@ -115,12 +115,12 @@ lsp.packages = { }, ["cmp-path"] = { "hrsh7th/cmp-path", - commit = "466b6b8270f7ba89abd59f402c73f63c7331ff6e", + commit = "447c87cdd6e6d6a1d2488b1d43108bfa217f56e1", after = "nvim-cmp", }, ["cmp-buffer"] = { "hrsh7th/cmp-buffer", - commit = "12463cfcd9b14052f9effccbf1d84caa7a2d57f0", + commit = "62fc67a2b0205136bc3e312664624ba2ab4a9323", after = "nvim-cmp", }, ["cmp_luasnip"] = { @@ -131,7 +131,7 @@ lsp.packages = { }, ["lsp_signature.nvim"] = { "ray-x/lsp_signature.nvim", - commit = "9ccee20602a10843e3ea3ebc2536dfdcc6cee9a3", + commit = "aea1e060d465fcb565bc1178e4189fc79524ba61", after = "nvim-lspconfig", }, } diff --git a/lua/doom/modules/features/lsp_progress/init.lua b/lua/doom/modules/features/lsp_progress/init.lua index 3aa872aae..cc59feb7c 100644 --- a/lua/doom/modules/features/lsp_progress/init.lua +++ b/lua/doom/modules/features/lsp_progress/init.lua @@ -5,7 +5,7 @@ fidget.settings = {} fidget.packages = { ["fidget.nvim"] = { "j-hui/fidget.nvim", - commit = "37d536bbbee47222ddfeca0e8186e8ee6884f9a2", + commit = "492492e7d50452a9ace8346d31f6d6da40439f0e", after = "nvim-lspconfig", }, } diff --git a/lua/doom/modules/features/minimap/init.lua b/lua/doom/modules/features/minimap/init.lua index 8c9b86e6d..6f3d3841f 100644 --- a/lua/doom/modules/features/minimap/init.lua +++ b/lua/doom/modules/features/minimap/init.lua @@ -5,7 +5,7 @@ minimap.settings = {} minimap.packages = { ["minimap.vim"] = { "wfxr/minimap.vim", - commit = "5d44fe7a3a5f7041c4220a71e8fe83d8c8498042", + commit = "3801d9dfaa5431e7b83ae6f98423ac077d9f5c3f", opt = true, cmd = { "Minimap", diff --git a/lua/doom/modules/features/neogit/init.lua b/lua/doom/modules/features/neogit/init.lua index 4afe80aca..9da58a3ae 100644 --- a/lua/doom/modules/features/neogit/init.lua +++ b/lua/doom/modules/features/neogit/init.lua @@ -5,7 +5,7 @@ neogit.settings = {} neogit.packages = { ["neogit"] = { "TimUntersberger/neogit", - commit = "0ce803d22e361080ec0daf6bee7aad45e8cf8b07", + commit = "06e986fab0d0c31ba981b9f21c712dc72b3d237f", cmd = "Neogit", opt = true, }, diff --git a/lua/doom/modules/features/projects/init.lua b/lua/doom/modules/features/projects/init.lua index a7e833b12..e18dc0dae 100644 --- a/lua/doom/modules/features/projects/init.lua +++ b/lua/doom/modules/features/projects/init.lua @@ -38,7 +38,7 @@ projects.settings = { projects.packages = { ["project.nvim"] = { "ahmedkhalf/project.nvim", - commit = "541115e762764bc44d7d3bf501b6e367842d3d4f", + commit = "e449497c0bceb6e50947b840ec3658bf1108bf0b", requires = { "nvim-treesitter/nvim-treesitter" }, }, } diff --git a/lua/doom/modules/features/snippets/init.lua b/lua/doom/modules/features/snippets/init.lua index c186b5748..03bbacaef 100644 --- a/lua/doom/modules/features/snippets/init.lua +++ b/lua/doom/modules/features/snippets/init.lua @@ -8,7 +8,7 @@ snippets.settings = { snippets.packages = { ["LuaSnip"] = { "L3MON4D3/LuaSnip", - commit = "52f4aed58db32a3a03211d31d2b12c0495c45580", + commit = "53e812a6f51c9d567c98215733100f0169bcc20a", requires = { "rafamadriz/friendly-snippets", opt = true }, }, } diff --git a/lua/doom/modules/features/statusline/init.lua b/lua/doom/modules/features/statusline/init.lua index 833d1a98c..5807f8cb9 100644 --- a/lua/doom/modules/features/statusline/init.lua +++ b/lua/doom/modules/features/statusline/init.lua @@ -133,7 +133,7 @@ end statusline.packages = { ["heirline.nvim"] = { "rebelot/heirline.nvim", - commit = "efbf99c48d03f456b19680a46f0e21acd6df5188", + commit = "805a158b2b44b015f7966b03cd9def489984be8f", }, } diff --git a/lua/doom/modules/features/telescope/init.lua b/lua/doom/modules/features/telescope/init.lua index 1c3c0e84c..b62b928dc 100644 --- a/lua/doom/modules/features/telescope/init.lua +++ b/lua/doom/modules/features/telescope/init.lua @@ -49,7 +49,7 @@ telescope.settings = { telescope.packages = { ["telescope.nvim"] = { "nvim-telescope/telescope.nvim", - commit = "e6b69b1488c598ff7b461c4d9cecad57ef708f9b", + commit = "b5833a682c511885887373aad76272ad70f7b3c2", cmd = "Telescope", opt = true, }, diff --git a/lua/doom/modules/features/terminal/init.lua b/lua/doom/modules/features/terminal/init.lua index f36597a28..32a738323 100644 --- a/lua/doom/modules/features/terminal/init.lua +++ b/lua/doom/modules/features/terminal/init.lua @@ -25,7 +25,7 @@ terminal.settings = { terminal.packages = { ["toggleterm.nvim"] = { "akinsho/toggleterm.nvim", - commit = "50f88d316261bfe56854cb75b9d092061c38b21e", + commit = "a7c9a6fd135f96639e2ac686691a32db6d011471", cmd = { "ToggleTerm", "TermExec" }, opt = true, }, diff --git a/lua/doom/modules/langs/config/init.lua b/lua/doom/modules/langs/config/init.lua index db7cf817c..dece84a00 100644 --- a/lua/doom/modules/langs/config/init.lua +++ b/lua/doom/modules/langs/config/init.lua @@ -17,7 +17,7 @@ config.settings = { config.packages = { ["SchemaStore.nvim"] = { "b0o/SchemaStore.nvim", - commit = "442b79a05eea082f22273e59dd3da365e7077aa2", + commit = "65e845c491db027f93648dbf6241bc73e68a44d0", ft = { "json", "yaml", "toml" }, }, } diff --git a/modules.lua b/modules.lua index 345eaee47..a4a09b474 100644 --- a/modules.lua +++ b/modules.lua @@ -15,7 +15,7 @@ return { "comment", -- Adds keybinds to comment in any language "linter", -- Linting and formatting for languages "lsp", -- Code completion - "snippets", -- Code snippets for all languages + -- "snippets", -- Code snippets for all languages -- Editor "auto_session", -- Remember sessions between loads @@ -58,7 +58,7 @@ return { langs = { -- Scripts "lua", - -- "python", + "python", -- "bash", -- "fish", From 05acab03022ddd0c1d7626c671bb8df05c2f39b3 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 30 Jul 2022 12:17:56 +1000 Subject: [PATCH 57/73] fix(lsp): Fixed some lsps not working when `snippets` module disabled. --- lua/doom/modules/features/lsp/init.lua | 23 ++++++++++++++------- lua/doom/modules/features/snippets/init.lua | 10 ++++----- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index 49761c121..66eca9150 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -98,10 +98,14 @@ lsp.packages = { commit = "60f2993b9661d9844cee3bebdbd1b5860577eb3c", module = "lspconfig", }, + ["LuaSnip"] = { + "L3MON4D3/LuaSnip", + commit = "53e812a6f51c9d567c98215733100f0169bcc20a", + module = "luasnip", + }, ["nvim-cmp"] = { "hrsh7th/nvim-cmp", commit = "706371f1300e7c0acb98b346f80dad2dd9b5f679", - after = is_module_enabled("features", "snippets") and "LuaSnip" or nil, }, ["cmp-nvim-lua"] = { "hrsh7th/cmp-nvim-lua", @@ -127,7 +131,6 @@ lsp.packages = { "saadparwaiz1/cmp_luasnip", commit = "a9de941bcbda508d0a45d28ae366bb3f08db2e36", after = "nvim-cmp", - disabled = not is_module_enabled("features", "snippets"), }, ["lsp_signature.nvim"] = { "ray-x/lsp_signature.nvim", @@ -193,10 +196,13 @@ lsp.configs["nvim-lspconfig"] = function() end lsp.configs["nvim-cmp"] = function() local utils = require("doom.utils") - local snippets_enabled = utils.is_module_enabled("features", "snippets") - local cmp = require("cmp") - local luasnip = snippets_enabled and require("luasnip") + local cmp_ok, cmp = pcall(require, "cmp") + local luasnip_ok, luasnip = pcall(require, "luasnip") + if not cmp_ok or not luasnip_ok then + return + end + local replace_termcodes = utils.replace_termcodes local source_map = { @@ -257,7 +263,7 @@ lsp.configs["nvim-cmp"] = function() [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() - elseif snippets_enabled and luasnip.expand_or_jumpable() then + elseif luasnip.expand_or_jumpable() then vim.fn.feedkeys(replace_termcodes("luasnip-expand-or-jump"), "") elseif check_backspace() then vim.fn.feedkeys(replace_termcodes(""), "n") @@ -271,7 +277,7 @@ lsp.configs["nvim-cmp"] = function() [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() - elseif snippets_enabled and luasnip.jumpable(-1) then + elseif luasnip.jumpable(-1) then vim.fn.feedkeys(replace_termcodes("luasnip-jump-prev"), "") else fallback() @@ -389,5 +395,8 @@ lsp.binds = { }, }, } +lsp.configs["LuaSnip"] = function() + require("luasnip").config.set_config(doom.features.snippets.settings) +end return lsp diff --git a/lua/doom/modules/features/snippets/init.lua b/lua/doom/modules/features/snippets/init.lua index 03bbacaef..8b3eaec1f 100644 --- a/lua/doom/modules/features/snippets/init.lua +++ b/lua/doom/modules/features/snippets/init.lua @@ -6,16 +6,14 @@ snippets.settings = { } snippets.packages = { - ["LuaSnip"] = { - "L3MON4D3/LuaSnip", - commit = "53e812a6f51c9d567c98215733100f0169bcc20a", - requires = { "rafamadriz/friendly-snippets", opt = true }, + ["friendly-snippets"] = { + "rafamadriz/friendly-snippets", + after = "LuaSnip" }, } snippets.configs = {} -snippets.configs["LuaSnip"] = function() - require("luasnip").config.set_config(doom.features.snippets.settings) +snippets.configs["friendly-snippets"] = function() require("luasnip.loaders.from_vscode").lazy_load() end From ae3670870b058ab84e634f8bb4629725cc70f44e Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 30 Jul 2022 12:30:02 +1000 Subject: [PATCH 58/73] refact(langs): Renamed `snippets` to `extra_snippets`. --- .../modules/features/extra_snippets/init.lua | 18 +++++++++++++++++ lua/doom/modules/features/lsp/init.lua | 12 +++++------ lua/doom/modules/features/snippets/init.lua | 20 ------------------- modules.lua | 2 +- 4 files changed, 24 insertions(+), 28 deletions(-) create mode 100644 lua/doom/modules/features/extra_snippets/init.lua delete mode 100644 lua/doom/modules/features/snippets/init.lua diff --git a/lua/doom/modules/features/extra_snippets/init.lua b/lua/doom/modules/features/extra_snippets/init.lua new file mode 100644 index 000000000..bedeab77d --- /dev/null +++ b/lua/doom/modules/features/extra_snippets/init.lua @@ -0,0 +1,18 @@ +local extra_snippets = {} + +extra_snippets.settings = { +} + +extra_snippets.packages = { + ["friendly-snippets"] = { + "rafamadriz/friendly-snippets", + after = "LuaSnip" + }, +} + +extra_snippets.configs = {} +extra_snippets.configs["friendly-snippets"] = function() + require("luasnip.loaders.from_vscode").lazy_load() +end + +return extra_snippets diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index 66eca9150..c042d9a83 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -98,14 +98,14 @@ lsp.packages = { commit = "60f2993b9661d9844cee3bebdbd1b5860577eb3c", module = "lspconfig", }, - ["LuaSnip"] = { + ["nvim-cmp"] = { + "hrsh7th/nvim-cmp", + commit = "706371f1300e7c0acb98b346f80dad2dd9b5f679", + requires = { "L3MON4D3/LuaSnip", commit = "53e812a6f51c9d567c98215733100f0169bcc20a", module = "luasnip", }, - ["nvim-cmp"] = { - "hrsh7th/nvim-cmp", - commit = "706371f1300e7c0acb98b346f80dad2dd9b5f679", }, ["cmp-nvim-lua"] = { "hrsh7th/cmp-nvim-lua", @@ -202,6 +202,7 @@ lsp.configs["nvim-cmp"] = function() if not cmp_ok or not luasnip_ok then return end + luasnip.config.set_config(doom.features.lsp.settings.snippets) local replace_termcodes = utils.replace_termcodes @@ -395,8 +396,5 @@ lsp.binds = { }, }, } -lsp.configs["LuaSnip"] = function() - require("luasnip").config.set_config(doom.features.snippets.settings) -end return lsp diff --git a/lua/doom/modules/features/snippets/init.lua b/lua/doom/modules/features/snippets/init.lua deleted file mode 100644 index 8b3eaec1f..000000000 --- a/lua/doom/modules/features/snippets/init.lua +++ /dev/null @@ -1,20 +0,0 @@ -local snippets = {} - -snippets.settings = { - history = true, - updateevents = "TextChanged,TextChangedI", -} - -snippets.packages = { - ["friendly-snippets"] = { - "rafamadriz/friendly-snippets", - after = "LuaSnip" - }, -} - -snippets.configs = {} -snippets.configs["friendly-snippets"] = function() - require("luasnip.loaders.from_vscode").lazy_load() -end - -return snippets diff --git a/modules.lua b/modules.lua index a4a09b474..36c58dcee 100644 --- a/modules.lua +++ b/modules.lua @@ -15,7 +15,7 @@ return { "comment", -- Adds keybinds to comment in any language "linter", -- Linting and formatting for languages "lsp", -- Code completion - -- "snippets", -- Code snippets for all languages + "extra_snippets", -- Code snippets for all languages -- Editor "auto_session", -- Remember sessions between loads From 7bec4b42db8c5eaa7c547d1aae62c1b482da5e65 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Sat, 30 Jul 2022 13:10:08 +1000 Subject: [PATCH 59/73] fix(lsp): Broken snippet options --- lua/doom/modules/features/lsp/init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index c042d9a83..53b1ca4b7 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -5,6 +5,10 @@ local lsp = {} lsp.__completions_enabled = true lsp.settings = { + snippets = { + history = true, + updateevents = "TextChanged,TextChangedI", + }, signature = { bind = true, doc_lines = 10, From 0294e7c09af1787f887dd8065f77b3f85b1f13a8 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Aug 2022 13:38:56 +1000 Subject: [PATCH 60/73] fix(linter): Increased formatting timeout. --- lua/doom/modules/features/linter/init.lua | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lua/doom/modules/features/linter/init.lua b/lua/doom/modules/features/linter/init.lua index d362569cf..1db0deb6c 100644 --- a/lua/doom/modules/features/linter/init.lua +++ b/lua/doom/modules/features/linter/init.lua @@ -2,6 +2,9 @@ local linter = {} linter.settings = { format_on_save = false, + null_ls_settings = { + default_timeout = 2000, + } } linter.packages = { @@ -16,11 +19,11 @@ linter.configs = {} linter.configs["null-ls.nvim"] = function() local null_ls = require("null-ls") - null_ls.setup({ + local null_ls_settings = doom.features.linter.settings.null_ls_settings + null_ls.setup(vim.tbl_deep_extend("force", null_ls_settings, { on_attach = function(client) - if - client.server_capabilities.documentFormattingProvider - and doom.features.linter.settings.format_on_save + if client.server_capabilities.documentFormattingProvider + and doom.features.linter.settings.format_on_save then vim.cmd([[ augroup LspFormatting @@ -30,17 +33,20 @@ linter.configs["null-ls.nvim"] = function() ]]) end end, - }) + })) end linter.binds = { { "cf", function() + local null_ls_settings = doom.features.linter.settings.null_ls_settings if type(vim.lsp.buf.format) == "function" then - vim.lsp.buf.format() + vim.lsp.buf.format({ + timeout_ms = null_ls_settings.default_timeout + }) else - vim.lsp.buf.formatting_sync() + vim.lsp.buf.formatting_sync(nil, null_ls_settings.default_timeout) end end, name = "Format/Fix", From e0a3a1159ffbe482b4aa5b51dd8574a2169dd672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edwin?= Date: Mon, 1 Aug 2022 04:52:57 +0100 Subject: [PATCH 61/73] fix(docker,lsp,core): Dockerfile, lsp warning and preserve_edit_pos (#371) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(.gitignore): contribute got renamed to tools delete packer_compiled.lua: this should not be commited! Signed-off-by: Edwin Török * chore(Dockerfile): add luacheck/stylua * chore(init.lua): fix luacheck warnings Delete dead code Signed-off-by: Edwin Török * chore(contribute): do not move branch in detached HEAD state When rebasing / bisecting / etc. the worktree would be in a detached HEAD state. Do not checkout the branch because this would unexpectedly move the currently checked out commit. Especially important if we want to compare performance one-by-one by rebasing in edit mode. Signed-off-by: Edwin Török * chore: fix contribute/start_docker pacman was stopping and asking a question, needs noconfirm flag. Directories mounted as volumes need to be created on first use. 'make' needs to be installed otherwise nvim-treesitter fails to compile the treesitter parsers and hangs at 'Compiling' (sync_install=true can be used to show actual error). Signed-off-by: Edwin Török * fix(preserve_edit_pos): do not jump to last position in git commit/rebase buffers See ':h last-position-jump' The commit message will likely be different each time, although the filename will be the same (`COMMIT_EDITMSG`). Signed-off-by: Edwin Török * fix(lsp): do not use deprecated vim.lsp.diagnostic APIs Use the vim.diagnostic API instead, see :h deprecated. Otherwise a message is printed on every use that they are deprecated. Signed-off-by: Edwin Török --- .gitignore | 6 +- lua/doom/modules/core/doom/init.lua | 2 +- lua/doom/modules/core/nest/init.lua | 2 - lua/doom/modules/features/lsp/init.lua | 3 +- tools/Dockerfile | 5 +- .../plugin/packer_compiled.lua | 203 ------------------ ...m%.config%nvim%lua%doom%modules%config.vim | 37 ---- .../sessions/%home%doom%.config%nvim.vim | 47 ---- .../%home%doom%workspace%neonz-ar-launch.vim | 52 ----- .../sessions/%home%doom%workspace.vim | 48 ----- tools/start_docker.sh | 5 +- 11 files changed, 13 insertions(+), 397 deletions(-) delete mode 100644 tools/local-share-nvim/plugin/packer_compiled.lua delete mode 100644 tools/local-share-nvim/sessions/%home%doom%.config%nvim%lua%doom%modules%config.vim delete mode 100644 tools/local-share-nvim/sessions/%home%doom%.config%nvim.vim delete mode 100644 tools/local-share-nvim/sessions/%home%doom%workspace%neonz-ar-launch.vim delete mode 100644 tools/local-share-nvim/sessions/%home%doom%workspace.vim diff --git a/.gitignore b/.gitignore index cbdc659da..f7305f88d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,9 +10,9 @@ tags # OS files .DS_Store # Doom Nvim Contrib files -contribute/doom-nvim-contrib -contribute/local-share-nvim -contribute/workspace +tools/doom-nvim-contrib +tools/local-share-nvim +tools/workspace # User modules user/modules/* diff --git a/lua/doom/modules/core/doom/init.lua b/lua/doom/modules/core/doom/init.lua index 5c4c49121..c3291792f 100644 --- a/lua/doom/modules/core/doom/init.lua +++ b/lua/doom/modules/core/doom/init.lua @@ -332,7 +332,7 @@ required.autocmds = function() table.insert(autocmds, { "BufReadPost", "*", - [[if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]], + [[if &ft !~# 'commit\|rebase' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]], }) end return autocmds diff --git a/lua/doom/modules/core/nest/init.lua b/lua/doom/modules/core/nest/init.lua index 03d460964..56757dff1 100644 --- a/lua/doom/modules/core/nest/init.lua +++ b/lua/doom/modules/core/nest/init.lua @@ -108,8 +108,6 @@ mapper.configs["nvim-mapper"] = function() if id ~= nil then local rhs = type(node.rhs) == "function" and "" or node.rhs if node_settings.buffer then - local bufnr = type(node_settings.buffer) == "number" and node_settings.buffer - or vim.api.nvim_get_current_buf() Mapper.map_buf_virtual( sanitizedMode, node.lhs, diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index 53b1ca4b7..d05af94a9 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -95,7 +95,6 @@ lsp.settings = { }, } -local is_module_enabled = require("doom.utils").is_module_enabled lsp.packages = { ["nvim-lspconfig"] = { "neovim/nvim-lspconfig", @@ -377,7 +376,7 @@ lsp.binds = { end, name = "Line", }, - { "l", vim.lsp.diagnostic.set_loclist, name = "Loclist" }, + { "l", vim.diagnostic.setloclist, name = "Loclist" }, }, }, }, diff --git a/tools/Dockerfile b/tools/Dockerfile index abea988a9..4f972c2b2 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -24,8 +24,11 @@ RUN pacman -Sy neovim --noconfirm # Install runtime dependencies of doom-nvim RUN pacman -Sy ripgrep nodejs-lts-fermium npm git bash gcc jq --noconfirm +# Lua +RUN pacman -Sy luacheck stylua --noconfirm + # Required for nvim-lsp-installer -RUN pacman -Sy wget unzip +RUN pacman -Sy wget unzip make --noconfirm # Required for watching Doom-nvim-contrib for changes RUN npm i -g chokidar-cli diff --git a/tools/local-share-nvim/plugin/packer_compiled.lua b/tools/local-share-nvim/plugin/packer_compiled.lua deleted file mode 100644 index 259aac165..000000000 --- a/tools/local-share-nvim/plugin/packer_compiled.lua +++ /dev/null @@ -1,203 +0,0 @@ --- Automatically generated packer.nvim plugin loader code - -if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then - vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') - return -end - -vim.api.nvim_command('packadd packer.nvim') - -local no_errors, error_msg = pcall(function() - - local time - local profile_info - local should_profile = true - if should_profile then - local hrtime = vim.loop.hrtime - profile_info = {} - time = function(chunk, start) - if start then - profile_info[chunk] = hrtime() - else - profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 - end - end - else - time = function(chunk, start) end - end - -local function save_profiles(threshold) - local sorted_times = {} - for chunk_name, time_taken in pairs(profile_info) do - sorted_times[#sorted_times + 1] = {chunk_name, time_taken} - end - table.sort(sorted_times, function(a, b) return a[2] > b[2] end) - local results = {} - for i, elem in ipairs(sorted_times) do - if not threshold or threshold and elem[2] > threshold then - results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' - end - end - - _G._packer = _G._packer or {} - _G._packer.profile_output = results -end - -time([[Luarocks path setup]], true) -local package_path_str = "/home/doom/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?.lua;/home/doom/.cache/nvim/packer_hererocks/2.0.5/share/lua/5.1/?/init.lua;/home/doom/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?.lua;/home/doom/.cache/nvim/packer_hererocks/2.0.5/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/home/doom/.cache/nvim/packer_hererocks/2.0.5/lib/lua/5.1/?.so" -if not string.find(package.path, package_path_str, 1, true) then - package.path = package.path .. ';' .. package_path_str -end - -if not string.find(package.cpath, install_cpath_pattern, 1, true) then - package.cpath = package.cpath .. ';' .. install_cpath_pattern -end - -time([[Luarocks path setup]], false) -time([[try_loadstring definition]], true) -local function try_loadstring(s, component, name) - local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) - if not success then - vim.schedule(function() - vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) - end) - end - return result -end - -time([[try_loadstring definition]], false) -time([[Defining packer_plugins]], true) -_G.packer_plugins = { - aniseed = { - config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, - loaded = false, - needs_bufread = true, - only_cond = false, - path = "/home/doom/.local/share/nvim/site/pack/packer/opt/aniseed", - url = "https://github.com/Olical/aniseed" - }, - ["nest.nvim"] = { - config = { "\27LJ\1\2\1\0\0\6\0\v\0\0284\0\0\0%\1\1\0>\0\2\0027\1\2\0004\2\0\0%\3\3\0>\2\2\0027\3\4\0024\4\0\0%\5\5\0>\4\2\0=\3\0\1\16\3\1\0%\4\6\0>\3\2\2\14\0\3\0T\3\64\3\0\0%\4\a\0>\3\2\0027\4\4\2\16\5\3\0>\4\2\0017\3\b\0024\4\t\0007\4\n\4>\3\2\1G\0\1\0\nbinds\tdoom\17applyKeymaps\31nest.integrations.whichkey\rwhichkey\29nest.integrations.mapper\venable\tnest\23is_plugin_disabled\15doom.utils\frequire\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, - load_after = {}, - loaded = true, - needs_bufread = false, - path = "/home/doom/.local/share/nvim/site/pack/packer/opt/nest.nvim", - url = "https://github.com/LuigiPiucco/nest.nvim" - }, - ["nvim-mapper"] = { - after = { "nest.nvim" }, - loaded = true, - only_config = true - }, - ["nvim-tree-docs"] = { - config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, - load_after = {}, - loaded = false, - needs_bufread = false, - path = "/home/doom/.local/share/nvim/site/pack/packer/opt/nvim-tree-docs", - url = "https://github.com/nvim-treesitter/nvim-tree-docs" - }, - ["nvim-treesitter"] = { - after = { "nvim-ts-autotag", "nvim-ts-context-commentstring", "nvim-tree-docs" }, - loaded = true, - only_config = true - }, - ["nvim-ts-autotag"] = { - config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, - load_after = {}, - loaded = false, - needs_bufread = false, - path = "/home/doom/.local/share/nvim/site/pack/packer/opt/nvim-ts-autotag", - url = "https://github.com/windwp/nvim-ts-autotag" - }, - ["nvim-ts-context-commentstring"] = { - config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, - load_after = {}, - loaded = false, - needs_bufread = false, - path = "/home/doom/.local/share/nvim/site/pack/packer/opt/nvim-ts-context-commentstring", - url = "https://github.com/JoosepAlviste/nvim-ts-context-commentstring" - }, - ["packer.nvim"] = { - config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, - loaded = false, - needs_bufread = false, - path = "/home/doom/.local/share/nvim/site/pack/packer/opt/packer.nvim", - url = "https://github.com/wbthomason/packer.nvim" - }, - ["plenary.nvim"] = { - config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, - loaded = false, - needs_bufread = false, - only_cond = false, - path = "/home/doom/.local/share/nvim/site/pack/packer/opt/plenary.nvim", - url = "https://github.com/nvim-lua/plenary.nvim" - }, - ["popup.nvim"] = { - config = { "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0" }, - loaded = false, - needs_bufread = false, - only_cond = false, - path = "/home/doom/.local/share/nvim/site/pack/packer/opt/popup.nvim", - url = "https://github.com/nvim-lua/popup.nvim" - } -} - -time([[Defining packer_plugins]], false) -local module_lazy_loads = { - ["^plenary"] = "plenary.nvim", - ["^popup"] = "popup.nvim", - aniseed = "aniseed" -} -local lazy_load_called = {['packer.load'] = true} -local function lazy_load_module(module_name) - local to_load = {} - if lazy_load_called[module_name] then return nil end - lazy_load_called[module_name] = true - for module_pat, plugin_name in pairs(module_lazy_loads) do - if not _G.packer_plugins[plugin_name].loaded and string.match(module_name, module_pat) then - to_load[#to_load + 1] = plugin_name - end - end - - if #to_load > 0 then - require('packer.load')(to_load, {module = module_name}, _G.packer_plugins) - local loaded_mod = package.loaded[module_name] - if loaded_mod then - return function(modname) return loaded_mod end - end - end -end - -if not vim.g.packer_custom_loader_enabled then - table.insert(package.loaders, 1, lazy_load_module) - vim.g.packer_custom_loader_enabled = true -end - --- Config for: nvim-mapper -time([[Config for nvim-mapper]], true) -try_loadstring("\27LJ\1\2V\0\0\2\0\6\0\t4\0\0\0%\1\1\0>\0\2\0027\0\2\0004\1\3\0007\1\4\0017\1\5\1>\0\2\1G\0\1\0\vmapper\tcore\tdoom\nsetup\16nvim-mapper\frequire\0", "config", "nvim-mapper") -try_loadstring("\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "config", "nvim-mapper") -time([[Config for nvim-mapper]], false) --- Config for: nvim-treesitter -time([[Config for nvim-treesitter]], true) -try_loadstring("\27LJ\1\2\3\0\0\a\0\17\0%4\0\0\0%\1\1\0>\0\2\0024\1\0\0%\2\2\0>\1\2\0027\2\3\0013\3\b\0004\4\4\0007\4\5\0047\4\6\4%\5\a\0>\4\2\2;\4\1\3>\2\2\0024\3\4\0007\3\5\0037\3\t\3\16\4\2\0\a\2\n\0T\5\2%\5\v\0T\6\1%\5\f\0$\4\5\4>\3\2\0028\3\1\3\16\5\3\0007\4\r\3%\6\14\0>\4\3\2\15\0\4\0T\5\37\4\15\0%\5\16\0>\4\2\1G\0\1\0\1doom-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)\twarn\nclang\nmatch\15 --version\5\acl\15systemlist\1\a\0\0\0\acc\bgcc\nclang\acl\bzig\aCC\vgetenv\afn\bvim\28find_executable_in_path\15doom.utils\23doom.utils.logging\frequire\2\1\0\t\0\17\0\0304\0\0\0%\1\1\0>\0\2\0027\0\2\0004\1\0\0%\2\3\0>\1\2\0027\1\4\0014\2\5\0007\2\6\2%\3\a\0004\4\b\0007\4\t\0047\4\n\0043\5\14\0003\6\f\0\16\a\0\0%\b\v\0>\a\2\2\17\a\a\0:\a\r\6:\6\v\5>\2\4\0=\1\0\0014\1\5\0007\1\15\0011\2\16\0'\3\3>\1\3\1G\0\1\0\0\rdefer_fn\1\0\0\venable\1\0\0\14autopairs\15treesitter\tcore\tdoom\nforce\20tbl_deep_extend\bvim\nsetup\28nvim-treesitter.configs\23is_plugin_disabled\15doom.utils\frequire\0", "config", "nvim-treesitter") -try_loadstring("\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "config", "nvim-treesitter") -time([[Config for nvim-treesitter]], false) --- Load plugins in order defined by `after` -time([[Sequenced loading]], true) -vim.cmd [[ packadd nest.nvim ]] - --- Config for: nest.nvim -try_loadstring("\27LJ\1\2\1\0\0\6\0\v\0\0284\0\0\0%\1\1\0>\0\2\0027\1\2\0004\2\0\0%\3\3\0>\2\2\0027\3\4\0024\4\0\0%\5\5\0>\4\2\0=\3\0\1\16\3\1\0%\4\6\0>\3\2\2\14\0\3\0T\3\64\3\0\0%\4\a\0>\3\2\0027\4\4\2\16\5\3\0>\4\2\0017\3\b\0024\4\t\0007\4\n\4>\3\2\1G\0\1\0\nbinds\tdoom\17applyKeymaps\31nest.integrations.whichkey\rwhichkey\29nest.integrations.mapper\venable\tnest\23is_plugin_disabled\15doom.utils\frequire\0", "config", "nest.nvim") -try_loadstring("\27LJ\1\2\v\0\0\1\0\0\0\1G\0\1\0\0", "config", "nest.nvim") - -time([[Sequenced loading]], false) -if should_profile then save_profiles() end - -end) - -if not no_errors then - vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') -end diff --git a/tools/local-share-nvim/sessions/%home%doom%.config%nvim%lua%doom%modules%config.vim b/tools/local-share-nvim/sessions/%home%doom%.config%nvim%lua%doom%modules%config.vim deleted file mode 100644 index c49b7c230..000000000 --- a/tools/local-share-nvim/sessions/%home%doom%.config%nvim%lua%doom%modules%config.vim +++ /dev/null @@ -1,37 +0,0 @@ -let SessionLoad = 1 -let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 -let v:this_session=expand(":p") -silent only -silent tabonly -cd ~/.config/nvim/lua/doom/modules/config -if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' - let s:wipebuf = bufnr('%') -endif -set shortmess=aoO -badd +0 doom-whichkey.lua -argglobal -%argdel -$argadd doom-whichkey.lua -edit doom-whichkey.lua -argglobal -let s:l = 17 - ((16 * winheight(0) + 11) / 23) -if s:l < 1 | let s:l = 1 | endif -keepjumps exe s:l -normal! zt -keepjumps 17 -normal! 019| -tabnext 1 -if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0&& getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' - silent exe 'bwipe ' . s:wipebuf -endif -unlet! s:wipebuf -set winheight=1 winwidth=20 shortmess=ifncaTFstOolxI -let s:sx = expand(":p:r")."x.vim" -if filereadable(s:sx) - exe "source " . fnameescape(s:sx) -endif -let &g:so = s:so_save | let &g:siso = s:siso_save -set hlsearch -doautoall SessionLoadPost -unlet SessionLoad -" vim: set ft=vim : diff --git a/tools/local-share-nvim/sessions/%home%doom%.config%nvim.vim b/tools/local-share-nvim/sessions/%home%doom%.config%nvim.vim deleted file mode 100644 index d5ec156fa..000000000 --- a/tools/local-share-nvim/sessions/%home%doom%.config%nvim.vim +++ /dev/null @@ -1,47 +0,0 @@ -let SessionLoad = 1 -let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 -let v:this_session=expand(":p") -silent only -silent tabonly -cd ~/.config/nvim -if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' - let s:wipebuf = bufnr('%') -endif -set shortmess=aoO -badd +1 doom_modules.lua -argglobal -%argdel -$argadd doom_modules.lua -edit doom_modules.lua -argglobal -setlocal fdm=manual -setlocal fde=0 -setlocal fmr={{{,}}} -setlocal fdi=# -setlocal fdl=0 -setlocal fml=1 -setlocal fdn=20 -setlocal fen -silent! normal! zE -let &fdl = &fdl -let s:l = 1 - ((0 * winheight(0) + 19) / 39) -if s:l < 1 | let s:l = 1 | endif -keepjumps exe s:l -normal! zt -keepjumps 1 -normal! 0 -tabnext 1 -if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0&& getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' - silent exe 'bwipe ' . s:wipebuf -endif -unlet! s:wipebuf -set winheight=1 winwidth=20 shortmess=ifncaTFstOolxI -let s:sx = expand(":p:r")."x.vim" -if filereadable(s:sx) - exe "source " . fnameescape(s:sx) -endif -let &g:so = s:so_save | let &g:siso = s:siso_save -set hlsearch -doautoall SessionLoadPost -unlet SessionLoad -" vim: set ft=vim : diff --git a/tools/local-share-nvim/sessions/%home%doom%workspace%neonz-ar-launch.vim b/tools/local-share-nvim/sessions/%home%doom%workspace%neonz-ar-launch.vim deleted file mode 100644 index b01d96cd7..000000000 --- a/tools/local-share-nvim/sessions/%home%doom%workspace%neonz-ar-launch.vim +++ /dev/null @@ -1,52 +0,0 @@ -let SessionLoad = 1 -let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 -let v:this_session=expand(":p") -silent only -silent tabonly -cd ~/workspace/neonz-ar-launch -if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' - let s:wipebuf = bufnr('%') -endif -set shortmess=aoO -badd +5 src/App.vue -badd +5 src/views/Home.vue -badd +23 ~/workspace/neonz-ar-launch/src/components/NeonzLauncher.vue -badd +44 ~/workspace/neonz-ar-launch/src/stores/WalletStore.ts -argglobal -%argdel -$argadd src/App.vue -edit ~/workspace/neonz-ar-launch/src/components/NeonzLauncher.vue -argglobal -balt ~/workspace/neonz-ar-launch/src/stores/WalletStore.ts -setlocal fdm=manual -setlocal fde=0 -setlocal fmr={{{,}}} -setlocal fdi=# -setlocal fdl=0 -setlocal fml=1 -setlocal fdn=20 -setlocal fen -silent! normal! zE -let &fdl = &fdl -let s:l = 23 - ((22 * winheight(0) + 27) / 54) -if s:l < 1 | let s:l = 1 | endif -keepjumps exe s:l -normal! zt -keepjumps 23 -normal! 021| -tabnext 1 -if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0&& getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' - silent exe 'bwipe ' . s:wipebuf -endif -unlet! s:wipebuf -set winheight=1 winwidth=20 shortmess=ifncaTFstOolxI -let s:sx = expand(":p:r")."x.vim" -if filereadable(s:sx) - exe "source " . fnameescape(s:sx) -endif -let &g:so = s:so_save | let &g:siso = s:siso_save -set hlsearch -nohlsearch -doautoall SessionLoadPost -unlet SessionLoad -" vim: set ft=vim : diff --git a/tools/local-share-nvim/sessions/%home%doom%workspace.vim b/tools/local-share-nvim/sessions/%home%doom%workspace.vim deleted file mode 100644 index 1394b43b8..000000000 --- a/tools/local-share-nvim/sessions/%home%doom%workspace.vim +++ /dev/null @@ -1,48 +0,0 @@ -let SessionLoad = 1 -let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1 -let v:this_session=expand(":p") -silent only -silent tabonly -cd ~/workspace -if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == '' - let s:wipebuf = bufnr('%') -endif -set shortmess=aoO -badd +1 file.js -argglobal -%argdel -$argadd file.js -edit file.js -argglobal -setlocal fdm=manual -setlocal fde=0 -setlocal fmr={{{,}}} -setlocal fdi=# -setlocal fdl=0 -setlocal fml=1 -setlocal fdn=20 -setlocal fen -silent! normal! zE -let &fdl = &fdl -let s:l = 1 - ((0 * winheight(0) + 11) / 23) -if s:l < 1 | let s:l = 1 | endif -keepjumps exe s:l -normal! zt -keepjumps 1 -normal! 0 -tabnext 1 -if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0&& getbufvar(s:wipebuf, '&buftype') isnot# 'terminal' - silent exe 'bwipe ' . s:wipebuf -endif -unlet! s:wipebuf -set winheight=1 winwidth=20 shortmess=ifncaTFstOolxI -let s:sx = expand(":p:r")."x.vim" -if filereadable(s:sx) - exe "source " . fnameescape(s:sx) -endif -let &g:so = s:so_save | let &g:siso = s:siso_save -set hlsearch -nohlsearch -doautoall SessionLoadPost -unlet SessionLoad -" vim: set ft=vim : diff --git a/tools/start_docker.sh b/tools/start_docker.sh index 4aaeb5a67..72e9575db 100755 --- a/tools/start_docker.sh +++ b/tools/start_docker.sh @@ -58,7 +58,9 @@ 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 symbolic-ref -q HEAD; then + echo "In detached HEAD state, not moving branch" +elif 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" @@ -98,6 +100,7 @@ fi # Create docker container if haven't already echo " - Success! Running docker container doom-nvim-contrib-container..." +mkdir -p "${SCRIPT_DIR}/local-share-nvim" "${SCRIPT_DIR}/workspace" echo "" docker run \ -it \ From 8506cbcdaa3a074e192de03a865c42cd5be88ade Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 03:53:12 +0000 Subject: [PATCH 62/73] chore: format source code --- init.lua | 2 +- lua/doom/core/doom_global.lua | 10 +- lua/doom/core/functions.lua | 5 +- lua/doom/modules/core/reloader/init.lua | 6 +- lua/doom/modules/core/updater/init.lua | 130 ++++++++---------- .../modules/features/extra_snippets/init.lua | 5 +- lua/doom/modules/features/linter/init.lua | 9 +- lua/doom/modules/features/lsp/init.lua | 15 +- lua/doom/modules/features/repl/init.lua | 5 +- lua/doom/modules/features/statusline/init.lua | 7 +- lua/doom/modules/langs/vue/init.lua | 24 +--- lua/doom/utils/init.lua | 14 +- lua/doom/utils/logging.lua | 9 +- modules.lua | 50 +++---- 14 files changed, 126 insertions(+), 165 deletions(-) diff --git a/init.lua b/init.lua index e4034a849..6c939ac9b 100644 --- a/init.lua +++ b/init.lua @@ -8,7 +8,7 @@ if vim.fn.has("nvim-0.6.0") ~= 1 then end -- Makes sure ~/.local/share/nvim exists, to prevent problems with logging -vim.fn.mkdir(vim.fn.stdpath("data"), 'p') +vim.fn.mkdir(vim.fn.stdpath("data"), "p") -- Add ~/.local/share to runtimepath early, such that -- neovim autoloads plugin/packer_compiled.lua along with vimscript, diff --git a/lua/doom/core/doom_global.lua b/lua/doom/core/doom_global.lua index e0564df58..7e0cd3839 100644 --- a/lua/doom/core/doom_global.lua +++ b/lua/doom/core/doom_global.lua @@ -166,11 +166,11 @@ doom = { -- @default = false use_floating_win_packer = false, - -- Set max cols - -- Defines the column to show a vertical marker - -- Set to false to disable - -- @default = 80 - max_columns = 80, + -- Set max cols + -- Defines the column to show a vertical marker + -- Set to false to disable + -- @default = 80 + max_columns = 80, -- Default indent size -- @default = 4 diff --git a/lua/doom/core/functions.lua b/lua/doom/core/functions.lua index fd97b1a42..04cc0755c 100644 --- a/lua/doom/core/functions.lua +++ b/lua/doom/core/functions.lua @@ -178,9 +178,8 @@ end -- Set the indent and tab related numbers. -- Negative numbers mean tabstop -- Really though? Tabs? functions.set_indent = function() - local indent = tonumber( - vim.fn.input("Set indent (>0 uses spaces, <0 uses tabs, 0 uses vim defaults): ") - ) + local indent = + tonumber(vim.fn.input("Set indent (>0 uses spaces, <0 uses tabs, 0 uses vim defaults): ")) if not indent then indent = -8 end diff --git a/lua/doom/modules/core/reloader/init.lua b/lua/doom/modules/core/reloader/init.lua index 5d51a07fc..66ee4a310 100644 --- a/lua/doom/modules/core/reloader/init.lua +++ b/lua/doom/modules/core/reloader/init.lua @@ -122,7 +122,7 @@ reloader._reload_doom = function() return t[1] end, doom.packages) local needs_install = vim.deep_equal(modules, old_modules) - and vim.deep_equal(packages, old_packages) + and vim.deep_equal(packages, old_packages) if needs_install then if not _G._doom_reloader._has_shown_packer_compile_message then log.warn( @@ -151,8 +151,8 @@ reloader.reload = function() log.info( "Reloaded Doom in " - .. vim.fn.printf("%.3f", vim.fn.reltimefloat(vim.fn.reltime(reload_time))) - .. " seconds" + .. vim.fn.printf("%.3f", vim.fn.reltimefloat(vim.fn.reltime(reload_time))) + .. " seconds" ) end diff --git a/lua/doom/modules/core/updater/init.lua b/lua/doom/modules/core/updater/init.lua index fb5bb0b91..1965c360c 100644 --- a/lua/doom/modules/core/updater/init.lua +++ b/lua/doom/modules/core/updater/init.lua @@ -39,19 +39,17 @@ updater._cwd = vim.fn.stdpath("config") ---@param callback function Handler to receive the list of versions updater._pull_tags = function(callback) local Job = require("plenary.job") - Job - :new({ - command = "git", - args = { "fetch", "--tags", "--all" }, - cwd = updater._cwd, - on_exit = function(j, exit_code) - if exit_code ~= 0 then - callback(nil, "Error pulling tags... \n\n " .. vim.inspect(j.result())) - end - callback(j:result()) - end, - }) - :start() + Job:new({ + command = "git", + args = { "fetch", "--tags", "--all" }, + cwd = updater._cwd, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error pulling tags... \n\n " .. vim.inspect(j.result())) + end + callback(j:result()) + end, + }):start() end --- Gets the current commit sha or error @@ -59,24 +57,22 @@ end updater._get_commit_sha = function(callback) local Job = require("plenary.job") - Job - :new({ - command = "git", - args = { "rev-parse", "HEAD" }, - on_exit = function(j, exit_code) - if exit_code ~= 0 then - callback(nil, "Error getting current commit... \n\n" .. vim.inspect(j:result())) - return - end - local result = j:result() - if #result == 1 then - callback(result[1]) - else - callback(nil, "Error getting current commit... No output.") - end - end, - }) - :start() + Job:new({ + command = "git", + args = { "rev-parse", "HEAD" }, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error getting current commit... \n\n" .. vim.inspect(j:result())) + return + end + local result = j:result() + if #result == 1 then + callback(result[1]) + else + callback(nil, "Error getting current commit... No output.") + end + end, + }):start() end --- Given a version string, checks if it's an alpha/beta version @@ -116,25 +112,23 @@ end ---@param callback function(version_tag, error_string) updater._get_last_version_for_commit = function(commit_sha, callback) local Job = require("plenary.job") - Job - :new({ - command = "git", - args = { "tag", "-l", "--sort", "-version:refname", "--merged", commit_sha }, - cwd = updater._cwd, - on_exit = function(j, exit_code) - if exit_code ~= 0 then - callback(nil, "Error getting current version... \n\n " .. vim.inspect(j:result())) - return - end - local result = j:result() - if #result > 0 then - callback(result[1]) - else - callback(nil, "Error getting current version... No output.") - end - end, - }) - :start() + Job:new({ + command = "git", + args = { "tag", "-l", "--sort", "-version:refname", "--merged", commit_sha }, + cwd = updater._cwd, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error getting current version... \n\n " .. vim.inspect(j:result())) + return + end + local result = j:result() + if #result > 0 then + callback(result[1]) + else + callback(nil, "Error getting current version... No output.") + end + end, + }):start() end --- Gets the current version and the latest upstream version @@ -255,25 +249,23 @@ end ---@param callback function(branch_name, error) updater._get_branch_name = function(callback) local Job = require("plenary.job") - Job - :new({ - command = "git", - args = { "symbolic-ref", "--short", "-q", "HEAD" }, - cwd = updater._cwd, - on_exit = function(j, exit_code) - if exit_code ~= 0 then - callback(nil, "Error getting branch name... \n\n " .. vim.inspect(j:result())) - return - end - local result = j:result() - if #result > 0 then - callback(result[1]) - else - callback(nil, "Error getting branch name... No output.") - end - end, - }) - :start() + Job:new({ + command = "git", + args = { "symbolic-ref", "--short", "-q", "HEAD" }, + cwd = updater._cwd, + on_exit = function(j, exit_code) + if exit_code ~= 0 then + callback(nil, "Error getting branch name... \n\n " .. vim.inspect(j:result())) + return + end + local result = j:result() + if #result > 0 then + callback(result[1]) + else + callback(nil, "Error getting branch name... No output.") + end + end, + }):start() end --- Entry point for `:DoomUpdate`, fetches new tags, compares with current version and attempts to merge new tags into current branch diff --git a/lua/doom/modules/features/extra_snippets/init.lua b/lua/doom/modules/features/extra_snippets/init.lua index bedeab77d..5ba6bac6a 100644 --- a/lua/doom/modules/features/extra_snippets/init.lua +++ b/lua/doom/modules/features/extra_snippets/init.lua @@ -1,12 +1,11 @@ local extra_snippets = {} -extra_snippets.settings = { -} +extra_snippets.settings = {} extra_snippets.packages = { ["friendly-snippets"] = { "rafamadriz/friendly-snippets", - after = "LuaSnip" + after = "LuaSnip", }, } diff --git a/lua/doom/modules/features/linter/init.lua b/lua/doom/modules/features/linter/init.lua index 1db0deb6c..306388933 100644 --- a/lua/doom/modules/features/linter/init.lua +++ b/lua/doom/modules/features/linter/init.lua @@ -4,7 +4,7 @@ linter.settings = { format_on_save = false, null_ls_settings = { default_timeout = 2000, - } + }, } linter.packages = { @@ -22,8 +22,9 @@ linter.configs["null-ls.nvim"] = function() local null_ls_settings = doom.features.linter.settings.null_ls_settings null_ls.setup(vim.tbl_deep_extend("force", null_ls_settings, { on_attach = function(client) - if client.server_capabilities.documentFormattingProvider - and doom.features.linter.settings.format_on_save + if + client.server_capabilities.documentFormattingProvider + and doom.features.linter.settings.format_on_save then vim.cmd([[ augroup LspFormatting @@ -43,7 +44,7 @@ linter.binds = { local null_ls_settings = doom.features.linter.settings.null_ls_settings if type(vim.lsp.buf.format) == "function" then vim.lsp.buf.format({ - timeout_ms = null_ls_settings.default_timeout + timeout_ms = null_ls_settings.default_timeout, }) else vim.lsp.buf.formatting_sync(nil, null_ls_settings.default_timeout) diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index d05af94a9..86ca9be51 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -105,10 +105,10 @@ lsp.packages = { "hrsh7th/nvim-cmp", commit = "706371f1300e7c0acb98b346f80dad2dd9b5f679", requires = { - "L3MON4D3/LuaSnip", - commit = "53e812a6f51c9d567c98215733100f0169bcc20a", - module = "luasnip", - }, + "L3MON4D3/LuaSnip", + commit = "53e812a6f51c9d567c98215733100f0169bcc20a", + module = "luasnip", + }, }, ["cmp-nvim-lua"] = { "hrsh7th/cmp-nvim-lua", @@ -242,11 +242,8 @@ lsp.configs["nvim-cmp"] = function() }, formatting = { format = function(entry, item) - item.kind = string.format( - "%s %s", - doom.features.lsp.settings.completion.kinds[item.kind], - item.kind - ) + item.kind = + string.format("%s %s", doom.features.lsp.settings.completion.kinds[item.kind], item.kind) item.menu = source_map[entry.source.name] item.dup = vim.tbl_contains({ "path", "buffer" }, entry.source.name) return item diff --git a/lua/doom/modules/features/repl/init.lua b/lua/doom/modules/features/repl/init.lua index f1825e9f4..9f1054930 100644 --- a/lua/doom/modules/features/repl/init.lua +++ b/lua/doom/modules/features/repl/init.lua @@ -50,9 +50,8 @@ repl.configs = { local iron = require("iron.core") local settings = vim.tbl_deep_extend("force", {}, doom.features.repl.settings) - settings.config.repl_open_command = require("iron.view").curry[settings.config.position]( - settings.config.size - ) + settings.config.repl_open_command = + require("iron.view").curry[settings.config.position](settings.config.size) iron.setup(settings) end, diff --git a/lua/doom/modules/features/statusline/init.lua b/lua/doom/modules/features/statusline/init.lua index 5807f8cb9..2f06ded6c 100644 --- a/lua/doom/modules/features/statusline/init.lua +++ b/lua/doom/modules/features/statusline/init.lua @@ -251,11 +251,8 @@ statusline.configs["heirline.nvim"] = function() init = function(self) local filename = self.filename local extension = vim.fn.fnamemodify(filename, ":e") - self.icon, self.icon_color = require("nvim-web-devicons").get_icon_color( - filename, - extension, - { default = true } - ) + self.icon, self.icon_color = + require("nvim-web-devicons").get_icon_color(filename, extension, { default = true }) end, provider = function(self) return self.icon and (self.icon .. " ") diff --git a/lua/doom/modules/langs/vue/init.lua b/lua/doom/modules/langs/vue/init.lua index 3edbe4cb6..4a11a0e7b 100644 --- a/lua/doom/modules/langs/vue/init.lua +++ b/lua/doom/modules/langs/vue/init.lua @@ -120,34 +120,22 @@ vue.autocmds = { }, } - local volar_api_config = vim.tbl_deep_extend( - "force", - {}, - doom.langs.vue.settings.volar_api, - base_config - ) + local volar_api_config = + vim.tbl_deep_extend("force", {}, doom.langs.vue.settings.volar_api, base_config) langs_utils.use_lsp("volar", { name = "volar_api", config = volar_api_config, }) - local volar_doc_config = vim.tbl_deep_extend( - "force", - {}, - doom.langs.vue.settings.volar_doc, - base_config - ) + local volar_doc_config = + vim.tbl_deep_extend("force", {}, doom.langs.vue.settings.volar_doc, base_config) langs_utils.use_lsp("volar", { name = "volar_doc", config = volar_doc_config, }) - local volar_html_config = vim.tbl_deep_extend( - "force", - {}, - doom.langs.vue.settings.volar_html, - base_config - ) + local volar_html_config = + vim.tbl_deep_extend("force", {}, doom.langs.vue.settings.volar_html, base_config) langs_utils.use_lsp("volar", { name = "volar_html", config = volar_html_config, diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 8e56f9d29..2ebd416f7 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -9,12 +9,8 @@ utils.version = { minor = 0, patch = 0, } -utils.doom_version = string.format( - "%d.%d.%d", - utils.version.major, - utils.version.minor, - utils.version.patch -) +utils.doom_version = + string.format("%d.%d.%d", utils.version.major, utils.version.minor, utils.version.patch) -- Finds `filename` (where it is a doom config file). utils.find_config = function(filename) @@ -29,10 +25,8 @@ utils.find_config = function(filename) if fs.file_exists(path) then return path end - local candidates = vim.api.nvim_get_runtime_file( - get_filepath("*" .. system.sep .. "doon-nvim"), - false - ) + local candidates = + vim.api.nvim_get_runtime_file(get_filepath("*" .. system.sep .. "doon-nvim"), false) if not vim.tbl_isempty(candidates) then return candidates[1] end diff --git a/lua/doom/utils/logging.lua b/lua/doom/utils/logging.lua index a507193ad..d7ef21bda 100644 --- a/lua/doom/utils/logging.lua +++ b/lua/doom/utils/logging.lua @@ -70,13 +70,8 @@ log.new = function(config, standalone) local console_output = vim.schedule_wrap(function(level_config, info, nameupper, msg) local console_lineinfo = vim.fn.fnamemodify(info.short_src, ":t") .. ":" .. info.currentline - local console_string = string.format( - "[%-6s%s] %s: %s", - nameupper, - os.date("%H:%M:%S"), - console_lineinfo, - msg - ) + local console_string = + string.format("[%-6s%s] %s: %s", nameupper, os.date("%H:%M:%S"), console_lineinfo, msg) if config.highlights and level_config.hl then vim.cmd(string.format("echohl %s", level_config.hl)) diff --git a/modules.lua b/modules.lua index 36c58dcee..02788e036 100644 --- a/modules.lua +++ b/modules.lua @@ -9,31 +9,31 @@ return { features = { -- Language features - "annotations", -- Code annotation generator - "auto_install", -- Auto install LSP providers - "autopairs", -- Automatically close character pairs - "comment", -- Adds keybinds to comment in any language - "linter", -- Linting and formatting for languages - "lsp", -- Code completion - "extra_snippets", -- Code snippets for all languages + "annotations", -- Code annotation generator + "auto_install", -- Auto install LSP providers + "autopairs", -- Automatically close character pairs + "comment", -- Adds keybinds to comment in any language + "linter", -- Linting and formatting for languages + "lsp", -- Code completion + "extra_snippets", -- Code snippets for all languages -- Editor - "auto_session", -- Remember sessions between loads - "colorizer", -- Show colors in neovim - "editorconfig", -- Support editorconfig files - "gitsigns", -- Show git changes in sidebar - "illuminate", -- Highlight other copies of the word you're hovering on - "indentlines", -- Show indent lines with special characters - "range_highlight", -- Highlight selected range from commands - "todo_comments", -- Highlight TODO: comments + "auto_session", -- Remember sessions between loads + "colorizer", -- Show colors in neovim + "editorconfig", -- Support editorconfig files + "gitsigns", -- Show git changes in sidebar + "illuminate", -- Highlight other copies of the word you're hovering on + "indentlines", -- Show indent lines with special characters + "range_highlight", -- Highlight selected range from commands + "todo_comments", -- Highlight TODO: comments -- "doom_themes", -- Extra themes for doom -- UI Components - "lsp_progress", -- Check status of LSP loading - "tabline", -- Tab bar buffer switcher - "dashboard", -- A pretty dashboard upon opening + "lsp_progress", -- Check status of LSP loading + "tabline", -- Tab bar buffer switcher + "dashboard", -- A pretty dashboard upon opening -- "trouble", -- A pretty diagnostic viewer - "statusline", -- A pretty status line at the bottom of the buffer + "statusline", -- A pretty status line at the bottom of the buffer -- "minimap", -- Shows current position in document -- "terminal", -- Integrated terminal in neovim -- "symbols", -- Navigate between code symbols using telescope @@ -44,16 +44,16 @@ return { -- Tools -- "dap", -- Debug code through neovim "repl", -- Interactive REPL in neovim - "explorer", -- An enhanced filetree explorer + "explorer", -- An enhanced filetree explorer -- "firenvim", -- Embed neovim in your browser -- "lazygit", -- Lazy git integration -- "neogit", -- A git client for neovim - "neorg", -- Organise your life - "projects", -- Quickly switch between projects + "neorg", -- Organise your life + "projects", -- Quickly switch between projects -- "superman", -- Read unix man pages in neovim -- "suda", -- Save using sudo when necessary - "telescope", -- Fuzzy searcher to find files, grep code and more - "whichkey", -- An interactive sheet + "telescope", -- Fuzzy searcher to find files, grep code and more + "whichkey", -- An interactive sheet }, langs = { -- Scripts @@ -81,7 +81,7 @@ return { -- "config", -- JSON, YAML, TOML -- "markdown", -- "terraform", -- Terraform / hcl files support - } + }, } -- vim: sw=2 sts=2 ts=2 fdm=indent expandtab From 50bb8d14ca250621c594d89109526f871185881d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edwin?= Date: Mon, 1 Aug 2022 12:25:25 +0100 Subject: [PATCH 63/73] feat(langs,ocaml): add language (#373) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses https://ocaml.org/p/ocaml-lsp-server/ as language server that can be installed via `opam`. Signed-off-by: Edwin Török --- lua/doom/modules/langs/ocaml/init.lua | 26 ++++++++++++++++++++++++++ modules.lua | 1 + tools/Dockerfile | 6 ++++++ 3 files changed, 33 insertions(+) create mode 100644 lua/doom/modules/langs/ocaml/init.lua diff --git a/lua/doom/modules/langs/ocaml/init.lua b/lua/doom/modules/langs/ocaml/init.lua new file mode 100644 index 000000000..b4ae0da88 --- /dev/null +++ b/lua/doom/modules/langs/ocaml/init.lua @@ -0,0 +1,26 @@ +local ocaml = {} + +ocaml.settings = { + language_server_name = "ocamllsp", +} + +ocaml.autocmds = { + { + "Filetype", + "ocaml,ocaml_interface,ocamllex", + function() + local langs_utils = require("doom.modules.langs.utils") + langs_utils.use_lsp(doom.langs.ocaml.settings.language_server_name) + + vim.schedule(function() + require("nvim-treesitter.install").ensure_installed("ocaml","ocaml_interface") + if vim.fn.executable("tree-sitter-cli") == 1 then + require("nvim-treesitter.install").ensure_installed("ocamllex") + end + end) + end, + once = true, + }, +} + +return ocaml diff --git a/modules.lua b/modules.lua index 02788e036..493388920 100644 --- a/modules.lua +++ b/modules.lua @@ -72,6 +72,7 @@ return { -- Compiled -- "rust", -- "cc", + -- "ocaml", -- JIT -- "c_sharp", diff --git a/tools/Dockerfile b/tools/Dockerfile index 4f972c2b2..cb311e5cf 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -33,6 +33,9 @@ RUN pacman -Sy wget unzip make --noconfirm # Required for watching Doom-nvim-contrib for changes RUN npm i -g chokidar-cli +# Required for OCaml language +# RUN pacman -Sy opam diffutils patch ocaml --noconfirm + # Create the doom user and group RUN groupadd doom RUN useradd -m -g doom doom @@ -43,6 +46,9 @@ RUN chown -R ${UNAME}:${GNAME} /usr/local/lib/node_modules/ USER doom WORKDIR /home/doom +# Required for OCaml language +# RUN opam init --disable-sandboxing && opam install ocaml-lsp-server -y + COPY _docker_entry.sh /usr/local/bin/ # Doom-nvim-contrib From ad93157f996fb20a8bc659f8da1554ad39d97849 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 11:25:48 +0000 Subject: [PATCH 64/73] chore: format source code --- lua/doom/modules/langs/ocaml/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/doom/modules/langs/ocaml/init.lua b/lua/doom/modules/langs/ocaml/init.lua index b4ae0da88..bcbc8370b 100644 --- a/lua/doom/modules/langs/ocaml/init.lua +++ b/lua/doom/modules/langs/ocaml/init.lua @@ -13,9 +13,9 @@ ocaml.autocmds = { langs_utils.use_lsp(doom.langs.ocaml.settings.language_server_name) vim.schedule(function() - require("nvim-treesitter.install").ensure_installed("ocaml","ocaml_interface") + require("nvim-treesitter.install").ensure_installed("ocaml", "ocaml_interface") if vim.fn.executable("tree-sitter-cli") == 1 then - require("nvim-treesitter.install").ensure_installed("ocamllex") + require("nvim-treesitter.install").ensure_installed("ocamllex") end end) end, From 276d65bf0afab54ef9621e53353082c97c2c186f Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Aug 2022 21:22:03 +1000 Subject: [PATCH 65/73] chore(docs): Removed references to deprecated `develop` branch. --- README.md | 4 +- docs/README.md | 30 +--- docs/contributing.md | 4 +- docs/faq.md | 20 --- docs/getting_started.md | 375 ---------------------------------------- tools/start_docker.sh | 12 +- 6 files changed, 13 insertions(+), 432 deletions(-) delete mode 100644 docs/faq.md delete mode 100644 docs/getting_started.md diff --git a/README.md b/README.md index c84a3f4ea..87899971c 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ ![License](https://img.shields.io/github/license/NTBBloodbath/doom-nvim?style=for-the-badge) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge)](http://makeapullrequest.com) ![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) +![GitHub last commit (branch)](https://img.shields.io/github/last-commit/NTBBloodbath/doom-nvim/main?style=for-the-badge) +![Neovim version](https://img.shields.io/badge/Neovim-0.7-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) diff --git a/docs/README.md b/docs/README.md index a30c3373b..eb59c93fb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,35 +1,17 @@ # Doom Nvim Documentation -Doom Nvim is a port to Neovim of the [Doom Emacs](https://github.com/hlissner/doom-emacs) -configuration framework for [GNU Emacs](https://www.gnu.org/software/emacs/) adapted -for all vimmer who want less framework in their framework and the performance of -a handmade configuration (or better). It can be a base for your own setup or a -resource for Neovim enthusiasts to learn more about our favorite editor and how to -do X things on it by using Lua. - -Doom Nvim is an opinionated collection of reasonable (and optional) defaults with -a focus on performance (both runtime and startup) and on abstraction-light, readable -code design, so that there is less between you and Neovim. - > The documentation is designed to be viewed within Doom Nvim. Access it by pressing > `:h doom_nvim`. ## Documentation -### Getting Started - -- [Install](./getting_started.md#install) -- [Update & Rollback](./getting_started.md#update--rollback) -- [Configuration](./getting_started.md#configuration) - -### Modules - -- [Introduction](./modules.md#introduction) -- [Tweaking Doom Nvim Modules](./modules.md#tweaking-doom-nvim-modules) +- [All Modules](./modules.md#all-modules) +- [Configuring modules](./modules.md#quick-guide) +- [Buidling/contributing your own modules](./modules.md#building-your-own-module) +- [API Reference](./api.md) :warning: Not yet implemented. Refer to comments in [doom_global.lua](../lua/doom/core/doom_global.lua) ### Contributing -- [Where can I help?](./contributing.md#where-can-i-help) - [Reporting issues](./contributing.md#reporting-issues) - [Suggesting features, keybinds and enhancements](./contributing.md#suggesting-features-keybinds-and-enhancements) - [Contributing code](./contributing.md#contributing-code) @@ -39,7 +21,3 @@ code design, so that there is less between you and Neovim. ### Asking for help - [Our issues tracker](https://github.com/NTBBloodbath/doom-nvim/issues) - -### Projects - -- [Projects](https://github.com/NTBBloodbath/doom-nvim/projects) diff --git a/docs/contributing.md b/docs/contributing.md index 3d588522d..e3d721dd4 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -100,9 +100,7 @@ quote_style = "AutoPreferDouble" #### Commits & PRs -- Target `develop` instead of `main`. - The only exception are hotfixes (plugins breaking changes, Doom bugs) - and documentation improvements! +- Target the `main` branch. #### Keybind conventions diff --git a/docs/faq.md b/docs/faq.md deleted file mode 100644 index 17203bc81..000000000 --- a/docs/faq.md +++ /dev/null @@ -1,20 +0,0 @@ -# Frequently Asked Questions - -## General - -### What type of vimmer is Doom Nvim intended for? - -Doom Nvim is intended for all types of Vimmers who want a stable and efficient -development environment without spending a lot of time setting everything up. - -### Why does Doom Nvim only support Neovim 0.5+? - -Doom Nvim doesn't support Neovim versions lower than the current stable (0.5) -due big plugin incompatibilities and performance differences, which would make -the experience not worth it. - -### How to version control Doom Nvim? - -Doom Nvim makes use of an internal variable called `doom_configs_root` that points -to `/home/user/.config/doom-nvim` path by default. This allows you to move your -configuration files to this path so you can version control your doom setup too. diff --git a/docs/getting_started.md b/docs/getting_started.md deleted file mode 100644 index fd6ffa894..000000000 --- a/docs/getting_started.md +++ /dev/null @@ -1,375 +0,0 @@ -# Getting Started - -## Install - -This is what you will have installed by the end of this section: - -- Git -- Neovim 0.6.0+ -- GNU Find -- **Optional**: ripgrep 11.0+ (highly recommended) -- **Optional**: fd 7.3.0+ (known as `fd-find` on Debian, Ubuntu & derivates), - improves performance for many file indexing commands -- **Optional**: node & npm, required to use some Language Server Protocols (LSP) and packages using LSP, like the symbols-outline plugin. - -These packages should to be available through the package managers of your OS; -i.e. pacman/aptitude/rpm/etc on the various Linux distributions. - -### Neovim & dependencies - -#### On Linux - -Neovim 0.5.0 was recently released as a stable version. -You can check what version your repository has by looking at [this site.](https://repology.org/project/neovim/versions) -If Neovim 0.5.0 is still not available in your repository, you can install it by doing one of the following: - -1. Using extra repositories according to your distribution (PPA/COPR/AUR/etc). - -2. Using a Neovim version manager like [nvenv](https://github.com/NTBBloodbath/nvenv). - -##### Ubuntu - -You can get nightly builds of git master from the -[Neovim Unstable PPA](https://launchpad.net/~neovim-ppa/+archive/ubuntu/unstable). - -```sh -add-apt-repository ppa:neovim-ppa/unstable -apt-get update -``` - -##### Fedora - -Nightly builds can be installed by using the -[agriffis/neovim-nightly](https://copr.fedorainfracloud.org/coprs/agriffis/neovim-nightly/) -COPR repository. - -```sh -dnf copr enable agriffis/neovim-nightly -dnf update -``` - -##### Arch - -Neovim Nightly builds can be installed using the PKGBUILD -[`neovim-nightly-bin`](https://aur.archlinux.org/packages/neovim-nightly-bin), -available on the [AUR](https://wiki.archlinux.org/index.php/Arch_User_Repository). - -#### On MacOS - -You can download a prebuilt binary from the [Neovim](https://github.com/neovim/neovim/releases/tag/nightly) releases page. - -1. Download: `curl -LO https://github.com/neovim/neovim/releases/download/v0.5.0/nvim-macos.tar.gz` -2. Extract: `tar xzvf nvim-macos.tar.gz` -3. Run: `./nvim-osx64/bin/nvim` - -You may wish to add it to your PATH using something like: -`export PATH="$HOME/nvim-osx64/bin:$PATH"` - -Neovim nightly can also be downloaded with [homebrew](https://brew.sh/): - -`brew install --HEAD neovim` will download the source and build it locally on your machine. - -If you already have Neovim v0.4 installed you may need to unlink it. - -``` -brew unlink neovim -brew install neovim --HEAD -nvim --version -``` - -MacPorts currently only has Neovim v0.4.4 - -#### On Windows - -> **NOTE**: new module architecture is pending tests on Windows. - -##### [Chocolatey](https://community.chocolatey.org/) - -``` -choco install neovim --pre -``` - -##### [Scoop](https://scoop.sh/) - -``` -scoop bucket add versions -scoop install neovim-nightly -``` - -##### Manual - -1. Download a prebuilt binary from the [Neovim](https://github.com/neovim/neovim/releases) releases page. -2. Unpack the binary -3. Move and symlink to somewhere in your path - -```sh -# unpack the binary -tar xzvf nvim-linux64.tar.gz - -# create a directory to store the unpacked folder -sudo mkdir /opt/nvim - -# move the unpacked binary -sudo mv nvim-linux64 /opt/nvim - -# add the neovim executable to somewhere in your path -# ex: /usr/bin OR $HOME/.local/bin -sudo ln -s /opt/nvim/nvim-linux64/bin/nvim /usr/bin/nvim - -# should print /usr/bin/nvim -which nvim - -# should print NVIM 0.5 -nvim --version -``` - -``` -# unpack the binary -tar xzvf nvim-linux64.tar.gz - -# create a directory to store the unpacked folder -sudo mkdir /opt/nvim - -# move the unpacked binary -sudo mv nvim-linux64 /opt/nvim - -# add the neovim executable to somewhere in your path -# ex: /usr/bin OR $HOME/.local/bin -sudo ln -s /opt/nvim/nvim-linux64/bin/nvim /usr/bin/nvim - -# should print /usr/bin/nvim -which nvim - -# should print NVIM 0.5 -nvim --version -``` -### External dependencies - -#### On Linux - -##### Ubuntu - -```sh -# Required dependencies -apt-get install git ripgrep - -# (Optional) Improves performance for many file indexing commands -apt-get install fd-find - -# (Optional) Required by some Language Server Protocols -apt-get install nodejs npm -``` - -##### Fedora - -```sh -# Required dependencies -dnf install git ripgrep - -# (Optional) Improves performance for many file indexing commands -dnf install fd-find # is 'fd' in Fedora <28 - -# (Optional) Required by some Language Server Protocols -dnf install nodejs -``` - -##### Arch - -```sh -# Required dependencies -pacman -S git ripgrep - -# (Optional) Improves performance for many file indexing commands -pacman -S fd - -# (Optional) Required by some Language Server Protocols -pacman -S nodejs npm -``` - -#### On MacOS - -Dependencies can be installed using [homebrew](https://brew.sh/) - -```sh -# Required dependencies -# git is already installed as part of MacOS -brew install ripgrep ctags - -# (Optional) Required by Language Server Protocols -brew install node -``` - -#### On Windows - -If you use Windows, please help by posting the steps to install the external -dependencies here! - -### Doom Nvim - -With Neovim v0.5.0 and Doom's dependencies installed, next is to install -Doom Nvim itself. - -> **IMPORTANT**: if you don't have a patched nerd font then you will need to -> install one in your system so you will be able to see icons in Neovim. - -First you'll want to backup your current Neovim configuration if you have one. - -> **NOTES**: -> -> 1. Your current configuration will be backed up to `~/.config/nvim.bak` -> or where your `XDG_CONFIG_HOME` environment variable points to. -> -> 2. If you're a cheovim user you can skip this step and go directly to -> [Using cheovim](#using-cheovim). - -```sh -[ -d ${XDG_CONFIG_HOME:-$HOME/.config}/nvim ] && mv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim ${XDG_CONFIG_HOME:-$HOME/.config}/nvim.bak -``` - -Now that you have backed up your current Neovim configuration you can proceed to install -`doom-nvim`. - -```sh -git clone --depth 1 https://github.com/NTBBloodbath/doom-nvim.git ${XDG_CONFIG_HOME:-$HOME/.config}/nvim -``` - -Or if you want to live in the bleeding-edge with the latest features: - -```sh -git clone --depth 1 -b develop https://github.com/NTBBloodbath/doom-nvim.git ${XDG_CONFIG_HOME:-$HOME/.config}/nvim -``` - -## Update & Rollback - -### Update Doom Nvim - -To update Doom Nvim, you have two options, run `:DoomUpdate` or SPC d u -inside Neovim or alternatively run `git pull` in doom-nvim directory (**not recommended, see why below**). - -#### Why use the built-in doom command for updating instead of running git pull manually? - -> **TODO**: These commands are pending testing in the new module architecture. - -> **tl;dr**: The `:DoomUpdate` command creates an additional local database of the doom-nvim -> releases so in case something breaks you can easily rollback to a previous doom-nvim version - -The reason is that `doom-nvim` also brings a functionality for rolling back to a previous version -or a previous state (e.g. a previous commit) and doing it manually can be a bit tedious (looking -for the previous release tag or the previous commit hash if there were too much commits). -Our `:DoomUpdate` command creates a local database into the `doom-nvim` directory depending on -what branch are you using because if you are using the development branch you will not want to -rollback to a previous version, isn't it? - -So, if you are using the main a.k.a stable branch of doom-nvim, the `:DoomUpdate` command will -create a local database of doom-nvim's releases. Otherwise, if you're using the development branch -it will create a local file with the commit hash that you were using before updating. - -### Rollback - -#### Previous Configurations - -To uninstall Doom Nvim and go back to your previous setup, simply remove the `~/.config/nvim` -directory if it's where you have `doom-nvim` installed and move your backup. - -```sh -rm -rf ${XDG_CONFIG_HOME:-$HOME/.config}/nvim \ - && mv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim.bak ${XDG_CONFIG_HOME:-$HOME/.config}/nvim -``` - -#### Rolling Back Doom - -Did the update screw up your setup because of a bug or a breaking change and you want to rollback? -Then you're lucky. Just run `:DoomRollback` in Neovim and Doom will rollback itself to -a previous release (for main branch) or a previous commit (for development branch). - -> **IMPORTANT**: remember to report the issues before just rolling back. In that -> way we can work on fixing them and make doom better! - -## Configuration - -You can configure Doom Nvim by tweaking the `config.lua` and -`modules.lua` files located in your Doom Nvim root directory -(`$HOME/.config/doom-nvim/` by default). - -### modules.lua - -This file handles all the Doom Nvim modules, copy the one in the root of this -repo for a template. - -> **NOTE**: for more information please refer to [modules]. - -### config.lua - -This file handles all the Doom Nvim configurations, including the ability to easily -create new custom mappings and global Neovim variables. - -It has no proper structure, but revolves around the `doom` global variable. -See each module's documentation for options. - -> **NOTE**: all your used-defined configurations here will be live-reloaded, e.g. -> mappings, autocommands, etc. - -### Plugin Management - -Doom Nvim uses a declarative and use-package inspired package manager called -[packer.nvim](https://github.com/wbthomason/packer.nvim). - -Each Doom module has a folder inside `lua/doom/modules/`, with the following -files: - -- `init.lua`: has default options and packer `config` functions. -- `packages.lua`: has packer specs, except for the config key. -- `binds.lua` (optional): has bindings for the module. -- `autocmds.lua` (optional): has autocmds. - -> **WARNING:** Do not change modules directly in Doom source code. Instead, -> use your `modules.lua` and `config.lua` files to modify them. - -### Configuring Doom - -#### Configuring settings - -You can change Doom's default settings by tweaking your `config.lua` file, -please see [modules] to know how. - -## Migrating to 4.0.0 - -As this is a major version, there are many improvements and breaking changes. -This section is made to help you migrate to this version without having to -respawn. - -### Changes for end users - -- Make modules more granular and configurable, allowing everything to be - overriden. -- Completely change the structure of `config.lua` to revolve around a - single settings store. -- Remove the category groupings in modules. -- Remove the need to return the filepath from each config file. -- Fully move all data file to stdpath("data"). -- Fix bugs. - -### Changes for contributors - -- Restructured source code. The Doom Nvim source code is now cleaner and - easier to understand. Many things have been flattened, no module is special - anymore, some things were removed in favor of later implementations - out-of-source. -- Adding modules is simpler, it only requires creating a new module folder - and adding its configuration. -- Care should be taken with order of execution, since you only have config - accesible after the doom global is created. You can't, for instance, - use the global do define defaults in `lua/doom/core/config/init.lua`. - This is rarely a problem, but worth mentioning. - -We recomend doing a fresh install, backing up your current -`~/.config/doom-nvim` for reference. Sadly, it cannot be used as is, and there's -no migration script yet. - -#### New configurations - - -[packer.nvim]: https://github.com/wbthomason/packer.nvim -[vhyrro]: https://github.com/vhyrro -[modules]: ./modules.md -[report them]: https://github.com/NTBBloodbath/doom-nvim/issues/new diff --git a/tools/start_docker.sh b/tools/start_docker.sh index 72e9575db..4e77d4d6c 100755 --- a/tools/start_docker.sh +++ b/tools/start_docker.sh @@ -49,7 +49,7 @@ if [[ ! -d "$SCRIPT_DIR"/doom-nvim-contrib ]]; then 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" + git worktree add ./doom-nvim-contrib origin/develop -b "$BRANCH_NAME" fi fi @@ -65,10 +65,10 @@ elif git show-ref --quiet refs/heads/"$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 +else + # Pull latest version of main + echo " - Creating new branch off main..." + git checkout -b "$BRANCH_NAME" main git fetch --quiet # If changes between local and origin, get latest changes if [[ ! $( git rev-list develop...origin/develop --count ) -eq 0 ]]; then @@ -111,6 +111,6 @@ docker run \ -v "$SCRIPT_DIR"/workspace:/home/doom/workspace \ --name doom-nvim-contrib-container \ --user doom \ - doom-nvim-contrib + doom-nvim-contrib From 789c712caee71f617183fca9b49c61993a4f93c1 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Mon, 1 Aug 2022 21:54:48 +1000 Subject: [PATCH 66/73] feat(lsp): Enabled ghost_text by default --- lua/doom/modules/features/lsp/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index 86ca9be51..22ab227b3 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -35,7 +35,6 @@ lsp.settings = { hint = "", info = "", }, - virtual_text = false, severity_sort = true, completion = { kinds = { @@ -65,6 +64,9 @@ lsp.settings = { Operator = " ", TypeParameter = " ", }, + experimental = { + ghost_text = true + }, completeopt = "menu,menuone,preview,noinsert", window = { documentation = { From 6a19199c8d5d501733d9a373cb31e88e865b8961 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 11:55:11 +0000 Subject: [PATCH 67/73] chore: format source code --- lua/doom/modules/features/lsp/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index 22ab227b3..df76f847b 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -65,7 +65,7 @@ lsp.settings = { TypeParameter = " ", }, experimental = { - ghost_text = true + ghost_text = true, }, completeopt = "menu,menuone,preview,noinsert", window = { From a09454df72831e4815bad9f43e2b218e58001f28 Mon Sep 17 00:00:00 2001 From: connorgmeean Date: Tue, 2 Aug 2022 11:04:38 +1000 Subject: [PATCH 68/73] feat(langs,dockerfile): Added Dockerfile language support. --- lua/doom/modules/langs/dockerfile/init.lua | 38 ++++++++++++++++++++++ modules.lua | 1 + 2 files changed, 39 insertions(+) create mode 100644 lua/doom/modules/langs/dockerfile/init.lua diff --git a/lua/doom/modules/langs/dockerfile/init.lua b/lua/doom/modules/langs/dockerfile/init.lua new file mode 100644 index 000000000..622fd4f61 --- /dev/null +++ b/lua/doom/modules/langs/dockerfile/init.lua @@ -0,0 +1,38 @@ +local dockerfile = {} + +dockerfile.settings = { + --- Enable/Disable linting via hadolint + --- @type boolean + disable_linter = true, + --- Language server name + --- @type string + language_server_name = "dockerls", +} + +dockerfile.autocmds = { + { + "FileType", + "dockerfile", + function() + local settings = doom.langs.dockerfile.settings + local langs_utils = require("doom.modules.langs.utils") + langs_utils.use_lsp(settings.language_server_name) + + vim.defer_fn(function() + require("nvim-treesitter.install").ensure_installed("dockerfile") + end, 0) + + -- Setup null-ls + if doom.features.linter and not settings.disable_linter then + local null_ls = require("null-ls") + + langs_utils.use_null_ls_source({ + null_ls.builtins.diagnostics.hadolint, + }) + end + end, + once = true, + }, +} + +return dockerfile diff --git a/modules.lua b/modules.lua index 493388920..9912e2064 100644 --- a/modules.lua +++ b/modules.lua @@ -82,6 +82,7 @@ return { -- "config", -- JSON, YAML, TOML -- "markdown", -- "terraform", -- Terraform / hcl files support + -- "dockerfile", }, } From 50514c61e7c0ee96f320a10738da93ce6335816b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= Date: Sun, 7 Aug 2022 23:10:49 +0100 Subject: [PATCH 69/73] fix(netrw): do not disable loading netrw when netrw feature is enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Edwin Török --- lua/doom/core/init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index b55bf237b..238044733 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -25,11 +25,6 @@ g.loaded_matchparen = 1 g.loaded_logiPat = 1 g.loaded_rrhelper = 1 -g.loaded_netrw = 1 -g.loaded_netrwPlugin = 1 -g.loaded_netrwSettings = 1 -g.loaded_netrwFileHandlers = 1 - -- Sets the `doom` global object require("doom.core.doom_global") @@ -38,6 +33,12 @@ local utils = require("doom.utils") -- Boostraps the doom-nvim framework, runs the user's `config.lua` file. local config = utils.safe_require("doom.core.config") config.load() +if not utils.is_module_enabled("features", "netrw") then + g.loaded_netrw = 1 + g.loaded_netrwPlugin = 1 + g.loaded_netrwSettings = 1 + g.loaded_netrwFileHandlers = 1 +end -- Load the colourscheme utils.safe_require("doom.core.ui") From 2e1dc99bf62c043dc2991454f795ceb0fa4c227d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= Date: Sun, 7 Aug 2022 23:48:22 +0100 Subject: [PATCH 70/73] fix(explorer): load when editing dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because netrw is turned off only an error message ` is a directory` is seen when trying to `:e path`. Add an autocommand that triggers loading nvim-tree and open the tree at the specified directory. Helps with muscle memory on `:e .` Signed-off-by: Edwin Török --- lua/doom/modules/features/explorer/init.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index 06fbc85d7..c53ebc345 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -95,6 +95,7 @@ explorer.packages = { ["nvim-tree.lua"] = { "kyazdani42/nvim-tree.lua", commit = "7fcb48c852b9d58709169a4dc1ec634fa9ea56f9", + module = 'nvim-tree.api', cmd = { "NvimTreeClipboard", "NvimTreeClose", @@ -184,4 +185,13 @@ explorer.binds = { }, } +explorer.autocmds = { + {"BufEnter", "*", function() + local name = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()) + if vim.fn.isdirectory(name) == 1 then + require("nvim-tree.api").tree.change_root(name) + end + end} +} + return explorer From bf67dad3037e5bd9c1b1eacf11e645512cd9244e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= Date: Sun, 7 Aug 2022 23:50:49 +0100 Subject: [PATCH 71/73] fix(explorer): avoid startup warning about unknown option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Edwin Török --- lua/doom/modules/features/explorer/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index c53ebc345..bec3dab77 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -17,7 +17,6 @@ explorer.settings = { view = { width = 35, side = "left", - auto_resize = true, mappings = { custom_only = false, }, @@ -72,6 +71,7 @@ explorer.settings = { }, actions = { open_file = { + resize_window = true, -- previously view.auto_resize window_picker = { exclude = { filetype = { From 053ad11ad8dbeb9594d304b3cf061ef1fd1a5ff5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 8 Aug 2022 04:25:55 +0000 Subject: [PATCH 72/73] chore: format source code --- lua/doom/core/init.lua | 8 ++++---- lua/doom/modules/features/explorer/init.lua | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index 238044733..b61e0e9a3 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -34,10 +34,10 @@ local utils = require("doom.utils") local config = utils.safe_require("doom.core.config") config.load() if not utils.is_module_enabled("features", "netrw") then - g.loaded_netrw = 1 - g.loaded_netrwPlugin = 1 - g.loaded_netrwSettings = 1 - g.loaded_netrwFileHandlers = 1 + g.loaded_netrw = 1 + g.loaded_netrwPlugin = 1 + g.loaded_netrwSettings = 1 + g.loaded_netrwFileHandlers = 1 end -- Load the colourscheme diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index bec3dab77..721c02bc4 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -95,7 +95,7 @@ explorer.packages = { ["nvim-tree.lua"] = { "kyazdani42/nvim-tree.lua", commit = "7fcb48c852b9d58709169a4dc1ec634fa9ea56f9", - module = 'nvim-tree.api', + module = "nvim-tree.api", cmd = { "NvimTreeClipboard", "NvimTreeClose", @@ -186,12 +186,16 @@ explorer.binds = { } explorer.autocmds = { - {"BufEnter", "*", function() - local name = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()) - if vim.fn.isdirectory(name) == 1 then - require("nvim-tree.api").tree.change_root(name) - end - end} + { + "BufEnter", + "*", + function() + local name = vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()) + if vim.fn.isdirectory(name) == 1 then + require("nvim-tree.api").tree.change_root(name) + end + end, + }, } return explorer From 414579bc7f3a146a837a16abf117b30dc9489259 Mon Sep 17 00:00:00 2001 From: hjalmar jakobsson Date: Mon, 8 Aug 2022 03:17:59 -0400 Subject: [PATCH 73/73] refactor(settings): move settings table into root --- README.md | 6 +- lua/doom/core/README.md | 4 +- lua/doom/core/config.lua | 28 ++-- lua/doom/core/doom_global.lua | 167 ------------------ lua/doom/core/init.lua | 3 + lua/doom/core/modules.lua | 10 +- lua/doom/core/ui.lua | 20 +-- lua/doom/modules/core/doom/init.lua | 18 +- lua/doom/modules/features/explorer/init.lua | 4 +- lua/doom/modules/features/lsp/init.lua | 18 +- lua/doom/modules/features/netrw/init.lua | 2 +- lua/doom/modules/features/whichkey/init.lua | 2 +- lua/doom/utils/logging.lua | 2 +- settings.lua | 177 ++++++++++++++++++++ 14 files changed, 236 insertions(+), 225 deletions(-) create mode 100644 settings.lua diff --git a/README.md b/README.md index 87899971c..2ff90c246 100644 --- a/README.md +++ b/README.md @@ -135,9 +135,9 @@ own options. See all available config options [in the API Reference](./docs/api ```lua -- config.lua -doom.freeze_dependencies = false -- Don't use pinned packer dependencies -doom.logging = 'trace' -- Debug doom internal issues -doom.indent = 2 -- Sets vim.opt.shiftwith, vim.opt.softtabstop, vim.opt.tabstop to 2 +doom.settings.freeze_dependencies = false -- Don't use pinned packer dependencies +doom.settings.logging = 'trace' -- Debug doom internal issues +doom.settings.indent = 2 -- Sets vim.opt.shiftwith, vim.opt.softtabstop, vim.opt.tabstop to 2 vim.opt.colorcolumn = 120 -- Regular vim options can also be set ``` diff --git a/lua/doom/core/README.md b/lua/doom/core/README.md index 444fad51c..71b7d4f09 100644 --- a/lua/doom/core/README.md +++ b/lua/doom/core/README.md @@ -9,7 +9,7 @@ The core workings of the doom-nvim framework. - `modules.lua` Responsible for storing the enabled modules (user's `modules.lua` file) as well as later acting upon `doom.modules` to set everything up. - `functions.lua` Extra helper functions used internally by doom-nvim. - `commands.lua` Extra helper commands used internally by doom-nvim. -- `ui.lua` Loads the user's colorscheme from the `doom.colorscheme` field. Falls back to `doom-one` if a colorscheme isn't set or is broken. +- `ui.lua` Loads the user's colorscheme from the `doom.settings.colorscheme` field. Falls back to `doom-one` if a colorscheme isn't set or is broken. Those modules are the following: - `system.lua` Evaluates and caches some directories/filepaths to be used internally. @@ -21,7 +21,7 @@ Those modules are the following: b. Loads the user's enabled modules from `modules.lua` c. Adds all of these module objects to the `doom.modules` field in the `doom` global object. d. Runs the user's `config.lua` file (so the user can apply their config) - e. Applies some of the settings in the `doom` global object such as `doom.indent` + e. Applies some of the settings in the `doom` global object such as `doom.settings.indent` 3. `init.lua` loads `functions.lua` and `commands.lua` to set these extra functions/commands. 4. `init.lua` runs the `start`, `load_modules` and `handle_user_config` functions of `modules.lua` which does the following: a. Install/bootstrap packer on behalf of the user. diff --git a/lua/doom/core/config.lua b/lua/doom/core/config.lua index ae6b49cb2..aaf216238 100644 --- a/lua/doom/core/config.lua +++ b/lua/doom/core/config.lua @@ -100,10 +100,10 @@ config.load = function() end -- Apply the necessary `doom.field_name` options - vim.opt.shiftwidth = doom.indent - vim.opt.softtabstop = doom.indent - vim.opt.tabstop = doom.indent - if doom.guicolors then + vim.opt.shiftwidth = doom.settings.indent + vim.opt.softtabstop = doom.settings.indent + vim.opt.tabstop = doom.settings.indent + if doom.settings.guicolors then if vim.fn.exists("+termguicolors") == 1 then vim.opt.termguicolors = true elseif vim.fn.exists("+guicolors") == 1 then @@ -111,38 +111,38 @@ config.load = function() end end - if doom.auto_comment then + if doom.settings.auto_comment then vim.opt.formatoptions:append("croj") end - if doom.movement_wrap then + if doom.settings.movement_wrap then vim.cmd("set whichwrap+=<,>,[,],h,l") end - if doom.undo_dir then + if doom.settings.undo_dir then vim.opt.undofile = true - vim.opt.undodir = doom.undo_dir + vim.opt.undodir = doom.settings.undo_dir else vim.opt.undofile = false vim.opt.undodir = nil end - if doom.global_statusline then + if doom.settings.global_statusline then vim.opt.laststatus = 3 end -- Use system clipboard - if doom.clipboard then + if doom.settings.clipboard then vim.opt.clipboard = "unnamedplus" end -- Color column - vim.opt.colorcolumn = type(doom.max_columns) == "number" and tostring(doom.max_columns) or "" + vim.opt.colorcolumn = type(doom.settings.max_columns) == "number" and tostring(doom.settings.max_columns) or "" -- Number column - vim.opt.number = not doom.disable_numbering - vim.opt.relativenumber = not doom.disable_numbering and doom.relative_num + vim.opt.number = not doom.settings.disable_numbering + vim.opt.relativenumber = not doom.settings.disable_numbering and doom.settings.relative_num - vim.g.mapleader = doom.leader_key + vim.g.mapleader = doom.settings.leader_key end -- Path cases: diff --git a/lua/doom/core/doom_global.lua b/lua/doom/core/doom_global.lua index 7e0cd3839..12f7fa83f 100644 --- a/lua/doom/core/doom_global.lua +++ b/lua/doom/core/doom_global.lua @@ -48,173 +48,6 @@ _G._doom = {} --- Global object doom = { - -- Use the global statusline - -- @default = true - global_statusline = true, - - -- Leader key for keybinds - -- @default = ' ' - leader_key = " ", - - -- Pins plugins to a commit sha to prevent breaking changes - -- @default = true - freeze_dependencies = true, - - -- Enables impatent.nvim caching to speed up start time. - -- Can cause more issues so disabled by default - -- @default false - impatient_enabled = false, - - -- Autosave - -- false : Disable autosave - -- true : Enable autosave - -- @default = false - autosave = false, - - -- Disable Vim macros - -- false : Enable - -- true : Disable - -- @default = false - disable_macros = false, - - -- Disable ex mode - -- false : Enable - -- true : Disable - -- @default = false - disable_ex = true, - - -- Disable suspension - -- false : Enable - -- true : Disable - -- @default = false - disable_suspension = true, - - -- Set numbering - -- false : Enable number lines - -- true : Disable number lines - -- @default = false - disable_numbering = false, - - -- Set numbering style - -- false : Shows absolute number lines - -- true : Shows relative number lines - -- @default = true - relative_num = true, - - -- h,l, wrap lines - movement_wrap = true, - - -- Undo directory (set to nil to disable) - -- @default = vim.fn.stdpath("data") .. "/undodir/" - undo_dir = vim.fn.stdpath("data") .. "/undodir/", - - -- Set preferred border style across UI - border_style = "single", - - -- Preserve last editing position - -- false : Disable preservation of last editing position - -- true : Enable preservation of last editing position - -- @default = false - preserve_edit_pos = false, - - -- 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 = "vertical", - - -- Enable auto comment (current line must be commented) - -- false : disables auto comment - -- true : enables auto comment - -- @default = false - auto_comment = false, - - -- Enable Highlight on yank - -- false : disables highligh on yank - -- true : enables highlight on yank - -- @default = true - highlight_yank = true, - - -- Use clipboard outside of vim - -- false : won't use third party clipboard - -- true : enables third part clipboard - -- @default = true - clipboard = true, - - -- Enable guicolors - -- Enables gui colors on GUI versions of Neovim - -- @default = true - guicolors = true, - - -- Show hidden files - -- @default = true - show_hidden = true, - - -- Hide files listed in .gitignore from file browsers - -- @default = true - hide_gitignore = true, - - -- Checkupdates on start - -- @default = false - check_updates = false, - - -- sequences used for escaping insert mode - -- @default = { 'jk', 'kj' } - escape_sequences = { "jk", "kj" }, - - -- Use floating windows for plugins manager (packer) operations - -- @default = false - use_floating_win_packer = false, - - -- Set max cols - -- Defines the column to show a vertical marker - -- Set to false to disable - -- @default = 80 - max_columns = 80, - - -- Default indent size - -- @default = 4 - indent = 4, - - -- Logging level - -- Set Doom logging level - -- Available levels: - -- · trace - -- · debug - -- · info - -- · warn - -- · error - -- · fatal - -- @default = 'info' - logging = "info", - - -- Default colorscheme - -- @default = doom-one - colorscheme = "doom-one", - - -- 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, - }, - packages = {}, --- Wrapper around packer.nvim `use` function --- diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index b61e0e9a3..066d8ee41 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -30,6 +30,9 @@ require("doom.core.doom_global") local utils = require("doom.utils") +-- Load user settings +doom[ "settings" ] = dofile(utils.find_config("settings.lua")) + -- Boostraps the doom-nvim framework, runs the user's `config.lua` file. local config = utils.safe_require("doom.core.config") config.load() diff --git a/lua/doom/core/modules.lua b/lua/doom/core/modules.lua index 4312ced36..749ad94c3 100644 --- a/lua/doom/core/modules.lua +++ b/lua/doom/core/modules.lua @@ -33,7 +33,7 @@ local system = require("doom.core.system") --- Initial bootstrapping of packer including auto-installation if necessary --- Initial bootstrapping of impatient.nvim modules.start = function() - if doom.impatient_enabled then + if doom.settings.impatient_enabled then local has_impatient = pcall(require, "impatient") if not has_impatient then -- Packer Bootstrapping @@ -93,15 +93,15 @@ modules.start = function() }, }, display = { - open_fn = doom.use_floating_win_packer and function() - return require("packer.util").float({ border = doom.border_style }) + open_fn = doom.settings.use_floating_win_packer and function() + return require("packer.util").float({ border = doom.settings.border_style }) end, }, profile = { enable = true, }, log = { - level = doom.logging, + level = doom.settings.logging, }, }) @@ -125,7 +125,7 @@ modules.load_modules = function() end -- Set/unset frozen packer dependencies - packer_spec.commit = doom.freeze_dependencies and packer_spec.commit or nil + packer_spec.commit = doom.settings.freeze_dependencies and packer_spec.commit or nil -- Initialise packer use(packer_spec) diff --git a/lua/doom/core/ui.lua b/lua/doom/core/ui.lua index 0c6e0f1ff..1b5a60198 100644 --- a/lua/doom/core/ui.lua +++ b/lua/doom/core/ui.lua @@ -7,13 +7,13 @@ local utils = require("doom.utils") local log = require("doom.utils.logging") -- If the colorscheme was not found then fallback to defaults. -if not utils.is_empty(doom.colorscheme) then +if not utils.is_empty(doom.settings.colorscheme) then local loaded_colorscheme = xpcall(function() - vim.api.nvim_command("colorscheme " .. doom.colorscheme) + vim.api.nvim_command("colorscheme " .. doom.settings.colorscheme) end, debug.traceback) if not loaded_colorscheme then - log.warn("Colorscheme '" .. doom.colorscheme .. "' not found, falling back to doom-one") + log.warn("Colorscheme '" .. doom.settings.colorscheme .. "' not found, falling back to doom-one") vim.api.nvim_command("colorscheme doom-one") end else @@ -22,13 +22,13 @@ else end -- Set doom-one colorscheme settings -if doom.colorscheme == "doom-one" then +if doom.settings.colorscheme == "doom-one" then require("colors.doom-one").setup({ - cursor_coloring = doom.doom_one.cursor_coloring, - terminal_colors = doom.doom_one.terminal_colors, - italic_comments = doom.doom_one.italic_comments, - enable_treesitter = doom.doom_one.enable_treesitter, - transparent_background = doom.doom_one.transparent_background, + cursor_coloring = doom.settings.doom_one.cursor_coloring, + terminal_colors = doom.settings.doom_one.terminal_colors, + italic_comments = doom.settings.doom_one.italic_comments, + enable_treesitter = doom.settings.doom_one.enable_treesitter, + transparent_background = doom.settings.doom_one.transparent_background, pumblend = { enable = true, transparency_amount = doom.complete_transparency, @@ -39,7 +39,7 @@ if doom.colorscheme == "doom-one" then bufferline = true, gitgutter = false, gitsigns = true, - telescope = doom.doom_one.telescope_highlights, + telescope = doom.settings.doom_one.telescope_highlights, neogit = true, nvim_tree = true, dashboard = true, diff --git a/lua/doom/modules/core/doom/init.lua b/lua/doom/modules/core/doom/init.lua index c3291792f..daa647b9a 100644 --- a/lua/doom/modules/core/doom/init.lua +++ b/lua/doom/modules/core/doom/init.lua @@ -33,7 +33,7 @@ required.packages = { -- core.modules.lua so that packer doesn't try and clean it up. ["impatient.nvim"] = { "lewis6991/impatient.nvim", - disabled = not doom.impatient_enabled, + disabled = not doom.settings.impatient_enabled, }, } @@ -105,20 +105,20 @@ required.binds = function() } -- Conditionally disable macros - if doom.disable_macros then + if doom.settings.disable_macros then table.insert(binds, { "q", "" }) end -- Conditionally disable ex mode - if doom.disable_ex then + if doom.settings.disable_ex then table.insert(binds, { "Q", "" }) end -- Conditionally disable suspension - if doom.disable_suspension then + if doom.settings.disable_suspension then table.insert(binds, { "", "" }) end -- Exit insert mode fast - for _, esc_seq in pairs(doom.escape_sequences) do + for _, esc_seq in pairs(doom.settings.escape_sequences) do table.insert(binds, { esc_seq, "", mode = "i" }) end @@ -144,7 +144,7 @@ required.binds = function() horizontal = "", [false] = "e", } - local split_prefix = split_modes[doom.new_file_split] + local split_prefix = split_modes[doom.settings.new_file_split] table.insert(binds, { "", name = "+prefix", @@ -314,11 +314,11 @@ end required.autocmds = function() local autocmds = {} - if doom.autosave then + if doom.settings.autosave then table.insert(autocmds, { "TextChanged,InsertLeave", "", "silent! write" }) end - if doom.highlight_yank then + if doom.settings.highlight_yank then table.insert(autocmds, { "TextYankPost", "*", @@ -328,7 +328,7 @@ required.autocmds = function() }) end - if doom.preserve_edit_pos then + if doom.settings.preserve_edit_pos then table.insert(autocmds, { "BufReadPost", "*", diff --git a/lua/doom/modules/features/explorer/init.lua b/lua/doom/modules/features/explorer/init.lua index 721c02bc4..307ebf86c 100644 --- a/lua/doom/modules/features/explorer/init.lua +++ b/lua/doom/modules/features/explorer/init.lua @@ -159,10 +159,10 @@ explorer.configs["nvim-tree.lua"] = function() }, }, filters = { - dotfiles = not doom.show_hidden, + dotfiles = not doom.settings.show_hidden, }, git = { - ignore = doom.hide_gitignore, + ignore = doom.settings.hide_gitignore, }, }, doom.features.explorer.settings, override_table) require("nvim-tree").setup(config) diff --git a/lua/doom/modules/features/lsp/init.lua b/lua/doom/modules/features/lsp/init.lua index df76f847b..8cd31c354 100644 --- a/lua/doom/modules/features/lsp/init.lua +++ b/lua/doom/modules/features/lsp/init.lua @@ -175,10 +175,10 @@ lsp.configs["nvim-lspconfig"] = function() }) -- Border for lsp_popups vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = doom.border_style, + border = doom.settings.border_style, }) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = doom.border_style, + border = doom.settings.border_style, }) -- symbols for autocomplete local kinds = {} @@ -301,13 +301,11 @@ lsp.configs["nvim-cmp"] = function() end lsp.configs["lsp_signature.nvim"] = function() -- Signature help - require("lsp_signature").setup( - vim.tbl_deep_extend("force", doom.features.lsp.settings.signature, { - handler_opts = { - border = doom.border_style, - }, - }) - ) + require("lsp_signature").setup(vim.tbl_deep_extend("force", doom.features.lsp.settings.signature, { + handler_opts = { + border = doom.settings.border_style, + }, + })) end lsp.binds = { @@ -370,7 +368,7 @@ lsp.binds = { function() vim.diagnostic.open_float(0, { focusable = false, - border = doom.border_style, + border = doom.settings.border_style, }) end, name = "Line", diff --git a/lua/doom/modules/features/netrw/init.lua b/lua/doom/modules/features/netrw/init.lua index fb3a8a52e..d62fa5c6f 100644 --- a/lua/doom/modules/features/netrw/init.lua +++ b/lua/doom/modules/features/netrw/init.lua @@ -35,7 +35,7 @@ vim.g.netrw_list_hide = vim.fn["netrw_gitignore#Hide"]() -- 0 : show all files -- 1 : show not-hidden files -- 2 : show hidden files only -vim.g.netrw_hide = not doom.show_hidden +vim.g.netrw_hide = not doom.settings.show_hidden -- Preview files in a vertical split window -- vim.g.netrw_preview = 1 diff --git a/lua/doom/modules/features/whichkey/init.lua b/lua/doom/modules/features/whichkey/init.lua index bc7d63a09..ffdc45cd8 100644 --- a/lua/doom/modules/features/whichkey/init.lua +++ b/lua/doom/modules/features/whichkey/init.lua @@ -39,7 +39,7 @@ whichkey.settings = { }, window = { padding = { 0, 0, 0, 0 }, - border = doom.border_style, + border = doom.settings.border_style, }, layout = { height = { min = 1, max = 10 }, diff --git a/lua/doom/utils/logging.lua b/lua/doom/utils/logging.lua index d7ef21bda..9cdf81c19 100644 --- a/lua/doom/utils/logging.lua +++ b/lua/doom/utils/logging.lua @@ -12,7 +12,7 @@ local default_config = { use_console = true, highlights = true, use_file = true, - level = doom.logging, + level = doom.settings.logging, modes = { { name = "trace", hl = "Comment" }, { name = "debug", hl = "Comment" }, diff --git a/settings.lua b/settings.lua new file mode 100644 index 000000000..5d51f0277 --- /dev/null +++ b/settings.lua @@ -0,0 +1,177 @@ +return { + -- Use the global statusline + -- @default = true + global_statusline = true, + + -- Leader key for keybinds + -- @default = ' ' + leader_key = ' ', + + -- Enables impatent.nvim caching to speed up start time. + -- Can cause more issues so disabled by default + -- @default false + impatient_enabled = false, + + + -- Pins plugins to a commit sha to prevent breaking changes + -- @default = true + freeze_dependencies = true, + + -- Autosave + -- false : Disable autosave + -- true : Enable autosave + -- @default = false + autosave = false, + + -- Disable Vim macros + -- false : Enable + -- true : Disable + -- @default = false + disable_macros = false, + + -- Disable ex mode + -- false : Enable + -- true : Disable + -- @default = false + disable_ex = true, + + -- Disable suspension + -- false : Enable + -- true : Disable + -- @default = false + disable_suspension = true, + + -- Set numbering + -- false : Enable number lines + -- true : Disable number lines + -- @default = false + disable_numbering = false, + + -- Set numbering style + -- false : Shows absolute number lines + -- true : Shows relative number lines + -- @default = true + relative_num = true, + + + -- h,l, wrap lines + movement_wrap = true, + + -- Undo directory (set to nil to disable) + -- @default = vim.fn.stdpath("data") .. "/undodir/" + undo_dir = vim.fn.stdpath("data") .. "/undodir/", + + -- Set preferred border style across UI + border_style = "single", + + -- Preserve last editing position + -- false : Disable preservation of last editing position + -- true : Enable preservation of last editing position + -- @default = false + preserve_edit_pos = false, + + -- 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 = "vertical", + + -- Enable auto comment (current line must be commented) + -- false : disables auto comment + -- true : enables auto comment + -- @default = false + auto_comment = false, + + -- Enable Highlight on yank + -- false : disables highligh on yank + -- true : enables highlight on yank + -- @default = true + highlight_yank = true, + + -- Use clipboard outside of vim + -- false : won't use third party clipboard + -- true : enables third part clipboard + -- @default = true + clipboard = true, + + -- Enable guicolors + -- Enables gui colors on GUI versions of Neovim + -- @default = true + guicolors = true, + + -- Show hidden files + -- @default = true + show_hidden = true, + + -- Hide files listed in .gitignore from file browsers + -- @default = true + hide_gitignore = true, + + -- Checkupdates on start + -- @default = false + check_updates = false, + + -- sequences used for escaping insert mode + -- @default = { 'jk', 'kj' } + escape_sequences = { "jk", "jk" }, + + -- If you require a specific command to be run when initiating a terminal + -- @default = "" + term_exec_cmd = "", + + -- Use floating windows for plugins manager (packer) operations + -- @default = false + use_floating_win_packer = false, + + -- Set max cols + -- Defines the column to show a vertical marker + -- Set to false to disable + -- @default = 80 + max_columns = 80, + + -- Default indent size + -- @default = 4 + indent = 4, + + -- Logging level + -- Set doom.settings.logging level + -- Available levels: + -- · trace + -- · debug + -- · info + -- · warn + -- · error + -- · fatal + -- @default = 'info' + logging = "warn", + + -- Default colorscheme + -- @default = doom-one + colorscheme = "doom-one", + + -- TODO: this one is used but hasn't been defined yet. + -- complete_transparency = ??, + + -- 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, + }, +}