diff --git a/.gitignore b/.gitignore
index fb3a9c1dc..a58273cfb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,4 @@
# My temp files
-plugin/
-sessions/
-undodir/
time_cost.txt
tags
# Backup files
@@ -16,3 +13,5 @@ tags
contribute/doom-nvim-contrib
contribute/local-share-nvim
contribute/workspace
+# Editor files
+.luarc.json
diff --git a/.luacheckrc b/.luacheckrc
index 8646d0643..10336acbe 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -1,13 +1,17 @@
stds.nvim = {
globals = {
- vim = { fields = { "g" } },
+ vim = { fields = { "g", "opt" } },
table = { fields = { "unpack" } },
package = { fields = { "searchers" } },
+ doom = { fields = { "packages", "binds", "autocmds" } },
+ _doom = { fields = { "cmp_enable" } }
},
read_globals = {
"vim",
"jit",
"packer_plugins",
+ "doom",
+ "_doom"
},
}
std = "lua51+nvim"
@@ -22,8 +26,4 @@ ignore = {
"631", -- Line is too long.
}
-exclude_files = {
- "plugin/packer_compiled.lua",
-}
-
-- vim: ft=lua sw=2 ts=2
diff --git a/README.md b/README.md
index 442f2a127..1b8e931aa 100644
--- a/README.md
+++ b/README.md
@@ -97,7 +97,7 @@ Its design is guided by these mantras:
- `nodejs` and `npm` (optional, required to use some Language Server Protocols)
- `wget`, `unzip` (optional, required for auto installing LSPs)
-Doom is comprised of [~40 optional plugins][modules], some of which may have
+Doom is comprised of [~40 optional modules][modules], some of which may have
additional dependencies. [Please visit their documentation][modules].
## Install
@@ -111,9 +111,6 @@ First you'll want to backup your current Neovim configuration if you have one.
>
> 1. Your current configuration will be backed up to `~/.config/nvim.bak`
> or where your `XDG_CONFIG_HOME` environment variable points to.
->
-> 2. If you're a cheovim user you can skip this step and go directly to
-> [installing with cheovim](#installing-with-cheovim).
```sh
[ -d ${XDG_CONFIG_HOME:-$HOME/.config}/nvim ] && mv ${XDG_CONFIG_HOME:-$HOME/.config}/nvim ${XDG_CONFIG_HOME:-$HOME/.config}/nvim.bak
@@ -132,27 +129,6 @@ Or if you want to live in the bleeding-edge with the latest features:
git clone --depth 1 -b develop https://github.com/NTBBloodbath/doom-nvim.git ${XDG_CONFIG_HOME:-$HOME/.config}/nvim
```
-### Installing with cheovim
-
-If you're using cheovim as your Neovim configurations manager you can install `doom-nvim` and then
-use the recipe listed in cheovim documentation:
-
-```sh
-# Clone doom-nvim under a specific directory under our '~/.config' directory
-git clone --depth 1 https://github.com/NTBBloodbath/doom-nvim.git ${XDG_CONFIG_HOME:-$HOME/.config}/doom-nvim
-
-# Change the doom-nvim internal path
-sed -i "37s/nvim/doom-nvim/" ${XDG_CONFIG_HOME:-$HOME/.config}/doom-nvim/lua/doom/core/system/init.lua
-```
-
-```lua
--- In your '~/.config/nvim/profiles.lua'
-doom_nvim = { "~/.config/doom-nvim", {
- plugins = "packer",
- preconfigure = "doom-nvim"
- }
-}
-```
---
Then [read our Getting Started guide][getting-started] to be walked through
@@ -160,7 +136,7 @@ installing, configuring and maintaining Doom Nvim.
## Getting help
-Neovim is not very difficult. Although you will occasionally run into problems
+Although Neovim is not very difficult, you will occasionally run into problems
if you are not an advanced vimmer. When you do, here are some places you can look help:
- [Our documentation][documentation] covers many use cases.
@@ -175,15 +151,14 @@ if you are not an advanced vimmer. When you do, here are some places you can loo
## Acknowledgements
-- [hlissner](https://github.com/hlissner) per doing Doom Emacs :heart:.
-- [romgrk](https://github.com/romgrk) per doing a port to Vim of Doom One
- colorscheme from Doom Emacs (and everyone who improves the colorscheme!).
+- [hlissner](https://github.com/hlissner) for making Doom Emacs :heart:.
+- [romgrk](https://github.com/romgrk) for making a port of Doom One to Vim :heart:.
- [All our contributors](#contributors) per helping improve Doom :heart:
## Contribute
- I really :heart: pull requests and bug reports (please see the [Contributing Guidelines][contribute] before contributing)!
-- Don't hesitate to [tell me my Lua coding style sucks](https://github.com/NTBBloodbath/doom-nvim/issues/new),
+- Don't hesitate to [tell me my Lua sucks](https://github.com/NTBBloodbath/doom-nvim/issues/new),
but please tell me why.
## Contributors
diff --git a/config.lua b/config.lua
new file mode 100644
index 000000000..bfe4aebc0
--- /dev/null
+++ b/config.lua
@@ -0,0 +1,7 @@
+-- doom_config - Doom Nvim user configurations file
+--
+-- This file contains the user-defined configurations for Doom nvim.
+-- Just override stuff in the `doom` global table (it's injected into scope
+-- automatically).
+
+-- vim: sw=2 sts=2 ts=2 expandtab
diff --git a/docs/contributing.md b/docs/contributing.md
index f75a16425..6f025a9f4 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -52,7 +52,7 @@ thus reach a solution more quickly.
Some important data would be:
- Your custom configuration if you have one
- (`doom_modules.lua`, `doom_config.lua` and `doom_userplugins.lua`)
+ (`modules.lua` and `config.lua`)
- Which branch of Doom Nvim are you using
- Which plugins are you using
diff --git a/docs/faq.md b/docs/faq.md
index c44878f83..17203bc81 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -4,42 +4,17 @@
### What type of vimmer is Doom Nvim intended for?
-Doom Nvim is intended for all types of Vimmer who want a stable and efficient
+Doom Nvim is intended for all types of Vimmers who want a stable and efficient
development environment without spending a lot of time setting everything up.
### Why does Doom Nvim only support Neovim 0.5+?
-Doom Nvim doesn't support Neovim versions lower than the current stable (0.5) due to:
-
-- some features would be lost
-- Not all Lua plugins have good alternatives in Vimscript, so the experience
- would not be the same
-- performance would not be the same as Lua cannot be used
+Doom Nvim doesn't support Neovim versions lower than the current stable (0.5)
+due big plugin incompatibilities and performance differences, which would make
+the experience not worth it.
### How to version control Doom Nvim?
Doom Nvim makes use of an internal variable called `doom_configs_root` that points
to `/home/user/.config/doom-nvim` path by default. This allows you to move your
configuration files to this path so you can version control your doom setup too.
-
-> **NOTE**: In case that you're using cheovim (with `/home/user/.config/doom-nvim`
-> as your Doom Nvim path) then you will need to change this variable value manually
-> by tweaking [this](../lua/doom/core/system/init.lua) file.
-
-After changing your configurations path you will surely want to remove your
-`~/.config/nvim/plugin/packer_compiled.lua` and running `:PackerCompile` again.
-
-Also you will need to create a symlink from your new path to the old one for
-avoiding issues when updating Doom Nvim. Here is a snippet for this task.
-
-```sh
-# Change this variable path if you have installed Doom Nvim in other place
-DOOM_ROOT="${XDG_CONFIG_HOME:-$HOME/.config}/nvim"
-# Change this variable path if you have changed the Doom Nvim doom_configs_root variable
-DOOM_CONFIG_ROOT="${XDG_CONFIG_HOME:-$HOME/.config}/doom-nvim"
-
-# Let's iterate over the configurations path directory files and create a symlink for them
-for _config_file in $(ls "$DOOM_CONFIG_ROOT"); do
- ln -s "${DOOM_CONFIG_ROOT}/$_config_file" "${DOOM_ROOT}/$_config_file"
-done
-```
diff --git a/docs/getting_started.md b/docs/getting_started.md
index b2827c874..9aacf69b2 100644
--- a/docs/getting_started.md
+++ b/docs/getting_started.md
@@ -10,9 +10,9 @@ This is what you will have installed by the end of this section:
- **Optional**: ripgrep 11.0+ (highly recommended)
- **Optional**: fd 7.3.0+ (known as `fd-find` on Debian, Ubuntu & derivates),
improves performance for many file indexing commands
-- **Optional**: node & npm, required to use LanguageServerProtocols (LSP) and the plugins using LSP, like the symbols-outline plugin.
+- **Optional**: node & npm, required to use some Language Server Protocols (LSP) and packages using LSP, like the symbols-outline plugin.
-These packages ought to be available through the package managers of your OS;
+These packages should to be available through the package managers of your OS;
i.e. pacman/aptitude/rpm/etc on the various Linux distributions.
### Neovim & dependencies
@@ -81,6 +81,8 @@ MacPorts currently only has Neovim v0.4.4
#### On Windows
+> **NOTE**: new module architecture is pending tests on Windows.
+
##### [Chocolatey](https://community.chocolatey.org/)
```
@@ -237,37 +239,17 @@ Or if you want to live in the bleeding-edge with the latest features:
git clone --depth 1 -b develop https://github.com/NTBBloodbath/doom-nvim.git ${XDG_CONFIG_HOME:-$HOME/.config}/nvim
```
-#### Using cheovim
-
-If you're using cheovim as your Neovim configurations manager you can install `doom-nvim` and then
-use the recipe listed in cheovim documentation:
-
-```sh
-# Clone doom-nvim under a specific directory under our '~/.config' directory
-git clone --depth 1 https://github.com/NTBBloodbath/doom-nvim.git ${XDG_CONFIG_HOME:-$HOME/.config}/doom-nvim
-
-# Change the doom-nvim internal path
-sed -i "37s/nvim/doom-nvim/" ${XDG_CONFIG_HOME:-$HOME/.config}/doom-nvim/lua/doom/core/system/init.lua
-```
-
-```lua
--- In your '~/.config/nvim/profiles.lua'
-doom_nvim = { "~/.config/doom-nvim", {
- plugins = "packer",
- preconfigure = "doom-nvim"
- }
-}
-```
-
## Update & Rollback
### Update Doom Nvim
-To update Doom Nvim, you have two options, run `:DoomUpdate` or SPC - d - u
+To update Doom Nvim, you have two options, run `:DoomUpdate` or SPC d u
inside Neovim or alternatively run `git pull` in doom-nvim directory (**not recommended, see why below**).
#### Why use the built-in doom command for updating instead of running git pull manually?
+> **TODO**: These commands are pending testing in the new module architecture.
+
> **tl;dr**: The `:DoomUpdate` command creates an additional local database of the doom-nvim
> releases so in case something breaks you can easily rollback to a previous doom-nvim version
@@ -296,7 +278,7 @@ rm -rf ${XDG_CONFIG_HOME:-$HOME/.config}/nvim \
#### Rolling Back Doom
-Did the update screwed up your setup because of a bug or a breaking change and you want to rollback?
+Did the update screw up your setup because of a bug or a breaking change and you want to rollback?
Then you're lucky. Just run `:DoomRollback` in Neovim and Doom will rollback itself to
a previous release (for main branch) or a previous commit (for development branch).
@@ -305,351 +287,89 @@ a previous release (for main branch) or a previous commit (for development branc
## Configuration
-You can configure Doom Nvim by tweaking the `doom_config.lua`,
-`doom_modules.lua` and the `doom_userplugins.lua` files located in your
-Doom Nvim root directory (`$HOME/.config/doom-nvim/` by default).
-
-### doom_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 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 M
-```
+You can configure Doom Nvim by tweaking the `config.lua` and
+`modules.lua` files located in your Doom Nvim root directory
+(`$HOME/.config/doom-nvim/` by default).
+
+### modules.lua
-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.
+This file handles all the Doom Nvim modules, copy the one in the root of this
+repo for a template.
> **NOTE**: for more information please refer to [modules].
-### doom_config.lua
+### config.lua
This file handles all the Doom Nvim configurations, including the ability to easily
create new custom mappings and global Neovim variables.
-All the options are self-documented on it so you can easily modify them and know
-exactly what you are doing.
-
-This is its structure:
-
-```lua
-local doom = {
- -- Here lies all the Doom Nvim configurations
-}
-
-local nvim = {
- -- Here lies all the custom Neovim configurations
-}
-
-return {
- doom = doom,
- nvim = nvim,
-}
-```
+It has no proper structure, but revolves around the `doom` global variable.
+See each module's documentation for options.
> **NOTE**: all your used-defined configurations here will be live-reloaded, e.g.
> mappings, autocommands, etc.
-### 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.
-
-If you are familiar with [packer.nvim] then you can see this file as a wrapper
-for its `use` function.
-
-This one just contains a `return {}` statement. Your plugins should be declared
-inside the returned table, e.g. if you want to install `markdown-preview.nvim`:
-
-```lua
-return {
- {
- 'iamcco/markdown-preview.nvim',
- run = 'cd app && yarn install',
- event = 'BufRead',
- },
-}
-```
-
-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
-> [specifying plugins](https://github.com/wbthomason/packer.nvim#specifying-plugins).
-
-### Modules
-
-Doom Nvim consists of around 5 modules. A Doom Nvim Module is a bundle of plugins,
-configuration and commands, organized into a unit that can be toggled easily by
-tweaking your `doom_modules.lua` (found in `$HOME/.config/doom-nvim`).
-
-Please see [Plugin Management](#plugin-management) for more information.
-
### Plugin Management
Doom Nvim uses a declarative and use-package inspired package manager called
[packer.nvim](https://github.com/wbthomason/packer.nvim).
-Modules and plugins are declared in `lua/doom/modules/init.lua` file, located
-in your Doom Nvim root directory. Read on to learn how to use this system to install
-your own plugins.
+Each Doom module has a folder inside `lua/doom/modules/`, with the following
+files:
+
+- `init.lua`: has default options and packer `config` functions.
+- `packages.lua`: has packer specs, except for the config key.
+- `binds.lua` (optional): has bindings for the module.
+- `autocmds.lua` (optional): has autocmds.
-> **WARNING:** Do not install plugins directly in `lua/doom/modules/init.lua`. Instead,
-> use your `doom_modules.lua` and `doom_userplugins.lua` files to modify them.
+> **WARNING:** Do not change modules directly in Doom source code. Instead,
+> use your `modules.lua` and `config.lua` files to modify them.
### Configuring Doom
#### Configuring settings
-You can change Doom's default settings by tweaking your `doom_config.lua` file,
-please see :h doom_nvim_options to know how to.
-
-#### Configuring plugins
-
-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 `doom_userplugins.lua` you
-can use the packer's `config` field, e.g.
-
-```lua
-{
- 'TimUntersberger/neogit',
- config = function()
- require('neogit').setup()
- end,
-}
-```
+You can change Doom's default settings by tweaking your `config.lua` file,
+please see [modules] to know how.
-##### Configuring LSP
-
-[Language Server Protocols](https://microsoft.github.io/language-server-protocol/) is installed as a plugin.
-
-To easily install language servers and without having to do it system-wide or having to
-manually configure servers, Doom Nvim makes use of [MordechaiHadad/nvim-lspmanager](https://github.com/MordechaiHadad/nvim-lspmanager).
-
-To enable the language server for a certain programming language and automatically
-install it, just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`,
-e.g. for enabling Rust support in Doom and install `rust-analyzer`:
-
-```lua
-local doom = {
- langs = {
- 'rust +lsp', -- Let's get rusty!
- }
-}
-```
-
-You can also override or add additional LSPs for a language using the `+lsp(OVERRIDE)` syntax.
-
-```lua
-local doom = {
- langs = {
- 'html +lsp(html, tailwindcss)' -- Enable extra LSPs for a language
- 'vue +lsp(volar)' -- Or override the default
- }
-}
-```
-
-> **NOTE**: You can see a list of currently supported languages at [bundled installers](https://github.com/MordechaiHadad/nvim-lspmanager#supported-language-servers).
-
-### Binding keys
-
-You can modify the default keybindings by modifying the following files:
-
-- `lua/doom/extras/keybindings/init.lua` - General and SPC keybindings
-- `lua/doom/modules/config` - lua plugins keybindings
-
-You can also define your own keybindings in your `doom_config.lua` with the `nvim.mappings` field.
-
-## Migrating to 3.0.0
+## Migrating to 4.0.0
As this is a major version, there are many improvements and breaking changes.
-This section is made to help you migrate to this version without dying in the
-attempt.
-
-But first let's see what's new:
+This section is made to help you migrate to this version without having to
+respawn.
### Changes for end users
-- Raw speed, never go slow again.
- Reduced average startuptime from 400ms to 40ms (tested with old hardware),
- special thanks to [vhyrro]!
-- New and better doom-one colorscheme written in pure Lua. Because the
- colorscheme matters.
-- Fragmented configuration file (`doomrc`) so it will be more easy to customize
- Doom. See [New configurations](#new-configurations).
-- Easily add new Neovim settings by using your `doom_config.lua` file.
- Extensibility is a feature that you cannot miss, and what better than being
- able to extend Doom as much as you want?
-- 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 `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
- current state of your Doom Nvim installation in case that you need to rollback
- your Doom Nvim version because of the demons!
-- Added a `DoomRollback` command. Something went wrong after updating? No worries,
- just rollback to a previous version (stable branch) or a previous commit
- (development branch) and be piece of mind!
-- Built-in plugins. Because we should have some utilities to make our lives
- easier, isn't this how it should be? See [modules/doom] for more information.
-- A lot of bug fixes.
+- Make modules more granular and configurable, allowing everything to be
+ overriden.
+- Completely change the structure of `config.lua` to revolve around a
+ single settings store.
+- Remove the category groupings in modules.
+- Remove the need to return the filepath from each config file.
+- Fully move all data file to stdpath("data").
+- Fix bugs.
### Changes for contributors
-- Better documentation. Added docs for each doom lua module because
- documentation is the core of all projects.
-- Restructured source code. Now the doom nvim source code is much cleaner and
- easier to understand.
-
-Now that we know what's new we will surely want to update, isn't it?
-
-Due to the new raw speed we highly recommend that you do a fresh installation so
-everything will be work as it should. **Make sure to backup your doomrc changes
-so you can apply your changes to the new `doom_config.lua` configuration file**.
-
-We don't recommend using the `:DoomUpdate` command for this task because of the
-huge changes that doom nvim gotten. This command will only end in a really
-bad status for this release due to git merging issues.
-
-With that being said, you can run the following command snippet:
-
-> **IMPORTANT:**
->
-> 1. Make sure to read everything it does before executing it.
->
-> 2. If you are using cheovim just remove and clone the doom-nvim repository again.
-
-```sh
-cp $HOME/.config/doom-nvim/doomrc $HOME/.config/doomrc.bak \
- && rm -rf $HOME/.config/doom-nvim $HOME/.local/share/nvim/site/pack/packer \
- && unlink $HOME/.config/nvim \
- && curl -sLf https://raw.githubusercontent.com/NTBBloodbath/doom-nvim/main/bin/install.sh | bash -s -- -d
-```
-
-This snippet will do the following tasks for you:
-
-1. Create a copy of your doomrc so you can use a diff tool later with the
- actual breaking changes to doomrc structure.
-2. Remove the doom-nvim configuration directory and all plugins (including packer).
-3. Remove the residual symlink that doom-nvim have created before during the
- installation (**omit that step if you're using cheovim**).
-4. Clone doom-nvim source to where it belongs again by using the installer
- (installing the development branch because this version is not released yet).
-
-Then you'll only need to start Neovim and start using it as usual!
+- Restructured source code. The Doom Nvim source code is now cleaner and
+ easier to understand. Many things have been flattened, no module is special
+ anymore, some things were removed in favor of later implementations
+ out-of-source.
+- Adding modules is simpler, it only requires creating a new module folder
+ and adding its configuration.
+- Care should be taken with order of execution, since you only have config
+ accesible after the doom global is created. You can't, for instance,
+ use the global do define defaults in `lua/doom/core/config/init.lua`.
+ This is rarely a problem, but worth mentioning.
+
+We recomend doing a fresh install, backing up your current
+`~/.config/doom-nvim` for reference. Sadly, it cannot be used as is, and there's
+no migration script yet.
#### New configurations
-Since version 3.0.0 the doomrc has been fragmented into some files, but why?
-
-This was done to benefit both contributors and end users as follows:
-
-- Improve understanding. One file that handles everything doesn't seem like a
- good thing on a large scale.
-- Easier to maintain. Divided by function, the new files make the code more
- readable and easy to modify.
-
-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.
-
-- `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.
-- `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]
-> so we can fix them and make doom more stable because that's the way to improve software.
-[vlog]: https://github.com/tjdevries/vlog.nvim
[packer.nvim]: https://github.com/wbthomason/packer.nvim
[vhyrro]: https://github.com/vhyrro
[modules]: ./modules.md
-[modules/doom]: https://github.com/NTBBloodbath/doom-nvim/tree/develop/lua/doom/modules/doom
[report them]: https://github.com/NTBBloodbath/doom-nvim/issues/new
diff --git a/docs/modules.md b/docs/modules.md
index 9b485fd89..5cdc1374c 100644
--- a/docs/modules.md
+++ b/docs/modules.md
@@ -2,69 +2,76 @@
## Introduction
-Doom Nvim consists of around 5 modules with ~40 plugins and growing.
-A Doom Nvim module is a bundle of plugins, configurations and commands,
-organized into a unit that can be toggled easily.
+Doom Nvim consists of around 40 plugins and growing.
+A Doom Nvim module is a bundle of packages, configurations, autocommands and
+binds, organized into a unit that can be toggled easily.
> **NOTE**: Doom Nvim uses [packer.nvim] as its plugins manager.
-## Tweaking Doom Nvim Modules
+## Toggling Doom Nvim Modules
-You can easily tweak Doom Nvim Modules by tweaking your `doom_modules.lua` file
-(found in `~/.config/doom-nvim`).
+You can easily toggle Doom Nvim Modules by tweaking your `doom-nvim/modules.lua` file
+(found in `~/.config/doom-nvim`). Return from this file a flat list of modules
+you want. The `core` module is required and need not be listed.
## List of modules
First of all, we must know which modules are there and their plugins.
-> **NOTE:** all plugins can be disabled, including the UI ones.
+> **NOTE:** all modules can be disabled, except `core`. Also, anything can be
+overriden in `doom-nvim/config.lua`, from packer specs to vim options.
-### Essentials
+### Essentials in core
-This ones are implicit plugins so the end user cannot disable them. But why?
+This is the one module you cannot disable. But why?
-That is because these plugins are the core of Doom so in fact, things can break
-without them. These plugins are the following:
+That is because these plugins are the core of Doom, why would you want a
+framework without these basic functionalies? These plugins are the following:
- [packer.nvim]
- A use-package inspired plugin manager for Neovim.
-- [treesitter]
+- [nvim-treesitter and companions]
- An incremental parsing system for programming tools.
+- [nest.nvim]
+ - A better way to set keybindings and create nvim-mapper structures.
+- [nvim-mapper]
+ - A cheatsheet generator for your binds.
-### UI
+### UI modules
+- [colorizer]
+ - Fastest colorizer for Neovim.
- [dashboard]
- Vim dashboard (start screen).
-- [doom-themes]
+- [doom_themes]
- Additional doom emacs' colorschemes.
- [indentlines]
- Show indent lines.
+- [range_highlight]
+ - Highlights ranges you have entered in commandline
- [statusline]
- Neovim statusline.
- [tabline]
- Tabline, shows your buffers list at top.
-- [which-key]
- - Keybindings popup like Emacs' guide-key.
+- [whichkey]
+ - Keybindings popup like Emacs' whichj-key.
- [zen]
- Distraction free environment.
-### Doom
-- [compiler] (built-in)
- - Compile _and run_ your projects with only a few keystrokes.
+### Lang modules
+
- [neorg]
- Life Organization Tool.
-- [runner] (built-in)
- - A code runner for your interpreted code.
-### Editor
+### Editor modules
- [autopairs]
- Autopairs.
-- [auto-session]
+- [auto_session]
- A small automated session manager for Neovim.
- [editorconfig]
- - EditorConfig support for Neovim, let other argue about tabs vs spaces.
+ - EditorConfig support for Neovim, let other people argue about tabs vs spaces.
- [explorer]
- Tree explorer.
- [formatter]
@@ -74,7 +81,7 @@ without them. These plugins are the following:
- [kommentary]
- Comments plugin.
- [lsp]
- - Language Server Protocols ([compe] + [lspinstall]).
+ - Language Server Protocols ([cmp] + [lspconfig]).
- [minimap]
- Code minimap, requires [wfxr/code-minimap](https://github.com/wfxr/code-minimap).
- snippets
@@ -86,195 +93,53 @@ without them. These plugins are the following:
- [terminal]
- Terminal for Neovim.
-### Langs
-
-The languages module entries has some flags that improves their experience and
-makes your life easier.
-
-The currently available flags are the following:
-
-- `+lsp` - enables and installs the Language Server Protocol for the language.
- e.g. `rust +lsp` will automatically install `rust-analyzer`.
-- `+debug` - enables and installs the Debug Adapter Protocol client for the
- language. e.g. `python +debug` will automatically install `debugpy`.
-
-> **NOTE**: when the language entry is not commented, doom-nvim will automatically
-> install the TreeSitter parser for that language too.
-
-#### Web development
-
-- **css**
- - CSS support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **html**
- - HTML support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **javascript**
- - JavaScript support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes, by using TSServer.
- - DAP client: yes.
-- **PHP**
- - PHP support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **typescript**
- - TypeScript support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: yes (via javascript).
-- **Svelte**
- - Svelte support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: yes (via javascript).
-- **Vue**
- - Vue support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: yes (via javascript).
-
-#### Scripting
-
-- **bash**
- - BASH support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **clojure**
- - Clojure support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **elixir**
- - Elixir support.
- - TreeSitter based syntax highlighting: yes.
- - 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).
-- **powershell**
- - PowerShell support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **python**
- - Python support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: yes.
-- **ruby**
- - Ruby support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: yes.
-
-#### Compiled
-
-- **cpp**
- - CPP support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: yes (not supported _yet_ by Doom for automatic installation).
-- **c_sharp (C#)**
- - C# support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **go**
- - Golang support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: yes.
-- **haskell**
- - Haskell support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **java**
- - Java support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **kotlin**
- - Kotlin support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: no.
-- **rust**
- - Rust support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
- - DAP client: yes (not supported _yet_ by Doom for automatic installation).
-
-#### Configs & DevOps
-
-- **json**/**json5**
- - JSON support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
-- **yaml**
- - YAML support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
-- **toml**
- - TOML support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: no.
-- **xml**
- - XML support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: no.
-- **dockerfile**
- - Docker support.
- - TreeSitter based syntax highlighting: yes.
- - LSP: yes.
-
-> **NOTE**: this group requires the `lsp` installed for the `+lsp` flags.
-
-### Utilities
+### Utilities modules
- [lazygit]
- LazyGit integration for neovim, requires LazyGit.
- [neogit]
- Magit 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.
+- [superman]
+ - Manage man files.
- [restclient]
- A fast Neovim http client.
## Managing modules
-Since version 3.0.0 managing the modules plugins is really easy because you
-don't need to learn nothing anymore. Just comment the plugins that you don't
-want to use and uncomment the ones that you are going to use!
-
-So by example, if you want to disable the tree explorer you can simply comment it.
-
-```lua
--- Before, the plugin is enabled
-'explorer', -- Tree explorer
-
--- After, the plugin is disabled
--- 'explorer', -- Tree explorer
-```
-
-After doing the changes, just restart Neovim and Doom Nvim will handle the plugins
-changes for you!
+Configurations go in `doom-nvim/config.lua`. In this file, a `doom` global variable
+is injected with defaults suh that you can override or insert to your liking.
+
+Common patterns:
+
+> **NOTE**: prefer setting the leaf keys, setting an entire table will override
+> everything.
+
+- Install package/override existing if name is already there:
+ ```lua
+ -- Use fork.
+ doom.packages[name][1] = "myfork/name.nvim"
+ -- Add config to be run after module config.
+ doom.packages[name].config = function()
+ require("name.whatever").do_something({
+ -- ..
+ })
+ end
+ ```
+- Add binds to your liking:
+ ```lua
+ table.insert(doom.binds, {
+ { "RnT", "RipAndTear", name = "Until it is done" },
+ })
+ ```
+- Add autocmds (`doom_` will be prefixed to the name):
+ ```lua
+ doom.autocmds[augroup_name] = {
+ { "BufReadPre", "*.lua", "setlocal sw=2", --[[once and nested are boolean keys here]] },
+ { "InsertEnter", "*", function() print("Lua functions are valid!") end, once = true }
+ }
+ ```
@@ -300,7 +165,7 @@ changes for you!
[neorg]: https://github.com/vhyrro/neorg
[lsp]: https://github.com/neovim/nvim-lspconfig
-[compe]: https://github.com/hrsh7th/nvim-compe
+[cmp]: https://github.com/hrsh7th/nvim-cmp
[lsp-installer]: https://github.com/williamboman/nvim-lsp-installer
[LuaSnip]: https://github.com/L3MON4D3/LuaSnip
[friendly-snippets]: https://github.com/rafamadriz/friendly-snippets
diff --git a/doom_config.lua b/doom_config.lua
deleted file mode 100644
index 5b06596bd..000000000
--- a/doom_config.lua
+++ /dev/null
@@ -1,480 +0,0 @@
--- doom_config - Doom Nvim user configurations file
---
--- This file contains the user-defined configurations for Doom nvim and consists
--- in two Lua tables:
--- 1. Doom, this one defines all the Doom nvim configurations that you can
--- tweak to fit your needs or tastes.
---
--- 2. Nvim, this one defines all the custom configurations that you want to
--- use in Neovim, e.g. a colorscheme italic_comments global variable
-
-local M = {}
-
-M.source = debug.getinfo(1, "S").source:sub(2)
-
-M.config = {
- doom = {
- -- Pins plugins to a commit sha to prevent breaking changes
- -- @default = true
- freeze_dependencies = true,
-
- -- Autosave
- -- false : Disable autosave
- -- true : Enable autosave
- -- @default = false
- autosave = false,
-
- -- 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,
-
- -- Use netrw as files explorer
- -- false : Use nvim-tree.lua
- -- true : Use netrw
- -- @default = false
- use_netrw = false,
-
- -- Enable folding
- -- true : fold is enabled
- -- false : fold is disabled
- -- @default = true
- foldenable = true,
-
- -- Autosave sessions
- -- false : Disable session autosave
- -- true : Enable session autosave
- -- @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
- 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 left (vertically)
- -- true : splits right (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 : Enable number lines
- -- true : Disable number lines
- -- @default = false
- disable_numbering = false,
-
- -- Set numbering style
- -- false : Shows absolute number lines
- -- true : Shows relative number lines
- -- @default = true
- relative_num = true,
-
- -- 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,
-
- -- Show the editing file path in your status line
- -- false : show only file name on status line
- -- true : show file name and the updir in status line
- statusline_show_file_path = true,
-
- -- Set the keybindings modules that you want to use
- -- false : disables keybindings module
- -- true : enables keybindings module
- keybinds_modules = {
- -- Core doom keybindings
- core = true,
- -- Movement keybindings, jump between your windows, buffers and code
- movement = true,
- -- Leader keybindings, a bunch of useful keybindings managed by space key
- -- WARNING: disabling this will break which-key plugin if the plugin is enabled
- leader = true,
- -- Completion and snippets keybindings
- completion = true,
- },
-
- -- sequences used for escaping insert mode
- -- @default = { 'jk', 'kj' }
- escape_sequences = { "jk", "kj" },
-
- -- Disable or enable Doom autocommands, this can break some configuration options (they will stop working)
- -- e.g. preserve_edit_pos or autosave
- --
- -- false : enable autocommands module
- -- true : disable autocommands module
- -- @default = false
- disable_autocommands = false,
-
- -- Enable LSP diagnostics virtual text
- -- @default = false
- enable_lsp_virtual_text = false,
-
- -- Use floating windows for plugins manager (packer) operations
- -- @default = false
- use_floating_win_packer = false,
-
- -- Default indent size
- -- @default = 4
- indent = 4,
-
- -- 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_warn = "",
- lsp_hint = "",
- lsp_info = "",
- lsp_virtual_text = " ",
-
- -- Set your linters for the programming languages that you use,
- -- see https://github.com/mfussenegger/nvim-lint#available-linters
- linters = {
- c = {},
- cpp = {},
- css = {},
- html = {},
- javascript = {},
- lua = {},
- markdown = {},
- nix = {},
- python = {},
- ruby = {},
- sh = {},
- typescript = {},
- },
-
- -- Set your dashboard custom colors below
- -- @default = doom emacs' default dashboard colors
- dashboard_custom_colors = {
- 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 = {
- -- Set custom Neovim global variables
- -- @default = {}
- -- example:
- -- {
- -- ['sonokai_style'] = 'andromeda',
- -- ['modelineexpr'] = true,
- -- }
- --
- -- modeline feature was turned off to reduce security exploit surfaces.
- -- Since modeline now uses whitelist approach since nvim 0.4 /vim 8.1,
- -- enabling this is as safe as external packages such as securemodelines.
- -- See https://github.com/neovim/neovim/issues/2865
- --
- global_variables = {},
-
- -- Set custom autocommands
- -- @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,
- -- -- If the function should be ran on neovim launch or if it should
- -- -- be a global function accesible from anywhere
- -- run_on_start = false,
- -- },
- -- }
- functions = {},
-
- -- Set custom options
- -- @default = {}
- -- example:
- -- {
- -- ['shiftwidth'] = 4
- -- }
- options = {},
- },
-}
-
-return M
-
--- vim: sw=2 sts=2 ts=2 fdm=indent noexpandtab
diff --git a/doom_modules.lua b/doom_modules.lua
deleted file mode 100644
index 7ef434ebb..000000000
--- a/doom_modules.lua
+++ /dev/null
@@ -1,100 +0,0 @@
--- doom_modules - Doom nvim module selection
---
--- 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.
---
--- NOTE: you can open the Doom nvim documentation by pressing `SPC d h`. You
--- will find a table of content where you will see a "Doomrc" section under the
--- "Configuration" one. In that section you will find a comprehensive list of
--- the available modules and all their supported flags.
-
-local M = {}
-
-M.source = debug.getinfo(1, "S").source:sub(2)
-
-M.modules = {
- ui = {
- "dashboard", -- Start screen
- -- "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
- -- "illuminated", -- Highlight other uses of the word under the cursor like VSC
- },
- doom = {
- -- "compiler", -- Compile (and run) your code with just pressing three keys!
- -- "contrib", -- Special plugins intended for Doom Nvim contributors (lua docs, etc)
- "neorg", -- Life Organization Tool, used by Doom Nvim user manual
- -- "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
- -- "linter", -- Asynchronous linter, see errors in your code on the fly
- "lsp", -- Language Server Protocols
- -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap
- -- "ranger", -- Ranger File Browser, requires ranger file browser
- "snippets", -- Code snippets
- -- "symbols", -- LSP symbols and tags
- "telescope", -- Highly extendable fuzzy finder over lists
- -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler)
- -- "trouble", -- A pretty list to help you solve all the trouble your code is causing.
- },
- langs = {
- -- To enable the language server for a language just add the +lsp flag
- -- 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!
-
- -- "c", -- Core dumped: segmentation fault
- -- "cpp", -- C++ support
- -- "go", -- Hello, gopher
- -- "haskell", -- Because Functional programming is fun, isn't it?
- -- "java", -- Java support
- -- "rust +lsp", -- Let's get rusty!
- -- "scala", -- Java, but good
-
- -- "comment", -- Better annotations and comments
- -- "config", -- Configuration files (JSON, YAML, TOML)
- -- "dockerfile", -- Do you like containers, right?
- },
- utilities = {
- -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit
- -- "neogit", -- Magit for Neovim
- "range-highlight", -- Hightlights ranges you have entered in commandline
- -- "suda", -- Write and read files without sudo permissions
- -- "superman", -- Read Unix man pages faster than a speeding bullet!
- -- "todo_comments", -- Highlight, list and search todo comments in your projects
- },
- web = {
- -- "colorizer", -- Fastest colorizer for Neovim
- -- "firenvim", -- Requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config
- -- "restclient", -- A fast Neovim http client
- },
-}
-
-return M
-
--- vim: sw=2 sts=2 ts=2 fdm=indent noexpandtab
diff --git a/doom_userplugins.lua b/doom_userplugins.lua
deleted file mode 100644
index a03700002..000000000
--- a/doom_userplugins.lua
+++ /dev/null
@@ -1,23 +0,0 @@
--- 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:
--- M.plugins {
--- {
--- 'user/repository',
--- requires = { 'nvim-lua/telescope.nvim' },
--- },
--- }
-
-local M = {}
-
-M.source = debug.getinfo(1, "S").source:sub(2)
-
-M.plugins = {}
-
-return M
-
--- vim: sw=2 sts=2 ts=2 noexpandtab
diff --git a/init.lua b/init.lua
index d43728559..76baae827 100644
--- a/init.lua
+++ b/init.lua
@@ -1,56 +1,29 @@
----[[---------------------------------------]]---
--- init.lua - Init file of Doom Nvim --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
----- Doom Utilities -----------------------------
--------------------------------------------------
--- Store startup time in seconds
-vim.g.start_time = vim.fn.reltime()
--- Lua modules loader, when loading our modules with this
--- we avoid breaking all the configuration if something fails
-local load_modules = require("doom.utils.modules").load_modules
-
--- Disable some unused built-in Neovim plugins
-vim.g.loaded_gzip = false
-vim.g.loaded_tarPlugin = false
-vim.g.loaded_zipPlugin = false
-vim.g.loaded_2html_plugin = false
-
----- Doom Configurations ------------------------
--------------------------------------------------
--- Load Doom core and UI related stuff (colorscheme, background)
-load_modules("doom", { "core" })
-
--- Defer and schedule loading of plugins and extra functionalities until the
--- Neovim API functions are safe to call to avoid weird errors with plugins stuff
+-- Add ~/.local/share to runtimepath early, such that
+-- neovim autoloads plugin/packer_compiled.lua along with vimscript,
+-- before we start using the plugins it lazy-loads.
+vim.opt.runtimepath:append(vim.fn.stdpath("data"))
+
+-- From here on, we have a hidden global `_doom` that holds state the user
+-- shouldn't mess with.
+_G._doom = {}
+
+-- From here on, we have a global `doom` with config.
+require("doom.core.config"):load()
+-- Load Doom core and UI related stuff (colorscheme, background).
+local utils = require("doom.utils")
+utils.load_modules("doom", { "core" })
+
+-- Defer and schedule loading of modules until the Neovim API functions are
+-- safe to call to avoid weird errors with plugins stuff.
vim.defer_fn(function()
- -- Load Doom extra stuff and plugins (modules, extras)
- load_modules("doom", { "modules", "extras" })
+ -- Load Doom modules.
+ utils.load_modules("doom", { "modules" })
- -- This loads certain plugins related to UI
- vim.cmd("doautocmd ColorScheme")
-
- -- If the current buffer name is empty then trigger Dashboard.
- -- NOTE: this is done to avoid some weird issues with Dashboard and
- -- number / signcolumn when Dashboard gets triggered automatically
+ -- Start dashboard if it is enabled and an empty buffer is opened initially.
if
- (vim.api.nvim_buf_get_name(0):len() == 0)
- and (packer_plugins and packer_plugins["dashboard-nvim"])
+ not require("doom.utils").is_plugin_disabled("dashboard")
+ and vim.api.nvim_buf_get_name(0):len() == 0
then
vim.cmd("Dashboard")
end
-
- vim.cmd([[
- PackerLoad nvim-treesitter
- " This BufEnter call should fix some issues with concealing in neorg
- doautocmd BufEnter
- ]])
-
- if not require("doom.utils").is_plugin_disabled("which-key") then
- vim.cmd([[
- PackerLoad which-key.nvim
- ]])
- end
end, 0)
diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua
index 4fbeb9168..868e001f8 100644
--- a/lua/colors/doom-one/init.lua
+++ b/lua/colors/doom-one/init.lua
@@ -479,10 +479,10 @@ doom_one.load_colorscheme = function()
-- netrw {{{
local netrw = {
- netrwClassify = { fg = blue },
- netrwDir = { fg = blue },
- netrwExe = { fg = green },
- netrwMakefile = { fg = yellow },
+ netrwClassify = { fg = blue },
+ netrwDir = { fg = blue },
+ netrwExe = { fg = green },
+ netrwMakefile = { fg = yellow },
}
apply_highlight(netrw)
@@ -930,7 +930,11 @@ doom_one.load_colorscheme = function()
if configuration.enable_treesitter then
-- We will set a special definition for TSStrike here
local treesitter = {
- TSStrike = { fg = utils.Darken(violet, 0.2), cterm = "strikethrough", gui = "strikethrough" },
+ TSStrike = {
+ fg = utils.Darken(violet, 0.2),
+ cterm = "strikethrough",
+ gui = "strikethrough",
+ },
}
apply_highlight(treesitter)
diff --git a/lua/colors/doom-one/utils/init.lua b/lua/colors/doom-one/utils/init.lua
index e95019f1f..ae9fff005 100644
--- a/lua/colors/doom-one/utils/init.lua
+++ b/lua/colors/doom-one/utils/init.lua
@@ -1,12 +1,5 @@
----[[------------------------]]---
--- COLOR UTILITIES --
----]]------------------------[[---
-
local M = {}
--------------------------------------------------------------------------------
--- Functions {{{
-
-- Convert RGB to Hex color.
-- @param r Red value
-- @param g Green value
@@ -28,10 +21,6 @@ local function Hex_to_RGB(color)
}
end
--- }}}
--------------------------------------------------------------------------------
--- Composed functions {{{
-
M.Lighten = function(color, percentage)
local amount = percentage == nil and 5.0 or percentage
@@ -102,8 +91,5 @@ M.Mix = function(first, second, percentage)
return RGB_to_Hex(r, g, b)
end
--- }}}
return M
-
--- vim: fdm=marker
diff --git a/lua/colors/utils/init.lua b/lua/colors/utils/init.lua
index e95019f1f..ae9fff005 100644
--- a/lua/colors/utils/init.lua
+++ b/lua/colors/utils/init.lua
@@ -1,12 +1,5 @@
----[[------------------------]]---
--- COLOR UTILITIES --
----]]------------------------[[---
-
local M = {}
--------------------------------------------------------------------------------
--- Functions {{{
-
-- Convert RGB to Hex color.
-- @param r Red value
-- @param g Green value
@@ -28,10 +21,6 @@ local function Hex_to_RGB(color)
}
end
--- }}}
--------------------------------------------------------------------------------
--- Composed functions {{{
-
M.Lighten = function(color, percentage)
local amount = percentage == nil and 5.0 or percentage
@@ -102,8 +91,5 @@ M.Mix = function(first, second, percentage)
return RGB_to_Hex(r, g, b)
end
--- }}}
return M
-
--- vim: fdm=marker
diff --git a/lua/doom/README.md b/lua/doom/README.md
index a05ec1faf..ec17fffa1 100644
--- a/lua/doom/README.md
+++ b/lua/doom/README.md
@@ -5,12 +5,10 @@ divided into three different sub-modules.
- [core](./core/README.md) - The Doom core, herein lies the entire Doom core,
e.g. configurations.
-- [extras](./extras/README.md) - Doom extras, herein lies the Doom keybindings,
- autocommands, etc.
-- [modules](./modules/README.md) - The Doom modules, herein lies the Doom plugins
- and their configurations.
-- [utils](./utils/README.md) - The Doom utilities, herein lies the Doom utility
- functions.
+- [modules](./modules/README.md) - The Doom modules, herein lies the Doom modules
+ and their configurations, bindings, autocmds and package management.
+- [utils](./utils/README.md) - The Doom utilities, herein lies the glorious
+ Doom utility functions.
## Note: dev w/ctags
diff --git a/lua/doom/core/README.md b/lua/doom/core/README.md
index aa1a2ec85..71525e534 100644
--- a/lua/doom/core/README.md
+++ b/lua/doom/core/README.md
@@ -5,8 +5,10 @@ be Doom.
Those modules are the following:
-- config - Doom configurations, handles `doom_*` file and UI settings.
-- settings - Doom configurations for Neovim, e.g. `tabwidth`, `showmode`.
+- config - Doom configurations, handles `doom-nvim/*.lua` files.
+ - init - `config.lua` handler, initializes the `doom` global.
+ - modules - `modules.lua` handler.
- functions - Doom core functions, e.g. `create_report`.
-- health - Doom health add-on.
- system - Doom system detection utilities.
+- ui - Doom UI settings.
+- netrw - Optional netrw configs.
diff --git a/lua/doom/core/commands.lua b/lua/doom/core/commands.lua
new file mode 100644
index 000000000..b8be48d25
--- /dev/null
+++ b/lua/doom/core/commands.lua
@@ -0,0 +1,18 @@
+-- This file only has side-effects.
+
+-- Doom Nvim commands.
+
+-- Set a custom command to update Doom Nvim can be called by using :DoomUpdate.
+vim.cmd([[command! DoomUpdate lua require("doom.core.functions").update_doom()]])
+-- Set a custom command to rollback Doom Nvim version can be called by using
+-- :DoomRollback.
+vim.cmd([[command! DoomRollback lua require("doom.core.functions").rollback_doom()]])
+-- Set a custom command to open Doom Nvim user manual can be called by using
+-- :DoomManual.
+vim.cmd([[command! DoomManual lua require("doom.core.functions").open_docs()]])
+-- Set a custom command to fully reload Doom Nvim and simulate a new Neovim run
+-- can be called by using :DoomReload.
+vim.cmd([[command! DoomReload lua require("doom.modules.built-in.reloader").full_reload()]])
+-- Set a custom command to create a crash report can be called by using
+-- :DoomReport.
+vim.cmd([[command! DoomReport lua require("doom.core.functions").create_report(]])
diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua
index 22d48fc8b..b1a7d9112 100644
--- a/lua/doom/core/config/init.lua
+++ b/lua/doom/core/config/init.lua
@@ -1,519 +1,293 @@
----[[------------------------------]]---
--- config - Core of Doom Nvim --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[------------------------------]]---
-
-local config = {}
-
-local log = require("doom.extras.logging")
-local system = require("doom.core.system")
-
-log.debug("Loading Doom config module ...")
-
--- Check if running Neovim or Vim and fails if:
--- 1. Running Vim instead of Neovim
--- 2. Running Neovim 0.4 or below
-if vim.fn.has("nvim") == 1 then
- if vim.fn.has("nvim-0.5") ~= 1 then
- log.fatal("Doom Nvim requires Neovim 0.5.0, please update it")
- end
-else
- log.fatal("Doom Nvim does not have support for Vim, please use it with Neovim instead")
+local utils = require("doom.utils")
+local enabled_modules = require("doom.core.config.modules").modules
+-- `core` is required, doom wouldn't make sense without it.
+if not vim.tbl_contains(enabled_modules, "core") then
+ table.insert(enabled_modules, "core")
end
--- Set termguicolors on load
-if vim.fn.has("vim_starting") then
- vim.opt.termguicolors = true
-end
+local config = {}
+local filename = "config.lua"
+-- TODO: Consider moving this to its own file.
-- {{{ Default doom_config values
-config.config = {
- -- {{{ Doom
- 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
- -- 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
+config.defaults = {
+ -- Pins plugins to a commit sha to prevent breaking changes
+ -- @default = true
+ freeze_dependencies = true,
+
+ -- Autosave
+ -- false : Disable autosave
+ -- true : Enable autosave
+ -- @default = false
+ autosave = false,
+
+ -- Disable Vim macros
+ -- false : Enable
+ -- true : Disable
+ -- @default = false
+ disable_macros = false,
+
+ -- Disable ex mode
+ -- false : Enable
+ -- true : Disable
+ -- @default = false
+ disable_ex = true,
+
+ -- Disable suspension
+ -- false : Enable
+ -- true : Disable
+ -- @default = false
+ disable_suspension = true,
+
+ -- h,l, wrap lines
+ movement_wrap = true,
+
+ -- Undo directory (set to nil to disable)
+ -- @default = vim.fn.stdpath("data") .. "/undodir/"
+ undo_dir = vim.fn.stdpath("data") .. "/undodir/",
+
+ -- Set preferred border style across UI
+ border_style = "single",
+
+ -- Preserve last editing position
+ -- false : Disable preservation of last editing position
+ -- true : Enable preservation of last editing position
+ -- @default = false
+ preserve_edit_pos = false,
+
+ -- horizontal split on creating a new file (fn)
+ -- false : doesn't split the window when creating a new file
+ -- true : horizontal split on creating a new file
+ -- @default = true
+ new_file_split = "vertical",
+
+ -- Enable auto comment (current line must be commented)
+ -- false : disables auto comment
+ -- true : enables auto comment
+ -- @default = false
+ auto_comment = false,
+
+ -- Enable Highlight on yank
+ -- false : disables highligh on yank
+ -- true : enables highlight on yank
+ -- @default = true
+ highlight_yank = true,
+
+ -- Enable guicolors
+ -- Enables gui colors on GUI versions of Neovim
+ -- @default = true
+ guicolors = true,
+
+ -- Show hidden files
+ -- @default = true
+ show_hidden = true,
+
+ -- Hide files listed in .gitignore from file browsers
+ -- @default = true
+ hide_gitignore = true,
+
+ -- Checkupdates on start
+ -- @default = false
+ check_updates = false,
+
+ -- sequences used for escaping insert mode
+ -- @default = { 'jk', 'kj' }
+ escape_sequences = { "jk", "kj" },
+
+ -- Use floating windows for plugins manager (packer) operations
+ -- @default = false
+ use_floating_win_packer = false,
+
+ -- Default indent size
+ -- @default = 4
+ indent = 4,
+
+ -- Logging level
+ -- Set Doom logging level
+ -- Available levels:
+ -- · trace
+ -- · debug
+ -- · info
+ -- · warn
+ -- · error
+ -- · fatal
+ -- @default = 'info'
+ logging = "warn",
+
+ -- Default colorscheme
+ -- @default = doom-one
+ colorscheme = "doom-one",
+
+ -- Doom One colorscheme settings
+ doom_one = {
+ -- If the cursor color should be blue
-- @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
+ cursor_coloring = false,
+ -- If TreeSitter highlighting should be enabled
-- @default = true
- mouse = true,
-
- -- Preserve last editing position
- -- false : Disable preservation of last editing position
- -- true : Enable preservation of last editing position
+ enable_treesitter = true,
+ -- If the comments should be italic
-- @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)
+ italic_comments = false,
+ -- If the telescope plugin window should be colored
-- @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
+ telescope_highlights = true,
+ -- If the built-in Neovim terminal should use the doom-one
+ -- colorscheme palette
-- @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 : Enable number lines
- -- true : Disable number lines
+ terminal_colors = true,
+ -- If the Neovim instance should be transparent
-- @default = false
- disable_numbering = false,
-
- -- Set numbering style
- -- 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,
+ transparent_background = false,
+ },
+}
- -- 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,
+config.source = nil
+config.load = function()
+ -- Set vim defaults on first load. To override these, the user can just
+ -- override vim.opt in their own config, no bells or whistles attached.
+ local first_load = vim.tbl_isempty(doom or {})
+ if first_load then
+ vim.opt.hidden = true
+ vim.opt.updatetime = 200
+ vim.opt.timeoutlen = 400
+ vim.opt.background = "dark"
+ vim.opt.completeopt = {
+ "menu",
+ "menuone",
+ "preview",
+ "noinsert",
+ "noselect",
+ }
+ vim.opt.shortmess = "atsc"
+ vim.opt.inccommand = "split"
+ vim.opt.path = "**"
+ vim.opt.signcolumn = "auto:2-3"
+ vim.opt.foldcolumn = "auto:9"
+ vim.opt.colorcolumn = "80"
+ vim.opt.formatoptions:append("j")
+ vim.opt.fillchars = {
+ vert = "▕",
+ fold = " ",
+ eob = " ",
+ diff = "─",
+ msgsep = "‾",
+ foldopen = "▾",
+ foldclose = "▸",
+ foldsep = "│",
+ }
+ vim.opt.smartindent = true
+ vim.opt.copyindent = true
+ vim.opt.preserveindent = true
+ vim.opt.clipboard = "unnamedplus"
+ vim.opt.cursorline = true
+ vim.opt.splitright = false
+ vim.opt.splitbelow = true
+ vim.opt.scrolloff = 4
+ vim.opt.showmode = false
+ vim.opt.mouse = "a"
+ vim.opt.wrap = false
+ vim.opt.swapfile = false
+ vim.opt.number = true
+ vim.opt.relativenumber = true
+ vim.opt.expandtab = true
+ vim.opt.conceallevel = 0
+ vim.opt.foldenable = true
+ vim.opt.foldtext = require("doom.core.functions").sugar_folds()
+ doom = config.defaults
+ doom.packages = {}
+ doom.autocmds = {}
+ doom.binds = {}
+ for _, module in ipairs(enabled_modules) do
+ local init = require(("doom.modules.%s"):format(module))
+ doom[module] = init.defaults
+ doom.packages = vim.tbl_extend(
+ "force",
+ doom.packages,
+ require(("doom.modules.%s.packages"):format(module))
+ )
+ doom.autocmds[module] = {}
+ end
+ end
- -- Checkupdates on start
- -- @default = false
- check_updates = false,
+ dofile(config.source)
- -- 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,
+ for module, _ in pairs(doom.autocmds) do
+ local ok, cmds = xpcall(require, debug.traceback, ("doom.modules.%s.autocmds"):format(module))
- -- Disable dashboard status line (does not work perfectly)
- -- false : disables dashboard status line
- -- true : enables dashboard status line
- -- @default = true
- dashboard_statline = true,
-
- -- Show the editing file path in your status line
- -- false : show only file name on status line
- -- true : show file name and the updir in status line
- statusline_show_file_path = true,
-
- -- Set the keybindings modules that you want to use
- -- false : disables keybindings module
- -- true : enables keybindings module
- keybinds_modules = {
- -- Core doom keybindings
- core = true,
- -- Movement keybindings, jump between your windows, buffers and code
- movement = true,
- -- Leader keybindings, a bunch of useful keybindings managed by space key
- -- WARNING: disabling this will break which-key plugin if the plugin is enabled
- leader = true,
- -- Completion and snippets keybindings
- completion = true,
- },
-
- -- sequences used for escaping insert mode
- -- @default = { 'jk', 'kj' }
- escape_sequences = { "jk", "kj" },
-
- -- Disable or enable Doom autocommands, this can break some configuration options (they will stop working)
- -- e.g. preserve_edit_pos or autosave
- --
- -- false : enable autocommands module
- -- true : disable autocommands module
- -- @default = false
- disable_autocommands = false,
+ if ok then
+ for _, cmd in ipairs(cmds) do
+ table.insert(doom.autocmds[module], cmd)
+ end
+ end
+ end
+ local module_binds = {}
+ for _, module in ipairs(enabled_modules) do
+ local ok, binds = xpcall(require, debug.traceback, ("doom.modules.%s.binds"):format(module))
- -- Enable LSP diagnostics virtual text
- -- @default = false
- enable_lsp_virtual_text = false,
+ if ok and not vim.tbl_isempty(binds) then
+ table.insert(module_binds, binds)
+ end
+ end
+ if not vim.tbl_isempty(module_binds) then
+ if not vim.tbl_isempty(doom.binds) then
+ doom.binds = { module_binds, doom.binds }
+ else
+ doom.binds = module_binds
+ end
+ end
- -- Use floating windows for plugins manager (packer) operations
- -- @default = false
- use_floating_win_packer = false,
-
- -- 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_warn = "",
- lsp_hint = "",
- lsp_info = "",
- lsp_virtual_text = " ",
-
- -- Set your linters for the programming languages that you use,
- -- see https://github.com/mfussenegger/nvim-lint#available-linters
- linters = {
- c = {},
- cpp = {},
- css = {},
- html = {},
- javascript = {},
- lua = {},
- markdown = {},
- nix = {},
- python = {},
- ruby = {},
- sh = {},
- typescript = {},
- },
-
- -- Set your dashboard custom colors below
- -- @default = doom emacs' default dashboard colors
- dashboard_custom_colors = {
- 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',
- -- ['modelineexpr'] = true,
- -- }
- --
- -- modeline feature was turned off to reduce security exploit surfaces.
- -- Since modeline now uses whitelist approach since nvim 0.4 /vim 8.1,
- -- enabling this is as safe as external packages such as securemodelines.
- -- See https://github.com/neovim/neovim/issues/2865
- --
- global_variables = {},
-
- -- Set custom autocommands
- -- @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,
- -- -- If the function should be ran on neovim launch or if it should
- -- -- be a global function accesible from anywhere
- -- run_on_start = false,
- -- },
- -- }
- functions = {},
-
- -- Set custom options
- -- @default = {}
- -- example:
- -- {
- -- { ['shiftwidth'] = 4 }
- -- }
- options = {},
- },
- -- }}}
-}
+ -- If we shouldn't freeze, remove commit SHAs.
+ if not doom.freeze_dependencies then
+ for _, spec in pairs(doom.packages) do
+ spec.commit = nil
+ end
+ end
--- }}}
+ -- Check plugins updates on start if enabled.
+ if doom.check_updates then
+ require("doom.core.functions").check_updates()
+ end
-config.source = nil
+ -- These are the few vim options we wrap directly, because their usual
+ -- interface is either error-prone or verbose.
+ if first_load then
+ vim.opt.shiftwidth = doom.indent
+ vim.opt.softtabstop = doom.indent
+ vim.opt.tabstop = doom.indent
+ if doom.guicolors then
+ if vim.fn.exists("+termguicolors") == 1 then
+ vim.opt.termguicolors = true
+ elseif vim.fn.exists("+guicolors") == 1 then
+ vim.opt.guicolors = true
+ end
+ end
-log.debug("Loading Doom config module ...")
+ if doom.auto_comment then
+ vim.opt.formatoptions:append("croj")
+ end
+ if doom.movement_wrap then
+ vim.cmd("set whichwrap+=<,>,[,],h,l")
+ end
--- Path cases:
--- 1. /home/user/.config/doom-nvim/doom_config.lua
--- 2. stdpath('config')/doom_config.lua
--- 3. /doom_config.lua
-local ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_config.lua")
-if ok then
- config.config = ret.config
- config.source = ret.source
-else
- ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_config.lua")
- if ok then
- config.config = ret.config
- config.source = ret.source
- else
- ok, ret = xpcall(require, debug.traceback, "doom_config")
- if ok then
- config.config = ret.config
- config.source = ret.source
+ if doom.undo_dir then
+ vim.opt.undofile = true
+ vim.opt.undodir = doom.undo_dir
else
- log.error("Error while loading doom_config.lua. Traceback:\n" .. ret)
+ vim.opt.undofile = false
+ vim.opt.undodir = nil
end
end
end
--- Check plugins updates on start if enabled
-if config.config.doom.check_updates then
- require("doom.core.functions").check_updates()
-end
+-- Path cases:
+-- 1. stdpath('config')/../doom-nvim/config.lua
+-- 2. stdpath('config')/config.lua
+-- 3. /doom-nvim/config.lua
+config.source = utils.find_config(filename)
return config
diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua
index dfd2f8d62..fd707327a 100644
--- a/lua/doom/core/config/modules.lua
+++ b/lua/doom/core/config/modules.lua
@@ -1,111 +1,13 @@
----[[---------------------------------------------]]---
--- modules - Load Doom Nvim doom_modules.lua --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------------]]---
-
-local system = require("doom.core.system")
-local log = require("doom.extras.logging")
+local utils = require("doom.utils")
+local filename = "modules.lua"
local modules = {}
-modules.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
- },
-}
-
-modules.source = nil
-
-log.debug("Loading Doom modules module ...")
-
-- Path cases:
--- 1. /home/user/.config/doom-nvim/doom_modules.lua
--- 2. stdpath('config')/doom_modules.lua
--- 3. /doom_modules.lua
-local ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_modules.lua")
-if ok then
- modules.modules = ret.modules
- modules.source = ret.source
-else
- ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_modules.lua")
- if ok then
- modules.modules = ret.modules
- modules.source = ret.source
- else
- ok, ret = xpcall(require, debug.traceback, "doom_modules")
- if ok then
- modules.modules = ret.modules
- modules.source = ret.source
- else
- log.error("Error while loading doom_modules.lua. Traceback:\n" .. ret)
- end
- end
-end
+-- 1. stdpath('config')/../doom-nvim/modules.lua
+-- 2. stdpath('config')/modules.lua
+-- 3. /doom-nvim/modules.lua
+modules.source = utils.find_config(filename)
+modules.modules = dofile(modules.source)
return modules
diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua
deleted file mode 100644
index bf8679c2b..000000000
--- a/lua/doom/core/config/ui.lua
+++ /dev/null
@@ -1,70 +0,0 @@
----[[---------------------------------------]]---
--- ui.lua - Doom Nvim UI settings --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
-local utils = require("doom.utils")
-local log = require("doom.extras.logging")
-local config = require("doom.core.config").config
-
-log.debug("Loading Doom UI module ...")
-
--- If no colorscheme was established then fallback to defauls
-if not utils.is_empty(config.doom.colorscheme) then
- local loaded_colorscheme = xpcall(function()
- vim.opt.background = config.doom.colorscheme_bg
- vim.api.nvim_command("colorscheme " .. config.doom.colorscheme)
- end, debug.traceback)
-
- if not loaded_colorscheme then
- log.warn("Colorscheme '" .. config.doom.colorscheme .. "' not found, falling to doom-one")
- vim.api.nvim_command("colorscheme doom-one")
- end
-else
- log.warn("Forced default Doom colorscheme")
- vim.api.nvim_command("colorscheme doom-one")
-end
-
--- Set colors based on environment (GUI, TUI)
-if config.doom.enable_guicolors then
- if vim.fn.exists("+termguicolors") == 1 then
- vim.opt.termguicolors = true
- elseif vim.fn.exists("+guicolors") == 1 then
- vim.opt.guicolors = true
- end
-end
-
--- Set custom WhichKey background
-vim.cmd("highlight WhichKeyFloat guibg=" .. config.doom.whichkey_bg)
-
--- Set doom-one colorscheme settings
-if config.doom.colorscheme == "doom-one" then
- require("colors.doom-one").setup({
- cursor_coloring = config.doom.doom_one.cursor_coloring,
- terminal_colors = config.doom.doom_one.terminal_colors,
- italic_comments = config.doom.doom_one.italic_comments,
- enable_treesitter = config.doom.doom_one.enable_treesitter,
- transparent_background = config.doom.doom_one.transparent_background,
- pumblend = {
- enable = true,
- transparency_amount = config.doom.complete_transparency,
- },
- plugins_integrations = {
- neorg = true,
- barbar = false,
- bufferline = true,
- gitgutter = false,
- gitsigns = true,
- telescope = config.doom.doom_one.telescope_highlights,
- neogit = true,
- nvim_tree = true,
- dashboard = true,
- startify = false,
- whichkey = true,
- indent_blankline = true,
- vim_illuminate = true,
- lspsaga = false,
- },
- })
-end
diff --git a/lua/doom/core/config/userplugins.lua b/lua/doom/core/config/userplugins.lua
deleted file mode 100644
index 03c6f620a..000000000
--- a/lua/doom/core/config/userplugins.lua
+++ /dev/null
@@ -1,42 +0,0 @@
----[[---------------------------------------]]---
--- userplugins - Load Doom Nvim doom_userplugins --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
-local system = require("doom.core.system")
-local log = require("doom.extras.logging")
-
-local userplugins = {}
-
-userplugins.plugins = {}
-
-userplugins.source = nil
-
-log.debug("Loading Doom userplugins module...")
-
--- Path cases:
--- 1. /home/user/.config/doom-nvim/doom_userplugins.lua
--- 2. stdpath('config')/doom_userplugins.lua
--- 3. /doom_userplugins.lua
-local ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_userplugins.lua")
-if ok then
- userplugins.plugins = ret.plugins
- userplugins.source = ret.source
-else
- ok, ret = xpcall(dofile, debug.traceback, system.doom_root .. "/doom_userplugins.lua")
- if ok then
- userplugins.plugins = ret.plugins
- userplugins.source = ret.source
- else
- ok, ret = xpcall(require, debug.traceback, "doom_userplugins")
- if ok then
- userplugins.plugins = ret.plugins
- userplugins.source = ret.source
- else
- log.error("Error while loading doom_userplugins.lua. Traceback:\n" .. ret)
- end
- end
-end
-
-return userplugins
diff --git a/lua/doom/core/functions/init.lua b/lua/doom/core/functions.lua
similarity index 60%
rename from lua/doom/core/functions/init.lua
rename to lua/doom/core/functions.lua
index ac88f863f..3de5af7bd 100644
--- a/lua/doom/core/functions/init.lua
+++ b/lua/doom/core/functions.lua
@@ -1,122 +1,19 @@
----[[---------------------------------------]]---
--- functions - Doom Nvim Functions --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
-local log = require("doom.extras.logging")
-local utils, fs = require("doom.utils"), require("doom.utils.fs")
+-- NOTE: Can't require "doom.utils.logging" in the top level, because `doom`
+-- may not exist here.
+local utils = require("doom.utils")
+local fs = require("doom.utils.fs")
local system = require("doom.core.system")
-local config = require("doom.core.config").config
-local async = require("doom.modules.built-in.async")
+local async = require("doom.utils.async")
+local is_plugin_disabled = utils.is_plugin_disabled
local functions = {}
-log.debug("Loading Doom functions module ...")
-
--- Load user-defined settings from the Neovim field in the doom_config.lua
--- @param settings_tbl The settings table to iterate over
--- @param scope The settings scope, e.g. autocmds
-functions.load_custom_settings = function(settings_tbl, scope)
- -- If the provided settings table is not empty
- if next(settings_tbl) ~= nil then
- log.debug("Loading custom " .. scope .. " ...")
- if scope == "functions" then
- for _, func in ipairs(settings_tbl) do
- -- Copy the function table so we can modify it safely
- local func_tbl = func
- -- Remove the additional table parameters
- func_tbl.run_on_start = nil
- local func_name = vim.tbl_keys(func_tbl)[1]
-
- -- If we should run the function on launch or set it as a global function
- if func.run_on_start then
- func_tbl[func_name]()
- else
- _G[func_name] = func_tbl[func_name]
- end
- end
- elseif scope == "mappings" then
- for _, map in ipairs(settings_tbl) do
- -- scope, lhs, rhs, options
- vim.api.nvim_set_keymap(map[1], map[2], map[3], map[4] and map[4] or {})
- end
- elseif scope == "autocmds" then
- utils.create_augroups(settings_tbl)
- elseif scope == "commands" then
- for _, cmd in ipairs(settings_tbl) do
- vim.cmd(cmd)
- end
- elseif scope == "variables" then
- for var, val in pairs(settings_tbl) do
- vim.g[var] = val
- end
- elseif scope == "options" then
- for var, val in pairs(settings_tbl) do
- vim.opt[var] = val
- end
- end
- end
-end
-
--- reload_custom_settings reloads all the user-defined configurations
--- in the 'doom_config.lua' file.
-functions.reload_custom_settings = function()
- -- Get the user-defined settings, the 'nvim' field in our 'doom_config.lua'
- local custom_settings = require("doom.core.config").config.nvim
- -- iterate over all the custom settings fields, e.g. global_variables, mappings, etc.
- for scope, _ in pairs(custom_settings) do
- functions.load_custom_settings(custom_settings[scope], scope)
- end
-end
-
--- Change the 'doom_config.lua' file configurations for the colorscheme and the
--- background if they were changed by the user within Neovim
-functions.change_colors_and_bg = function()
- local changed_colorscheme, err = xpcall(function()
- log.debug("Checking if the colorscheme or background were changed ...")
- local target_colorscheme = vim.g.colors_name
- local target_background = vim.opt.background:get()
-
- -- Set the correct path for the 'doom_config.lua' file
- local doom_config_path = require("doom.core.config").source
-
- if target_colorscheme ~= config.doom.colorscheme then
- local doom_config = fs.read_file(doom_config_path)
- doom_config = string.gsub(
- doom_config,
- string.format('"%s"', utils.escape_str(config.doom.colorscheme)),
- string.format('"%s"', utils.escape_str(target_colorscheme))
- )
- fs.write_file(doom_config_path, doom_config, "w+")
- log.debug("Colorscheme successfully changed to " .. target_colorscheme)
- end
- if target_background ~= config.doom.colorscheme_bg then
- local doom_config = fs.read_file(doom_config_path)
- doom_config = string.gsub(
- doom_config,
- string.format('"%s"', config.doom.colorscheme_bg),
- string.format('"%s"', target_background)
- )
- fs.write_file(doom_config_path, doom_config, "w+")
- log.debug("Background successfully changed to " .. target_background)
- end
- end, debug.traceback)
-
- if not changed_colorscheme then
- log.error("Unable to write to the doom_config.lua file. Traceback:\n" .. err)
- end
-end
-
--- 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
+-- Quit Neovim and dump all messages to doom.log file.
+-- @tparam bool dont_write If doom shouldn't save before exiting
-- @tparam bool force If doom should force the exiting
-functions.quit_doom = function(write, force)
- functions.change_colors_and_bg()
-
+functions.quit_doom = function(dont_write, force)
local quit_cmd = ""
- if write then
+ if not dont_write then
quit_cmd = "wa | "
end
if force then
@@ -128,6 +25,7 @@ end
-- check_updates checks for plugins updates
functions.check_updates = function()
+ local log = require("doom.utils.logging")
local updated_plugins, err = xpcall(function()
log.info("Updating the outdated plugins ...")
vim.cmd("PackerSync")
@@ -176,6 +74,7 @@ end
-- create_report creates a markdown report. It's meant to be used when a bug
-- occurs, useful for debugging issues.
functions.create_report = function()
+ local log = require("doom.utils.logging")
local date = os.date("%Y-%m-%d %H:%M:%S")
local created_report, err = xpcall(function()
-- Get and save only the warning and error logs from today
@@ -260,6 +159,7 @@ end
-- save_backup_hashes saves the commits or releases SHA for future rollbacks
local function save_backup_hashes()
+ local log = require("doom.utils.logging")
-- Check for the current branch
local git_branch = utils.get_git_output("branch --show-current", true)
@@ -334,7 +234,9 @@ end
-- update_doom saves the current commit/release hash into a file for future
-- restore if needed and then updates Doom.
+-- TODO: Port to module architecture
functions.update_doom = function()
+ local log = require("doom.utils.logging")
save_backup_hashes()
log.info("Pulling Doom remote changes ...")
@@ -346,7 +248,7 @@ functions.update_doom = function()
if data then
log.info("Successfully updated Doom!")
--- Completely reload Doom Nvim
- require("doom.modules.built-in.reloader").full_reload()
+ require("doom.utils.reloader").full_reload()
end
end,
on_stderr = function(err, data)
@@ -362,7 +264,9 @@ end
-- rollback_doom will rollback the local doom version to an older one
-- in case that the local one is broken
+-- TODO: Port to module architecture
functions.rollback_doom = function()
+ local log = require("doom.utils.logging")
-- Backup file for main (stable) branch
local releases_database_path = string.format("%s%s.doom_releases", system.doom_root, system.sep)
-- Backup file for development branch
@@ -462,186 +366,122 @@ functions.rollback_doom = function()
end
end
--- edit_config creates a prompt to modify a doom configuration file
-functions.edit_config = function()
- local selected_config = tonumber(vim.fn.inputlist({
- "Select a configuration file to edit:",
- "1. doom_config.lua",
- "2. doom_modules.lua",
- "3. doom_userplugins.lua",
- }))
- local direction = config.doom.vertical_split and "vert " or ""
- local open_command = config.doom.new_file_split and "split" or "edit"
-
- if selected_config == 1 then
- vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config").source))
- elseif selected_config == 2 then
- vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source))
- elseif selected_config == 3 then
- vim.cmd(
- ("%s%s %s"):format(direction, open_command, require("doom.core.config.userplugins").source)
- )
- elseif selected_config ~= 0 then
- log.error("Invalid option selected.")
- end
+local function bool2str(bool)
+ return bool and "on" or "off"
end
--- followings are called from lua/doom/extras/keybindings/leader.lua
---
--- toggle_background() -- tb -- toggle background light/dark
+-- Toggle background="dark"|"light"
functions.toggle_background = function()
local background = vim.go.background
if background == "light" then
vim.go.background = "dark"
- print("background=dark")
else
vim.go.background = "light"
- print("background=light")
end
+ -- XXX: Should we "just print"? Maybe and info log?
+ print(string.format("background=%s", vim.go.background))
end
--- toggle_completion() -- tc -- toggle completion
-vim.g.cmp_toggle_flag = true -- initialize
-local normal_buftype = function()
- return vim.api.nvim_buf_get_option(0, "buftype") ~= "prompt"
-end
-functions.toggle_completion = function()
- local ok, cmp = xpcall(require, debug.traceback, "cmp")
- if ok then
- local next_cmp_toggle_flag = not vim.g.cmp_toggle_flag
- if next_cmp_toggle_flag then
- print("completion on")
- else
- print("completion off")
- end
- cmp.setup({
- enabled = function()
- vim.g.cmp_toggle_flag = next_cmp_toggle_flag
- if next_cmp_toggle_flag then
- return normal_buftype
- else
- return next_cmp_toggle_flag
- end
- end,
- })
- else
- print("completion not available")
+-- Only define if lsp enabled, it only makes sense there.
+if not is_plugin_disabled("lsp") then
+ -- Toggle completion (by running cmp setup again).
+ functions.toggle_completion = function()
+ _doom.cmp_enable = not _doom.cmp_enable
+ print(string.format("completion=%s", bool2str(_doom.cmp_enable)))
end
end
--- toggle_signcolumn() -- tg -- signcolumn auto/no
+-- Toggle signcolumn="auto"|"no"
functions.toggle_signcolumn = function()
local signcolumn = vim.o.signcolumn
if signcolumn == "no" then
- vim.o.signcolumn = "auto"
- print("signcolumn=auto")
+ vim.opt.signcolumn = "auto"
else
- vim.o.signcolumn = "no"
- print("signcolumn=no")
+ vim.opt.signcolumn = "no"
end
+ print(string.format("signcolumn=%s", vim.opt.signcolumn))
end
--- set_indent() -- ti -- set the indent and tab related numbers
+-- Set the indent and tab related numbers.
+-- Negative numbers mean tabstop -- Really though? Tabs?
functions.set_indent = function()
local indent = tonumber(
- vim.fn.input(
- "Set all tab related options to a specified number and set expandtab\n(0 to reset to vim defaults, ? to print current settings): "
- )
+ vim.fn.input("Set indent (>0 uses spaces, <0 uses tabs, 0 uses vim defaults): ")
)
- if (indent == nil) or (indent < 0) then
- vim.cmd("set softtabstop? tabstop? shiftwidth? expandtab?")
- elseif indent > 0 then
- vim.o.tabstop = indent
- vim.o.softtabstop = indent
- vim.o.shiftwidth = indent
- vim.o.expandtab = true
- print(("\nindent=%i, expandtab"):format(indent))
- else -- indent == 0
- vim.o.tabstop = 8
- vim.o.softtabstop = 0
- vim.o.shiftwidth = 8
- vim.o.expandtab = false
- print("\nindent=8, noexpandtab")
+ if not indent then
+ indent = -8
end
+ vim.opt.expandtab = indent > 0
+ indent = math.abs(indent)
+ vim.opt.tabstop = indent
+ vim.opt.softtabstop = indent
+ vim.opt.shiftwidth = indent
+ print(string.format("indent=%d %s", indent, vim.opt.expandtab and "spaces" or "tabs"))
end
--- change_number() -- tn -- change the number display modes
+-- Change the number display modes.
functions.change_number = function()
- local number = vim.o.number
- local relativenumber = vim.o.relativenumber
+ local number = vim.opt.number
+ local relativenumber = vim.opt.relativenumber
if (number == false) and (relativenumber == false) then
- vim.o.number = true
- vim.o.relativenumber = false
- print("number on, relativenumber off")
+ vim.opt.number = true
+ vim.opt.relativenumber = false
elseif (number == true) and (relativenumber == false) then
- vim.o.number = false
- vim.o.relativenumber = true
- print("number off, relativenumber on")
+ vim.opt.number = false
+ vim.opt.relativenumber = true
elseif (number == false) and (relativenumber == true) then
- vim.o.number = true
- vim.o.relativenumber = true
- print("number on, relativenumber on")
+ vim.opt.number = true
+ vim.opt.relativenumber = true
else -- (number == true) and (relativenumber == true) then
- vim.o.number = false
- vim.o.relativenumber = false
- print("number off, relativenumber off")
+ vim.opt.number = false
+ vim.opt.relativenumber = false
end
+ print("number=%s, relativenumber=%s", bool2str(vim.opt.number), bool2str(vim.opt.relativenumber))
end
--- toggle_autopairs() -- tp -- toggle autopairs
-functions.toggle_autopairs = function()
- local ok, autopairs = xpcall(require, debug.traceback, "nvim-autopairs")
- if ok then
+-- Toggle autopairs.
+if not is_plugin_disabled("autopairs") then
+ functions.toggle_autopairs = function()
+ local autopairs = require("nvim-autopairs")
if autopairs.state.disabled then
autopairs.enable()
- print("autopairs on")
else
autopairs.disable()
- print("autopairs off")
end
- else
- print("autopairs not available")
end
end
--- toggle_spell() -- ts -- toggle spell
+-- Toggle spell.
functions.toggle_spell = function()
- if vim.o.spell then
- vim.o.spell = false
- print("spell off")
- else
- if vim.o.spelllang == nil then
- vim.o.spelllang = "en_us"
- end
- vim.o.spell = true
- print(("spell on, lang %s"):format(vim.o.spelllang))
- end
+ vim.opt.spell = not vim.opt.spell
+ print(string.format("spell=%s", bool2str(vim.opt.spell)))
end
--- change_syntax() -- tx -- toggle syntax/treesetter
+-- Toggle syntax/treesitter
functions.change_syntax = function()
- local ok, parsers = xpcall(require, debug.traceback, "nvim-treesitter.parsers")
- if ok and parsers and parsers.has_parser() then
- if vim.o.syntax then
+ local parsers = require("nvim-treesitter.parsers")
+ if parsers.has_parser() then
+ if vim.opt.syntax then
vim.cmd("TSBufDisable highlight")
vim.cmd("syntax off")
- print("syntax off, treesetter off")
else
vim.cmd("TSBufEnable highlight")
vim.cmd("syntax on")
- print("syntax on, treesetter on")
end
+ local state = bool2str(vim.opt.syntax)
+ print(string.format("syntax=%s, treesitter=%s", state, state))
else
if vim.o.syntax then
vim.cmd("syntax off")
- print("syntax off")
else
vim.cmd("syntax on")
- print("syntax on")
end
+ local state = bool2str(vim.opt.syntax)
+ print(string.format("syntax=%s", state))
end
end
+-- Better folding function.
functions.sugar_folds = function()
local start_line = vim.fn.getline(vim.v.foldstart):gsub("\t", ("\t"):rep(vim.opt.tabstop:get()))
return string.format("%s ... (%d lines)", start_line, vim.v.foldend - vim.v.foldstart + 1)
diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua
index fb544585e..17d95ac9f 100644
--- a/lua/doom/core/init.lua
+++ b/lua/doom/core/init.lua
@@ -2,30 +2,14 @@
--- This file loads all doom core components
--- (ui, options, doomrc, etc)
-local log = require("doom.extras.logging")
+local utils = require("doom.utils")
+local is_plugin_disabled = utils.is_plugin_disabled
-log.debug("Loading Doom core ...")
-
-local core_modules = { "settings", "settings.netrw", "config.ui", "config" }
-for i = 1, #core_modules, 1 do
- local ok, err = xpcall(require, debug.traceback, ("doom.core.%s"):format(core_modules[i]))
- if ok then
- if core_modules[i] == "settings" then
- -- Neovim configurations, e.g. shiftwidth
- require("doom.core.settings").load_default_options()
- -- User-defined settings (global variables, mappings, ect)
- require("doom.core.settings").custom_options()
- -- Doom Nvim custom commands
- require("doom.core.settings").doom_commands()
- end
- log.debug(string.format("Successfully loaded 'doom.core.%s' module", core_modules[i]))
- else
- log.error(
- string.format(
- "There was an error loading the module 'doom.core.%s'. Traceback:\n%s",
- core_modules[i],
- err
- )
- )
- end
+-- Required setup modules.
+local core_modules = { "commands", "ui" }
+-- If the explorer is disabled, the user probably wants a better netrw.
+-- Otherwise, don't bother configuring it.
+if is_plugin_disabled("explorer") then
+ table.insert(core_modules, "netrw")
end
+utils.load_modules("doom.core", core_modules)
diff --git a/lua/doom/core/settings/netrw.lua b/lua/doom/core/netrw.lua
similarity index 86%
rename from lua/doom/core/settings/netrw.lua
rename to lua/doom/core/netrw.lua
index 4d3560ad9..6419e1531 100644
--- a/lua/doom/core/settings/netrw.lua
+++ b/lua/doom/core/netrw.lua
@@ -1,12 +1,9 @@
----[[---------------------------------------]]---
--- netrw - Doom Nvim netrw setup --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
local utils = require("doom.utils")
local system = require("doom.core.system")
-local config = require("doom.core.config").config.doom
+
+-- Netew winsize
+-- @default = 20
+vim.g.netrw_winsize = 20
-- Netrw banner
-- 0 : Disable banner
@@ -38,10 +35,7 @@ vim.g.netrw_list_hide = vim.fn["netrw_gitignore#Hide"]()
-- 0 : show all files
-- 1 : show not-hidden files
-- 2 : show hidden files only
-vim.g.netrw_hide = config.show_hidden and 0 or 1
-
--- Change the size of the Netrw window when it creates a split
-vim.g.netrw_winsize = (0 - config.sidebar_width)
+vim.g.netrw_hide = not doom.show_hidden
-- Preview files in a vertical split window
-- vim.g.netrw_preview = 1
@@ -71,16 +65,12 @@ end
-- Highlight marked files in the same way search matches are
vim.cmd("hi! link netrwMarkFile Search")
------ KEYBINDS ------------------------
----------------------------------------
local function netrw_maps()
if vim.bo.filetype ~= "netrw" then
return
end
local opts = { silent = true }
- ----- General -----------------------
- -------------------------------------
-- Toggle dotfiles
vim.api.nvim_buf_set_keymap(0, "n", ".", "gh", opts)
@@ -103,8 +93,6 @@ local function netrw_maps()
-- Close netrw
vim.api.nvim_buf_set_keymap(0, "n", "q", ":Lexplore", opts)
- ----- Files and Directories ---------
- -------------------------------------
-- Create a new file and save it
vim.api.nvim_buf_set_keymap(0, "n", "ff", "%:w:buffer #", opts)
@@ -151,8 +139,6 @@ local function netrw_maps()
opts
)
- ----- Marks (selections) ------------
- -------------------------------------
-- Toggle the mark on a file or directory
vim.api.nvim_buf_set_keymap(0, "n", "", "mf", opts)
@@ -162,8 +148,6 @@ local function netrw_maps()
-- Remove all the marks on all files
vim.api.nvim_buf_set_keymap(0, "n", "", "mu", opts)
- ----- Bookmarks ---------------------
- -------------------------------------
-- Create a bookmark
vim.api.nvim_buf_set_keymap(0, "n", "bc", "mb", opts)
@@ -174,13 +158,11 @@ local function netrw_maps()
vim.api.nvim_buf_set_keymap(0, "n", "bj", "gb", opts)
end
------ ICONS ---------------------------
----------------------------------------
local function draw_icons()
if vim.bo.filetype ~= "netrw" then
return
end
- local is_devicons_available, devicons = pcall(require, "nvim-web-devicons")
+ local is_devicons_available, devicons = xpcall(require, debug.traceback, "nvim-web-devicons")
if not is_devicons_available then
return
end
diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua
deleted file mode 100644
index ac95600b2..000000000
--- a/lua/doom/core/settings/init.lua
+++ /dev/null
@@ -1,195 +0,0 @@
----[[---------------------------------------]]---
--- settings - Doom Nvim settings --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
-local functions = require("doom.core.functions")
-local log = require("doom.extras.logging")
-local config = require("doom.core.config").config
-
-local settings = {}
-
-log.debug("Loading Doom defaults module ...")
-
--- load_default_options sets and loads default Neovim options based on doom_config.lua values
-settings.load_default_options = function()
- ----- Default Neovim configurations
- -- Global options
- vim.opt.hidden = true
- vim.opt.updatetime = 200
- vim.opt.timeoutlen = 500
- vim.opt.completeopt = {
- "menu",
- "menuone",
- "preview",
- "noinsert",
- "noselect",
- }
- vim.opt.shortmess:append("atsc")
- vim.opt.inccommand = "split"
- vim.opt.path = "**"
- vim.opt.signcolumn = "auto:2-3"
- vim.opt.foldcolumn = "auto:9"
-
- vim.opt.fillchars = {
- vert = "▕",
- fold = " ",
- eob = " ",
- diff = "─",
- msgsep = "‾",
- foldopen = "▾",
- foldclose = "▸",
- foldsep = "│",
- }
-
- -- Buffer options
- vim.opt.smartindent = true
- vim.opt.copyindent = true
- vim.opt.preserveindent = true
-
- -- Set Gui Fonts
- vim.opt.guifont = config.doom.guifont .. ":h" .. config.doom.guifont_size
-
- -- Use clipboard outside vim
- if config.doom.clipboard then
- vim.opt.clipboard = "unnamedplus"
- end
-
- if config.doom.line_highlight then
- vim.opt.cursorline = true
- else
- vim.opt.cursorline = false
- end
-
- -- Automatic split locations
- if config.doom.split_right then
- vim.opt.splitright = true
- else
- vim.opt.splitright = false
- end
-
- if config.doom.split_below then
- vim.opt.splitbelow = true
- else
- vim.opt.splitbelow = false
- end
-
- -- Enable scroll off
- if config.doom.scrolloff then
- vim.opt.scrolloff = config.doom.scrolloff_amount
- end
-
- -- Enable showmode
- if not config.doom.show_mode then
- vim.opt.showmode = false
- else
- vim.opt.showmode = true
- end
-
- -- Enable mouse input
- if config.doom.mouse then
- vim.opt.mouse = "a"
- end
-
- -- Enable wrapping
- if not config.doom.line_wrap then
- vim.opt.wrap = false
- else
- vim.opt.wrap = true
- end
-
- -- Enable swap files
- if not config.doom.swap_files then
- vim.opt.swapfile = false
- else
- vim.opt.swapfile = true
- end
-
- -- Set numbering
- if not config.doom.disable_numbering then
- if config.doom.relative_num then
- vim.opt.number = true
- vim.opt.relativenumber = true
- else
- vim.opt.number = true
- end
- end
-
- -- Enable winwidth
- if config.doom.win_width then
- vim.opt.winwidth = config.doom.win_width_nr
- end
-
- -- Checks to see if undo_dir does not exist. If it doesn't, it will create a undo folder
- local undo_dir = vim.fn.stdpath("data") .. config.doom.undo_dir
- if config.doom.backup and vim.fn.empty(vim.fn.glob(undo_dir)) >= 0 then
- if vim.fn.isdirectory(undo_dir) ~= 1 then
- vim.api.nvim_command("!mkdir -p " .. undo_dir)
- end
- vim.opt.undofile = true
- end
-
- -- If backup is false but `undo_dir` still exists then it will delete it.
- if not config.doom.backup and vim.fn.empty(vim.fn.glob(undo_dir)) == 0 then
- vim.api.nvim_command("!rm -rf " .. undo_dir)
- vim.opt.undofile = false
- end
-
- -- Set local-buffer options
- if config.doom.expand_tabs then
- vim.opt.expandtab = true
- else
- vim.opt.expandtab = false
- end
- vim.opt.tabstop = config.doom.indent
- vim.opt.shiftwidth = config.doom.indent
- vim.opt.softtabstop = config.doom.indent
- vim.opt.colorcolumn = tostring(config.doom.max_columns)
- vim.opt.conceallevel = config.doom.conceallevel
- vim.opt.foldenable = config.doom.foldenable
-
- -- Better folding
- vim.cmd([[set foldtext=luaeval(\"require('doom.core.functions').sugar_folds()\")]])
-end
-
--- Doom Nvim commands
-settings.doom_commands = function()
- -- Set a custom command to update Doom Nvim
- -- can be called by using :DoomUpdate
- vim.cmd('command! DoomUpdate lua require("doom.core.functions").update_doom()')
- -- Set a custom command to rollback Doom Nvim version
- -- can be called by using :DoomRollback
- vim.cmd('command! DoomRollback lua require("doom.core.functions").rollback_doom()')
- -- Set a custom command to open Doom Nvim user manual
- -- can be called by using :DoomManual
- vim.cmd('command! DoomManual lua require("doom.core.functions").open_docs()')
- -- Set a custom command to edit Doom Nvim private configurations
- -- can be called by using :DoomConfigs
- vim.cmd('command! DoomConfigs lua require("doom.core.functions").edit_config()')
- -- Set a custom command to reload Doom Nvim custom mappings, autocommands, etc
- -- can be called by using :DoomConfigsReload
- vim.cmd('command! DoomConfigsReload lua require("doom.core.functions").reload_custom_settings()')
- -- Set a custom command to fully reload Doom Nvim and simulate a new Neovim run
- -- can be called by using :DoomReload
- vim.cmd('command! DoomReload lua require("doom.modules.built-in.reloader").full_reload()')
- -- Set a custom command to create a crash report
- -- can be called by using :DoomReport
- vim.cmd('command! DoomReport lua require("doom.core.functions").create_report()')
- -- Set a custom command to display an information dashboard
- -- can be called by using :DoomInfo
- vim.cmd('command! DoomInfo lua require("doom.modules.built-in.info").toggle()')
-end
-
--- Custom Doom Nvim options
-settings.custom_options = function()
- -- Load user-defined settings from the Neovim field in the doom_config.lua file
- functions.load_custom_settings(config.nvim.functions, "functions")
- functions.load_custom_settings(config.nvim.autocmds, "autocmds")
- functions.load_custom_settings(config.nvim.commands, "commands")
- functions.load_custom_settings(config.nvim.mappings, "mappings")
- functions.load_custom_settings(config.nvim.global_variables, "variables")
- functions.load_custom_settings(config.nvim.options, "options")
-end
-
-return settings
diff --git a/lua/doom/core/system/init.lua b/lua/doom/core/system.lua
similarity index 59%
rename from lua/doom/core/system/init.lua
rename to lua/doom/core/system.lua
index 822f8553a..8628ed5ff 100644
--- a/lua/doom/core/system/init.lua
+++ b/lua/doom/core/system.lua
@@ -1,20 +1,14 @@
----[[---------------------------------------]]---
--- system - Doom Nvim system integration --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
local system = {}
local stdpath = vim.fn.stdpath
local config_dir = stdpath("config"):match(".*[/\\]"):sub(1, -2)
system.sep = package.config:sub(1, 1)
--- The doom-nvim root directory, works as a fallback for looking Doom Nvim configurations
--- in case that doom_configs_root directory does not exists.
+-- The nvim root directory, works as a fallback for looking Doom Nvim configurations
+-- in case that doom_configs_root directory does not exist.
system.doom_root = stdpath("config")
--- The doom-nvim configurations root directory
+-- The doom-nvim configurations root directory.
system.doom_configs_root = table.concat({ config_dir, "doom-nvim" }, system.sep)
local testdir = vim.loop.fs_opendir(system.doom_configs_root)
@@ -24,6 +18,8 @@ else
system.doom_configs_root = stdpath("config")
end
+system.doom_compile_path = vim.fn.stdpath("data") .. "/plugin/packer_compiled.lua"
+
-- The doom-nvim logs file path
system.doom_logs = table.concat({ stdpath("data"), "doom.log" }, system.sep)
@@ -31,6 +27,6 @@ system.doom_logs = table.concat({ stdpath("data"), "doom.log" }, system.sep)
system.doom_report = table.concat({ stdpath("data"), "doom_report.md" }, system.sep)
-- The git workspace for doom-nvim, e.g. 'git -C /home/JohnDoe/.config/nvim'
-system.git_workspace = string.format("git -C %s ", stdpath("config"))
+system.git_workspace = string.format("git -C %s ", system.doom_root)
return system
diff --git a/lua/doom/core/ui.lua b/lua/doom/core/ui.lua
new file mode 100644
index 000000000..942a3260e
--- /dev/null
+++ b/lua/doom/core/ui.lua
@@ -0,0 +1,48 @@
+local utils = require("doom.utils")
+local log = require("doom.utils.logging")
+
+-- If the colorscheme was not found then fallback to defaults.
+if not utils.is_empty(doom.colorscheme) then
+ local loaded_colorscheme = xpcall(function()
+ vim.api.nvim_command("colorscheme " .. doom.colorscheme)
+ end, debug.traceback)
+
+ if not loaded_colorscheme then
+ log.warn("Colorscheme '" .. doom.colorscheme .. "' not found, falling back to doom-one")
+ vim.api.nvim_command("colorscheme doom-one")
+ end
+else
+ log.warn("Forced default Doom colorscheme")
+ vim.api.nvim_command("colorscheme doom-one")
+end
+
+-- Set doom-one colorscheme settings
+if doom.colorscheme == "doom-one" then
+ require("colors.doom-one").setup({
+ cursor_coloring = doom.doom_one.cursor_coloring,
+ terminal_colors = doom.doom_one.terminal_colors,
+ italic_comments = doom.doom_one.italic_comments,
+ enable_treesitter = doom.doom_one.enable_treesitter,
+ transparent_background = doom.doom_one.transparent_background,
+ pumblend = {
+ enable = true,
+ transparency_amount = doom.complete_transparency,
+ },
+ plugins_integrations = {
+ neorg = true,
+ barbar = false,
+ bufferline = true,
+ gitgutter = false,
+ gitsigns = true,
+ telescope = doom.doom_one.telescope_highlights,
+ neogit = true,
+ nvim_tree = true,
+ dashboard = true,
+ startify = false,
+ whichkey = true,
+ indent_blankline = true,
+ vim_illuminate = true,
+ lspsaga = false,
+ },
+ })
+end
diff --git a/lua/doom/extras/README.md b/lua/doom/extras/README.md
deleted file mode 100644
index fae1a5483..000000000
--- a/lua/doom/extras/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# Core
-
-Herein lies the core of Doom. In other words, the modules needed for Doom to
-be Doom.
-
-Those modules are the following:
-
-- autocmds - Doom autocommands.
-- keybindings - Doom keybindings.
-- logging - Doom logging system.
diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua
deleted file mode 100644
index e47ad53eb..000000000
--- a/lua/doom/extras/autocmds/init.lua
+++ /dev/null
@@ -1,201 +0,0 @@
----[[---------------------------------------]]---
--- autocmds - Doom Nvim Autocmds --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
-local utils = require("doom.utils")
-local log = require("doom.extras.logging")
-local config = require("doom.core.config").config
-local is_plugin_disabled = require("doom.utils").is_plugin_disabled
-
-log.debug("Loading Doom autocmds module ...")
-
-local autocmds = {
- doom_core = {
- -- Compile new plugins configurations changes at save
- {
- "BufWritePost",
- "*/config/doom-*.lua",
- "PackerCompile profile=true",
- },
- -- Compile modules and custom plugins changes at exit, in that way we avoid
- -- weird errors of Packer complaining about uninstalled plugins on startup
- {
- "VimLeavePre",
- "doom_modules.lua,doom_userplugins.lua",
- "PackerCompile profile=true",
- },
- -- Live-reload plugins and automatically install or clean them at save
- {
- "BufWritePost",
- "doom_modules.lua,doom_userplugins.lua",
- "lua require('doom.modules.built-in.reloader').reload_plugins_definitions()",
- },
- -- Live-reload user-defined settings when 'doom_config.lua' file was modified
- {
- "BufWritePost",
- "doom_config.lua",
- "lua require('doom.core.functions').reload_custom_settings()",
- },
- -- Live-reload plugins configuration files
- {
- "BufWritePost",
- "*/config/doom-*.lua",
- "lua require('doom.modules.built-in.reloader').reload_lua_module(vim.fn.expand('%:p'))",
- },
- -- Automatically change colorscheme and background on exit
- {
- "VimLeavePre",
- "*",
- "lua require('doom.core.functions').change_colors_and_bg()",
- },
- },
- doom_extras = {
- -- Set up vim_buffer_previewer in telescope.nvim
- { "User", "TelescopePreviewerLoaded", "setlocal wrap" },
- },
-}
-
--- Set numbering
-if not config.doom.disable_numbering then
- if config.doom.relative_num then
- table.insert(autocmds["doom_core"], {
- "BufEnter,WinEnter",
- "*",
- "if &nu | set rnu | endif",
- })
- else
- table.insert(autocmds["doom_core"], {
- "BufEnter,WinEnter",
- "*",
- "if &nu | set nornu | endif",
- })
- end
-end
-
--- Install plugins on launch
-if config.doom.auto_install_plugins then
- vim.defer_fn(function()
- -- Check if there is only packer installed so we can decide if we should
- -- use PackerInstall or PackerSync, useful for generating the
- -- `plugin/packer_compiled.lua` on first doom launch
- if
- vim.tbl_count(vim.fn.globpath(vim.fn.stdpath("data") .. "/site/pack/packer/opt", "*", 0, 1))
- == 1
- then
- vim.cmd("PackerSync")
- else
- -- Clean disabled plugins
- vim.cmd("PackerClean")
- -- Defer the installation of new plugins to avoid a weird bug where packer
- -- tries to clean the plugins that are being installed right now
- vim.defer_fn(function()
- -- Install the plugins
- vim.cmd("PackerInstall")
- end, 200)
- end
- end, 400)
-end
-
--- Set autosave
-if config.doom.autosave then
- table.insert(autocmds["doom_core"], {
- "TextChanged,InsertLeave",
- "",
- "silent! write",
- })
-end
-
--- Enable auto comment
-if not config.doom.auto_comment then
- vim.opt.formatoptions:remove({ "c", "r", "o" })
-end
-
--- Enable highlight on yank
-if config.doom.highlight_yank then
- table.insert(autocmds["doom_core"], {
- {
- "TextYankPost",
- "*",
- "lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})",
- },
- })
-end
-
--- Format on save
--- NOTE: Requires formatter to be enabled!
-if config.doom.fmt_on_save then
- table.insert(autocmds["doom_core"], {
- "BufWritePre",
- "*",
- "FormatWrite",
- })
-end
-
--- Preserve last editing position
-if config.doom.preserve_edit_pos then
- table.insert(autocmds["doom_core"], {
- "BufReadPost",
- "*",
- [[
- if line("'\"") > 1 && line("'\"") <= line("$") |
- exe "normal! g'\"" |
- endif
- ]],
- })
-end
-
--- Linting
-if not is_plugin_disabled("linter") and packer_plugins and packer_plugins["nvim-lint"] then
- table.insert(autocmds["doom_extras"], {
- "BufWinEnter,BufWritePost",
- "",
- "lua require('lint').try_lint()",
- })
-end
-
--- Quickly exit Neovim on dashboard
-if not is_plugin_disabled("dashboard") then
- table.insert(autocmds["doom_extras"], {
- "FileType",
- "dashboard",
- "nnoremap q :q",
- })
-end
-
--- Show line diagnostics on hover
-if not config.doom.enable_lsp_virtual_text then
- local show_diagnostics_function = "vim.diagnostic.open_float(nil, { focus = false })"
- if utils.nvim_is_05 then
- show_diagnostics_function =
- 'vim.lsp.diagnostic.show_line_diagnostics({ focusable = false, border = "single" })'
- end
- table.insert(autocmds["doom_extras"], {
- "CursorHold,CursorHoldI",
- "",
- string.format("lua %s", show_diagnostics_function),
- })
-end
-
--- Eye candy netrw (add icons)
-if config.doom.use_netrw then
- table.insert(autocmds["doom_extras"], {
- "FileType",
- "netrw",
- "lua require('doom.core.settings.netrw').set_maps()",
- })
- table.insert(autocmds["doom_extras"], {
- "FileType",
- "netrw",
- "lua require('doom.core.settings.netrw').draw_icons()",
- })
- table.insert(autocmds["doom_extras"], {
- "TextChanged",
- "*",
- "lua require('doom.core.settings.netrw').draw_icons()",
- })
-end
-
--- Create augroups
-utils.create_augroups(autocmds)
diff --git a/lua/doom/extras/init.lua b/lua/doom/extras/init.lua
deleted file mode 100644
index c3fc659d8..000000000
--- a/lua/doom/extras/init.lua
+++ /dev/null
@@ -1,14 +0,0 @@
---- Main Doom extras file
---- This file loads all doom extra components
---- (autocommands, keybindings)
-
-require("doom.extras.logging").debug("Loading Doom extras ...")
-
-local extra_modules = { "keybindings" }
-
-local disabled_autocommands = require("doom.core.config").config.doom.disable_autocommands
-if not disabled_autocommands then
- vim.list_extend(extra_modules, { "autocmds" })
-end
-
-require("doom.utils.modules").load_modules("doom.extras", extra_modules)
diff --git a/lua/doom/extras/keybindings/completion.lua b/lua/doom/extras/keybindings/completion.lua
deleted file mode 100644
index f9d89b90e..000000000
--- a/lua/doom/extras/keybindings/completion.lua
+++ /dev/null
@@ -1,144 +0,0 @@
----[[-----------------]]---
--- LSP Keybindings --
----]]-----------------[[---
-
-local mappings = require("doom.utils.mappings")
-local check_plugin = require("doom.utils").check_plugin
-
-local opts = { silent = true }
-local lsp_opts = vim.tbl_extend("force", opts, { expr = true })
-
--- gd: jump to definition
-mappings.map(
- "n",
- "gd",
- ":lua vim.lsp.buf.definition()",
- opts,
- "LSP",
- "jump_to_definition",
- "Jump to definition"
-)
--- gr: go to reference
-mappings.map(
- "n",
- "gr",
- ":lua vim.lsp.buf.references()",
- opts,
- "LSP",
- "goto_reference",
- "Goto reference"
-)
--- gi: buf implementation
-mappings.map(
- "n",
- "gi",
- ":lua vim.lsp.buf.implementation()",
- opts,
- "LSP",
- "goto_implementation",
- "List implementations"
-)
--- ca: code actions
-mappings.map(
- "n",
- "ca",
- ":lua vim.lsp.buf.code_action()",
- opts,
- "LSP",
- "code_action",
- "Code action"
-)
--- K: hover doc
-mappings.map(
- "n",
- "K",
- ":lua vim.lsp.buf.hover()",
- opts,
- "LSP",
- "hover_doc",
- "Hover documentation"
-)
--- Control+p: Jump to previous diagnostic
--- TODO: Find the equivalent for the new vim.diagnostic api
-mappings.map(
- "n",
- "",
- ":lua vim.lsp.diagnostic.goto_prev()",
- opts,
- "LSP",
- "prev_diagnostic",
- "Jump to previous diagnostic"
-)
--- Control+n: Jump to next diagnostic
--- TODO: Find the equivalent for the new vim.diagnostic api
-mappings.map(
- "n",
- "",
- ":lua vim.lsp.diagnostic.goto_next()",
- opts,
- "LSP",
- "next_diagnostic",
- "Jump to next diagnostic"
-)
-
-vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()')
-
--- LuaSnip mappings
-if check_plugin("LuaSnip", "opt") then
- mappings.map(
- "n",
- "",
- 'luasnip#expand_or_jumpable() ? "luasnip-expand-or-jump" : ""',
- lsp_opts,
- "Snippets",
- "luasnip_expand",
- "Expand snippet"
- )
- mappings.map(
- "i",
- "",
- 'lua require("luasnip").jump(-1)',
- opts,
- "Snippets",
- "luasnip_prev_sel",
- "Previous snippet"
- )
-
- mappings.map(
- "s",
- "",
- 'lua require("luasnip").jump(1)',
- opts,
- "Snippets",
- "luasnip_next_sel",
- "Next snippet"
- )
- mappings.map(
- "s",
- "",
- 'lua require("luasnip").jump(-1)',
- opts,
- "Snippets",
- "luasnip_prev_sel_s",
- "Previous snippet (Select mode)"
- )
-
- mappings.map(
- "i",
- "",
- 'luasnip#choice_active() ? "luasnip-next-choice" : ""',
- lsp_opts,
- "Snippets",
- "luasnip_next_choice",
- "Next snippets field"
- )
- mappings.map(
- "s",
- "",
- 'luasnip#choice_active() ? "luasnip-next-choice" : ""',
- lsp_opts,
- "Snippets",
- "luasnip_next_choice_s",
- "Next snippet field"
- )
-end
diff --git a/lua/doom/extras/keybindings/core.lua b/lua/doom/extras/keybindings/core.lua
deleted file mode 100644
index 30b4ec586..000000000
--- a/lua/doom/extras/keybindings/core.lua
+++ /dev/null
@@ -1,126 +0,0 @@
-local mappings = require("doom.utils.mappings")
-local config = require("doom.core.config").config
-local is_plugin_disabled = require("doom.utils").is_plugin_disabled
-
--- Additional options for mappings
-local opts = { silent = true }
-
--- Fast exit from Doom Nvim
-mappings.map(
- "n",
- "ZZ",
- 'lua require("doom.core.functions").quit_doom(true, true)',
- opts,
- "Editor",
- "fast_exit",
- "Fast exit from Doom Nvim"
-)
-
--- ESC to turn off search highlighting
-mappings.map(
- "n",
- "",
- ":noh",
- opts,
- "Editor",
- "no_highlight",
- "Turn off search highlighting"
-)
-
----[[-----------------]]---
--- Disable keys --
----]]-----------------[[---
--- Disable accidentally pressing ctrl-z and suspending
-mappings.map("n", "", "", opts, "Editor", "disable_suspending", "Disable suspending")
-
--- Disable ex mode
-mappings.map("n", "Q", "", opts, "Editor", "disable_ex", "Disable ex mode")
-
--- Disable recording macros
-if config.doom.disable_macros then
- mappings.map("n", "q", "", opts, "Editor", "disable_macros", "Disable macros")
-end
-
----[[-----------------]]---
--- Escape Remaps --
----]]-----------------[[---
-for _, esc_seq in pairs(config.doom.escape_sequences or { "jk", "kj" }) do
- mappings.map(
- "i",
- esc_seq,
- "",
- opts,
- "Editor",
- "exit_insert" .. esc_seq,
- "Exit insert mode `" .. esc_seq .. "`"
- )
-end
-
----[[-----------------]]---
--- Make inclusive --
----]]-----------------[[---
--- BUG: my nvim freezes from this when which key shows up
--- NOTE: IMO inclusive is better
--- mappings.map("o", "T", "vT", opts, "Editor", "occurence_backw_inclusive", "Backwards occurence inclusive")
--- mappings.map("o", "F", "vF", opts, "Editor", "occurence_backw_till_inclusive", "Backwards occurence till inclusive")
-
----[[------------------]]---
--- F keybindings --
----]]------------------[[---
-if not is_plugin_disabled("symbols") then
- mappings.map(
- "n",
- "",
- ":SymbolsOutline",
- opts,
- "Editor",
- "open_symbols",
- "Toggle SymbolsOutline (LSP tags)"
- )
-end
-if not is_plugin_disabled("explorer") and not config.doom.use_netrw then
- mappings.map(
- "n",
- "",
- ":NvimTreeToggle",
- opts,
- "Editor",
- "open_tree",
- "Toggle file explorer"
- )
-else
- mappings.map(
- "n",
- "",
- string.format(":Lexplore%s", config.doom.explorer_right and "!" or ""),
- opts,
- "Editor",
- "open_tree",
- "Toggle file explorer"
- )
-end
-if not is_plugin_disabled("minimap") then
- mappings.map(
- "n",
- "",
- ":MinimapToggle",
- opts,
- "Editor",
- "open_minimap",
- "Toggle code minimap"
- )
-end
-if not is_plugin_disabled("zen") then
- mappings.map("n", "", ":TZAtaraxis", opts, "Editor", "open_zen", "Toggle Zen mode")
-end
-if not is_plugin_disabled("restclient") then
- mappings.map(
- "n",
- "",
- ":RestNvim",
- opts,
- "Editor",
- "exec_http",
- "Execute http client under cursor"
- )
-end
diff --git a/lua/doom/extras/keybindings/init.lua b/lua/doom/extras/keybindings/init.lua
deleted file mode 100644
index 11b2e0670..000000000
--- a/lua/doom/extras/keybindings/init.lua
+++ /dev/null
@@ -1,70 +0,0 @@
----[[---------------------------------------]]---
--- keybindings - Doom Nvim keybindings --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
-local log = require("doom.extras.logging")
-local config = require("doom.core.config").config
-
-log.debug("Loading Doom keybindings module ...")
-
--------------------------------------------------
-
----[[---------------------------------]]---
--- Custom Key mappings --
--- --
--- b = +buffers --
--- c = +code --
--- d = +debug --
--- l = +lsp --
--- d = +doom --
--- f = +file --
--- g = +git --
--- p = +plugins --
--- q = +quit/sessions --
--- s = +search --
--- t = +tweak --
--- w = +windows --
--- o = +open --
--- j = +jumps --
--- --
--- TAB = Cycle buffers --
--- ESC = Search highlight off --
--- F2 = Toggle Symbols-Outline --
--- F3 = Toggle Tree Explorer --
--- F4 = Toggle Terminal --
--- F5 = Toggle Minimap --
--- F6 = Toggle Zen Mode --
--- F7 = Run restclient --
----]]---------------------------------[[---
-
--------------------------------------------------
-
-local keybinds_modules = config.doom.keybinds_modules
- or {
- -- Core doom keybindings
- core = true,
- -- Movement keybindings, jump between your windows, buffers and code
- movement = true,
- -- Leader keybindings, a bunch of useful keybindings managed by space key
- -- WARNING: disabling this will break which-key plugin if the plugin is enabled
- leader = true,
- -- Completion and snippets keybindings
- completion = true,
- }
-
-for module in pairs(keybinds_modules) do
- if keybinds_modules[module] then
- local ok, err = xpcall(require, debug.traceback, ("doom.extras.keybindings.%s"):format(module))
- if not ok then
- log.error(
- string.format(
- "There was an error loading the module 'doom.extras.keybindings.%s'. Traceback:\n%s",
- module,
- err
- )
- )
- end
- end
-end
diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua
deleted file mode 100644
index 7fd5b5120..000000000
--- a/lua/doom/extras/keybindings/leader.lua
+++ /dev/null
@@ -1,858 +0,0 @@
----[[-----------------]]---
--- WhichKey binds --
----]]-----------------[[---
-
-local mappings = require("doom.utils.mappings")
-local config = require("doom.core.config").config
-local is_plugin_disabled = require("doom.utils").is_plugin_disabled
-
--- Additional options for mappings
-local opts = { silent = true }
-
--- Set Space key as leader
-if is_plugin_disabled("which-key") then
- mappings.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu")
-end
-vim.g.mapleader = " "
-
-if config.doom.new_file_split then
- if config.doom.vertical_split then
- mappings.map(
- "n",
- "fn",
- ":vert new",
- opts,
- "Editor",
- "new_buffer_split_vertical",
- "Open a new unnamed buffer in a vertical split window"
- )
- else
- mappings.map(
- "n",
- "fn",
- ":new",
- opts,
- "Editor",
- "new_buffer_split",
- "Open a new unnamed buffer in a split window"
- )
- end
-else
- mappings.map(
- "n",
- "fn",
- ":enew",
- opts,
- "Editor",
- "new_buffer",
- "Open a new unnamed buffer"
- )
-end
-
--- Misc
-mappings.map(
- "n",
- "`",
- "lua require('telescope.builtin').find_files({cwd=vim.fn.expand('%:p:h')})",
- opts,
- "Editor",
- "cwd_file_browser",
- "Find file from CWD of current file"
-)
-mappings.map(
- "n",
- ".",
- "Telescope file_browser",
- opts,
- "Editor",
- "file_browser",
- "Browse files"
-)
-mappings.map(
- "n",
- ",",
- "Telescope buffers show_all_buffers=true",
- opts,
- "Movement",
- "switch_buffers",
- "Switch buffers"
-)
-mappings.map(
- "n",
- "/",
- "Telescope live_grep",
- opts,
- "Editor",
- "live_grep",
- "Search a word"
-)
-mappings.map(
- "n",
- ":",
- "Telescope command_history",
- opts,
- "Editor",
- "command_history",
- "Command history"
-)
-
--- buffers
-mappings.map(
- "n",
- "bc",
- 'lua require("bufferline").handle_close_buffer(vim.fn.bufnr("%"))',
- opts,
- "Buffer",
- "close_current_buffer",
- "Close current buffer"
-)
-mappings.map(
- "n",
- "bb",
- "e #",
- opts,
- "Buffer",
- "switch_buffer",
- "Switch to other buffer"
-)
-mappings.map(
- "n",
- "b]",
- 'lua require("bufferline").cycle(1)',
- opts,
- "Buffer",
- "next_buffer_alt",
- "Goto next buffer"
-)
-mappings.map(
- "n",
- "bn",
- 'lua require("bufferline").cycle(1)',
- opts,
- "Buffer",
- "next_buffer",
- "Goto next buffer"
-)
-mappings.map(
- "n",
- "bg",
- 'lua require("bufferline").pick_buffer()',
- opts,
- "Buffer",
- "goto_buffer",
- "Goto buffer"
-)
-mappings.map(
- "n",
- "b[",
- 'lua require("bufferline").cycle(-1)',
- opts,
- "Buffer",
- "prev_buffer_alt",
- "Goto previous buffer"
-)
-mappings.map(
- "n",
- "bp",
- 'lua require("bufferline").cycle(-1)',
- opts,
- "Buffer",
- "prev_buffer",
- "Goto previous buffer"
-)
-mappings.map(
- "n",
- "bf",
- "FormatWrite",
- opts,
- "Buffer",
- "format_buffer",
- "Format buffer"
-)
-
--- doom
-mappings.map(
- "n",
- "dc",
- "DoomConfigs",
- opts,
- "Doom",
- "edit_doom_config",
- "Edit Doom configuration"
-)
-mappings.map(
- "n",
- "dd",
- "DoomManual",
- opts,
- "Doom",
- "help_doom",
- "Open Doom user manual"
-)
-mappings.map(
- "n",
- "du",
- "DoomUpdate",
- opts,
- "Doom",
- "update_doom",
- "Update Doom Nvim"
-)
-mappings.map(
- "n",
- "dr",
- "DoomRollback",
- opts,
- "Doom",
- "rollback_doom",
- "Rollback Doom Nvim version"
-)
-mappings.map(
- "n",
- "dR",
- "DoomReport",
- opts,
- "Doom",
- "create_crash_report",
- "Create crash report"
-)
-mappings.map(
- "n",
- "ds",
- "lua require('telescope.builtin.internal').colorscheme({enable_preview = true})",
- opts,
- "Editor",
- "change_colorscheme",
- "Change colorscheme"
-)
-mappings.map(
- "n",
- "db",
- "Telescope mapper",
- opts,
- "Doom",
- "show_keybindings",
- "Show Doom keybindings"
-)
-mappings.map(
- "n",
- "dl",
- "DoomConfigsReload",
- opts,
- "Doom",
- "reload_user_settings",
- "Reload user custom settings"
-)
-mappings.map(
- "n",
- "di",
- "DoomInfo",
- opts,
- "Doom",
- "display_info_dashboard",
- "Display information dashboard"
-)
-
--- plugins
-mappings.map(
- "n",
- "ps",
- "PackerSync",
- opts,
- "Plugins",
- "packer_sync",
- "Synchronize your plugins"
-)
-mappings.map(
- "n",
- "pi",
- "PackerInstall",
- opts,
- "Plugins",
- "packer_install",
- "Install missing plugins"
-)
-mappings.map(
- "n",
- "pc",
- "PackerClean",
- opts,
- "Plugins",
- "packer_clean",
- "Clean unused plugins"
-)
-mappings.map(
- "n",
- "pC",
- "PackerCompile",
- opts,
- "Plugins",
- "packer_compile",
- "Compile your plugins changes"
-)
-mappings.map(
- "n",
- "pS",
- "PackerStatus",
- opts,
- "Plugins",
- "packer_status",
- "Plugins status"
-)
-mappings.map(
- "n",
- "pp",
- "PackerProfile",
- opts,
- "Plugins",
- "packer_profile",
- "Profile the time taken loading your plugins"
-)
-
--- files
-mappings.map(
- "n",
- "fc",
- "e $MYVIMRC",
- opts,
- "Editor",
- "edit_vimrc",
- "Edit your Neovim rc"
-)
-mappings.map(
- "n",
- "ff",
- "Telescope find_files",
- opts,
- "Editor",
- "find_files_alt",
- "Find files"
-)
-
-mappings.map(
- "n",
- "fr",
- "Telescope oldfiles",
- opts,
- "Editor",
- "recent_files",
- "Recently opened files"
-)
-mappings.map(
- "n",
- "ft",
- "Telescope help_tags",
- opts,
- "Editor",
- "help_tags",
- "Help tags"
-)
-mappings.map(
- "n",
- "fR",
- "SudaRead",
- opts,
- "Editor",
- "read_sudo",
- "Re-open file with sudo permissions"
-)
-mappings.map(
- "n",
- "fw",
- "SudaWrite",
- opts,
- "Editor",
- "write_sudo",
- "Write file with sudo permissions"
-)
-
--- search
-mappings.map(
- "n",
- "sg",
- "Telescope live_grep",
- opts,
- "Editor",
- "live_grep_alt",
- "Search a word"
-)
-mappings.map(
- "n",
- "sb",
- "Telescope current_buffer_fuzzy_find",
- opts,
- "Editor",
- "fzf",
- "Search in buffer"
-)
-mappings.map(
- "n",
- "ss",
- "Telescope lsp_document_symbols",
- opts,
- "LSP",
- "lsp_symbols",
- "Goto symbol"
-)
-mappings.map(
- "n",
- "sh",
- "Telescope command_history",
- opts,
- "Editor",
- "command_history_alt",
- "Command history"
-)
-mappings.map(
- "n",
- "sm",
- "Telescope marks",
- opts,
- "Editor",
- "jump_mark",
- "Jump to mark"
-)
-
--- tweak
-mappings.map(
- "n",
- "tb",
- 'lua require("doom.core.functions").toggle_background()',
- opts,
- "Tweak",
- "toggle_background",
- "Toggle background"
-)
-mappings.map(
- "n",
- "tc",
- 'lua require("doom.core.functions").toggle_completion()',
- opts,
- "Tweak",
- "toggle_completion",
- "Toggle completion"
-)
--- "g" as gutter, git, ... (but this tweak is applicable for linter like ALE, too)
-mappings.map(
- "n",
- "tg",
- 'lua require("doom.core.functions").toggle_signcolumn()',
- opts,
- "Tweak",
- "toggle_signcolumn",
- "Toggle signcolumn"
-)
-mappings.map(
- "n",
- "ti",
- 'lua require("doom.core.functions").set_indent()',
- opts,
- "Tweak",
- "set_indent",
- "Set tab and indent"
-)
-mappings.map(
- "n",
- "tn",
- 'lua require("doom.core.functions").change_number()',
- opts,
- "Tweak",
- "change_number",
- "Change number"
-)
-if not is_plugin_disabled("autopairs") then
- mappings.map(
- "n",
- "tp",
- 'lua require("doom.core.functions").toggle_autopairs()',
- opts,
- "Tweak",
- "toggle_autopairs",
- "Toggle autopairs"
- )
-end
-mappings.map(
- "n",
- "ts",
- 'lua require("doom.core.functions").toggle_spell()',
- opts,
- "Tweak",
- "toggle_spell",
- "Toggle spell"
-)
-mappings.map(
- "n",
- "tx",
- 'lua require("doom.core.functions").change_syntax()',
- opts,
- "Tweak",
- "change_syntax",
- "Change syntax"
-)
-
--- windows
-mappings.map("n", "ww", "p", opts, "Window", "other_window", "Goto other window")
-mappings.map("n", "wd", "c", opts, "Window", "close_window", "Close current window")
-mappings.map("n", "w-", "s", opts, "Window", "split_below", "Split window below")
-mappings.map("n", "w|", "v", opts, "Window", "split_right", "Split window right")
-mappings.map("n", "w2", "