diff --git a/doc/doom_nvim.txt b/doc/doom_nvim.txt index 6096587cb..4bf880187 100644 --- a/doc/doom_nvim.txt +++ b/doc/doom_nvim.txt @@ -56,11 +56,11 @@ INTRODUCTION *doom_nvim_intro* Doom Neovim is a Neovim port of the Doom Emacs configuration framework, adapted for the Neovim user that wants less framework in their framework and the performance -of a hand-made configuration. You can use it as a base for your own setup or as +of a hand-made configuration. You can use it as a base for your own setup or as a learning resource on how to achieve a great Neovim configuration. Doom Neovim features an opinionated collection of reasonable and optional -defaults, with a focus on runtime and startup performance, and a clean, +defaults, with a focus on runtime and startup performance, and a clean, readable code base. @@ -81,7 +81,7 @@ COLORSCHEME *doom_nvim_colorscheme* The colorscheme of Doom Nvim. Default is `doom-one`. There are some additional doom emacs' colorschemes port for Neovim that can be enabled by uncommenting -the `doom-themes` in your `doomrc.lua`. +the `doom-themes` in your `doom_modules.lua`. You can switch between colorschemes by doing ds and then type the name of the colorscheme you want to use. You can also edit the `doom_config.lua` @@ -129,7 +129,7 @@ See |doom_nvim_commands| for more information. ============================================================================== FILE EXPLORER *doom_nvim_configuration_layout_explorer* -Doom Neovim uses the `kyazdani42/nvim-tree.lua` plugin as a file explorer. +Doom Neovim uses the `kyazdani42/nvim-tree.lua` plugin as a file explorer. It can be toggled by running the following commands: oe for `FileExplorer` for `FileExplorer` @@ -222,11 +222,11 @@ and Doom Nvim will automatically handle your changes on here. ============================================================================== CUSTOM PLUGINS *doom_nvim_configuration_custom_plugins* -To use your own plugins in Doom Nvim you can use the `plugins.lua` file -located in the Doom Nvim root directory. +To use your own plugins in Doom Nvim you can use the `doom_userplugins.lua` +file located in the Doom Nvim root directory. NOTE: if you are familiar with `packer.nvim` (the plugins manager used by Doom -Nvim) then you can see the `plugins.lua` file as a wrapper for it. +Nvim) then you can see the `doom_userplugins.lua` file as a wrapper for it. To add plugins without extra configurations (e.g., if a plugin does not depend on other plugins), you can simply set it as follow: @@ -259,8 +259,8 @@ having to manually configure servers, Doom Nvim makes use of To enable the language server for a certain programming language and automatically install it, just append a `+lsp` flag at the end of the language -field in your `doomrc.lua`, e.g. for enabling Rust support in Doom and install -`rust-analyzer`: +field in your `doom_modules.lua`, e.g. for enabling Rust support in Doom and +install `rust-analyzer`: ` local doom = {` ` langs = {` @@ -495,9 +495,9 @@ development environment without spending a lot of time setting everything up. - Why does Doom Nvim only support Neovim 0.5.0 (and beyond)? -Doom Nvim relies on lua for the configuration and use of many plugins. Since +Doom Nvim relies on lua for the configuration and use of many plugins. Since lua is not available in neovim 0.4.4 and below, it is not possible to use Doom -Nvim with a neovim version lower than 0.5.0. However, the Doom Nvim installer +Nvim with a neovim version lower than 0.5.0. However, the Doom Nvim installer automatically installs Neovim 0.5.0 for you! ============================================================================== @@ -515,7 +515,9 @@ This is the structure of Doom Nvim: ├── doc # Doom Nvim documentation to be used inside Nvim │ └── doom_nvim.txt # Doom Nvim help file ├── docs # Doom Nvim docs meant to be readed on GitHub -├── doomrc # Doom Nvim user configurations file +├── doom_config.lua # Doom Nvim user configurations file +├── doom_modules.lua # Doom Nvim user module selection +├── doom_userplugins.lua # Doom Nvim user plugins ├── init.lua # init.lua file ├── install.sh # Doom Nvim installer ├── LICENSE # Doom Nvim License @@ -537,8 +539,8 @@ This is the structure of Doom Nvim: │ └── init.lua # packer.nvim setup └── sessions # Location of Neovim workspaces -Doom Nvim also sets default configurations for the `doomrc.lua` and the -`doom_config.lua` files, which serves as the user configuration file +Doom Nvim also sets default configurations for the `doom_config.lua` and the +`doom_modules.lua` files, which serves as the user configuration file if it is not present on the system. It allows a fine control over the core functions of Doom Nvim. diff --git a/docs/contributing.md b/docs/contributing.md index d98e230ae..acb2008ca 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -50,7 +50,7 @@ thus reach a solution more quickly. Some important data would be: - Your custom configuration if you have one - (`doomrc.lua`, `doom_config.lua` and `plugins.lua`) + (`doom_modules.lua`, `doom_config.lua` and `doom_userplugins.lua`) - Which branch of Doom Nvim are you using - Which plugins are you using diff --git a/docs/getting_started.md b/docs/getting_started.md index 3ec4fa1ac..61ee5ce1e 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -305,11 +305,11 @@ a previous release (for main branch) or a previous commit (for development branc ## Configuration -You can configure Doom Nvim by tweaking the `doomrc.lua`, `doom_config.lua` and -the `plugins.lua` files located in your Doom Nvim root directory -(`$HOME/.config/doom-nvim/` by default). +You can configure Doom Nvim by tweaking the `doom_config.lua`, +`doom_modules.lua` and the `doom_userplugins.lua` files located in your +Doom Nvim root directory (`$HOME/.config/doom-nvim/` by default). -### doomrc.lua +### doom_modules.lua This file handles all the Doom Nvim modules, its structure is really simple and easy to understand. @@ -317,74 +317,81 @@ easy to understand. This one will look like that: ```lua -local doom = { - ui = { - 'dashboard', -- Start screen - -- 'doom-themes', -- Additional doom emacs' colorschemes - 'statusline', -- Statusline - 'tabline', -- Tabline, shows your buffers list at top - -- 'zen', -- Distraction free environment - 'which-key', -- Keybindings popup menu like Emacs' guide-key - -- 'indentlines', -- Show indent lines - }, - doom = { - -- 'neorg', -- Life Organization Tool - -- 'runner', -- Open a REPL for the current language or run the current file - -- 'compiler', -- Compile (and run) your code with just pressing three keys! - }, - editor = { - 'auto-session', -- A small automated session manager for Neovim - -- 'terminal', -- Terminal for Neovim (NOTE: needed for runner and compiler) - 'explorer', -- Tree explorer - 'symbols', -- LSP symbols and tags - -- 'minimap', -- Code minimap, requires github.com/wfxr/code-minimap - 'gitsigns', -- Git signs - 'telescope', -- Highly extendable fuzzy finderover lists - -- 'restclient', -- A fast Neovim http client - 'formatter', -- File formatting - 'autopairs', -- Autopairs - -- 'editorconfig', -- EditorConfig support for Neovim - 'kommentary', -- Comments plugin - 'lsp', -- Language Server Protocols - 'snippets', -- LSP snippets - }, - langs = { - -- To enable the language server for a language justadd the +lsp flag - -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter - -- parser and rust-analyzer - -- - -- 'html', -- HTML support - -- 'css', -- CSS support - -- 'javascript', -- JavaScript support - -- 'typescript', -- TypeScript support - -- 'bash', -- The terminal gods language - -- 'python +lsp', -- Python support + lsp - -- 'ruby', -- Look ma, I love the gems! - 'lua', -- Support for our gods language - -- 'elixir', -- Build scalable and maintainablesoftware - -- 'haskell', -- Because Functional programming is fun, isn't it? - - -- 'rust +lsp', -- Let's get rusty! - -- 'go', -- Hello, gopher - -- 'cpp', -- C++ support - -- 'java', -- Java support - - -- 'config', -- Configuration files (JSON, YAML, TOML) - -- 'dockerfile', -- Do you like containers, right? - }, - utilities = { - -- 'suda', -- Write and read files without sudo permissions - -- 'lazygit', -- LazyGit integration for Neovim, requires LazyGit - -- 'neogit', -- Magit for Neovim - -- 'colorizer', -- Fastets colorizer for Neovim - 'range-highlight', -- hightlights ranges you haveentered in commandline - }, +local M = {} +M.source = debug.getinfo(1, "S").source:sub(2) + +M.modules = { + ui = { + "dashboard", -- Start screen + -- "doom-themes", -- Additional doom emacs' colorschemes + -- "indentlines", -- Show indent lines + -- "show_registers", -- popup that shows register contents + "statusline", -- Statusline + "tabline", -- Tabline, shows your buffers list at top + "which-key", -- Keybindings popup menu like Emacs' guide-key + -- "zen", -- Distraction free environment + }, + doom = { + -- "compiler", -- Compile (and run) your code with just pressing three keys! + -- "neorg", -- Life Organization Tool + -- "runner", -- Open a REPL for the current language or run the current file + }, + editor = { + "autopairs", -- Autopairs + "auto-session", -- A small automated session manager for Neovim + "dap", -- Debug Adapter Protocol + -- "editorconfig", -- EditorConfig support for Neovim + "explorer", -- Tree explorer + "formatter", -- File formatting + "gitsigns", -- Git signs + "kommentary", -- Comments plugin + "lsp", -- Language Server Protocols + -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap + -- "ranger", -- Ranger File Browser, requires ranger file browser + "snippets", -- LSP snippets + "symbols", -- LSP symbols and tags + "telescope", -- Highly extendable fuzzy finder over lists + -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) + }, + langs = { + -- To enable the language server for a language just add the +lsp flag + -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter + -- parser and rust-analyzer + -- + -- "bash", -- The terminal gods language + -- "config", -- Configuration files (JSON, YAML, TOML) + -- "cpp", -- C++ support + -- "css", -- CSS support + -- "dockerfile", -- Do you like containers, right? + -- "elixir", -- Build scalable and maintainable software + -- "go", -- Hello, gopher + -- "haskell", -- Because Functional programming is fun, isn't it? + -- "html", -- HTML support + -- "java", -- Java support + -- "javascript", -- JavaScript support + "lua", -- Support for our gods language + -- "python +lsp", -- Python support + lsp + -- "ruby", -- Look ma, I love the gems! + -- "rust +lsp", -- Let's get rusty! + -- "typescript", -- TypeScript support + }, + utilities = { + -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit + -- "neogit", -- Magit for Neovim + "range-highlight", -- hightlights ranges you have entered in commandline + -- "suda", -- Write and read files without sudo permissions + }, + web = { + -- "colorizer", -- Fastest colorizer for Neovim + -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config + -- "restclient", -- A fast Neovim http client + } } -return doom +return M ``` -And as the `doomrc.lua` file self-documentation says, you will only need to uncomment +And as the `doom_modules.lua` file self-documentation says, you will only need to uncomment or comment the plugins names in order to enable or disable them. e.g. to enable the `terminal` plugin you will only need to uncomment the `-- 'terminal',` line and restart Neovim. Doom will automatically handle your changes and install the `terminal` plugin for you. @@ -419,7 +426,7 @@ return { > **NOTE**: all your used-defined configurations here will be live-reloaded, e.g. > mappings, autocommands, etc. -### plugins.lua +### doom_userplugins.lua This file handles your custom plugins, in other words, it handles all the extra plugins you need that are not covered by Doom Nvim. @@ -440,7 +447,7 @@ return { } ``` -And as with the `doomrc.lua` file, Doom Nvim will automatically handle your changes +And as with the `doom_modules.lua` file, Doom Nvim will automatically handle your changes and install or uninstall the plugins declared on here. > **NOTE**: all the valid options for declaring plugins can be found in @@ -450,7 +457,7 @@ and install or uninstall the plugins declared on here. Doom Nvim consists of around 5 modules. A Doom Nvim Module is a bundle of plugins, configuration and commands, organized into a unit that can be toggled easily by -tweaking your `doomrc.lua` (found in `$HOME/.config/doom-nvim`). +tweaking your `doom_modules.lua` (found in `$HOME/.config/doom-nvim`). Please see [Plugin Management](#plugin-management) for more information. @@ -464,7 +471,7 @@ in your Doom Nvim root directory. Read on to learn how to use this system to ins your own plugins. > **WARNING:** Do not install plugins directly in `lua/doom/modules/init.lua`. Instead, -> use your `doomrc.lua` and `plugins.lua` files to modify them. +> use your `doom_modules.lua` and `doom_userplugins.lua` files to modify them. ### Configuring Doom @@ -480,7 +487,7 @@ Do you want to change some configurations of some modules? Go to `lua/doom/modules/config` directory and you will find the configurations for the plugins. -Otherwise if you want to configure a plugin declared in your `plugins.lua` you +Otherwise if you want to configure a plugin declared in your `doom_userplugins.lua` you can use the packer's `config` field, e.g. ```lua @@ -500,7 +507,7 @@ To easily install language servers and without having to do it system-wide or ha manually configure servers, Doom Nvim makes use of [kabouzeid/nvim-lspinstall](https://github.com/kabouzeid/nvim-lspinstall). To enable the language server for a certain programming language and automatically -install it, just append a `+lsp` flag at the end of the language field in your `doomrc.lua`, +install it, just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`, e.g. for enabling Rust support in Doom and install `rust-analyzer`: ```lua @@ -545,7 +552,7 @@ But first let's see what's new: - New logging system powered by [vlog]. A faster and smaller logging system because complexity is not always the best choice. - Easily enable and disable plugins. Now toggling the doom default plugins is easier - than before, just comment or uncomment it in your `doomrc.lua`! + than before, just comment or uncomment it in your `doom_modules.lua`! - Better custom plugins management. Now the custom plugins are being directly handled by packer as it should be, no more nonsense wrappers around it. - Better updating mechanism. Forget these annoying merging issues and save the @@ -618,12 +625,12 @@ And now, how can I start using the new configuration files? I'm going to explain you in a short way because the new configuration files has a rich documentation inside them. -- `doomrc.lua`, this file handles the Doom Nvim modules, in other words, which +- `doom_modules.lua`, this file handles the Doom Nvim modules, in other words, which plugins are being installed and loaded and which plugins are not. - `doom_config.lua`, this file handles the user configurations for doom nvim, e.g. if mouse is enabled or not. This one also handles user-defined Neovim configurations like global variables and mappings. -- `plugins.lua`, this file handles the user-defined plugins, it is the +- `doom_userplugins.lua`, this file handles the user-defined plugins, it is the replacement for the `custom_plugins` field in the old doomrc. > Are you having issues with the 3.0.0 version? Don't hesitate to [report them] diff --git a/docs/modules.md b/docs/modules.md index 648d89de3..e00d58804 100644 --- a/docs/modules.md +++ b/docs/modules.md @@ -10,7 +10,7 @@ organized into a unit that can be toggled easily. ## Tweaking Doom Nvim Modules -You can easily tweak Doom Nvim Modules by tweaking your `doomrc.lua` file +You can easily tweak Doom Nvim Modules by tweaking your `doom_modules.lua` file (found in `~/.config/doom-nvim`). ## List of modules @@ -37,56 +37,54 @@ without them. These plugins are the following: - Vim dashboard (start screen). - [doom-themes] - Additional doom emacs' colorschemes. +- [indentlines] + - Show indent lines. - [statusline] - Neovim statusline. - [tabline] - Tabline, shows your buffers list at top. -- [zen] - - Distraction free environment. - [which-key] - Keybindings popup like Emacs' guide-key. -- [indentlines] - - Show indent lines. +- [zen] + - Distraction free environment. ### Doom +- [compiler] (built-in) + - Compile _and run_ your projects with only a few keystrokes. - [neorg] - Life Organization Tool. - [runner] (built-in) - A code runner for your interpreted code. -- [compiler] (built-in) - - Compile _and run_ your projects with only a few keystrokes. ### Editor +- [autopairs] + - Autopairs. - [auto-session] - A small automated session manager for Neovim. -- [terminal] - - Terminal for Neovim. +- [editorconfig] + - EditorConfig support for Neovim, let other argue about tabs vs spaces. - [explorer] - Tree explorer. -- [symbols] - - LSP symbols and tags. -- [minimap] - - Code minimap, requires [wfxr/code-minimap](https://github.com/wfxr/code-minimap). -- [gitsigns] - - Git signs. -- [telescope] - - Highly extendable fuzzy finder over lists. -- [restclient] - - A fast Neovim http client. - [formatter] - File formatting. -- [autopairs] - - Autopairs. -- [editorconfig] - - EditorConfig support for Neovim, let other argue about tabs vs spaces. +- [gitsigns] + - Git signs. - [kommentary] - Comments plugin. - [lsp] - Language Server Protocols ([compe] + [lspinstall]). +- [minimap] + - Code minimap, requires [wfxr/code-minimap](https://github.com/wfxr/code-minimap). - snippets - Code snippets ([LuaSnip] + [friendly-snippets]). +- [symbols] + - LSP symbols and tags. +- [telescope] + - Highly extendable fuzzy finder over lists. +- [terminal] + - Terminal for Neovim. ### Langs @@ -105,13 +103,13 @@ The currently available flags are the following: #### Web development -- **html** - - HTML support. +- **css** + - CSS support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. -- **css** - - CSS support. +- **html** + - HTML support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. @@ -133,6 +131,15 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. +- **elixir** + - Elixir support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. +- **lua** + - Lua support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: no (it has but isn't supported by Doom _yet_, requires extra setup). - **python** - Python support. - TreeSitter based syntax highlighting: yes. @@ -143,25 +150,11 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: yes. -- **lua** - - Lua support. - - TreeSitter based syntax highlighting: yes. - - LSP: yes. - - DAP client: no (it has but isn't supported by Doom _yet_, requires extra setup). -- **elixir** - - Elixir support. - - TreeSitter based syntax highlighting: yes. - - LSP: yes. #### Compiled -- **haskell** - - Haskell support. - - TreeSitter based syntax highlighting: yes. - - LSP: yes. - - DAP client: no. -- **rust** - - Rust support. +- **cpp** + - CPP support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: yes (not supported _yet_ by Doom for automatic installation). @@ -170,16 +163,21 @@ The currently available flags are the following: - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: yes. -- **cpp** - - CPP support. +- **haskell** + - Haskell support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - - DAP client: yes (not supported _yet_ by Doom for automatic installation). + - DAP client: no. - **java** - Java support. - TreeSitter based syntax highlighting: yes. - LSP: yes. - DAP client: no. +- **rust** + - Rust support. + - TreeSitter based syntax highlighting: yes. + - LSP: yes. + - DAP client: yes (not supported _yet_ by Doom for automatic installation). #### Configs & DevOps @@ -196,16 +194,21 @@ The currently available flags are the following: ### Utilities -- [suda] - - Write and read files without sudo permissions. - [lazygit] - LazyGit integration for neovim, requires LazyGit. - [neogit] - Magit for Neovim. -- [colorizer] - - Fastest colorizer for Neovim. - [range-highlight] - Highlights ranges you have entered in commandline +- [suda] + - Write and read files without sudo permissions. + +### Web + +- [colorizer] + - Fastest colorizer for Neovim. +- [restclient] + - A fast Neovim http client. ## Managing modules diff --git a/doom_config.lua b/doom_config.lua index 70181722e..2148eb807 100644 --- a/doom_config.lua +++ b/doom_config.lua @@ -1,3 +1,5 @@ +local M = {} +M.source = debug.getinfo(1, "S").source:sub(2) -- doom_config - Doom Nvim user configurations file -- -- This file contains the user-defined configurations for Doom nvim and consists @@ -8,379 +10,380 @@ -- 2. Nvim, this one defines all the custom configurations that you want to -- use in Neovim, e.g. a colorscheme italic_comments global variable --- {{{ Doom -local doom = { - -- Autosave - -- false : Disable autosave - -- true : Enable autosave - -- @default = false - autosave = false, - - -- Format on save - -- false : Disable format on save - -- true : Enable format on save - -- @default = false - fmt_on_save = false, - - -- Disable Vim macros - -- false : Enable Vim macros - -- true : Disable Vim macros - -- @default = false - disable_macros = false, - - -- Autosave sessions - -- false : Disable session autosave - -- true : Enable session autosave - -- @default = false - autosave_sessions = false, - - -- Autoload sessions - -- false : Disable session autoload - -- true : Enable session autoload - -- @default = false - autoload_last_session = false, - - -- Enable Swap files - -- false : no swap files - -- true : enables swap files - -- @default = false - swap_files = false, - - -- Undo Directories - -- the backup variable enables backup related settings (undofile, undodir) - -- false : ignores undo Directories (this code block will be ignored) - -- true : enable undo files/undo dirs. - -- @default = false - backup = false, -- WARNING: if you change this to false and you have an undo dir already, it will REMOVE the undodir (loss of data might take place) - - -- Enable Line wrapping - -- false : disables line wrapping - -- true : enables line wrapping - -- @default = false - line_wrap = false, - - -- Enable Show mode ( -- INSERT --, -- NORMAL --, -- VISUAL -- ) - -- false : disables show mode - -- true : enables show mode - -- @default = false - show_mode = false, - - -- Enable scroll off - -- false : disables scroll off - -- true : enables scroll off - -- @default = true, @default scrolloff_amount = 4, - scrolloff = true, - scrolloff_amount = 4, - - -- Enable mouse - -- false : disables mouse - -- true : enables mouse - -- @default = true - mouse = true, - - -- Preserve last editing position - -- false : Disable preservation of last editing position - -- true : Enable preservation of last editing position - -- @default = false - preserve_edit_pos = false, - - -- Allow overriding the default Doom Nvim keybinds - -- false : Default keybinds cannot be overwritten - -- true : Default keybinds can be overwritten - -- @default = true - allow_default_keymaps_overriding = true, - - -- horizontal split on creating a new file (fn) - -- false : doesn't split the window when creating a new file - -- true : horizontal split on creating a new file - -- @default = true - new_file_split = true, - - -- enable current line highlight - -- false : disables current line highlight - -- true : enables current line highlight - -- @default = true - line_highlight = true, - - -- Automatically split right - -- false : splits right (vertically) - -- true : splits left (vertically) - -- @default = true - split_right = true, - - -- Automatically split above - -- false : splits above (horizontally) - -- true : splits below (horizontally) - -- @default = true - split_below = true, - - -- Use clipboard outside of vim - -- false : won't use third party clipboard - -- true : enables third part clipboard - -- @default = true - clipboard = true, - - -- Enable auto comment (current line must be commented) - -- false : disables auto comment - -- true : enables auto comment - -- @default = false - auto_comment = false, - - -- Show indent lines - -- @default = true - show_indent = true, - - -- Expand tabs - -- Specifies if spaces or tabs must be used - -- false : spaces - -- true : tabs - -- @default = true - expand_tabs = true, - - -- Set numbering - -- false : Shows absolute number lines - -- true : Shows relative number lines - -- @default = true - relative_num = true, - - -- Enable winwidth - -- false : Manually set win width - -- true : Active window auto sets width - -- @default = false, @default win_width_nr = 85 - win_width = false, - win_width_nr = 85, - - -- Enable Highlight on yank - -- false : disables highligh on yank - -- true : enables highlight on yank - -- @default = true - highlight_yank = true, - - -- Enable guicolors - -- Enables gui colors on GUI versions of Neovim - -- @default = true - enable_guicolors = true, - - -- Tree explorer on the right - -- Places the Tree explorer buffer to the right when enabled - -- @default = false - explorer_right = false, - - -- Show hidden files - -- @default = true - show_hidden = true, - - -- Checkupdates on start - -- @default = false - check_updates = false, - - -- Auto install plugins on launch, useful if you don't want to run - -- PackerInstall every time you add a new plugin - -- @default = true - auto_install_plugins = true, - - -- Disable dashboard status line (does not work perfectly) - -- false : disables dashboard status line - -- true : enables dashboard status line - -- @default = true - dashboard_statline = true, - - -- Default indent size - -- @default = 4 - indent = 4, - - -- Set max cols - -- Defines the column to show a vertical marker - -- @default = 80 - max_columns = 80, - - -- Completion box height - -- @default = 10 - complete_size = 10, - - -- Completion box transparency - -- 0 = no transparency - -- 100 = fully transparent - -- @default = 25 - complete_transparency = 25, - - -- Sidebar sizing - -- Specifies the default width of Tree Explorer and Tagbar - -- @default = 25 - sidebar_width = 25, - - -- Set the Terminal width - -- Applies only to float direction - -- @default = 70 - terminal_width = 70, - - -- Set the Terminal height - -- Applies to all directions except window - -- @default = 20 - terminal_height = 20, - - -- Conceal level - -- Set Neovim conceal level - -- 0 : Disable indentline and show all - -- 1 : Conceal some functions and show indentlines - -- 2 : Concealed text is completely hidden unless it has a custom replacement - -- character defined - -- 3 : Concealed text is completely hidden - conceallevel = 0, - - -- Logging level - -- Set Doom logging level - -- Available levels: - -- · trace - -- · debug - -- · info - -- · warn - -- · error - -- · fatal - -- @default = 'info' - logging = "info", - - -- Set the Terminal direction - -- Available directions: - -- - vertical - -- - horizontal - -- - window - -- - float - -- @default = 'horizontal' - terminal_direction = "horizontal", - - -- NOTE: This will only be activated if 'backup' is true. - -- We don'recommend you put this outside of neovim so we've restricted to the path: ~/.config/nvim - -- WARNING: only put the folder name that you want. (eg: undo_dir = '/undodir') - -- @default_directory = '~/.config/nvim/undodir' - undo_dir = "/undodir", - - -- Default colorscheme - -- @default = doom-one - colorscheme = "doom-one", - - -- Background color - -- @default = dark - colorscheme_bg = "dark", - - -- Doom One colorscheme settings - doom_one = { - -- If the cursor color should be blue +M.config = { + -- {{{ Doom + doom = { + -- Autosave + -- false : Disable autosave + -- true : Enable autosave -- @default = false - cursor_coloring = false, - -- If TreeSitter highlighting should be enabled + autosave = false, + + -- Format on save + -- false : Disable format on save + -- true : Enable format on save + -- @default = false + fmt_on_save = false, + + -- Disable Vim macros + -- false : Enable Vim macros + -- true : Disable Vim macros + -- @default = false + disable_macros = false, + + -- Autosave sessions + -- false : Disable session autosave + -- true : Enable session autosave + -- @default = false + autosave_sessions = false, + + -- Autoload sessions + -- false : Disable session autoload + -- true : Enable session autoload + -- @default = false + autoload_last_session = false, + + -- Enable Swap files + -- false : no swap files + -- true : enables swap files + -- @default = false + swap_files = false, + + -- Undo Directories + -- the backup variable enables backup related settings (undofile, undodir) + -- false : ignores undo Directories (this code block will be ignored) + -- true : enable undo files/undo dirs. + -- @default = false + -- WARNING: if you change this to false and you have an undo dir already, + -- it will REMOVE the undodir (loss of data might take place) + backup = false, + + -- Enable Line wrapping + -- false : disables line wrapping + -- true : enables line wrapping + -- @default = false + line_wrap = false, + + -- Enable Show mode ( -- INSERT --, -- NORMAL --, -- VISUAL -- ) + -- false : disables show mode + -- true : enables show mode + -- @default = false + show_mode = false, + + -- Enable scroll off + -- false : disables scroll off + -- true : enables scroll off + -- @default = true, @default scrolloff_amount = 4, + scrolloff = true, + scrolloff_amount = 4, + + -- Enable mouse + -- false : disables mouse + -- true : enables mouse -- @default = true - enable_treesitter = true, - -- If the comments should be italic + mouse = true, + + -- Preserve last editing position + -- false : Disable preservation of last editing position + -- true : Enable preservation of last editing position -- @default = false - italic_comments = false, - -- If the telescope plugin window should be colored + preserve_edit_pos = false, + + -- Allow overriding the default Doom Nvim keybinds + -- false : Default keybinds cannot be overwritten + -- true : Default keybinds can be overwritten + -- @default = true + allow_default_keymaps_overriding = true, + + -- horizontal split on creating a new file (fn) + -- false : doesn't split the window when creating a new file + -- true : horizontal split on creating a new file + -- @default = true + new_file_split = true, + + -- enable current line highlight + -- false : disables current line highlight + -- true : enables current line highlight + -- @default = true + line_highlight = true, + + -- Automatically split right + -- false : splits right (vertically) + -- true : splits left (vertically) + -- @default = true + split_right = true, + + -- Automatically split above + -- false : splits above (horizontally) + -- true : splits below (horizontally) -- @default = true - telescope_highlights = true, - -- If the built-in Neovim terminal should use the doom-one - -- colorscheme palette + split_below = true, + + -- Use clipboard outside of vim + -- false : won't use third party clipboard + -- true : enables third part clipboard + -- @default = true + clipboard = true, + + -- Enable auto comment (current line must be commented) + -- false : disables auto comment + -- true : enables auto comment -- @default = false - terminal_colors = true, - -- If the Neovim instance should be transparent + auto_comment = false, + + -- Show indent lines + -- @default = true + show_indent = true, + + -- Expand tabs + -- Specifies if spaces or tabs must be used + -- false : spaces + -- true : tabs + -- @default = true + expand_tabs = true, + + -- Set numbering + -- false : Shows absolute number lines + -- true : Shows relative number lines + -- @default = true + relative_num = true, + + -- Enable winwidth + -- false : Manually set win width + -- true : Active window auto sets width + -- @default = false, @default win_width_nr = 85 + win_width = false, + win_width_nr = 85, + + -- Enable Highlight on yank + -- false : disables highligh on yank + -- true : enables highlight on yank + -- @default = true + highlight_yank = true, + + -- Enable guicolors + -- Enables gui colors on GUI versions of Neovim + -- @default = true + enable_guicolors = true, + + -- Tree explorer on the right + -- Places the Tree explorer buffer to the right when enabled -- @default = false - transparent_background = false, - }, + explorer_right = false, - -- Set gui fonts here - -- @default = "FiraCode Nerd Font", @default font size = 15, - -- WARNING: Font sizes must be in string format! - guifont = "FiraCode Nerd Font", - guifont_size = "15", - - -- change Which Key background color - -- can use hex, or normal color names (eg: Red, Gree, Blue) - -- @default = #202328 - whichkey_bg = "#202328", - - -- set your custom lsp diagnostic symbols below - lsp_error = "", - lsp_warning = "", - lsp_hint = "", - lsp_information = "", - lsp_virtual_text = " ", - - -- Set your dashboard custom colors below - -- @default = doom emacs' default dashboard colors - dashboard_custom_colors = { - header_color = "#586268", - center_color = "#51afef", - shortcut_color = "#a9a1e1", - footer_color = "#586268", - }, + -- Show hidden files + -- @default = true + show_hidden = true, - -- Set your custom dashboard header below - -- @default = doom emacs' default dashboard header - dashboard_custom_header = {}, -} --- }}} - --- {{{ Nvim -local nvim = { - -- Set custom Neovim global variables - -- @default = {} - -- example: - -- { ['sonokai_style'] = 'andromeda' } - global_variables = {}, - - -- Set custom autocommands - -- @default = {} - -- example: - -- augroup_name = { - -- { 'BufNewFile,BufRead', 'doomrc', 'set ft=lua'} - -- } - autocmds = {}, - - -- Set custom key bindings - -- @default = {} - -- example: - -- { - -- {'n', 'ca', ':Lspsaga code_action', options} - -- } - -- - -- where - -- 'n' is the map scope - -- 'ca' is the map activator - -- ':Lspsaga ...' is the command to be executed - -- options is a Lua table containing the mapping options, e.g. - -- { silent = true }, see ':h map-arguments'. - mappings = {}, - - -- Set custom commands - -- @default = {} - -- example: - -- { - -- 'echo "Hello, custom commands!"' - -- } - commands = {}, - - -- Set custom functions - -- @default = {} - -- example: - -- { - -- hello_custom_func = function() - -- print("Hello, custom functions!") - -- end - -- } - functions = {}, - - -- Set custom options - -- @default = {} - -- example: - -- { - -- { ['shiftwidth'] = 4 } - -- } - options = {}, -} --- }}} + -- Checkupdates on start + -- @default = false + check_updates = false, -return { - doom = doom, - nvim = nvim, + -- Auto install plugins on launch, useful if you don't want to run + -- PackerInstall every time you add a new plugin + -- @default = true + auto_install_plugins = true, + + -- Disable dashboard status line (does not work perfectly) + -- false : disables dashboard status line + -- true : enables dashboard status line + -- @default = true + dashboard_statline = true, + + -- Default indent size + -- @default = 4 + indent = 4, + + -- Set max cols + -- Defines the column to show a vertical marker + -- @default = 80 + max_columns = 80, + + -- Completion box height + -- @default = 10 + complete_size = 10, + + -- Completion box transparency + -- 0 = no transparency + -- 100 = fully transparent + -- @default = 25 + complete_transparency = 25, + + -- Sidebar sizing + -- Specifies the default width of Tree Explorer and Tagbar + -- @default = 25 + sidebar_width = 25, + + -- Set the Terminal width + -- Applies only to float direction + -- @default = 70 + terminal_width = 70, + + -- Set the Terminal height + -- Applies to all directions except window + -- @default = 20 + terminal_height = 20, + + -- Conceal level + -- Set Neovim conceal level + -- 0 : Disable indentline and show all + -- 1 : Conceal some functions and show indentlines + -- 2 : Concealed text is completely hidden unless it has a custom replacement + -- character defined + -- 3 : Concealed text is completely hidden + conceallevel = 0, + + -- Logging level + -- Set Doom logging level + -- Available levels: + -- · trace + -- · debug + -- · info + -- · warn + -- · error + -- · fatal + -- @default = 'info' + logging = "info", + + -- Set the Terminal direction + -- Available directions: + -- - vertical + -- - horizontal + -- - window + -- - float + -- @default = 'horizontal' + terminal_direction = "horizontal", + + -- NOTE: This will only be activated if 'backup' is true. + -- We don'recommend you put this outside of neovim so we've restricted to the path: ~/.config/nvim + -- WARNING: only put the folder name that you want. (eg: undo_dir = '/undodir') + -- @default_directory = '~/.config/nvim/undodir' + undo_dir = "/undodir", + + -- Default colorscheme + -- @default = doom-one + colorscheme = "doom-one", + + -- Background color + -- @default = dark + colorscheme_bg = "dark", + + -- Doom One colorscheme settings + doom_one = { + -- If the cursor color should be blue + -- @default = false + cursor_coloring = false, + -- If TreeSitter highlighting should be enabled + -- @default = true + enable_treesitter = true, + -- If the comments should be italic + -- @default = false + italic_comments = false, + -- If the telescope plugin window should be colored + -- @default = true + telescope_highlights = true, + -- If the built-in Neovim terminal should use the doom-one + -- colorscheme palette + -- @default = false + terminal_colors = true, + -- If the Neovim instance should be transparent + -- @default = false + transparent_background = false, + }, + + -- Set gui fonts here + -- @default = "FiraCode Nerd Font", @default font size = 15, + -- WARNING: Font sizes must be in string format! + guifont = "FiraCode Nerd Font", + guifont_size = "15", + + -- change Which Key background color + -- can use hex, or normal color names (eg: Red, Gree, Blue) + -- @default = #202328 + whichkey_bg = "#202328", + + -- set your custom lsp diagnostic symbols below + lsp_error = "", + lsp_warning = "", + lsp_hint = "", + lsp_information = "", + lsp_virtual_text = " ", + + -- Set your dashboard custom colors below + -- @default = doom emacs' default dashboard colors + dashboard_custom_colors = { + header_color = "#586268", + center_color = "#51afef", + shortcut_color = "#a9a1e1", + footer_color = "#586268", + }, + + -- Set your custom dashboard header below + -- @default = doom emacs' default dashboard header + dashboard_custom_header = {}, + }, + -- }}} + + -- {{{ Nvim + nvim = { + -- Set custom Neovim global variables + -- @default = {} + -- example: + -- { ['sonokai_style'] = 'andromeda' } + global_variables = {}, + + -- Set custom autocommands + -- @default = {} + -- example: + -- augroup_name = { + -- { 'BufNewFile,BufRead', 'doom_modules.lua', 'set ft=lua'} + -- } + autocmds = {}, + + -- Set custom key bindings + -- @default = {} + -- example: + -- { + -- {'n', 'ca', ':Lspsaga code_action', options} + -- } + -- + -- where + -- 'n' is the map scope + -- 'ca' is the map activator + -- ':Lspsaga ...' is the command to be executed + -- options is a Lua table containing the mapping options, e.g. + -- { silent = true }, see ':h map-arguments'. + mappings = {}, + + -- Set custom commands + -- @default = {} + -- example: + -- { + -- 'echo "Hello, custom commands!"' + -- } + commands = {}, + + -- Set custom functions + -- @default = {} + -- example: + -- { + -- hello_custom_func = function() + -- print("Hello, custom functions!") + -- end + -- } + functions = {}, + + -- Set custom options + -- @default = {} + -- example: + -- { + -- { ['shiftwidth'] = 4 } + -- } + options = {}, + }, + -- }}} } +return M + -- vim: fdm=marker diff --git a/doomrc.lua b/doom_modules.lua similarity index 87% rename from doomrc.lua rename to doom_modules.lua index 57c221957..a7cba70b4 100644 --- a/doomrc.lua +++ b/doom_modules.lua @@ -1,7 +1,9 @@ --- doomrc - Doom nvim configurations file +local M = {} +M.source = debug.getinfo(1, "S").source:sub(2) +-- doom_modules - Doom nvim module selection -- --- The doomrc controls what Doom nvim plugins modules are enabled and what --- features are being used. +-- The doom_modules controls what Doom nvim plugins modules are enabled and +-- what features are being used. -- -- Comment out a plugin to enable it and comment a non-commented one to -- disable and uninstall it. @@ -11,75 +13,75 @@ -- "Configuration" one. In that section you will find a comprehensive list of -- the available modules and all their supported flags. -local doom = { +M.modules = { ui = { "dashboard", -- Start screen -- "doom-themes", -- Additional doom emacs' colorschemes + -- "indentlines", -- Show indent lines + -- "show_registers", -- popup that shows register contents "statusline", -- Statusline "tabline", -- Tabline, shows your buffers list at top - -- "zen", -- Distraction free environment "which-key", -- Keybindings popup menu like Emacs' guide-key - -- "indentlines", -- Show indent lines - -- "show_registers", -- popup that shows register contents + -- "zen", -- Distraction free environment }, doom = { + -- "compiler", -- Compile (and run) your code with just pressing three keys! -- "neorg", -- Life Organization Tool -- "runner", -- Open a REPL for the current language or run the current file - -- "compiler", -- Compile (and run) your code with just pressing three keys! }, editor = { + "autopairs", -- Autopairs "auto-session", -- A small automated session manager for Neovim - "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) + "dap", -- Debug Adapter Protocol + -- "editorconfig", -- EditorConfig support for Neovim "explorer", -- Tree explorer - -- "ranger", -- Ranger File Browser, requires ranger file browser - "symbols", -- LSP symbols and tags - -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap - "gitsigns", -- Git signs - "telescope", -- Highly extendable fuzzy finder over lists "formatter", -- File formatting - "autopairs", -- Autopairs - -- "editorconfig", -- EditorConfig support for Neovim + "gitsigns", -- Git signs "kommentary", -- Comments plugin "lsp", -- Language Server Protocols - "dap", -- Debug Adapter Protocol - "snippets", -- Snippets + -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap + -- "ranger", -- Ranger File Browser, requires ranger file browser + "snippets", -- LSP snippets + "symbols", -- LSP symbols and tags + "telescope", -- Highly extendable fuzzy finder over lists + -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) }, langs = { -- To enable the language server for a language just add the +lsp flag -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter -- parser and rust-analyzer -- - -- "html", -- HTML support -- "css", -- CSS support + -- "html", -- HTML support -- "javascript", -- JavaScript support -- "typescript", -- TypeScript support + -- "bash", -- The terminal gods language + -- "elixir", -- Build scalable and maintainable software + "lua", -- Support for our gods language -- "python +lsp", -- Python support + lsp -- "ruby", -- Look ma, I love the gems! - "lua", -- Support for our gods language - -- "elixir", -- Build scalable and maintainable software - -- "haskell", -- Because Functional programming is fun, isn't it? - -- "rust +lsp", -- Let's get rusty! - -- "go", -- Hello, gopher -- "cpp", -- C++ support + -- "go", -- Hello, gopher + -- "haskell", -- Because Functional programming is fun, isn't it? -- "java", -- Java support + -- "rust +lsp", -- Let's get rusty! -- "config", -- Configuration files (JSON, YAML, TOML) -- "dockerfile", -- Do you like containers, right? }, utilities = { - -- "suda", -- Write and read files without sudo permissions -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit -- "neogit", -- Magit for Neovim - -- "colorizer", -- Fastest colorizer for Neovim "range-highlight", -- hightlights ranges you have entered in commandline + -- "suda", -- Write and read files without sudo permissions }, web = { - -- "restclient", -- A fast Neovim http client - -- "firenvim", -- requires firenvim web extension; change fontsize by increasing guifontsize in doom_config -- "colorizer", -- Fastest colorizer for Neovim + -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config + -- "restclient", -- A fast Neovim http client } } -return doom +return M diff --git a/plugins.lua b/doom_userplugins.lua similarity index 55% rename from plugins.lua rename to doom_userplugins.lua index 1412a966c..513e478ee 100644 --- a/plugins.lua +++ b/doom_userplugins.lua @@ -1,15 +1,18 @@ --- plugins - Doom nvim custom plugins +local M = {} +M.source = debug.getinfo(1, "S").source:sub(2) +-- doom_userplugins - Doom nvim custom plugins -- -- This file contains all the custom plugins that are not in Doom nvim but that -- the user requires. All the available fields can be found here -- https://github.com/wbthomason/packer.nvim#specifying-plugins -- -- By example, for including a plugin with a dependency on telescope: --- return { --- { --- 'user/repository', --- requires = { 'nvim-lua/telescope.nvim' }, --- }, +-- M.plugins { +-- { +-- 'user/repository', +-- requires = { 'nvim-lua/telescope.nvim' }, +-- }, -- } +M.plugins = {} -return {} +return M diff --git a/lua/doom/core/README.md b/lua/doom/core/README.md index 5c8a547bf..aa1a2ec85 100644 --- a/lua/doom/core/README.md +++ b/lua/doom/core/README.md @@ -5,7 +5,7 @@ be Doom. Those modules are the following: -- config - Doom configurations, handles doomrc file and UI settings. +- config - Doom configurations, handles `doom_*` file and UI settings. - settings - Doom configurations for Neovim, e.g. `tabwidth`, `showmode`. - functions - Doom core functions, e.g. `create_report`. - health - Doom health add-on. diff --git a/lua/doom/core/config/doomrc.lua b/lua/doom/core/config/doomrc.lua deleted file mode 100644 index 7ba82cc76..000000000 --- a/lua/doom/core/config/doomrc.lua +++ /dev/null @@ -1,119 +0,0 @@ ----[[---------------------------------------]]--- --- doomrc.lua - Load Doom Nvim doomrc -- --- Author: NTBBloodbath -- --- License: GPLv2 -- ----[[---------------------------------------]]--- - -local utils = require("doom.utils") -local system = require("doom.core.system") -local log = require("doom.extras.logging") - -local M = {} - -log.debug("Loading Doom doomrc module ...") - --- default_doomrc_values loads the default doomrc values --- @return table -local function default_doomrc_values() - return { - ui = { - "dashboard", -- Start screen - -- 'doom-themes', -- Additional doom emacs' colorschemes - "statusline", -- Statusline - "tabline", -- Tabline, shows your buffers list at top - -- 'zen', -- Distraction free environment - "which-key", -- Keybindings popup menu like Emacs' guide-key - -- "show_registers", -- popup that shows register contents - -- 'indentlines', -- Show indent lines - }, - doom = { - -- 'neorg', -- Life Organization Tool - -- 'runner', -- Open a REPL for the current language or run the current file - -- 'compiler', -- Compile (and run) your code with just pressing three keys! - }, - editor = { - "auto-session", -- A small automated session manager for Neovim - -- 'terminal', -- Terminal for Neovim (NOTE: needed for runner and compiler) - "explorer", -- Tree explorer - -- "ranger", -- Ranger File Browser, requires ranger file browser - "symbols", -- LSP symbols and tags - -- 'minimap', -- Code minimap, requires github.com/wfxr/code-minimap - "gitsigns", -- Git signs - "telescope", -- Highly extendable fuzzy finder over lists - "formatter", -- File formatting - "autopairs", -- Autopairs - -- 'editorconfig', -- EditorConfig support for Neovim - "kommentary", -- Comments plugin - "lsp", -- Language Server Protocols - "snippets", -- LSP snippets - }, - langs = { - -- To enable the language server for a language just add the +lsp flag - -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter - -- parser and rust-analyzer - -- - -- 'html', -- HTML support - -- 'css', -- CSS support - -- 'javascript', -- JavaScript support - -- 'typescript', -- TypeScript support - -- 'bash', -- The terminal gods language - -- 'python +lsp', -- Python support + lsp - -- 'ruby', -- Look ma, I love the gems! - "lua", -- Support for our gods language - -- 'elixir', -- Build scalable and maintainable software - -- 'haskell', -- Because Functional programming is fun, isn't it? - - -- 'rust +lsp', -- Let's get rusty! - -- 'go', -- Hello, gopher - -- 'cpp', -- C++ support - -- 'java', -- Java support - - -- 'config', -- Configuration files (JSON, YAML, TOML) - -- 'dockerfile', -- Do you like containers, right? - }, - utilities = { - -- 'suda', -- Write and read files without sudo permissions - -- 'lazygit', -- LazyGit integration for Neovim, requires LazyGit - -- 'neogit', -- Magit for Neovim - "range-highlight", -- hightlights ranges you have entered in commandline - }, - web = { - -- 'restclient', -- A fast Neovim http client - -- "firenvim", -- requires firenvim extension to be installed in webbrowser - -- 'colorizer', -- Fastets colorizer for Neovim - } - } -end - --- load_doomrc Loads the doomrc if it exists, otherwise it'll fallback to doom --- default configs. -M.load_doomrc = function() - local config, doomrc_path - - -- Path cases: - -- 1. /home/user/.config/doom-nvim/doomrc.lua - -- 2. /home/user/.config/nvim/doomrc.lua - if utils.file_exists(string.format("%s%sdoomrc.lua", system.doom_configs_root, system.sep)) then - doomrc_path = string.format("%s%sdoomrc.lua", system.doom_configs_root, system.sep) - elseif utils.file_exists(string.format("%s%sdoomrc.lua", system.doom_root, system.sep)) then - doomrc_path = string.format("%s%sdoomrc.lua", system.doom_root, system.sep) - end - - if doomrc_path then - local loaded_doomrc, err = pcall(function() - log.debug("Loading the doomrc file ...") - config = dofile(doomrc_path) - end) - - if not loaded_doomrc then - log.error("Error while loading the doomrc. Traceback:\n" .. err) - end - else - log.warn("No doomrc.lua file found, falling to defaults") - config = default_doomrc_values() - end - - return config -end - -return M diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua index 7727b4592..e911ce274 100644 --- a/lua/doom/core/config/init.lua +++ b/lua/doom/core/config/init.lua @@ -30,11 +30,9 @@ end -- {{{ Default doom_config values --- default_doom_config_values loads the default doom_config values --- @return table -local function default_doom_config_values() +M.config = { -- {{{ Doom - local doom = { + doom = { -- Autosave -- false : Disable autosave -- true : Enable autosave @@ -111,6 +109,12 @@ local function default_doom_config_values() -- @default = false preserve_edit_pos = false, + -- Allow overriding the default Doom Nvim keybinds + -- false : Default keybinds cannot be overwritten + -- true : Default keybinds can be overwritten + -- @default = true + allow_default_keymaps_overriding = true, + -- horizontal split on creating a new file (fn) -- false : doesn't split the window when creating a new file -- true : horizontal split on creating a new file @@ -337,11 +341,11 @@ local function default_doom_config_values() -- Set your custom dashboard header below -- @default = doom emacs' default dashboard header dashboard_custom_header = {}, - } + }, -- }}} -- {{{ Nvim - local nvim = { + nvim = { -- Set custom Neovim global variables -- @default = {} -- example: @@ -352,7 +356,7 @@ local function default_doom_config_values() -- @default = {} -- example: -- augroup_name = { - -- { 'BufNewFile,BufRead', 'doomrc', 'set ft=lua'} + -- { 'BufNewFile,BufRead', 'doom_modules.lua', 'set ft=lua'} -- } autocmds = {}, @@ -360,13 +364,15 @@ local function default_doom_config_values() -- @default = {} -- example: -- { - -- {'n', 'ca', ':Lspsaga code_action'} + -- {'n', 'ca', ':Lspsaga code_action', options} -- } -- -- where -- 'n' is the map scope -- 'ca' is the map activator -- ':Lspsaga ...' is the command to be executed + -- options is a Lua table containing the mapping options, e.g. + -- { silent = true }, see ':h map-arguments'. mappings = {}, -- Set custom commands @@ -386,57 +392,38 @@ local function default_doom_config_values() -- end -- } functions = {}, - } + }, -- }}} - - return { - doom = doom, - nvim = nvim, - } -end +} -- }}} --- load_config Loads the doom_config.lua file if it exists --- @return table -M.load_config = function() - local config = { - doom = {}, - nvim = {}, - } - local doom_config_path - - -- Path cases: - -- 1. /home/user/.config/doom-nvim/doom_config.lua - -- 2. /home/user/.config/nvim/doom_config.lua - if - utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) - then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep) - elseif utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_root, system.sep) - end +M.source = nil - if doom_config_path then - local loaded_doom_config, err = pcall(function() - config = dofile(doom_config_path) - end) +log.debug("Loading Doom config module ...") - if not loaded_doom_config then - log.error("Error while loading the doom_config file. Traceback:\n" .. err) - end +-- Path cases: +-- 1. /doom_config.lua +-- 2. /home/user/.config/doom-nvim/doom_config.lua +-- 3. stdpath('config')/doom_config.lua +local ok, ret = pcall(require, "doom_config") +if ok then + M.config = ret.config + M.source = ret.source +else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_config.lua") + if ok then + M.config = ret.config + M.source = ret.source else - log.warn("No doom_config.lua file found, falling to defaults") - default_doom_config_values() + log.error("Error while loading doom_config.lua. Traceback:\n" .. ret) end - - return config end -- install_servers will install the language servers for the languages with -- the +lsp flag. -- --- @param langs The list of languages in the doomrc +-- @param langs The list of languages in the doom_modules.lua M.install_servers = function(langs) if packer_plugins and packer_plugins["lspinstall"] and packer_plugins["lspinstall"].loaded then local lspinstall = require("lspinstall") @@ -466,7 +453,7 @@ end -- install_dap_clients will install the DAP clients for the languages with -- the +debug flag. -- --- @param langs The list of languages in the doomrc +-- @param langs The list of languages in the doom_modules.lua M.install_dap_clients = function(langs) if packer_plugins @@ -501,7 +488,7 @@ M.install_dap_clients = function(langs) end -- Check plugins updates on start if enabled -if M.load_config().doom.check_updates then +if M.config.doom.check_updates then require("doom.core.functions").check_updates() end diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua new file mode 100644 index 000000000..715c479f1 --- /dev/null +++ b/lua/doom/core/config/modules.lua @@ -0,0 +1,105 @@ +---[[---------------------------------------------]]--- +-- modules - Load Doom Nvim doom_modules.lua -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------------]]--- + +local system = require("doom.core.system") +local log = require("doom.extras.logging") + +local M = {} + +M.modules = { + ui = { + "dashboard", -- Start screen + -- "doom-themes", -- Additional doom emacs' colorschemes + -- "indentlines", -- Show indent lines + -- "show_registers", -- popup that shows register contents + "statusline", -- Statusline + "tabline", -- Tabline, shows your buffers list at top + "which-key", -- Keybindings popup menu like Emacs' guide-key + -- "zen", -- Distraction free environment + }, + doom = { + -- "compiler", -- Compile (and run) your code with just pressing three keys! + -- "neorg", -- Life Organization Tool + -- "runner", -- Open a REPL for the current language or run the current file + }, + editor = { + "autopairs", -- Autopairs + "auto-session", -- A small automated session manager for Neovim + "dap", -- Debug Adapter Protocol + -- "editorconfig", -- EditorConfig support for Neovim + "explorer", -- Tree explorer + "formatter", -- File formatting + "gitsigns", -- Git signs + "kommentary", -- Comments plugin + "lsp", -- Language Server Protocols + -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap + -- "ranger", -- Ranger File Browser, requires ranger file browser + "snippets", -- LSP snippets + "symbols", -- LSP symbols and tags + "telescope", -- Highly extendable fuzzy finder over lists + -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler) + }, + langs = { + -- To enable the language server for a language just add the +lsp flag + -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter + -- parser and rust-analyzer + -- + -- "css", -- CSS support + -- "html", -- HTML support + -- "javascript", -- JavaScript support + -- "typescript", -- TypeScript support + + -- "bash", -- The terminal gods language + -- "elixir", -- Build scalable and maintainable software + "lua", -- Support for our gods language + -- "python +lsp", -- Python support + lsp + -- "ruby", -- Look ma, I love the gems! + + -- "cpp", -- C++ support + -- "go", -- Hello, gopher + -- "haskell", -- Because Functional programming is fun, isn't it? + -- "java", -- Java support + -- "rust +lsp", -- Let's get rusty! + + -- "config", -- Configuration files (JSON, YAML, TOML) + -- "dockerfile", -- Do you like containers, right? + }, + utilities = { + -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit + -- "neogit", -- Magit for Neovim + "range-highlight", -- hightlights ranges you have entered in commandline + -- "suda", -- Write and read files without sudo permissions + }, + web = { + -- "colorizer", -- Fastest colorizer for Neovim + -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config + -- "restclient", -- A fast Neovim http client + } +} + +M.source = nil + +log.debug("Loading Doom modules module ...") + +-- Path cases: +-- 1. /doom_modules.lua +-- 2. /home/user/.config/doom-nvim/doom_modules.lua +-- 3. stdpath('config')/doom_modules.lua +local ok, ret = pcall(require, "doom_modules") +if ok then + M.modules = ret.modules + M.source = ret.source +else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_modules.lua") + if ok then + M.modules = ret.modules + M.source = ret.source + else + log.error("Error while loading doom_modules.lua. Traceback:\n" .. ret) + end +end + +return M diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua index 9bc9f383e..d2bfebef7 100644 --- a/lua/doom/core/config/ui.lua +++ b/lua/doom/core/config/ui.lua @@ -6,7 +6,7 @@ local utils = require("doom.utils") local log = require("doom.extras.logging") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config log.debug("Loading Doom UI module ...") diff --git a/lua/doom/core/config/userplugins.lua b/lua/doom/core/config/userplugins.lua new file mode 100644 index 000000000..a70f8422c --- /dev/null +++ b/lua/doom/core/config/userplugins.lua @@ -0,0 +1,35 @@ +local M = {} +---[[---------------------------------------]]--- +-- userplugins - Load Doom Nvim doom_userplugins -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------]]--- + +local system = require("doom.core.system") +local log = require("doom.extras.logging") + +M.plugins = {} + +M.source = nil + +log.debug("Loading Doom userplugins module...") + +-- Path cases: +-- 1. /doom_userplugins.lua +-- 2. /home/user/.config/doom-nvim/doom_userplugins.lua +-- 3. stdpath('config')/doom_userplugins.lua +local ok, ret = pcall(require, "doom_userplugins") +if ok then + M.plugins = ret.plugins + M.source = ret.source +else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_userplugins.lua") + if ok then + M.plugins = ret.plugins + M.source = ret.source + else + log.error("Error while loading doom_userplugins.lua. Traceback:\n" .. ret) + end +end + +return M diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions/init.lua index 17f58cada..cbfdb25de 100644 --- a/lua/doom/core/functions/init.lua +++ b/lua/doom/core/functions/init.lua @@ -7,7 +7,7 @@ local log = require("doom.extras.logging") local utils = require("doom.utils") local system = require("doom.core.system") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config local M = {} @@ -27,14 +27,14 @@ M.check_plugin = function(plugin_name, path) ) == 1 end --- is_plugin_disabled checks if the given plugin is disabled in doomrc +-- is_plugin_disabled checks if the given plugin is disabled in doom_modules.lua -- @tparam string plugin The plugin identifier, e.g. statusline -- @return bool M.is_plugin_disabled = function(plugin) - local doomrc = require("doom.core.config.doomrc").load_doomrc() + local modules = require("doom.core.config.modules").modules - -- Iterate over all doomrc sections (e.g. ui) and their plugins - for _, section in pairs(doomrc) do + -- Iterate over all modules sections (e.g. ui) and their plugins + for _, section in pairs(modules) do if utils.has_value(section, plugin) then return false end @@ -43,7 +43,7 @@ M.is_plugin_disabled = function(plugin) return true end --- Load user-defined settings from the Neovim field in the doomrc +-- Load user-defined settings from the Neovim field in the doom_config.lua -- @param settings_tbl The settings table to iterate over -- @param scope The settings scope, e.g. autocmds M.load_custom_settings = function(settings_tbl, scope) @@ -81,7 +81,7 @@ end -- in the 'doom_config.lua' file. M.reload_custom_settings = function() -- Get the user-defined settings, the 'nvim' field in our 'doom_config.lua' - local custom_settings = require("doom.core.config").load_config().nvim + local custom_settings = require("doom.core.config").config.nvim -- iterate over all the custom settings fields, e.g. global_variables, mappings, etc. for scope, _ in pairs(custom_settings) do M.load_custom_settings(custom_settings[scope], scope) @@ -97,16 +97,7 @@ M.change_colors_and_bg = function() local target_background = vim.opt.background:get() -- Set the correct path for the 'doom_config.lua' file - local doom_config_path - if - utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) - then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep) - elseif - utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) - then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_root, system.sep) - end + local doom_config_path = require("doom.core.config").source if target_colorscheme ~= config.doom.colorscheme then local doom_config = utils.read_file(doom_config_path) @@ -135,7 +126,7 @@ M.change_colors_and_bg = function() end end --- Quit Neovim and change the colorscheme at doomrc if the colorscheme is not the same, +-- Quit Neovim and change the colorscheme at doom_config.lua if the colorscheme is not the same, -- dump all messages to doom.log file -- @tparam bool write If doom should save before exiting -- @tparam bool force If doom should force the exiting @@ -455,17 +446,17 @@ M.edit_config = function() local selected_config = tonumber(vim.fn.inputlist({ "Select a configuration file to edit:", "1. doom_config.lua", - "2. doomrc.lua", - "3. plugins.lua", + "2. doom_modules.lua", + "3. doom_userplugins.lua", })) local open_command = config.doom.new_file_split and "split" or "edit" if selected_config == 1 then - vim.cmd(string.format("%s %s%sdoom_config.lua", open_command, system.doom_root, system.sep)) + vim.cmd(("%s %s"):format(open_command, require("doom.core.config").source)) elseif selected_config == 2 then - vim.cmd(string.format("%s %s%sdoomrc.lua", open_command, system.doom_root, system.sep)) + vim.cmd(("%s %s"):format(open_command, require("doom.core.config.modules").source)) elseif selected_config == 3 then - vim.cmd(string.format("%s %s%splugins.lua", open_command, system.doom_root, system.sep)) + vim.cmd(("%s %s"):format(open_command, require("doom.core.config.userplugins").source)) elseif selected_config ~= 0 then log.error("Invalid option selected.") end diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua index 265cb0c23..aa2592393 100644 --- a/lua/doom/core/init.lua +++ b/lua/doom/core/init.lua @@ -6,17 +6,7 @@ local log = require("doom.extras.logging") local core_modules = { "config", "config.ui", "settings" } for i = 1, #core_modules, 1 do - local ok, err = xpcall(require, debug.traceback, string.format("doom.core.%s", core_modules[i])) - if not ok then - log.error( - string.format( - "There was an error loading the module 'doom.core.%s'. Traceback:\n%s", - core_modules[i], - err - ) - ) - end - + local ok, err = xpcall(require, debug.traceback, ("doom.core.%s"):format(core_modules[i])) if ok then if core_modules[i] == "settings" then -- Neovim configurations, e.g. shiftwidth @@ -26,12 +16,20 @@ for i = 1, #core_modules, 1 do elseif core_modules[i] == "config" then -- Automatically install language servers require("doom.core.config").install_servers( - require("doom.core.config.doomrc").load_doomrc().langs + require("doom.core.config.modules").modules.langs ) -- Automatically install language DAP clients require("doom.core.config").install_dap_clients( - require("doom.core.config.doomrc").load_doomrc().langs + require("doom.core.config.modules").modules.langs ) end + else + log.error( + string.format( + "There was an error loading the module 'doom.core.%s'. Traceback:\n%s", + core_modules[i], + err + ) + ) end end diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua index e2e346ac9..fc3083c18 100644 --- a/lua/doom/core/settings/init.lua +++ b/lua/doom/core/settings/init.lua @@ -6,13 +6,13 @@ local functions = require("doom.core.functions") local log = require("doom.extras.logging") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config local M = {} log.debug("Loading Doom defaults module ...") --- load_default_options sets and loads default Neovim options based on doomrc values +-- load_default_options sets and loads default Neovim options based on doom_config.lua values M.load_default_options = function() ----- Default Neovim configurations -- Set colorscheme @@ -149,7 +149,7 @@ M.custom_options = function() -- can be called by using :DoomRollback vim.cmd('command! DoomRollback lua require("doom.core.functions").rollback_doom()') - -- Load user-defined settings from the Neovim field in the doomrc file + -- Load user-defined settings from the Neovim field in the doom_config.lua file functions.load_custom_settings(config.nvim.autocmds, "autocmds") functions.load_custom_settings(config.nvim.commands, "commands") functions.load_custom_settings(config.nvim.functions, "functions") diff --git a/lua/doom/core/system/init.lua b/lua/doom/core/system/init.lua index afd232f85..9da0fd18e 100644 --- a/lua/doom/core/system/init.lua +++ b/lua/doom/core/system/init.lua @@ -5,43 +5,27 @@ ---[[---------------------------------------]]--- local M = {} +local stdpath = vim.fn.stdpath +local config_dir = stdpath("config"):match(".*[/\\]"):sub(1,-2) --- get_config_dir will get the config path based in the current system, e.g. --- 'C:\Users\JohnDoe\AppData\Local' for windows and '~/.config' for *nix --- @return string -local function get_config_dir() - if string.find(vim.loop.os_uname().sysname, "Windows") then - return os.getenv("USERPROFILE") .. "\\AppData\\Local\\" - end - - return (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME")) - or (os.getenv("HOME") .. "/.config") -end - --- get_separator will return the system paths separator, e.g. \ for Windows and / for *nix --- @return string -local function get_separator() - if vim.loop.os_uname().sysname == "Windows" then - return "\\" - end - - return "/" -end - -M.config_dir = get_config_dir() - -M.sep = get_separator() +M.sep = package.config:sub(1,1) -- The doom-nvim root directory, works as a fallback for looking Doom Nvim configurations -- in case that doom_configs_root directory does not exists. -M.doom_root = string.format("%s%snvim", M.config_dir, M.sep) +M.doom_root = stdpath("config") -- The doom-nvim configurations root directory -M.doom_configs_root = string.format("%s%sdoom-nvim", M.config_dir, M.sep) +M.doom_configs_root = table.concat({config_dir, "doom-nvim"}, M.sep) +local testdir = vim.loop.fs_opendir(M.doom_configs_root) +if testdir then + vim.loop.fs_closedir(testdir) +else + M.doom_configs_root = stdpath("config") +end -- The doom-nvim logs file path -M.doom_logs = vim.fn.stdpath("data") .. string.format("%sdoom.log", M.sep) +M.doom_logs = table.concat({stdpath("data"), "doom.log"}, M.sep) -- The doom-nvim bug report file path -M.doom_report = vim.fn.stdpath("data") .. string.format("%sdoom_report.md", M.sep) +M.doom_report = table.concat({stdpath("data"), "doom_report.md"}, M.sep) -- The git workspace for doom-nvim, e.g. 'git -C /home/JohnDoe/.config/nvim' -M.git_workspace = string.format("git -C %s ", M.doom_root) +M.git_workspace = string.format("git -C %s", stdpath("config")) return M diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua index 99173199d..7432dba31 100644 --- a/lua/doom/extras/autocmds/init.lua +++ b/lua/doom/extras/autocmds/init.lua @@ -6,7 +6,7 @@ local utils = require("doom.utils") local log = require("doom.extras.logging") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config log.debug("Loading Doom autocmds module ...") @@ -15,7 +15,7 @@ local autocmds = { -- Compile new plugins changes at save { "BufWritePost", - "*/doom-*.lua,doomrc.lua,plugins.lua", + "*/doom-*.lua,doom_modules.lua,doom_userplugins.lua", "PackerCompile profile=true", }, -- Reload user-defined settings when 'doom_config.lua' file was modified diff --git a/lua/doom/extras/keybindings/init.lua b/lua/doom/extras/keybindings/init.lua index f1953582d..14eb59ee5 100644 --- a/lua/doom/extras/keybindings/init.lua +++ b/lua/doom/extras/keybindings/init.lua @@ -6,7 +6,7 @@ local utils = require("doom.utils") local log = require("doom.extras.logging") -local config = require("doom.core.config").load_config() +local config = require("doom.core.config").config local functions = require("doom.core.functions") log.debug("Loading Doom keybindings module ...") diff --git a/lua/doom/extras/logging/init.lua b/lua/doom/extras/logging/init.lua index 93229d47c..e46ea033c 100644 --- a/lua/doom/extras/logging/init.lua +++ b/lua/doom/extras/logging/init.lua @@ -9,22 +9,19 @@ ----- CUSTOM SECTION -------------------------------------- ----------------------------------------------------------- -local utils = require("doom.utils") local system = require("doom.core.system") -- logging defaults to "info" level -local doom_config = { - doom = { - logging = "info", - }, -} - --- /home/user/.config/doom-nvim/doom_config.lua -if utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) then - doom_config = dofile(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) -elseif - utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) -then - doom_config = dofile(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) +local logging_level = "info" + +-- Manually load doom_config.lua to avoid circular dependencies +local ok, ret = pcall(require, "doom_config") +if ok then + logging_level = ret.config.doom.logging or logging_level +else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_config.lua") + if ok then + logging_level = ret.config.doom.logging or logging_level + end end ----------------------------------------------------------- @@ -46,7 +43,7 @@ local default_config = { -- Any messages above this level will be logged. -- defaults to info - level = doom_config.doom.logging, + level = logging_level; -- Level configuration modes = { @@ -70,12 +67,7 @@ local unpack = unpack or table.unpack log.new = function(config, standalone) config = vim.tbl_deep_extend("force", default_config, config) - local outfile = string.format( - "%s%s%s.log", - vim.api.nvim_call_function("stdpath", { "data" }), - system.sep, - config.plugin - ) + local outfile = ("%s/%s.log"):format(vim.fn.stdpath("data"), config.plugin) local obj if standalone then diff --git a/lua/doom/modules/built-in/compiler/init.lua b/lua/doom/modules/built-in/compiler/init.lua index 087911f22..f861e949e 100644 --- a/lua/doom/modules/built-in/compiler/init.lua +++ b/lua/doom/modules/built-in/compiler/init.lua @@ -5,7 +5,7 @@ if packer_plugins and packer_plugins["nvim-toggleterm.lua"] then term = require("toggleterm.terminal").Terminal else log.error( - "Doom compiler needs toggleterm plugin, please uncomment the 'terminal' entry in your doomrc" + "Doom compiler needs toggleterm plugin, please uncomment the 'terminal' entry in your doom_modules.lua" ) end diff --git a/lua/doom/modules/built-in/runner/init.lua b/lua/doom/modules/built-in/runner/init.lua index a378ac9ac..1a604d065 100644 --- a/lua/doom/modules/built-in/runner/init.lua +++ b/lua/doom/modules/built-in/runner/init.lua @@ -5,7 +5,7 @@ if packer_plugins and packer_plugins["nvim-toggleterm.lua"] then term = require("toggleterm.terminal").Terminal else log.error( - "Doom runner needs toggleterm plugin, please uncomment the 'terminal' entry in your doomrc" + "Doom runner needs toggleterm plugin, please uncomment the 'terminal' entry in your doom_modules.lua" ) end diff --git a/lua/doom/modules/config/doom-blankline.lua b/lua/doom/modules/config/doom-blankline.lua index 88fa18994..793035354 100644 --- a/lua/doom/modules/config/doom-blankline.lua +++ b/lua/doom/modules/config/doom-blankline.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config require("indent_blankline").setup({ enabled = config.doom.show_indent, diff --git a/lua/doom/modules/config/doom-dashboard.lua b/lua/doom/modules/config/doom-dashboard.lua index b52216f8f..5e57931d5 100644 --- a/lua/doom/modules/config/doom-dashboard.lua +++ b/lua/doom/modules/config/doom-dashboard.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config vim.g.dashboard_session_directory = require("doom.core.system").doom_root .. "/sessions" vim.g.dashboard_default_executive = "telescope" diff --git a/lua/doom/modules/config/doom-eviline.lua b/lua/doom/modules/config/doom-eviline.lua index 973ad7905..0372d91f3 100644 --- a/lua/doom/modules/config/doom-eviline.lua +++ b/lua/doom/modules/config/doom-eviline.lua @@ -1,6 +1,6 @@ return function() local utils = require("doom.utils") - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config local get_color = require("doom.modules.config.doom-eviline-palettes").get_color local bo = vim.bo diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index cf573a815..1ef7a1376 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -1,7 +1,7 @@ return function() local fn = vim.fn local lsp = vim.lsp - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config -- Snippets support local capabilities = lsp.protocol.make_client_capabilities() diff --git a/lua/doom/modules/config/doom-symbols.lua b/lua/doom/modules/config/doom-symbols.lua index 492bb0633..f58992c5c 100644 --- a/lua/doom/modules/config/doom-symbols.lua +++ b/lua/doom/modules/config/doom-symbols.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config vim.g.symbols_outline = { highlight_hovered_item = true, diff --git a/lua/doom/modules/config/doom-toggleterm.lua b/lua/doom/modules/config/doom-toggleterm.lua index 0384b3316..89f9037ae 100644 --- a/lua/doom/modules/config/doom-toggleterm.lua +++ b/lua/doom/modules/config/doom-toggleterm.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config require("toggleterm").setup({ size = config.doom.terminal_height, diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index 0d5c2dbcd..bdf520483 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config local tree_cb = require("nvim-tree.config").nvim_tree_callback -- Empty by default diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 6c262e893..9b8b2ca27 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -1,6 +1,6 @@ return function() local has_value = require("doom.utils").has_value - local doomrc = require("doom.core.config.doomrc").load_doomrc() + local modules = require("doom.core.config.modules").modules local functions = require("doom.core.functions") local function get_ts_parsers(languages) @@ -35,7 +35,7 @@ return function() }, } if packer_plugins and packer_plugins["neorg"] then - table.insert(doomrc.langs, "norg") + table.insert(modules.langs, "norg") end -- Set up treesitter for HTTP @@ -47,14 +47,14 @@ return function() }, } if packer_plugins and packer_plugins["rest.nvim"] then - table.insert(doomrc.langs, "http") + table.insert(modules.langs, "http") end -- macos uses wrong c version require("nvim-treesitter.install").compilers = { "gcc" } require("nvim-treesitter.configs").setup({ - ensure_installed = get_ts_parsers(doomrc.langs), + ensure_installed = get_ts_parsers(modules.langs), highlight = { enable = true }, autopairs = { enable = functions.is_plugin_disabled("autopairs") and false or true, diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 35db525f8..04d3f9f77 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -3,8 +3,6 @@ -- NOTE: We do not provide other LSP integration like coc.nvim, please refer -- to our FAQ to see why. -local utils = require("doom.utils") -local system = require("doom.core.system") local functions = require("doom.core.functions") ---- Packer Bootstrap --------------------------- @@ -496,12 +494,7 @@ packer.startup(function(use) --- Custom Plugins --- -----]]----------------[[----- -- If there are custom plugins then also require them - local custom_plugins - if utils.file_exists(string.format("%s%splugins.lua", system.doom_configs_root, system.sep)) then - custom_plugins = dofile(string.format("%s%splugins.lua", system.doom_configs_root, system.sep)) - else - custom_plugins = dofile(string.format("%s%splugins.lua", system.doom_root, system.sep)) - end + local custom_plugins = require("doom.core.config.userplugins").plugins for _, plug in pairs(custom_plugins or {}) do packer.use(plug) diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 7def3745a..e1be91f65 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -59,13 +59,16 @@ if is_module_available("nvim-mapper") then end else -- Manually load the doom_config.lua file to avoid circular dependencies - local doom_config_path - if M.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep) - elseif M.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_root, system.sep) + local config = {} + local ok, ret = pcall(require, "doom_config") + if ok then + config = ret.config + else + ok, ret = pcall(dofile, system.doom_configs_root.."/doom_config.lua") + if ok then + config = ret.config + end end - local config = dofile(doom_config_path) M.map = function(mode, lhs, rhs, opts, _, _, _) local options = config.doom.allow_default_keymaps_overriding and {} or { noremap = true }