Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

feat: Refactor config handling #108

Merged
merged 1 commit into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions doc/doom_nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.


Expand All @@ -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 <Space>ds and then type the name
of the colorscheme you want to use. You can also edit the `doom_config.lua`
Expand Down Expand Up @@ -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:
<Space>oe for `FileExplorer`
<F3> for `FileExplorer`
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 = {`
Expand Down Expand Up @@ -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!

==============================================================================
Expand All @@ -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
Expand All @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
161 changes: 84 additions & 77 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,86 +305,93 @@ 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.

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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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.

Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
Loading