Terminal
-| lugin
-| | Clean unused plugins
-| | Compile your plugins changes
-| | Install missing plugins
-| | Profile the time taken loading your plugins
-| | Sync plugins (Clean and Update)
-| | Plugins status
-| uit /
-| sessions
-| | Session switcher
-| | Quit
-| | Restore previously saved session
-| | Save current session
-| | Save and quit
-| earch
-| | Buffer
-| | Grep
-| | Command history
-| | Jump to mark
-| | Goto symbol
-| indow
-| | <-> Split window below
-| | <2> Layout double columns
-| | <=> Balance window
-| | <|> Split window right
-| | Delete window
-| | Expand window left
-| | Window left
-| | Expand window below
-| | Window below
-| | Expand window up
-| | Window up
-| | Expand window right
-| | Window right
-| | Split window below
-| | Split window right
-| | Other window
-
-But there is still more, Doom Nvim knows that you love to use the keyboard but
-you do not like to be typing so much so it has more keybindings that will make
-your life easier!
-
-| | Cycle buffers (next buffer)
-| | Cycle buffers (prev buffer)
-| | Search highlighting off
-| | Toggle Symbols-Outline
-| | Toggle Tree Explorer
-| | Toggle Terminal
-| | Toggle Minimap
-| | Toggle Zen mode
-| | Run rest client
-| | Fast exit from Doom Nvim
-| | Fast exit from `INSERT` mode
-| | Comment current line (`NORMAL` mode)
-| | Comment selected block (`VISUAL` mode)
-| | Select window left
-| | Select window below
-| | Select window up
-| | Select window right
-| | Resize window up
-| | Resize window below
-| | Resize window left
-| | Resize window right
-
-You can modify the default keybindings by modifying the following files:
- - `lua/doom/core/keybindings/init.lua` - General keybindings
- - `lua/doom/modules/config` - Lua plugins keybindings
-
-You can also make your own keybindings by editing your `doom_config.lua` file.
-
-
-==============================================================================
-USAGE *doom_nvim_usage*
-
-Start Doom Nvim by typing `nvim` in a terminal emulator or by executing your
-preferred Neovim GUI.
-
-By default, if no files were opened, Doom Nvim will show the start menu
-`dashboard-nvim` where you can select files to edit or if you have a saved
-session in the current workspace, Doom will load it automatically if you
-want to.
-
-
-==============================================================================
-MOVING AROUND *doom_nvim_usage_moving_around*
-
-Doom Nvim uses the default Vim keybindings to move around: `h` `j` `k` `l`
-and the cursor keys.
-Use `h` go to left, `j` to go down, `k` to go up, `l` to go right.
-
- ^
- k
-
-
-
- j
- v
-
-See `Tutor` to know how to use Vim and its keybindings.
-
-To move around buffers execute b to select the `buffers` section
-and then press the key to select a buffer or press `` to cycle buffers.
-
-
-==============================================================================
-KNOWN ISSUES *doom_nvim_issues*
-
-- If you are facing an undocummented issue, feel free to open an issue at Doom
- Nvim's repository on GitHub and we will try to fix it.
- https://github.com/NTBBloodbath/doom-nvim/issues/new
-
-
-==============================================================================
-FAQ *doom_nvim_faq*
-
-- General
- - Who is Doom Nvim intended for?
-
-Doom Nvim is intended for anyone who wants a stable and efficient
-development environment without spending a lot of time setting everything up.
-
- - Why does Doom Nvim only support Neovim 0.5.0 (and beyond)?
-
-Doom Nvim relies on lua for the configuration and use of many plugins. Since
-lua is not available in neovim 0.4.4 and below, it is not possible to use Doom
-Nvim with a neovim version lower than 0.5.0. However, the Doom Nvim installer
-automatically installs Neovim 0.5.0 for you!
-
-==============================================================================
-HACKING DOOM NVIM *doom_nvim_hacking*
-
-Doom Nvim aims to be hackable to suit everyone's needs. Therefore
-
-This is the structure of Doom Nvim:
-
-. # Doom Nvim root
-โโโ autoload # Files loaded at launch
-โ โโโ health # Doom Nvim health add-ons for `:checkhealth`
-โโโ colors # Pre-installed colorschemes directory
-โ โโโ doom-one.vim # doom-one colorscheme ported to Nvim (`default one`)
-โโโ doc # Doom Nvim documentation to be used inside Nvim
-โ โโโ doom_nvim.txt # Doom Nvim help file
-โโโ docs # Doom Nvim docs meant to be readed on GitHub
-โโโ doomrc # Doom Nvim user configurations file
-โโโ init.lua # init.lua file
-โโโ install.sh # Doom Nvim installer
-โโโ LICENSE # Doom Nvim License
-โโโ lua # Location of Doom Nvim Lua files
-โ โโโ doom # Doom Nvim Lua core
-โ โ โโโ core # Doom Nvim core functionality
-โ โ โ โโโ autocmds # Doom Nvim autocommands
-โ โ โ โโโ config # Doom Nvim configuration files
-โ โ โ โโโ default # Doom Nvim default Neovim settings
-โ โ โ โโโ functions # Doom Nvim functions
-โ โ โ โโโ health # Doom Nvim health checking
-โ โ โ โโโ keybindings # Doom Nvim keybindings
-โ โ โ โโโ logging # Doom Nvim logging system
-โ โ โ โโโ system # Doom Nvim system utilities (early stage)
-โ โ โโโ utils # Doom Nvim utilities
-โ โโโ modules # Location of Doom Nvim plugins
-โ โโโ configs # Plugins configurations
-โ โโโ built-in # Doom Nvim built-in plugins
-โ โโโ init.lua # packer.nvim setup
-โโโ sessions # Location of Neovim workspaces
-
-Doom Nvim also sets default configurations for the `doomrc.lua` and the
-`doom_config.lua` files, which serves as the user configuration file
-if it is not present on the system. It allows a fine control over the core
-functions of Doom Nvim.
-
-
-==============================================================================
-HACKING LUA CORE *doom_nvim_hacking_lua_core*
-
-The `lua/doom` directory content is loaded by Neovim on_start. It is the
-location of the Doom Nvim plugin which is loaded everytime nvim starts.
-
-The `doom/default/init.lua` file contains most of the global variables used by
-Doom Nvim and executes the init functions of Doom Nvim.
-
-The files inside the `doom/` directory have core functions for Doom Nvim.
-
- - autocmds/ : Autocommands
- - config/ : Manages the BFC
- - functions/ : Utility functions
- - health/ : Used to check the health of installation
- - logging/ : Logging handler
- - system/ : Cross-platform support (WIP)
- - utils/ : Utility Lua functions
-
-
-==============================================================================
-ACKNOWLEDGEMENTS *doom_nvim_acknowledgements*
-
-Doom Nvim would not have been possible had it not been for
-
- - hlissner : Creator of Doom Emacs
- - romgrk : Ported doom-one colorscheme from Doom Emacs to Vim
- - All our contributors
-
-
-==============================================================================
-LICENSE *doom_nvim_license*
-
-Doom Nvim is distributed under GPLv2 license.
-
-
-==============================================================================
-CONTRIBUTING *doom_nvim_contributing*
-
-- I really love pull requests and bug reports
- (please see the Contributing Guidelines on GitHub before contributing)
-
-- Don't hesitate to tell me my Lua coding style sucks, but please tell me why.
-
-
-==============================================================================
-CHANGELOG *doom_nvim_changelog*
-
-Please see `$HOME/.config/doom-nvim/CHANGELOG.md` for a full and detailed
-changelog.
diff --git a/doc/tags b/doc/tags
index 82f38189a..89298c7b1 100644
--- a/doc/tags
+++ b/doc/tags
@@ -1,29 +1,26 @@
-doom_nvim doom_nvim.txt /*doom_nvim*
-doom_nvim.txt doom_nvim.txt /*doom_nvim.txt*
-doom_nvim_acknowledgements doom_nvim.txt /*doom_nvim_acknowledgements*
-doom_nvim_autocomplete doom_nvim.txt /*doom_nvim_autocomplete*
-doom_nvim_changelog doom_nvim.txt /*doom_nvim_changelog*
-doom_nvim_colorscheme doom_nvim.txt /*doom_nvim_colorscheme*
-doom_nvim_commands doom_nvim.txt /*doom_nvim_commands*
-doom_nvim_commands_keybindings doom_nvim.txt /*doom_nvim_commands_keybindings*
-doom_nvim_configuration doom_nvim.txt /*doom_nvim_configuration*
-doom_nvim_configuration_custom_plugins doom_nvim.txt /*doom_nvim_configuration_custom_plugins*
-doom_nvim_configuration_layout doom_nvim.txt /*doom_nvim_configuration_layout*
-doom_nvim_configuration_layout_explorer doom_nvim.txt /*doom_nvim_configuration_layout_explorer*
-doom_nvim_configuration_layout_mainbuffer doom_nvim.txt /*doom_nvim_configuration_layout_mainbuffer*
-doom_nvim_configuration_layout_minimap doom_nvim.txt /*doom_nvim_configuration_layout_minimap*
-doom_nvim_configuration_layout_outline doom_nvim.txt /*doom_nvim_configuration_layout_outline*
-doom_nvim_configuration_layout_terminal doom_nvim.txt /*doom_nvim_configuration_layout_terminal*
-doom_nvim_configuration_lsp doom_nvim.txt /*doom_nvim_configuration_lsp*
-doom_nvim_configuration_modules doom_nvim.txt /*doom_nvim_configuration_modules*
-doom_nvim_configuration_modules_tweaking doom_nvim.txt /*doom_nvim_configuration_modules_tweaking*
-doom_nvim_contents doom_nvim.txt /*doom_nvim_contents*
-doom_nvim_contributing doom_nvim.txt /*doom_nvim_contributing*
-doom_nvim_faq doom_nvim.txt /*doom_nvim_faq*
-doom_nvim_hacking doom_nvim.txt /*doom_nvim_hacking*
-doom_nvim_hacking_lua_core doom_nvim.txt /*doom_nvim_hacking_lua_core*
-doom_nvim_intro doom_nvim.txt /*doom_nvim_intro*
-doom_nvim_issues doom_nvim.txt /*doom_nvim_issues*
-doom_nvim_license doom_nvim.txt /*doom_nvim_license*
-doom_nvim_usage doom_nvim.txt /*doom_nvim_usage*
-doom_nvim_usage_moving_around doom_nvim.txt /*doom_nvim_usage_moving_around*
+doom doom_nvim.norg /* Table of Contents
+doom-intro doom_nvim.norg /* Introduction
+doom-daily-usage doom_nvim.norg /* Using Doom Nvim as your daily setup
+doom-moving-around doom_nvim.norg / ** Moving around
+doom-configuration doom_nvim.norg / ** Configuration
+doom-modules doom_nvim.norg / *** Modules
+doom-tweaking-modules doom_nvim.norg / **** Tweaking modules
+doom-custom-plugins doom_nvim.norg / *** Custom plugins
+doom-lsp doom_nvim.norg / *** Language Server Protocols
+doom-autocompletion doom_nvim.norg / ** Autocompletion
+doom-colorscheme doom_nvim.norg / ** Colorscheme
+doom-layout doom_nvim.norg / ** Layout
+doom-explorer doom_nvim.norg / *** File Explorer
+doom-buffer doom_nvim.norg / *** Main Buffer
+doom-terminal doom_nvim.norg / *** Terminal
+doom-minimap doom_nvim.norg / *** Minimap
+doom-outline doom_nvim.norg / *** Outline
+doom-commands doom_nvim.norg / ** Commands
+doom-keybindings doom_nvim.norg / ** Keybindings
+doom-hacking doom_nvim.norg / ** Hacking Doom Nvim
+doom-issues doom_nvim.norg /* Known issues
+doom-faq doom_nvim.norg /* FAQ
+doom-faq-general doom_nvim.norg / ** General
+doom-acknowledgements doom_nvim.norg /* Acknowledgements
+doom-contributing doom_nvim.norg /* Contributing
+doom-license doom_nvim.norg /* License
diff --git a/docs/contributing.md b/docs/contributing.md
index ad802e85b..f75a16425 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -32,6 +32,8 @@ will have less settings and plugins than you personal branch and therefore it wi
not work as expected otherwise. Eg. you will see 'Dashboard' text on vim load instead of
'Doom'.
+> Alternatively you can setup an isolated dev environment for contributing using our docker image [here](../contribute/README.md#doom-contrib-docker-image-start_dockersh).
+
## Reporting issues
### Acquire a backtrace from errors
@@ -50,7 +52,7 @@ thus reach a solution more quickly.
Some important data would be:
- Your custom configuration if you have one
- (`doomrc.lua`, `doom_config.lua` and `plugins.lua`)
+ (`doom_modules.lua`, `doom_config.lua` and `doom_userplugins.lua`)
- Which branch of Doom Nvim are you using
- Which plugins are you using
@@ -73,8 +75,8 @@ Doom Nvim follows some code style rules like ones the mentioned below:
- Double quotes over single quotes.
- Spaces over tabs.
-- Two spaces indentation
-- Variable names in `snake_case`
+- Two spaces indentation.
+- Variable names in `snake_case`.
- Function names in `snake_case`.
- [stylua] is used to format lua files with the following configuration:
@@ -116,3 +118,13 @@ your pull request :)
[gist]: https://gist.github.com/
[stylua]: https://github.com/JohnnyMorganz/StyLua
[luacheck]:https://github.com/luarocks/luacheck
+
+### Tools
+
+A range of tools for contributors are currently housed in the `contribute/` folder.
+Read the detailed [documentation](../contribute/README.md).
+
+#### Notable Tools
+
+ - [`contribute/start_docker.sh`](../contribute/README.md#doom-contrib-docker-image-start_dockersh) Sets up a dev environment for contributing to doom-nvim. Creates a git worktree to make changes and a docker image to test them within.
+
diff --git a/docs/getting_started.md b/docs/getting_started.md
index d0bf21588..82bc20561 100644
--- a/docs/getting_started.md
+++ b/docs/getting_started.md
@@ -347,11 +347,11 @@ a previous release (for main branch) or a previous commit (for development branc
## Configuration
-You can configure Doom Nvim by tweaking the `doomrc.lua`, `doom_config.lua` and
-the `plugins.lua` files located in your Doom Nvim root directory
-(`$HOME/.config/doom-nvim/` by default).
+You can configure Doom Nvim by tweaking the `doom_config.lua`,
+`doom_modules.lua` and the `doom_userplugins.lua` files located in your
+Doom Nvim root directory (`$HOME/.config/doom-nvim/` by default).
-### doomrc.lua
+### doom_modules.lua
This file handles all the Doom Nvim modules, its structure is really simple and
easy to understand.
@@ -359,74 +359,81 @@ easy to understand.
This one will look like that:
```lua
-local doom = {
- ui = {
- 'dashboard', -- Start screen
- -- 'doom-themes', -- Additional doom emacs' colorschemes
- 'statusline', -- Statusline
- 'tabline', -- Tabline, shows your buffers list at top
- -- 'zen', -- Distraction free environment
- 'which-key', -- Keybindings popup menu like Emacs' guide-key
- -- 'indentlines', -- Show indent lines
- },
- doom = {
- -- 'neorg', -- Life Organization Tool
- -- 'runner', -- Open a REPL for the current language or run the current file
- -- 'compiler', -- Compile (and run) your code with just pressing three keys!
- },
- editor = {
- 'auto-session', -- A small automated session manager for Neovim
- -- 'terminal', -- Terminal for Neovim (NOTE: needed for runner and compiler)
- 'explorer', -- Tree explorer
- 'symbols', -- LSP symbols and tags
- -- 'minimap', -- Code minimap, requires github.com/wfxr/code-minimap
- 'gitsigns', -- Git signs
- 'telescope', -- Highly extendable fuzzy finderover lists
- -- 'restclient', -- A fast Neovim http client
- 'formatter', -- File formatting
- 'autopairs', -- Autopairs
- -- 'editorconfig', -- EditorConfig support for Neovim
- 'kommentary', -- Comments plugin
- 'lsp', -- Language Server Protocols
- 'snippets', -- LSP snippets
- },
- langs = {
- -- To enable the language server for a language justadd the +lsp flag
- -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter
- -- parser and rust-analyzer
- --
- -- 'html', -- HTML support
- -- 'css', -- CSS support
- -- 'javascript', -- JavaScript support
- -- 'typescript', -- TypeScript support
- -- 'bash', -- The terminal gods language
- -- 'python +lsp', -- Python support + lsp
- -- 'ruby', -- Look ma, I love the gems!
- 'lua', -- Support for our gods language
- -- 'elixir', -- Build scalable and maintainablesoftware
- -- 'haskell', -- Because Functional programming is fun, isn't it?
-
- -- 'rust +lsp', -- Let's get rusty!
- -- 'go', -- Hello, gopher
- -- 'cpp', -- C++ support
- -- 'java', -- Java support
-
- -- 'config', -- Configuration files (JSON, YAML, TOML)
- -- 'dockerfile', -- Do you like containers, right?
- },
- utilities = {
- -- 'suda', -- Write and read files without sudo permissions
- -- 'lazygit', -- LazyGit integration for Neovim, requires LazyGit
- -- 'neogit', -- Magit for Neovim
- -- 'colorizer', -- Fastets colorizer for Neovim
- 'range-highlight', -- hightlights ranges you haveentered in commandline
- },
+local M = {}
+M.source = debug.getinfo(1, "S").source:sub(2)
+
+M.modules = {
+ ui = {
+ "dashboard", -- Start screen
+ -- "doom-themes", -- Additional doom emacs' colorschemes
+ -- "indentlines", -- Show indent lines
+ -- "show_registers", -- popup that shows register contents
+ "statusline", -- Statusline
+ "tabline", -- Tabline, shows your buffers list at top
+ "which-key", -- Keybindings popup menu like Emacs' guide-key
+ -- "zen", -- Distraction free environment
+ },
+ doom = {
+ -- "compiler", -- Compile (and run) your code with just pressing three keys!
+ -- "neorg", -- Life Organization Tool
+ -- "runner", -- Open a REPL for the current language or run the current file
+ },
+ editor = {
+ "autopairs", -- Autopairs
+ "auto-session", -- A small automated session manager for Neovim
+ "dap", -- Debug Adapter Protocol
+ -- "editorconfig", -- EditorConfig support for Neovim
+ "explorer", -- Tree explorer
+ "formatter", -- File formatting
+ "gitsigns", -- Git signs
+ "kommentary", -- Comments plugin
+ "lsp", -- Language Server Protocols
+ -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap
+ -- "ranger", -- Ranger File Browser, requires ranger file browser
+ "snippets", -- LSP snippets
+ "symbols", -- LSP symbols and tags
+ "telescope", -- Highly extendable fuzzy finder over lists
+ -- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler)
+ },
+ langs = {
+ -- To enable the language server for a language just add the +lsp flag
+ -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter
+ -- parser and rust-analyzer
+ --
+ -- "bash", -- The terminal gods language
+ -- "config", -- Configuration files (JSON, YAML, TOML)
+ -- "cpp", -- C++ support
+ -- "css", -- CSS support
+ -- "dockerfile", -- Do you like containers, right?
+ -- "elixir", -- Build scalable and maintainable software
+ -- "go", -- Hello, gopher
+ -- "haskell", -- Because Functional programming is fun, isn't it?
+ -- "html", -- HTML support
+ -- "java", -- Java support
+ -- "javascript", -- JavaScript support
+ "lua", -- Support for our gods language
+ -- "python +lsp", -- Python support + lsp
+ -- "ruby", -- Look ma, I love the gems!
+ -- "rust +lsp", -- Let's get rusty!
+ -- "typescript", -- TypeScript support
+ },
+ utilities = {
+ -- "lazygit", -- LazyGit integration for Neovim, requires LazyGit
+ -- "neogit", -- Magit for Neovim
+ "range-highlight", -- hightlights ranges you have entered in commandline
+ -- "suda", -- Write and read files without sudo permissions
+ },
+ web = {
+ -- "colorizer", -- Fastest colorizer for Neovim
+ -- "firenvim", -- requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config
+ -- "restclient", -- A fast Neovim http client
+ }
}
-return doom
+return M
```
-And as the `doomrc.lua` file self-documentation says, you will only need to uncomment
+And as the `doom_modules.lua` file self-documentation says, you will only need to uncomment
or comment the plugins names in order to enable or disable them. e.g. to enable the `terminal`
plugin you will only need to uncomment the `-- 'terminal',` line and restart Neovim.
Doom will automatically handle your changes and install the `terminal` plugin for you.
@@ -461,7 +468,7 @@ return {
> **NOTE**: all your used-defined configurations here will be live-reloaded, e.g.
> mappings, autocommands, etc.
-### plugins.lua
+### doom_userplugins.lua
This file handles your custom plugins, in other words, it handles all the extra
plugins you need that are not covered by Doom Nvim.
@@ -482,7 +489,7 @@ return {
}
```
-And as with the `doomrc.lua` file, Doom Nvim will automatically handle your changes
+And as with the `doom_modules.lua` file, Doom Nvim will automatically handle your changes
and install or uninstall the plugins declared on here.
> **NOTE**: all the valid options for declaring plugins can be found in
@@ -492,7 +499,7 @@ and install or uninstall the plugins declared on here.
Doom Nvim consists of around 5 modules. A Doom Nvim Module is a bundle of plugins,
configuration and commands, organized into a unit that can be toggled easily by
-tweaking your `doomrc.lua` (found in `$HOME/.config/doom-nvim`).
+tweaking your `doom_modules.lua` (found in `$HOME/.config/doom-nvim`).
Please see [Plugin Management](#plugin-management) for more information.
@@ -506,7 +513,7 @@ in your Doom Nvim root directory. Read on to learn how to use this system to ins
your own plugins.
> **WARNING:** Do not install plugins directly in `lua/doom/modules/init.lua`. Instead,
-> use your `doomrc.lua` and `plugins.lua` files to modify them.
+> use your `doom_modules.lua` and `doom_userplugins.lua` files to modify them.
### Configuring Doom
@@ -522,7 +529,7 @@ Do you want to change some configurations of some modules?
Go to `lua/doom/modules/config` directory and you will find the configurations
for the plugins.
-Otherwise if you want to configure a plugin declared in your `plugins.lua` you
+Otherwise if you want to configure a plugin declared in your `doom_userplugins.lua` you
can use the packer's `config` field, e.g.
```lua
@@ -539,10 +546,10 @@ can use the packer's `config` field, e.g.
[Language Server Protocols](https://microsoft.github.io/language-server-protocol/) is installed as a plugin.
To easily install language servers and without having to do it system-wide or having to
-manually configure servers, Doom Nvim makes use of [kabouzeid/nvim-lspinstall](https://github.com/kabouzeid/nvim-lspinstall).
+manually configure servers, Doom Nvim makes use of [MordechaiHadad/nvim-lspmanager](https://github.com/MordechaiHadad/nvim-lspmanager).
To enable the language server for a certain programming language and automatically
-install it, just append a `+lsp` flag at the end of the language field in your `doomrc.lua`,
+install it, just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`,
e.g. for enabling Rust support in Doom and install `rust-analyzer`:
```lua
@@ -553,7 +560,18 @@ local doom = {
}
```
-> **NOTE**: You can see a list of currently supported languages at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall#bundled-installers).
+You can also override or add additional LSPs for a language using the `+lsp(OVERRIDE)` syntax.
+
+```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
@@ -587,7 +605,7 @@ But first let's see what's new:
- New logging system powered by [vlog]. A faster and smaller logging system
because complexity is not always the best choice.
- Easily enable and disable plugins. Now toggling the doom default plugins is easier
- than before, just comment or uncomment it in your `doomrc.lua`!
+ than before, just comment or uncomment it in your `doom_modules.lua`!
- Better custom plugins management. Now the custom plugins are being directly
handled by packer as it should be, no more nonsense wrappers around it.
- Better updating mechanism. Forget these annoying merging issues and save the
@@ -606,8 +624,6 @@ But first let's see what's new:
documentation is the core of all projects.
- Restructured source code. Now the doom nvim source code is much cleaner and
easier to understand.
-- Added selene linter CI for incoming pull requests and stylua CI for pushes.
- Let's get a consistent way to maintain Doom Nvim source!
Now that we know what's new we will surely want to update, isn't it?
@@ -662,12 +678,12 @@ And now, how can I start using the new configuration files?
I'm going to explain you in a short way because the new configuration files has
a rich documentation inside them.
-- `doomrc.lua`, this file handles the Doom Nvim modules, in other words, which
+- `doom_modules.lua`, this file handles the Doom Nvim modules, in other words, which
plugins are being installed and loaded and which plugins are not.
- `doom_config.lua`, this file handles the user configurations for doom nvim,
e.g. if mouse is enabled or not. This one also handles user-defined Neovim
configurations like global variables and mappings.
-- `plugins.lua`, this file handles the user-defined plugins, it is the
+- `doom_userplugins.lua`, this file handles the user-defined plugins, it is the
replacement for the `custom_plugins` field in the old doomrc.
> Are you having issues with the 3.0.0 version? Don't hesitate to [report them]
diff --git a/docs/modules.md b/docs/modules.md
index 648d89de3..9b485fd89 100644
--- a/docs/modules.md
+++ b/docs/modules.md
@@ -10,7 +10,7 @@ organized into a unit that can be toggled easily.
## Tweaking Doom Nvim Modules
-You can easily tweak Doom Nvim Modules by tweaking your `doomrc.lua` file
+You can easily tweak Doom Nvim Modules by tweaking your `doom_modules.lua` file
(found in `~/.config/doom-nvim`).
## List of modules
@@ -37,56 +37,54 @@ without them. These plugins are the following:
- Vim dashboard (start screen).
- [doom-themes]
- Additional doom emacs' colorschemes.
+- [indentlines]
+ - Show indent lines.
- [statusline]
- Neovim statusline.
- [tabline]
- Tabline, shows your buffers list at top.
-- [zen]
- - Distraction free environment.
- [which-key]
- Keybindings popup like Emacs' guide-key.
-- [indentlines]
- - Show indent lines.
+- [zen]
+ - Distraction free environment.
### Doom
+- [compiler] (built-in)
+ - Compile _and run_ your projects with only a few keystrokes.
- [neorg]
- Life Organization Tool.
- [runner] (built-in)
- A code runner for your interpreted code.
-- [compiler] (built-in)
- - Compile _and run_ your projects with only a few keystrokes.
### Editor
+- [autopairs]
+ - Autopairs.
- [auto-session]
- A small automated session manager for Neovim.
-- [terminal]
- - Terminal for Neovim.
+- [editorconfig]
+ - EditorConfig support for Neovim, let other argue about tabs vs spaces.
- [explorer]
- Tree explorer.
-- [symbols]
- - LSP symbols and tags.
-- [minimap]
- - Code minimap, requires [wfxr/code-minimap](https://github.com/wfxr/code-minimap).
-- [gitsigns]
- - Git signs.
-- [telescope]
- - Highly extendable fuzzy finder over lists.
-- [restclient]
- - A fast Neovim http client.
- [formatter]
- File formatting.
-- [autopairs]
- - Autopairs.
-- [editorconfig]
- - EditorConfig support for Neovim, let other argue about tabs vs spaces.
+- [gitsigns]
+ - Git signs.
- [kommentary]
- Comments plugin.
- [lsp]
- Language Server Protocols ([compe] + [lspinstall]).
+- [minimap]
+ - Code minimap, requires [wfxr/code-minimap](https://github.com/wfxr/code-minimap).
- snippets
- Code snippets ([LuaSnip] + [friendly-snippets]).
+- [symbols]
+ - LSP symbols and tags.
+- [telescope]
+ - Highly extendable fuzzy finder over lists.
+- [terminal]
+ - Terminal for Neovim.
### Langs
@@ -105,13 +103,13 @@ The currently available flags are the following:
#### Web development
-- **html**
- - HTML support.
+- **css**
+ - CSS support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- DAP client: no.
-- **css**
- - CSS support.
+- **html**
+ - HTML support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- DAP client: no.
@@ -120,11 +118,26 @@ The currently available flags are the following:
- TreeSitter based syntax highlighting: yes.
- LSP: yes, by using TSServer.
- DAP client: yes.
+- **PHP**
+ - PHP support.
+ - TreeSitter based syntax highlighting: yes.
+ - LSP: yes.
+ - DAP client: no.
- **typescript**
- TypeScript support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- - DAP client: no.
+ - DAP client: yes (via javascript).
+- **Svelte**
+ - Svelte support.
+ - TreeSitter based syntax highlighting: yes.
+ - LSP: yes.
+ - DAP client: yes (via javascript).
+- **Vue**
+ - Vue support.
+ - TreeSitter based syntax highlighting: yes.
+ - LSP: yes.
+ - DAP client: yes (via javascript).
#### Scripting
@@ -133,60 +146,92 @@ The currently available flags are the following:
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- DAP client: no.
-- **python**
- - Python support.
+- **clojure**
+ - Clojure support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- - DAP client: yes.
-- **ruby**
- - Ruby support.
+ - DAP client: no.
+- **elixir**
+ - Elixir support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- - DAP client: yes.
- **lua**
- Lua support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- DAP client: no (it has but isn't supported by Doom _yet_, requires extra setup).
-- **elixir**
- - Elixir support.
+- **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
-- **haskell**
- - Haskell support.
+- **cpp**
+ - CPP support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- - DAP client: no.
-- **rust**
- - Rust support.
+ - 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: yes (not supported _yet_ by Doom for automatic installation).
+ - DAP client: no.
- **go**
- Golang support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- DAP client: yes.
-- **cpp**
- - CPP support.
+- **haskell**
+ - Haskell support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- - DAP client: yes (not supported _yet_ by Doom for automatic installation).
+ - DAP client: no.
- **java**
- Java support.
- TreeSitter based syntax highlighting: yes.
- LSP: yes.
- DAP client: no.
+- **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
-- **config**
- - Configuration languages support (JSON, YAML, TOML).
+- **json**/**json5**
+ - JSON support.
+ - TreeSitter based syntax highlighting: yes.
+ - LSP: yes.
+- **yaml**
+ - YAML support.
- TreeSitter based syntax highlighting: yes.
- - LSP: not yet.
+ - 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.
@@ -196,16 +241,21 @@ The currently available flags are the following:
### Utilities
-- [suda]
- - Write and read files without sudo permissions.
- [lazygit]
- LazyGit integration for neovim, requires LazyGit.
- [neogit]
- Magit for Neovim.
-- [colorizer]
- - Fastest colorizer for Neovim.
- [range-highlight]
- Highlights ranges you have entered in commandline
+- [suda]
+ - Write and read files without sudo permissions.
+
+### Web
+
+- [colorizer]
+ - Fastest colorizer for Neovim.
+- [restclient]
+ - A fast Neovim http client.
## Managing modules
@@ -251,7 +301,7 @@ changes for you!
[lsp]: https://github.com/neovim/nvim-lspconfig
[compe]: https://github.com/hrsh7th/nvim-compe
-[lspinstall]: https://github.com/kabouzeid/nvim-lspinstall
+[lsp-installer]: https://github.com/williamboman/nvim-lsp-installer
[LuaSnip]: https://github.com/L3MON4D3/LuaSnip
[friendly-snippets]: https://github.com/rafamadriz/friendly-snippets
diff --git a/doom_config.lua b/doom_config.lua
index fbd5b7ac5..5b06596bd 100644
--- a/doom_config.lua
+++ b/doom_config.lua
@@ -8,379 +8,473 @@
-- 2. Nvim, this one defines all the custom configurations that you want to
-- use in Neovim, e.g. a colorscheme italic_comments global variable
--- {{{ Doom
-local doom = {
- -- Autosave
- -- false : Disable autosave
- -- true : Enable autosave
- -- @default = false
- autosave = false,
-
- -- Format on save
- -- false : Disable format on save
- -- true : Enable format on save
- -- @default = false
- fmt_on_save = false,
-
- -- Disable Vim macros
- -- false : Enable Vim macros
- -- true : Disable Vim macros
- -- @default = false
- disable_macros = false,
-
- -- Autosave sessions
- -- false : Disable session autosave
- -- true : Enable session autosave
- -- @default = false
- autosave_sessions = false,
-
- -- Autoload sessions
- -- false : Disable session autoload
- -- true : Enable session autoload
- -- @default = false
- autoload_last_session = false,
-
- -- Enable Swap files
- -- false : no swap files
- -- true : enables swap files
- -- @default = false
- swap_files = false,
-
- -- Undo Directories
- -- the backup variable enables backup related settings (undofile, undodir)
- -- false : ignores undo Directories (this code block will be ignored)
- -- true : enable undo files/undo dirs.
- -- @default = false
- backup = false, -- WARNING: if you change this to false and you have an undo dir already, it will REMOVE the undodir (loss of data might take place)
-
- -- Enable Line wrapping
- -- false : disables line wrapping
- -- true : enables line wrapping
- -- @default = false
- line_wrap = false,
-
- -- Enable Show mode ( -- INSERT --, -- NORMAL --, -- VISUAL -- )
- -- false : disables show mode
- -- true : enables show mode
- -- @default = false
- show_mode = false,
-
- -- Enable scroll off
- -- false : disables scroll off
- -- true : enables scroll off
- -- @default = true, @default scrolloff_amount = 4,
- scrolloff = true,
- scrolloff_amount = 4,
-
- -- Enable mouse
- -- false : disables mouse
- -- true : enables mouse
- -- @default = true
- mouse = true,
-
- -- Preserve last editing position
- -- false : Disable preservation of last editing position
- -- true : Enable preservation of last editing position
- -- @default = false
- preserve_edit_pos = false,
-
- -- Allow overriding the default Doom Nvim keybinds
- -- false : Default keybinds cannot be overwritten
- -- true : Default keybinds can be overwritten
- -- @default = true
- allow_default_keymaps_overriding = true,
-
- -- horizontal split on creating a new file (fn)
- -- false : doesn't split the window when creating a new file
- -- true : horizontal split on creating a new file
- -- @default = true
- new_file_split = true,
-
- -- enable current line highlight
- -- false : disables current line highlight
- -- true : enables current line highlight
- -- @default = true
- line_highlight = true,
-
- -- Automatically split right
- -- false : splits right (vertically)
- -- true : splits left (vertically)
- -- @default = true
- split_right = true,
-
- -- Automatically split above
- -- false : splits above (horizontally)
- -- true : splits below (horizontally)
- -- @default = true
- split_below = true,
-
- -- Use clipboard outside of vim
- -- false : won't use third party clipboard
- -- true : enables third part clipboard
- -- @default = true
- clipboard = true,
-
- -- Enable auto comment (current line must be commented)
- -- false : disables auto comment
- -- true : enables auto comment
- -- @default = false
- auto_comment = false,
-
- -- Show indent lines
- -- @default = true
- show_indent = true,
-
- -- Expand tabs
- -- Specifies if spaces or tabs must be used
- -- false : spaces
- -- true : tabs
- -- @default = true
- expand_tabs = true,
-
- -- Set numbering
- -- false : Shows absolute number lines
- -- true : Shows relative number lines
- -- @default = true
- relative_num = true,
-
- -- Enable winwidth
- -- false : Manually set win width
- -- true : Active window auto sets width
- -- @default = false, @default win_width_nr = 85
- win_width = false,
- win_width_nr = 85,
-
- -- Enable Highlight on yank
- -- false : disables highligh on yank
- -- true : enables highlight on yank
- -- @default = true
- highlight_yank = true,
-
- -- Enable guicolors
- -- Enables gui colors on GUI versions of Neovim
- -- @default = true
- enable_guicolors = true,
-
- -- Tree explorer on the right
- -- Places the Tree explorer buffer to the right when enabled
- -- @default = false
- explorer_right = false,
-
- -- Show hidden files
- -- @default = true
- show_hidden = true,
-
- -- Checkupdates on start
- -- @default = false
- check_updates = false,
-
- -- Auto install plugins on launch, useful if you don't want to run
- -- PackerInstall every time you add a new plugin
- -- @default = true
- auto_install_plugins = true,
-
- -- Disable dashboard status line (does not work perfectly)
- -- false : disables dashboard status line
- -- true : enables dashboard status line
- -- @default = true
- dashboard_statline = true,
-
- -- Default indent size
- -- @default = 4
- indent = 4,
-
- -- Set max cols
- -- Defines the column to show a vertical marker
- -- @default = 80
- max_columns = 80,
-
- -- Completion box height
- -- @default = 10
- complete_size = 10,
-
- -- Completion box transparency
- -- 0 = no transparency
- -- 100 = fully transparent
- -- @default = 25
- complete_transparency = 25,
-
- -- Sidebar sizing
- -- Specifies the default width of Tree Explorer and Tagbar
- -- @default = 25
- sidebar_width = 25,
-
- -- Set the Terminal width
- -- Applies only to float direction
- -- @default = 70
- terminal_width = 70,
-
- -- Set the Terminal height
- -- Applies to all directions except window
- -- @default = 20
- terminal_height = 20,
-
- -- Conceal level
- -- Set Neovim conceal level
- -- 0 : Disable indentline and show all
- -- 1 : Conceal some functions and show indentlines
- -- 2 : Concealed text is completely hidden unless it has a custom replacement
- -- character defined
- -- 3 : Concealed text is completely hidden
- conceallevel = 0,
-
- -- Logging level
- -- Set Doom logging level
- -- Available levels:
- -- ยท trace
- -- ยท debug
- -- ยท info
- -- ยท warn
- -- ยท error
- -- ยท fatal
- -- @default = 'info'
- logging = "info",
-
- -- Set the Terminal direction
- -- Available directions:
- -- - vertical
- -- - horizontal
- -- - window
- -- - float
- -- @default = 'horizontal'
- terminal_direction = "horizontal",
-
- -- NOTE: This will only be activated if 'backup' is true.
- -- We don'recommend you put this outside of neovim so we've restricted to the path: ~/.config/nvim
- -- WARNING: only put the folder name that you want. (eg: undo_dir = '/undodir')
- -- @default_directory = '~/.config/nvim/undodir'
- undo_dir = "/undodir",
-
- -- Default colorscheme
- -- @default = doom-one
- colorscheme = "doom-one",
-
- -- Background color
- -- @default = dark
- colorscheme_bg = "dark",
-
- -- Doom One colorscheme settings
- doom_one = {
- -- If the cursor color should be blue
+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
- cursor_coloring = false,
- -- If TreeSitter highlighting should be enabled
+ autosave = false,
+
+ -- Format on save
+ -- false : Disable format on save
+ -- true : Enable format on save
+ -- @default = false
+ fmt_on_save = false,
+
+ -- Disable Vim macros
+ -- false : Enable Vim macros
+ -- true : Disable Vim macros
+ -- @default = false
+ disable_macros = false,
+
+ -- 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
- enable_treesitter = true,
- -- If the comments should be italic
+ 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
- italic_comments = false,
- -- If the telescope plugin window should be colored
+ 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
- telescope_highlights = true,
- -- If the built-in Neovim terminal should use the doom-one
- -- colorscheme palette
+ mouse = true,
+
+ -- Preserve last editing position
+ -- false : Disable preservation of last editing position
+ -- true : Enable preservation of last editing position
-- @default = false
- terminal_colors = true,
- -- If the Neovim instance should be transparent
+ 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
- transparent_background = 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,
- -- Set gui fonts here
- -- @default = "FiraCode Nerd Font", @default font size = 15,
- -- WARNING: Font sizes must be in string format!
- guifont = "FiraCode Nerd Font",
- guifont_size = "15",
-
- -- change Which Key background color
- -- can use hex, or normal color names (eg: Red, Gree, Blue)
- -- @default = #202328
- whichkey_bg = "#202328",
-
- -- set your custom lsp diagnostic symbols below
- lsp_error = "๏",
- lsp_warning = "๏ฑ",
- lsp_hint = "๏ช",
- lsp_information = "๏",
- lsp_virtual_text = "๏ ",
-
- -- Set your dashboard custom colors below
- -- @default = doom emacs' default dashboard colors
- dashboard_custom_colors = {
- header_color = "#586268",
- center_color = "#51afef",
- shortcut_color = "#a9a1e1",
- footer_color = "#586268",
+ -- 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 = {},
},
- -- Set your custom dashboard header below
- -- @default = doom emacs' default dashboard header
- dashboard_custom_header = {},
-}
--- }}}
-
--- {{{ Nvim
-local nvim = {
- -- Set custom Neovim global variables
- -- @default = {}
- -- example:
- -- { ['sonokai_style'] = 'andromeda' }
- global_variables = {},
-
- -- Set custom autocommands
- -- @default = {}
- -- example:
- -- augroup_name = {
- -- { 'BufNewFile,BufRead', 'doomrc', 'set ft=lua'}
- -- }
- autocmds = {},
-
- -- Set custom key bindings
- -- @default = {}
- -- example:
- -- {
- -- {'n', 'ca', ':Lspsaga code_action', options}
- -- }
- --
- -- where
- -- 'n' is the map scope
- -- 'ca' is the map activator
- -- ':Lspsaga ...' is the command to be executed
- -- options is a Lua table containing the mapping options, e.g.
- -- { silent = true }, see ':h map-arguments'.
- mappings = {},
-
- -- Set custom commands
- -- @default = {}
- -- example:
- -- {
- -- 'echo "Hello, custom commands!"'
- -- }
- commands = {},
-
- -- Set custom functions
- -- @default = {}
- -- example:
- -- {
- -- hello_custom_func = function()
- -- print("Hello, custom functions!")
- -- end
- -- }
- functions = {},
-
- -- Set custom options
- -- @default = {}
- -- example:
- -- {
- -- ['shiftwidth'] = 4
- -- }
- options = {},
+ 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 {
- doom = doom,
- nvim = nvim,
-}
+return M
--- vim: fdm=marker
+-- vim: sw=2 sts=2 ts=2 fdm=indent noexpandtab
diff --git a/doomrc.lua b/doom_modules.lua
similarity index 69%
rename from doomrc.lua
rename to doom_modules.lua
index 57c221957..7ef434ebb 100644
--- a/doomrc.lua
+++ b/doom_modules.lua
@@ -1,7 +1,7 @@
--- doomrc - Doom nvim configurations file
+-- doom_modules - Doom nvim module selection
--
--- The doomrc controls what Doom nvim plugins modules are enabled and what
--- features are being used.
+-- The doom_modules controls what Doom nvim plugins modules are enabled and
+-- what features are being used.
--
-- Comment out a plugin to enable it and comment a non-commented one to
-- disable and uninstall it.
@@ -11,75 +11,90 @@
-- "Configuration" one. In that section you will find a comprehensive list of
-- the available modules and all their supported flags.
-local doom = {
+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
- -- "zen", -- Distraction free environment
"which-key", -- Keybindings popup menu like Emacs' guide-key
- -- "indentlines", -- Show indent lines
- -- "show_registers", -- popup that shows register contents
+ -- "zen", -- Distraction free environment
+ -- "illuminated", -- Highlight other uses of the word under the cursor like VSC
},
doom = {
- -- "neorg", -- Life Organization Tool
- -- "runner", -- Open a REPL for the current language or run the current file
-- "compiler", -- Compile (and run) your code with just pressing three keys!
+ -- "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
- "terminal", -- Terminal for Neovim (NOTE: needed for runner and compiler)
+ "dap", -- Debug Adapter Protocol
+ -- "editorconfig", -- EditorConfig support for Neovim
"explorer", -- Tree explorer
- -- "ranger", -- Ranger File Browser, requires ranger file browser
- "symbols", -- LSP symbols and tags
- -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap
- "gitsigns", -- Git signs
- "telescope", -- Highly extendable fuzzy finder over lists
"formatter", -- File formatting
- "autopairs", -- Autopairs
- -- "editorconfig", -- EditorConfig support for Neovim
+ "gitsigns", -- Git signs
"kommentary", -- Comments plugin
+ -- "linter", -- Asynchronous linter, see errors in your code on the fly
"lsp", -- Language Server Protocols
- "dap", -- Debug Adapter Protocol
- "snippets", -- Snippets
+ -- "minimap", -- Code minimap, requires github.com/wfxr/code-minimap
+ -- "ranger", -- Ranger File Browser, requires ranger file browser
+ "snippets", -- 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
--
- -- "html", -- HTML support
-- "css", -- CSS support
+ -- "html", -- HTML support
-- "javascript", -- JavaScript support
-- "typescript", -- TypeScript support
+
-- "bash", -- The terminal gods language
+ -- "elixir", -- Build scalable and maintainable software
+ "lua", -- Support for our gods language
-- "python +lsp", -- Python support + lsp
-- "ruby", -- Look ma, I love the gems!
- "lua", -- Support for our gods language
- -- "elixir", -- Build scalable and maintainable software
- -- "haskell", -- Because Functional programming is fun, isn't it?
- -- "rust +lsp", -- Let's get rusty!
- -- "go", -- Hello, gopher
+ -- "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 = {
- -- "suda", -- Write and read files without sudo permissions
-- "lazygit", -- LazyGit integration for Neovim, requires LazyGit
-- "neogit", -- Magit for Neovim
- -- "colorizer", -- Fastest colorizer for Neovim
- "range-highlight", -- hightlights ranges you have entered in commandline
+ "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 = {
- -- "restclient", -- A fast Neovim http client
- -- "firenvim", -- requires firenvim web extension; change fontsize by increasing guifontsize in doom_config
-- "colorizer", -- Fastest colorizer for Neovim
- }
+ -- "firenvim", -- Requires firenvim browser extension; change fontsize by increasing guifontsize in doom_config
+ -- "restclient", -- A fast Neovim http client
+ },
}
-return doom
+return M
+
+-- vim: sw=2 sts=2 ts=2 fdm=indent noexpandtab
diff --git a/plugins.lua b/doom_userplugins.lua
similarity index 51%
rename from plugins.lua
rename to doom_userplugins.lua
index 1412a966c..a03700002 100644
--- a/plugins.lua
+++ b/doom_userplugins.lua
@@ -1,15 +1,23 @@
--- plugins - Doom nvim custom plugins
+-- doom_userplugins - Doom nvim custom plugins
--
-- This file contains all the custom plugins that are not in Doom nvim but that
-- the user requires. All the available fields can be found here
-- https://github.com/wbthomason/packer.nvim#specifying-plugins
--
-- By example, for including a plugin with a dependency on telescope:
--- return {
--- {
--- 'user/repository',
--- requires = { 'nvim-lua/telescope.nvim' },
--- },
+-- M.plugins {
+-- {
+-- 'user/repository',
+-- requires = { 'nvim-lua/telescope.nvim' },
+-- },
-- }
-return {}
+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 c93000bf2..d43728559 100644
--- a/init.lua
+++ b/init.lua
@@ -8,67 +8,49 @@
-------------------------------------------------
-- 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 these for very fast startup time
-vim.cmd([[
- syntax off
- filetype off
- filetype plugin indent off
-]])
-
--- Temporarily disable shada file to improve performance
-vim.opt.shadafile = "NONE"
-- Disable some unused built-in Neovim plugins
vim.g.loaded_gzip = false
-vim.g.loaded_netrwPlugin = false
vim.g.loaded_tarPlugin = false
vim.g.loaded_zipPlugin = false
vim.g.loaded_2html_plugin = false
-vim.g.loaded_remote_plugins = false
---- Doom Configurations ------------------------
-------------------------------------------------
-vim.defer_fn(function()
- local load_modules = require("doom.utils").load_modules
-
- -- Load Doom stuff (core, modules, extras)
- load_modules("doom", { "core", "modules", "extras.autocmds" })
+-- Load Doom core and UI related stuff (colorscheme, background)
+load_modules("doom", { "core" })
- -- If the dashboard plugin is already installed and the packer_compiled.lua
- -- file exists so we can make sure that the dashboard have been loaded.
- local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep
- local compiled_plugins_path = string.format(
- "%s%splugin%spacker_compiled.lua",
- doom_root,
- sep,
- sep
- )
- if require("doom.utils").file_exists(compiled_plugins_path) then
- -- If the current buffer name is empty then trigger Dashboard.
- -- NOTE: this is done to avoid some weird issues with Dashboard and
- -- number / signcolumn when Dashboard gets triggered automatically
- if (vim.api.nvim_buf_get_name(0):len() == 0) and packer_plugins["dashboard-nvim"] then
- vim.cmd("Dashboard")
- end
+-- Defer and schedule loading of plugins and extra functionalities until the
+-- Neovim API functions are safe to call to avoid weird errors with plugins stuff
+vim.defer_fn(function()
+ -- Load Doom extra stuff and plugins (modules, extras)
+ load_modules("doom", { "modules", "extras" })
+
+ -- 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
+ if
+ (vim.api.nvim_buf_get_name(0):len() == 0)
+ and (packer_plugins and packer_plugins["dashboard-nvim"])
+ then
+ vim.cmd("Dashboard")
end
- vim.opt.shadafile = ""
vim.cmd([[
- rshada!
- doautocmd BufRead
- syntax on
- filetype on
- filetype plugin indent on
PackerLoad nvim-treesitter
+ " This BufEnter call should fix some issues with concealing in neorg
+ doautocmd BufEnter
]])
- -- Load keybindings module at the end because the keybindings module cost is high
- vim.defer_fn(function()
- load_modules("doom.extras", { "keybindings" })
- if not require("doom.core.functions").is_plugin_disabled("which-key") then
- vim.cmd([[
- PackerLoad which-key.nvim
- ]])
- end
- end, 20)
+ if not require("doom.utils").is_plugin_disabled("which-key") then
+ vim.cmd([[
+ PackerLoad which-key.nvim
+ ]])
+ end
end, 0)
diff --git a/lua/colors/doom-one/config/init.lua b/lua/colors/doom-one/config/init.lua
new file mode 100644
index 000000000..4a0c91364
--- /dev/null
+++ b/lua/colors/doom-one/config/init.lua
@@ -0,0 +1,52 @@
+--- @class config
+local config = {}
+
+local configuration = {
+ cursor_coloring = false,
+ terminal_colors = false,
+ italic_comments = false,
+ enable_treesitter = true,
+ transparent_background = false,
+ pumblend = {
+ enable = true,
+ transparency_amount = 20,
+ },
+ plugins_integrations = {
+ neorg = true,
+ barbar = true,
+ bufferline = false,
+ gitgutter = false,
+ gitsigns = true,
+ telescope = false,
+ neogit = true,
+ nvim_tree = true,
+ dashboard = true,
+ startify = true,
+ whichkey = true,
+ indent_blankline = true,
+ vim_illuminate = true,
+ lspsaga = false,
+ },
+}
+
+--- Get a configuration value
+--- @param opt string
+--- @return any
+config.get = function(opt)
+ if opt then
+ return configuration[opt]
+ end
+ return configuration
+end
+
+--- Set user-defined configurations
+--- @param user_configs table
+--- @return table
+config.set = function(user_configs)
+ vim.validate({ user_configs = { user_configs, "table" } })
+
+ configuration = vim.tbl_deep_extend("force", configuration, user_configs)
+ return configuration
+end
+
+return config
diff --git a/lua/colors/doom-one/init.lua b/lua/colors/doom-one/init.lua
index 1a91c03e7..4fbeb9168 100644
--- a/lua/colors/doom-one/init.lua
+++ b/lua/colors/doom-one/init.lua
@@ -7,61 +7,60 @@
-- Helpers {{{
-local utils = require('colors.utils')
+local doom_one = {}
+
+local utils = require("colors.utils")
+local config = require("colors.doom-one.config")
-- }}}
--- Customization variables {{{
+local configuration = config.get()
--- Set default values for doom_one variables if they don't exists
-if vim.g.doom_one_cursor_coloring == nil then
- vim.g.doom_one_cursor_coloring = false
-end
-if vim.g.doom_one_terminal_colors == nil then
- vim.g.doom_one_terminal_colors = false
-end
-if vim.g.doom_one_enable_treesitter == nil then
- vim.g.doom_one_enable_treesitter = true
+--- Establish the user configurations
+--- @param user_configs table
+doom_one.setup = function(user_configs)
+ configuration = config.set(user_configs or {})
+ -- Reload colorscheme with user configurations override
+ doom_one.load_colorscheme()
end
-if vim.g.doom_one_transparent_background == nil then
- vim.g.doom_one_transparent_background = false
-end
-if vim.g.doom_one_italic_comments == nil then
- vim.g.doom_one_italic_comments = false
-end
-if vim.g.doom_one_telescope_highlights == nil then
- vim.g.doom_one_telescope_highlights = true
+
+-- Customization variables {{{
+
+local transparent_bg = configuration.transparent_background
+
+if configuration.cursor_coloring then
+ vim.opt.guicursor = "n-v-c:block-Cursor,i-ci-ve:ver25-Cursor,r-cr-o:hor25-Cursor"
end
-local transparent_bg = vim.g.doom_one_transparent_background
+if configuration.pumblend.enable then
+ vim.opt.pumblend = configuration.pumblend.transparency_amount
+end
-- }}}
-- Highlight Functions and Color definitions {{{
local function high_clear(group)
- vim.api.nvim_command('hi! clear ' .. group)
+ vim.api.nvim_command("hi! clear " .. group)
end
local function high_link(group, link)
- vim.api.nvim_command('hi! link ' .. group .. ' ' .. link)
+ vim.api.nvim_command("hi! link " .. group .. " " .. link)
end
local function highlight(group, styles)
- local bg = styles.bg and 'guibg=' .. styles.bg or 'guibg=NONE'
- local fg = styles.fg and 'guifg=' .. styles.fg or 'guifg=NONE'
- local sp = styles.sp and 'guisp=' .. styles.sp or 'guisp=NONE'
- local gui = styles.gui and 'gui=' .. styles.gui or 'gui=NONE'
-
- vim.api.nvim_command(
- 'hi! ' .. group .. ' ' .. bg .. ' ' .. fg .. ' ' .. sp .. ' ' .. gui
- )
+ local bg = styles.bg and "guibg=" .. styles.bg or "guibg=NONE"
+ local fg = styles.fg and "guifg=" .. styles.fg or "guifg=NONE"
+ local sp = styles.sp and "guisp=" .. styles.sp or "guisp=NONE"
+ local gui = styles.gui and "gui=" .. styles.gui or "gui=NONE"
+
+ vim.api.nvim_command("hi! " .. group .. " " .. bg .. " " .. fg .. " " .. sp .. " " .. gui)
end
local function apply_highlight(groups)
- for group, styles in pairs(groups) do
- highlight(group, styles)
- end
+ for group, styles in pairs(groups) do
+ highlight(group, styles)
+ end
end
-- Change the colorscheme colors depending on the current background, defaults to
@@ -69,810 +68,943 @@ end
local current_bg = vim.opt.background:get()
local light_bg = false
-local base0 = '#1B2229'
-local base1 = '#1c1f24'
-local base2 = '#202328'
-local base3 = '#23272e'
-local base4 = '#3f444a'
-local base5 = '#5B6268'
-local base6 = '#73797e'
-local base7 = '#9ca0a4'
-local base8 = '#DFDFDF'
-local base9 = '#E6E6E6'
+local base0 = "#1B2229"
+local base1 = "#1c1f24"
+local base2 = "#202328"
+local base3 = "#23272e"
+local base4 = "#3f444a"
+local base5 = "#5B6268"
+local base6 = "#73797e"
+local base7 = "#9ca0a4"
+local base8 = "#DFDFDF"
+local base9 = "#E6E6E6"
local grey = base4
-local red = '#ff6c6b'
-local orange = '#da8548'
-local green = '#98be65'
-local yellow = '#ECBE7B'
-local blue = '#51afef'
-local dark_blue = '#2257A0'
-local magenta = '#c678dd'
+local red = "#ff6c6b"
+local orange = "#da8548"
+local green = "#98be65"
+local yellow = "#ECBE7B"
+local blue = "#51afef"
+local dark_blue = "#2257A0"
+local magenta = "#c678dd"
local light_magenta = utils.Lighten(magenta, 0.4)
-local violet = '#a9a1e1'
-local cyan = '#46D9FF'
-local white = '#efefef'
-
-local bg = '#282c34'
-local bg_alt = '#21242b'
-local bg_highlight = '#21252a'
-local bg_popup = '#3E4556'
+local violet = "#a9a1e1"
+local dark_violet = "#4e4f67"
+local cyan = "#46D9FF"
+local white = "#efefef"
+
+local bg = "#282c34"
+local bg_alt = "#21242b"
+local bg_highlight = "#21252a"
+local bg_popup = "#3E4556"
local bg_statusline = bg_popup
-local bg_highlighted = '#4A4A45'
+local bg_highlighted = "#4A4A45"
-local fg = '#bbc2cf'
-local fg_alt = '#5B6268'
+local fg = "#bbc2cf"
+local fg_alt = "#5B6268"
local fg_highlight = utils.Lighten(fg, 0.2)
local tag = utils.Mix(blue, cyan, 0.5)
local diff_info_fg = orange
-local diff_info_bg0 = utils.Mix('#D8EEFD', bg, 0.6)
-local diff_info_bg1 = utils.Mix('#D8EEFD', bg, 0.8)
+local diff_info_bg0 = utils.Mix("#D8EEFD", bg, 0.6)
+local diff_info_bg1 = utils.Mix("#D8EEFD", bg, 0.8)
local diff_add_fg = green
local diff_add_fg0 = utils.Mix(green, fg, 0.4)
-local diff_add_bg0 = utils.Mix('#506d5b', bg, 0.6)
-local diff_add_bg1 = utils.Mix('#acf2bd', bg, 0.8)
-
-local gh_danger_fg = red
-local gh_danger_fg0 = utils.Mix(red, fg, 0.6)
-local gh_danger_bg0 = utils.Mix('#ffdce0', bg, 0.6)
-local gh_danger_bg1 = utils.Mix('#ffdce0', bg, 0.8)
-
-if current_bg == 'light' then
- light_bg = true
-
- base0 = '#f0f0f0'
- base1 = '#e7e7e7'
- base2 = '#dfdfdf'
- base3 = '#c6c7c7'
- base4 = '#9ca0a4'
- base5 = '#383a42'
- base6 = '#202328'
- base7 = '#23272e'
- base8 = '#1c1f24'
- base9 = '#1B2229'
-
- grey = base4
- red = '#e45649'
- orange = '#da8548'
- green = '#50a14f'
- yellow = '#986801'
- blue = '#4078f2'
- dark_blue = '#a0bcf8'
- magenta = '#a626a4'
- light_magenta = utils.Darken(magenta, 0.36)
- violet = '#b751b6'
- cyan = '#0184bc'
- white = '#efefef'
-
- bg = '#fafafa'
- bg_alt = '#f0f0f0'
- bg_highlight = utils.Darken(bg, 0.3)
- bg_popup = bg_alt
- bg_statusline = bg_popup
-
- fg = base5
- fg_alt = base3
- fg_highlight = utils.Lighten(fg, 0.2)
-
- tag = utils.Mix(blue, cyan, 0.5)
-
- diff_info_fg = orange
- diff_info_bg0 = utils.Mix('#D8EEFD', bg, 0.6)
- diff_info_bg1 = utils.Mix('#D8EEFD', bg, 0.8)
-
- diff_add_fg = green
- diff_add_fg0 = utils.Mix(green, fg, 0.4)
- diff_add_bg0 = utils.Mix('#506d5b', bg, 0.4)
- diff_add_bg1 = utils.Mix('#acf2bd', bg, 0.8)
-
- gh_danger_fg = red
- gh_danger_fg0 = utils.Mix(red, fg, 0.6)
- gh_danger_bg0 = utils.Mix('#ffdce0', bg, 0.8)
- gh_danger_bg1 = utils.Mix('#ffdce0', bg, 0.9)
-end
-
-if vim.g.doom_one_cursor_coloring then
- vim.opt.guicursor =
- 'n-v-c:block-Cursor,i-ci-ve:ver25-Cursor,r-cr-o:hor25-Cursor'
-end
-
--- }}}
-
--- General UI {{{
-
-local general_ui = {
- Normal = { fg = fg, bg = transparent_bg and 'NONE' or bg },
- NormalPopup = {
- fg = fg_highlight,
- bg = transparent_bg and 'NONE' or bg_popup,
- },
- NormalPopover = {
- fg = fg_highlight,
- bg = transparent_bg and 'NONE' or bg_popup,
- },
- NormalPopupPrompt = {
- fg = base7,
- bg = transparent_bg and 'NONE' or utils.Darken(bg_popup, 0.3),
- gui = 'bold',
- },
- NormalPopupSubtle = {
- fg = base6,
- bg = transparent_bg and 'NONE' or bg_popup,
- },
- EndOfBuffer = { fg = bg, bg = transparent_bg and 'NONE' or bg },
-
- Visual = { bg = dark_blue },
- VisualBold = { bg = dark_blue, gui = 'bold' },
-
- LineNr = { fg = grey, bg = transparent_bg and 'NONE' or bg },
- Cursor = { bg = blue },
- CursorLine = { bg = bg_highlight },
- CursorLineNr = { fg = fg, bg = bg_highlight },
- CursorColumn = { bg = bg_highlight },
-
- Folded = { fg = base5, bg = bg_highlight },
- FoldColumn = { fg = fg_alt, bg = bg },
- SignColumn = { bg = transparent_bg and 'NONE' or bg },
- ColorColumn = { bg = bg_highlight },
-
- IndentGuide = { fg = grey },
- IndentGuideEven = { fg = grey },
- IndentGuideOdd = { fg = grey },
-
- TermCursor = { fg = fg, gui = 'reverse' },
- TermCursorNC = { fg = fg_alt, gui = 'reverse' },
- TermNormal = { fg = fg, bg = bg },
- TermNormalNC = { fg = fg, bg = bg },
-
- WildMenu = { fg = fg, bg = dark_blue },
- Separator = { fg = fg_alt },
- VertSplit = { fg = grey, bg = bg },
-
- TabLine = {
- fg = base7,
- bg = bg_alt,
- gui = 'bold',
- },
- TabLineSel = { fg = blue, bg = bg, gui = 'bold' },
- TabLineFill = { bg = base1, gui = 'bold' },
-
- StatusLine = { fg = base8, bg = base3 },
- StatusLineNC = { fg = base6, bg = bg_popup },
- StatusLinePart = { fg = base6, bg = bg_popup, gui = 'bold' },
- StatusLinePartNC = { fg = base6, bg = bg_popup, gui = 'bold' },
-
- Pmenu = { fg = fg, bg = bg_highlight },
- PmenuSel = { fg = base0, bg = blue },
- PmenuSelBold = { fg = base0, bg = blue, gui = 'bold' },
- PmenuSbar = { bg = bg_alt },
- PmenuThumb = { bg = fg },
-}
-
-if vim.opt.pumblend == 1 then
- vim.opt.pumblend = 20
-end
-
-apply_highlight(general_ui)
-
--- }}}
-
--- Search, Highlight. Conceal, Messages {{{
-
-local search_high_ui = {
- Search = { fg = fg, bg = dark_blue, gui = 'bold' },
- Substitute = { fg = red, gui = 'strikethrough,bold' },
- IncSearch = { fg = fg, bg = dark_blue, gui = 'bold' },
- IncSearchCursor = { gui = 'reverse' },
-
- Conceal = { fg = grey, gui = 'none' },
- SpecialKey = { fg = violet, gui = 'bold' },
- NonText = { fg = fg_alt, gui = 'bold' },
- MatchParen = { fg = red, gui = 'bold' },
- Whitespace = { fg = grey },
-
- Highlight = { bg = bg_highlighted },
- HighlightSubtle = { bg = bg_highlighted },
-
- Question = { fg = green, gui = 'bold' },
-
- File = { fg = fg },
- Directory = { fg = violet, gui = 'bold' },
- Title = { fg = violet, gui = 'bold' },
-
- Bold = { gui = 'bold' },
- Emphasis = { fg = green, gui = 'bold' },
-}
-
-apply_highlight(search_high_ui)
-
--- }}}
-
--- Text levels {{{
-
-local text_colors = {
- Normal = fg,
- Info = blue,
- Success = green,
- Warning = yellow,
- Debug = yellow,
- Error = red,
- Special = violet,
- Muted = base7,
-}
-
-for key, _ in pairs(text_colors) do
- apply_highlight({
- ['Text' .. key] = {
- fg = text_colors[key],
- },
- })
- apply_highlight({
- ['Text' .. key .. 'Bold'] = {
- fg = text_colors[key],
- gui = 'bold',
- },
- })
-end
-
-high_link('Msg', 'TextSuccess')
-high_link('MoreMsg', 'TextInfo')
-high_link('WarningMsg', 'TextWarning')
-high_link('Error', 'TextError')
-high_link('ErrorMsg', 'TextError')
-high_link('ModeMsg', 'TextSpecial')
-high_link('Todo', 'TextWarningBold')
-
--- }}}
-
--- Main Syntax {{{
-
-local main_syntax = {
- Tag = { fg = tag, gui = 'bold' },
- Link = { fg = tag, gui = 'undercurl' },
- URL = { fg = tag, gui = 'undercurl' },
- Underlined = { fg = tag, gui = 'underline' },
-
- Comment = {
- fg = fg_alt,
- gui = vim.g.doom_one_italic_comments and 'italic' or 'NONE',
- },
- CommentBold = { fg = fg_alt, gui = 'bold' },
- SpecialComment = { fg = base7, gui = 'bold' },
-
- Macro = { fg = violet },
- Define = { fg = violet, gui = 'bold' },
- Include = { fg = violet, gui = 'bold' },
- PreProc = { fg = violet, gui = 'bold' },
- PreCondit = { fg = violet, gui = 'bold' },
-
- Label = { fg = light_bg and orange or blue },
- Repeat = { fg = light_bg and orange or blue },
- Keyword = { fg = light_bg and orange or blue },
- Operator = { fg = light_bg and orange or blue },
- Delimiter = { fg = light_bg and orange or blue },
- Statement = { fg = light_bg and orange or blue },
- Exception = { fg = light_bg and orange or blue },
- Conditional = { fg = light_bg and orange or blue },
-
- Variable = { fg = '#8B93E6' },
- VariableBuiltin = { fg = '#8B93E6', gui = 'bold' },
- Constant = { fg = violet, gui = 'bold' },
-
- Number = { fg = light_bg and yellow or orange },
- Float = { fg = light_bg and yellow or orange },
- Boolean = { fg = light_bg and yellow or orange, gui = 'bold' },
- Enum = { fg = light_bg and yellow or orange },
-
- Character = { fg = violet, gui = 'bold' },
- SpecialChar = { fg = base8, gui = 'bold' },
-
- String = { fg = green },
- StringDelimiter = { fg = green },
-
- Special = { fg = violet },
- SpecialBold = { fg = violet, gui = 'bold' },
-
- Field = { fg = violet },
- Argument = { fg = light_magenta },
- Attribute = { fg = light_magenta },
- Identifier = { fg = light_magenta },
- Property = { fg = magenta },
- Function = { fg = magenta },
- FunctionBuiltin = { fg = light_magenta, gui = 'bold' },
- KeywordFunction = { fg = light_bg and orange or blue },
- Method = { fg = violet },
-
- Type = { fg = yellow },
- TypeBuiltin = { fg = yellow, gui = 'bold' },
- StorageClass = { fg = light_bg and orange or blue },
- Class = { fg = light_bg and orange or blue },
- Structure = { fg = light_bg and orange or blue },
- Typedef = { fg = light_bg and orange or blue },
-
- Regexp = { fg = '#dd0093' },
- RegexpSpecial = { fg = '#a40073' },
- RegexpDelimiter = { fg = '#540063', gui = 'bold' },
- RegexpKey = { fg = '#5f0041', gui = 'bold' },
-}
-
-apply_highlight(main_syntax)
-high_link('CommentURL', 'URL')
-high_link('CommentLabel', 'CommentBold')
-high_link('CommentSection', 'CommentBold')
-high_link('Noise', 'Comment')
-
--- }}}
-
--- Diff {{{
-
-local diff = {
- diffLine = { fg = base8, bg = diff_info_bg1 },
- diffSubName = { fg = base8, bg = diff_info_bg1 },
-
- DiffAdd = { bg = diff_add_bg1 },
- DiffChange = { bg = diff_add_bg1 },
- DiffText = { bg = diff_add_bg0 },
- DiffDelete = { bg = gh_danger_bg0 },
-
- DiffAdded = { fg = diff_add_fg0, bg = diff_add_bg1 },
- DiffModified = { fg = fg, bg = diff_info_bg0 },
- DiffRemoved = { fg = gh_danger_fg0, bg = gh_danger_bg1 },
-
- DiffAddedGutter = { fg = diff_add_fg, gui = 'bold' },
- DiffModifiedGutter = { fg = diff_info_fg, gui = 'bold' },
- DiffRemovedGutter = { fg = gh_danger_fg, gui = 'bold' },
-
- DiffAddedGutterLineNr = { fg = grey },
- DiffModifiedGutterLineNr = { fg = grey },
- DiffRemovedGutterLineNr = { fg = grey },
-}
-
-high_clear('DiffAdd')
-high_clear('DiffChange')
-high_clear('DiffText')
-high_clear('DiffDelete')
-apply_highlight(diff)
-
--- }}}
-
--- Markdown {{{
-local markdown = {
- markdownCode = { bg = bg_highlight },
- markdownCodeBlock = { bg = bg_highlight },
- markdownH1 = { gui = 'bold' },
- markdownH2 = { gui = 'bold' },
- markdownLinkText = { gui = 'underline' },
-}
-
-apply_highlight(markdown)
---}}}
-
--- Plugins {{{
+local diff_add_bg0 = utils.Mix("#506d5b", bg, 0.6)
+local diff_add_bg1 = utils.Mix("#acf2bd", bg, 0.8)
--- barbar.nvim {{{
+local ng_add_fg = "#799850"
+local ng_add_fg_hl = green
+local ng_add_bg = "#333a38"
+local ng_add_bg_hl = "#3e493d"
-local barbar = {
- BufferCurrent = { fg = base9, bg = bg },
- BufferCurrentIndex = { fg = base6, bg = bg },
- BufferCurrentMod = { fg = yellow, bg = bg },
- BufferCurrentSign = { fg = blue, bg = bg },
- BufferCurrentTarget = { fg = red, bg = bg, gui = 'bold' },
+local ng_delete_fg = "#cc5655"
+local ng_delete_fg_hl = red
+local ng_delete_bg = "#392d34"
+local ng_delete_bg_hl = "#3f343a"
- BufferVisible = { fg = base7, bg = bg },
- BufferVisibleIndex = { fg = base9, bg = bg },
- BufferVisibleMod = { fg = yellow, bg = bg },
- BufferVisibleSign = { fg = base4, bg = bg },
- BufferVisibleTarget = { fg = red, bg = bg, gui = 'bold' },
+local ng_header_bg = dark_violet
+local ng_header_bg_hl = violet
- BufferInactive = { fg = base6, bg = base1 },
- BufferInactiveIndex = { fg = base6, bg = base1 },
- BufferInactiveMod = { fg = yellow, bg = base1 },
- BufferInactiveSign = { fg = base4, bg = base1 },
- BufferInactiveTarget = { fg = red, bg = base1, gui = 'bold' },
-
- BufferTabpages = { fg = blue, bg = bg_statusline, gui = 'bold' },
- BufferTabpageFill = { fg = base4, bg = base1, gui = 'bold' },
-
- BufferPart = { fg = diff_info_fg, bg = diff_info_bg0, gui = 'bold' },
-}
-
-apply_highlight(barbar)
-
--- }}}
-
--- BufferLine {{{
-
--- NOTE: this is a temporal workaround for using bufferline with a transparent
--- background and having highlighting, please refer to
--- https://github.com/NTBBloodbath/doom-one.nvim/issues/8#issuecomment-883737667
--- for more information about this
-if transparent_bg then
- local bufferline = {
- BufferLineTab = { fg = fg, bg = bg },
- BufferLineTabClose = { fg = fg, bg = bg, gui = 'bold' },
- BufferLineTabSelected = { fg = blue, bg = bg, gui = 'bold,italic' },
- BufferLineBackground = { fg = fg_alt, bg = bg },
- BufferLineBufferSelected = { fg = fg, bg = bg, gui = 'bold,italic' },
- BufferLineBufferVisible = { fg = fg, bg = bg },
- BufferLineCloseButton = { fg = fg_alt, bg = bg },
- BufferLineCloseButtonSelected = { fg = fg, bg = bg, gui = 'bold' },
- BufferLineCloseButtonVisible = { fg = fg, bg = bg },
- BufferLineModified = { fg = green, bg = bg },
- BufferLineModifiedSelected = { fg = green, bg = bg },
- BufferLineModifiedVisible = { fg = green, bg = bg },
- BufferLineFill = { fg = blue, bg = bg_alt },
- BufferLineIndicatorSelected = { fg = blue, bg = bg },
- BufferLineSeparator = { fg = base0, bg = bg },
- BufferLineSeparatorSelected = { fg = base0, bg = bg },
- BufferLineSeparatorVisible = { fg = base0, bg = bg_alt },
- BufferLinePick = { fg = fg, bg = bg, gui = 'bold' },
- BufferLinePickSelected = { fg = blue, bg = bg, gui = 'bold,italic' },
- BufferLinePickVisible = { fg = fg, bg = bg_alt },
-
- BufferLineDiagnostic = { fg = fg, bg = bg, sp = fg },
- BufferLineDiagnosticSelected = { fg = fg, bg = bg, sp = fg },
- BufferLineDiagnosticVisible = { fg = fg, bg = bg, sp = fg },
-
- BufferLineInfo = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' },
- BufferLineInfoSelected = {
- fg = cyan,
- bg = bg,
- sp = cyan,
- gui = 'bold,italic',
- },
- BufferLineInfoVisible = { fg = cyan, bg = bg, sp = cyan, gui = 'bold' },
- BufferLineInfoDiagnostic = { fg = cyan, bg = bg, sp = cyan },
- BufferLineInfoDiagnosticSelected = { fg = cyan, bg = bg, sp = cyan },
- BufferLineInfoDiagnosticVisible = { fg = cyan, bg = bg, sp = cyan },
- BufferLineError = { fg = red, bg = bg, sp = red, gui = 'bold' },
- BufferLineErrorSelected = {
- fg = red,
- bg = bg,
- sp = red,
- gui = 'bold,italic',
- },
- BufferLineErrorVisible = { fg = red, bg = bg, sp = red, gui = 'bold' },
- BufferLineErrorDiagnostic = { fg = red, bg = bg, sp = red },
- BufferLineErrorDiagnosticSelected = { fg = red, bg = bg, sp = red },
- BufferLineErrorDiagnosticVisible = { fg = red, bg = bg, sp = red },
- BufferLineWarning = {
- fg = yellow,
- bg = bg,
- sp = yellow,
- gui = 'bold,italic',
- },
- BufferLineWarningSelected = {
- fg = yellow,
- bg = bg,
- sp = yellow,
- gui = 'bold,italic',
- },
- BufferLineWarningVisible = {
- fg = yellow,
- bg = bg,
- sp = yellow,
- gui = 'bold',
- },
- BufferLineWarningDiagnostic = { fg = yellow, bg = bg, sp = yellow },
- BufferLineWarningDiagnosticSelected = {
- fg = yellow,
- bg = bg,
- sp = yellow,
- },
- BufferLineWarningDiagnosticVisible = {
- fg = yellow,
- bg = bg,
- sp = yellow,
- },
- }
-
- apply_highlight(bufferline)
-end
-
--- }}}
-
--- Gitgutter {{{
-
-high_link('GitGutterAdd', 'DiffAddedGutter')
-high_link('GitGutterChange', 'DiffModifiedGutter')
-high_link('GitGutterDelete', 'DiffRemovedGutter')
-high_link('GitGutterChangeDelete', 'DiffModifiedGutter')
-
-high_link('GitGutterAddLineNr', 'DiffAddedGutterLineNr')
-high_link('GitGutterChangeLineNr', 'DiffModifiedGutterLineNr')
-high_link('GitGutterDeleteLineNr', 'DiffRemovedGutterLineNr')
-high_link('GitGutterChangeDeleteLineNr', 'DiffModifiedGutterLineNr')
-
--- }}}
-
--- Gitsigns {{{
-
-high_link('GitSignsAdd', 'DiffAddedGutter')
-high_link('GitSignsChange', 'DiffModifiedGutter')
-high_link('GitSignsDelete', 'DiffRemovedGutter')
-high_link('GitSignsChangeDelete', 'DiffModifiedGutter')
-
--- }}}
-
--- Telescope {{{
-
-if vim.g.doom_one_telescope_highlights then
- local telescope = {
- TelescopeSelection = { fg = yellow, gui = 'bold' },
- TelescopeSelectionCaret = { fg = light_bg and orange or blue },
- TelescopeMultiSelection = { fg = grey },
- TelescopeNormal = { fg = fg },
- TelescopeMatching = { fg = green, gui = 'bold' },
- TelescopePromptPrefix = { fg = light_bg and orange or blue },
- TelescopeBorder = { fg = light_bg and orange or blue },
- TelescopePromptBorder = { fg = light_bg and orange or blue },
- TelescopeResultsBorder = { fg = light_bg and orange or blue },
- TelescopePreviewBorder = { fg = light_bg and orange or blue },
- }
-
- apply_highlight(telescope)
- high_link('TelescopePrompt', 'TelescopeNormal')
-end
-
--- }}}
-
--- NvimTree {{{
-
-local nvim_tree = {
- NvimTreeFolderName = { fg = light_bg and base9 or blue, gui = 'bold' },
- NvimTreeRootFolder = { fg = green },
- NvimTreeEmptyFolderName = { fg = fg_alt, gui = 'bold' },
- NvimTreeSymlink = { fg = fg, gui = 'underline' },
- NvimTreeExecFile = { fg = green, gui = 'bold' },
- NvimTreeImageFile = { fg = light_bg and orange or blue },
- NvimTreeOpenedFile = { fg = fg_alt },
- NvimTreeSpecialFile = { fg = fg, gui = 'underline' },
- NvimTreeMarkdownFile = { fg = fg, gui = 'underline' },
-}
-
-apply_highlight(nvim_tree)
-high_link('NvimTreeGitDirty', 'DiffModifiedGutter')
-high_link('NvimTreeGitStaged', 'DiffModifiedGutter')
-high_link('NvimTreeGitMerge', 'DiffModifiedGutter')
-high_link('NvimTreeGitRenamed', 'DiffModifiedGutter')
-high_link('NvimTreeGitNew', 'DiffAddedGutter')
-high_link('NvimTreeGitDeleted', 'DiffRemovedGutter')
-
-high_link('NvimTreeIndentMarker', 'IndentGuide')
-high_link('NvimTreeOpenedFolderName', 'NvimTreeFolderName')
-
--- }}}
-
--- Dashboard {{{
-
-local dashboard = {
- dashboardHeader = { fg = '#586268' },
- dashboardCenter = { fg = light_bg and orange or blue },
- dashboardShortcut = { fg = '#9788b9' },
-}
-
-apply_highlight(dashboard)
-high_link('dashboardFooter', 'dashboardHeader')
-
--- }}}
-
--- Startify {{{
-
-local startify = {
- StartifyHeader = { fg = bg_popup },
- StartifyBracket = { fg = bg_popup },
- StartifyNumber = { fg = blue },
- StartifyPath = { fg = violet },
- StartifySlash = { fg = violet },
- StartifyFile = { fg = green },
-}
-
-apply_highlight(startify)
-
--- }}}
-
--- WhichKey {{{
-
-local whichkey = {
- WhichKey = { fg = light_bg and orange or blue },
- WhichKeyGroup = { fg = magenta },
- WhichKeyDesc = { fg = magenta },
- WhichKeySeparator = { fg = base5 },
- WhichKeyFloat = { bg = base2 },
- WhichKeyValue = { fg = grey },
-}
-
-apply_highlight(whichkey)
-
--- }}}
-
--- indent-blankline {{{
-
-local indent_blankline = {
- IndentBlanklineChar = {
- fg = base4,
- cterm = 'nocombine',
- gui = 'nocombine',
- },
- IndentBlanklineContextChar = {
- fg = blue,
- cterm = 'nocombine',
- gui = 'nocombine',
- },
- IndentBlanklineSpaceChar = {
- fg = base4,
- cterm = 'nocombine',
- gui = 'nocombine',
- },
- IndentBlanklineSpaceCharBlankline = {
- fg = base4,
- cterm = 'nocombine',
- gui = 'nocombine',
- },
-}
-
-apply_highlight(indent_blankline)
-
--- }}}
-
--- }}}
-
--- LSP {{{
-
-local msg_underline = {
- ErrorMsgUnderline = { fg = red, gui = 'undercurl' },
- WarningMsgUnderline = { fg = yellow, gui = 'undercurl' },
- MoreMsgUnderline = { fg = blue, gui = 'undercurl' },
- MsgUnderline = { fg = green, gui = 'undercurl' },
-}
-
-apply_highlight(msg_underline)
-high_link('LspDiagnosticsFloatingError', 'ErrorMsg')
-high_link('LspDiagnosticsFloatingWarning', 'Warning')
-high_link('LspDiagnosticsFloatingInformation', 'MoreMsg')
-high_link('LspDiagnosticsFloatingHint', 'Msg')
-high_link('LspDiagnosticsDefaultError', 'ErrorMsg')
-high_link('LspDiagnosticsDefaultWarning', 'WarningMsg')
-high_link('LspDiagnosticsDefaultInformation', 'MoreMsg')
-high_link('LspDiagnosticsDefaultHint', 'Msg')
-high_link('LspDiagnosticsVirtualTextError', 'ErrorMsg')
-high_link('LspDiagnosticsVirtualTextWarning', 'WarningMsg')
-high_link('LspDiagnosticsVirtualTextInformation', 'MoreMsg')
-high_link('LspDiagnosticsVirtualTextHint', 'Msg')
-high_link('LspDiagnosticsUnderlineError', 'ErrorMsgUnderline')
-high_link('LspDiagnosticsUnderlineWarning', 'WarningMsgUnderline')
-high_link('LspDiagnosticsUnderlineInformation', 'MoreMsgUnderline')
-high_link('LspDiagnosticsUnderlineHint', 'MsgUnderline')
-high_link('LspDiagnosticsSignError', 'ErrorMsg')
-high_link('LspDiagnosticsSignWarning', 'WarningMsg')
-high_link('LspDiagnosticsSignInformation', 'MoreMsg')
-high_link('LspDiagnosticsSignHint', 'Msg')
-high_link('LspReferenceText', 'Bold')
-high_link('LspReferenceRead', 'Bold')
-high_link('LspReferenceWrite', 'Bold')
-high_link('TermCursor', 'Cursor')
-high_link('healthError', 'ErrorMsg')
-high_link('healthSuccess', 'Msg')
-high_link('healthWarning', 'WarningMsg')
-
--- LspSaga {{{
-
-local lspsaga = {
- SagaShadow = { bg = bg },
- LspSagaDiagnosticHeader = { fg = red },
-}
-
-apply_highlight(lspsaga)
-high_link('LspSagaDiagnosticBorder', 'Normal')
-high_link('LspSagaDiagnosticTruncateLine', 'Normal')
-high_link('LspFloatWinBorder', 'Normal')
-high_link('LspSagaBorderTitle', 'Title')
-high_link('TargetWord', 'Error')
-high_link('ReferencesCount', 'Title')
-high_link('ReferencesIcon', 'Special')
-high_link('DefinitionCount', 'Title')
-high_link('TargetFileName', 'Comment')
-high_link('DefinitionIcon', 'Special')
-high_link('ProviderTruncateLine', 'Normal')
-high_link('LspSagaFinderSelection', 'Search')
-high_link('DiagnosticTruncateLine', 'Normal')
-high_link('DiagnosticError', 'LspDiagnosticsDefaultError')
-high_link('DiagnosticWarning', 'LspDiagnosticsDefaultWarning')
-high_link('DiagnosticInformation', 'LspDiagnosticsDefaultInformation')
-high_link('DiagnosticHint', 'LspDiagnosticsDefaultHint')
-high_link('DefinitionPreviewTitle', 'Title')
-high_link('LspSagaShTruncateLine', 'Normal')
-high_link('LspSagaDocTruncateLine', 'Normal')
-high_link('LineDiagTuncateLine', 'Normal')
-high_link('LspSagaCodeActionTitle', 'Title')
-high_link('LspSagaCodeActionTruncateLine', 'Normal')
-high_link('LspSagaCodeActionContent', 'Normal')
-high_link('LspSagaRenamePromptPrefix', 'Normal')
-high_link('LspSagaRenameBorder', 'Bold')
-high_link('LspSagaHoverBorder', 'Bold')
-high_link('LspSagaSignatureHelpBorder', 'Bold')
-high_link('LspSagaCodeActionBorder', 'Bold')
-high_link('LspSagaDefPreviewBorder', 'Bold')
-high_link('LspLinesDiagBorder', 'Bold')
-
--- }}}
-
--- }}}
-
--- TreeSitter {{{
-
-if vim.g.doom_one_enable_treesitter then
- high_link('TSException', 'Exception')
- high_link('TSAnnotation', 'PreProc')
- high_link('TSAttribute', 'Attribute')
- high_link('TSConditional', 'Conditional')
- high_link('TSComment', 'Comment')
- high_link('TSConstructor', 'Structure')
- high_link('TSConstant', 'Constant')
- high_link('TSConstBuiltin', 'Constant')
- high_link('TSConstMacro', 'Macro')
- high_link('TSError', 'Error')
- high_link('TSField', 'Field')
- high_link('TSFloat', 'Float')
- high_link('TSFunction', 'Function')
- high_link('TSFuncBuiltin', 'FunctionBuiltin')
- high_link('TSFuncMacro', 'Macro')
- high_link('TSInclude', 'Include')
- high_link('TSKeyword', 'Keyword')
- high_link('TSKeywordFunction', 'KeywordFunction')
- high_link('TSLabel', 'Label')
- high_link('TSMethod', 'Method')
- high_link('TSNamespace', 'Directory')
- high_link('TSNumber', 'Number')
- high_link('TSOperator', 'Operator')
- high_link('TSParameter', 'Argument')
- high_link('TSParameterReference', 'Argument')
- high_link('TSProperty', 'Property')
- high_link('TSPunctDelimiter', 'Delimiter')
- high_link('TSPunctBracket', 'Delimiter')
- high_link('TSPunctSpecial', 'Delimiter')
- high_link('TSRepeat', 'Repeat')
- high_link('TSString', 'String')
- high_link('TSStringRegex', 'StringDelimiter')
- high_link('TSStringEscape', 'StringDelimiter')
- high_link('TSTag', 'Tag')
- high_link('TSTagDelimiter', 'Delimiter')
- high_link('TSStrong', 'Bold')
- high_link('TSURI', 'URL')
- high_link('TSWarning', 'Warning')
- high_link('TSDanger', 'Error')
- high_link('TSType', 'Type')
- high_link('TSTypeBuiltin', 'TypeBuiltin')
- high_link('TSVariable', 'None')
- high_link('TSVariableBuiltin', 'VariableBuiltin')
+local gh_danger_fg = red
+local gh_danger_fg0 = utils.Mix(red, fg, 0.6)
+local gh_danger_bg0 = utils.Mix("#ffdce0", bg, 0.6)
+local gh_danger_bg1 = utils.Mix("#ffdce0", bg, 0.8)
+
+if current_bg == "light" then
+ light_bg = true
+
+ base0 = "#f0f0f0"
+ base1 = "#e7e7e7"
+ base2 = "#dfdfdf"
+ base3 = "#c6c7c7"
+ base4 = "#9ca0a4"
+ base5 = "#383a42"
+ base6 = "#202328"
+ base7 = "#23272e"
+ base8 = "#1c1f24"
+ base9 = "#1B2229"
+
+ grey = base4
+ red = "#e45649"
+ orange = "#da8548"
+ green = "#50a14f"
+ yellow = "#986801"
+ blue = "#4078f2"
+ dark_blue = "#a0bcf8"
+ magenta = "#a626a4"
+ light_magenta = utils.Darken(magenta, 0.36)
+ violet = "#b751b6"
+ dark_violet = "#e5c7e5"
+ cyan = "#0184bc"
+ white = "#efefef"
+
+ bg = "#fafafa"
+ bg_alt = "#f0f0f0"
+ bg_highlight = utils.Darken(bg, 0.3)
+ bg_popup = bg_alt
+ bg_statusline = bg_popup
+
+ fg = base5
+ fg_alt = base3
+ fg_highlight = utils.Lighten(fg, 0.2)
+
+ tag = utils.Mix(blue, cyan, 0.5)
+
+ diff_info_fg = orange
+ diff_info_bg0 = utils.Mix("#D8EEFD", bg, 0.6)
+ diff_info_bg1 = utils.Mix("#D8EEFD", bg, 0.8)
+
+ diff_add_fg = green
+ diff_add_fg0 = utils.Mix(green, fg, 0.4)
+ diff_add_bg0 = utils.Mix("#506d5b", bg, 0.4)
+ diff_add_bg1 = utils.Mix("#acf2bd", bg, 0.8)
+
+ ng_add_fg = "#40803f"
+ ng_add_fg_hl = green
+ ng_add_bg = "#e9f1e8"
+ ng_add_bg_hl = "#d8e8d7"
+
+ ng_delete_fg = "#cc5655"
+ ng_delete_fg_hl = red
+ ng_delete_bg = "#f7e9e8"
+ ng_delete_bg_hl = "#f5d9d6"
+
+ ng_header_bg = dark_violet
+ ng_header_bg_hl = violet
+
+ gh_danger_fg = red
+ gh_danger_fg0 = utils.Mix(red, fg, 0.6)
+ gh_danger_bg0 = utils.Mix("#ffdce0", bg, 0.8)
+ gh_danger_bg1 = utils.Mix("#ffdce0", bg, 0.9)
end
-- }}}
--- Neovim Terminal Colors {{{
-
-if vim.g.doom_one_terminal_colors then
- vim.g.terminal_color_0 = bg
- vim.g.terminal_color_1 = red
- vim.g.terminal_color_2 = green
- vim.g.terminal_color_3 = yellow
- vim.g.terminal_color_4 = blue
- vim.g.terminal_color_5 = violet
- vim.g.terminal_color_6 = cyan
- vim.g.terminal_color_7 = fg
- vim.g.terminal_color_8 = grey
- vim.g.terminal_color_9 = red
- vim.g.terminal_color_10 = green
- vim.g.terminal_color_11 = orange
- vim.g.terminal_color_12 = blue
- vim.g.terminal_color_13 = violet
- vim.g.terminal_color_14 = cyan
- vim.g.terminal_color_15 = white
- vim.g.terminal_color_background = bg_alt
- vim.g.terminal_color_foreground = fg_alt
+--- Load the colorscheme
+doom_one.load_colorscheme = function()
+ -- General UI {{{
+
+ local general_ui = {
+ Normal = { fg = fg, bg = transparent_bg and "NONE" or bg },
+ NormalPopup = {
+ fg = fg_highlight,
+ bg = transparent_bg and "NONE" or bg_popup,
+ },
+ NormalPopover = {
+ fg = fg_highlight,
+ bg = transparent_bg and "NONE" or bg_popup,
+ },
+ NormalPopupPrompt = {
+ fg = base7,
+ bg = transparent_bg and "NONE" or utils.Darken(bg_popup, 0.3),
+ gui = "bold",
+ },
+ NormalPopupSubtle = {
+ fg = base6,
+ bg = transparent_bg and "NONE" or bg_popup,
+ },
+ EndOfBuffer = { fg = bg, bg = transparent_bg and "NONE" or bg },
+
+ Visual = { bg = dark_blue },
+ VisualBold = { bg = dark_blue, gui = "bold" },
+
+ LineNr = { fg = grey, bg = transparent_bg and "NONE" or bg },
+ Cursor = { bg = blue },
+ CursorLine = { bg = bg_highlight },
+ CursorLineNr = { fg = fg, bg = bg_highlight },
+ CursorColumn = { bg = bg_highlight },
+
+ Folded = { fg = base5, bg = bg_highlight },
+ FoldColumn = { fg = fg_alt, bg = bg },
+ SignColumn = { bg = transparent_bg and "NONE" or bg },
+ ColorColumn = { bg = bg_highlight },
+
+ IndentGuide = { fg = grey },
+ IndentGuideEven = { fg = grey },
+ IndentGuideOdd = { fg = grey },
+
+ TermCursor = { fg = fg, gui = "reverse" },
+ TermCursorNC = { fg = fg_alt, gui = "reverse" },
+ TermNormal = { fg = fg, bg = bg },
+ TermNormalNC = { fg = fg, bg = bg },
+
+ WildMenu = { fg = fg, bg = dark_blue },
+ Separator = { fg = fg_alt },
+ VertSplit = { fg = grey, bg = bg },
+
+ TabLine = {
+ fg = base7,
+ bg = bg_alt,
+ gui = "bold",
+ },
+ TabLineSel = { fg = blue, bg = bg, gui = "bold" },
+ TabLineFill = { bg = base1, gui = "bold" },
+
+ StatusLine = { fg = base8, bg = base3 },
+ StatusLineNC = { fg = base6, bg = bg_popup },
+ StatusLinePart = { fg = base6, bg = bg_popup, gui = "bold" },
+ StatusLinePartNC = { fg = base6, bg = bg_popup, gui = "bold" },
+
+ Pmenu = { fg = fg, bg = bg_highlight },
+ PmenuSel = { fg = base0, bg = blue },
+ PmenuSelBold = { fg = base0, bg = blue, gui = "bold" },
+ PmenuSbar = { bg = bg_alt },
+ PmenuThumb = { bg = fg },
+ }
+
+ if vim.opt.pumblend == 1 then
+ vim.opt.pumblend = 20
+ end
+
+ apply_highlight(general_ui)
+
+ -- }}}
+
+ -- Search, Highlight. Conceal, Messages {{{
+
+ local search_high_ui = {
+ Search = { fg = fg, bg = dark_blue, gui = "bold" },
+ Substitute = { fg = red, gui = "strikethrough,bold" },
+ IncSearch = { fg = fg, bg = dark_blue, gui = "bold" },
+ IncSearchCursor = { gui = "reverse" },
+
+ Conceal = { fg = grey, gui = "none" },
+ SpecialKey = { fg = violet, gui = "bold" },
+ NonText = { fg = fg_alt, gui = "bold" },
+ MatchParen = { fg = red, gui = "bold" },
+ Whitespace = { fg = grey },
+
+ Highlight = { bg = bg_highlighted },
+ HighlightSubtle = { bg = bg_highlighted },
+ LspHighlight = { bg = bg_highlight, style = "bold" },
+
+ Question = { fg = green, gui = "bold" },
+
+ File = { fg = fg },
+ Directory = { fg = violet, gui = "bold" },
+ Title = { fg = violet, gui = "bold" },
+
+ Bold = { gui = "bold" },
+ Emphasis = { fg = green, gui = "bold" },
+ }
+
+ apply_highlight(search_high_ui)
+
+ -- }}}
+
+ -- Text levels {{{
+
+ local text_colors = {
+ Normal = fg,
+ Info = blue,
+ Success = green,
+ Warning = yellow,
+ Debug = yellow,
+ Error = red,
+ Special = violet,
+ Muted = base7,
+ }
+
+ for key, _ in pairs(text_colors) do
+ apply_highlight({
+ ["Text" .. key] = {
+ fg = text_colors[key],
+ },
+ })
+ apply_highlight({
+ ["Text" .. key .. "Bold"] = {
+ fg = text_colors[key],
+ gui = "bold",
+ },
+ })
+ end
+
+ high_link("Msg", "TextSuccess")
+ high_link("MoreMsg", "TextInfo")
+ high_link("WarningMsg", "TextWarning")
+ high_link("Error", "TextError")
+ high_link("ErrorMsg", "TextError")
+ high_link("ModeMsg", "TextSpecial")
+ high_link("Todo", "TextWarningBold")
+
+ -- }}}
+
+ -- Main Syntax {{{
+
+ local main_syntax = {
+ Tag = { fg = tag, gui = "bold" },
+ Link = { fg = green, gui = "underline" },
+ URL = { fg = green, gui = "underline" },
+ Underlined = { fg = tag, gui = "underline" },
+
+ Comment = {
+ fg = fg_alt,
+ gui = configuration.italic_comments and "italic" or "NONE",
+ },
+ CommentBold = { fg = fg_alt, gui = "bold" },
+ SpecialComment = { fg = base7, gui = "bold" },
+
+ Macro = { fg = violet },
+ Define = { fg = violet, gui = "bold" },
+ Include = { fg = violet, gui = "bold" },
+ PreProc = { fg = violet, gui = "bold" },
+ PreCondit = { fg = violet, gui = "bold" },
+
+ Label = { fg = light_bg and orange or blue },
+ Repeat = { fg = light_bg and orange or blue },
+ Keyword = { fg = light_bg and orange or blue },
+ Operator = { fg = light_bg and orange or blue },
+ Delimiter = { fg = light_bg and orange or blue },
+ Statement = { fg = light_bg and orange or blue },
+ Exception = { fg = light_bg and orange or blue },
+ Conditional = { fg = light_bg and orange or blue },
+
+ Variable = { fg = "#8B93E6" },
+ VariableBuiltin = { fg = "#8B93E6", gui = "bold" },
+ Constant = { fg = violet, gui = "bold" },
+
+ Number = { fg = light_bg and yellow or orange },
+ Float = { fg = light_bg and yellow or orange },
+ Boolean = { fg = light_bg and yellow or orange, gui = "bold" },
+ Enum = { fg = light_bg and yellow or orange },
+
+ Character = { fg = violet, gui = "bold" },
+ SpecialChar = { fg = base8, gui = "bold" },
+
+ String = { fg = green },
+ StringDelimiter = { fg = green },
+
+ Special = { fg = violet },
+ SpecialBold = { fg = violet, gui = "bold" },
+
+ Field = { fg = violet },
+ Argument = { fg = light_magenta },
+ Attribute = { fg = light_magenta },
+ Identifier = { fg = light_magenta },
+ Property = { fg = magenta },
+ Function = { fg = magenta },
+ FunctionBuiltin = { fg = light_magenta, gui = "bold" },
+ KeywordFunction = { fg = light_bg and orange or blue },
+ Method = { fg = violet },
+
+ Type = { fg = yellow },
+ TypeBuiltin = { fg = yellow, gui = "bold" },
+ StorageClass = { fg = light_bg and orange or blue },
+ Class = { fg = light_bg and orange or blue },
+ Structure = { fg = light_bg and orange or blue },
+ Typedef = { fg = light_bg and orange or blue },
+
+ Regexp = { fg = "#dd0093" },
+ RegexpSpecial = { fg = "#a40073" },
+ RegexpDelimiter = { fg = "#540063", gui = "bold" },
+ RegexpKey = { fg = "#5f0041", gui = "bold" },
+ }
+
+ apply_highlight(main_syntax)
+ high_link("CommentURL", "URL")
+ high_link("CommentLabel", "CommentBold")
+ high_link("CommentSection", "CommentBold")
+ high_link("Noise", "Comment")
+
+ -- }}}
+
+ -- Diff {{{
+
+ local diff = {
+ diffLine = { fg = base8, bg = diff_info_bg1 },
+ diffSubName = { fg = base8, bg = diff_info_bg1 },
+
+ DiffAdd = { bg = diff_add_bg1 },
+ DiffChange = { bg = diff_add_bg1 },
+ DiffText = { bg = diff_add_bg0 },
+ DiffDelete = { bg = gh_danger_bg0 },
+
+ DiffAdded = { fg = diff_add_fg0, bg = diff_add_bg1 },
+ DiffModified = { fg = fg, bg = diff_info_bg0 },
+ DiffRemoved = { fg = gh_danger_fg0, bg = gh_danger_bg1 },
+
+ DiffAddedGutter = { fg = diff_add_fg, gui = "bold" },
+ DiffModifiedGutter = { fg = diff_info_fg, gui = "bold" },
+ DiffRemovedGutter = { fg = gh_danger_fg, gui = "bold" },
+
+ DiffAddedGutterLineNr = { fg = grey },
+ DiffModifiedGutterLineNr = { fg = grey },
+ DiffRemovedGutterLineNr = { fg = grey },
+ }
+
+ high_clear("DiffAdd")
+ high_clear("DiffChange")
+ high_clear("DiffText")
+ high_clear("DiffDelete")
+ apply_highlight(diff)
+
+ -- }}}
+
+ -- Markdown {{{
+ local markdown = {
+ markdownCode = { bg = bg_highlight },
+ markdownCodeBlock = { bg = bg_highlight },
+ markdownH1 = { gui = "bold" },
+ markdownH2 = { gui = "bold" },
+ markdownLinkText = { gui = "underline" },
+ }
+
+ apply_highlight(markdown)
+ --}}}
+
+ -- Plugins {{{
+
+ -- netrw {{{
+ local netrw = {
+ netrwClassify = { fg = blue },
+ netrwDir = { fg = blue },
+ netrwExe = { fg = green },
+ netrwMakefile = { fg = yellow },
+ }
+
+ apply_highlight(netrw)
+ high_link("netrwTreeBar", "Comment")
+ -- }}}
+
+ -- barbar.nvim {{{
+
+ if configuration.plugins_integrations.barbar then
+ local barbar = {
+ BufferCurrent = { fg = base9, bg = bg },
+ BufferCurrentIndex = { fg = base6, bg = bg },
+ BufferCurrentMod = { fg = yellow, bg = bg },
+ BufferCurrentSign = { fg = blue, bg = bg },
+ BufferCurrentTarget = { fg = red, bg = bg, gui = "bold" },
+
+ BufferVisible = { fg = base7, bg = bg },
+ BufferVisibleIndex = { fg = base9, bg = bg },
+ BufferVisibleMod = { fg = yellow, bg = bg },
+ BufferVisibleSign = { fg = base4, bg = bg },
+ BufferVisibleTarget = { fg = red, bg = bg, gui = "bold" },
+
+ BufferInactive = { fg = base6, bg = base1 },
+ BufferInactiveIndex = { fg = base6, bg = base1 },
+ BufferInactiveMod = { fg = yellow, bg = base1 },
+ BufferInactiveSign = { fg = base4, bg = base1 },
+ BufferInactiveTarget = { fg = red, bg = base1, gui = "bold" },
+
+ BufferTabpages = { fg = blue, bg = bg_statusline, gui = "bold" },
+ BufferTabpageFill = { fg = base4, bg = base1, gui = "bold" },
+
+ BufferPart = { fg = diff_info_fg, bg = diff_info_bg0, gui = "bold" },
+ }
+
+ apply_highlight(barbar)
+ end
+
+ -- }}}
+
+ -- BufferLine {{{
+
+ if configuration.plugins_integrations.bufferline and transparent_bg then
+ -- NOTE: this is a temporal workaround for using bufferline with a transparent
+ -- background and having highlighting, please refer to
+ -- https://github.com/NTBBloodbath/doom-one.nvim/issues/8#issuecomment-883737667
+ -- for more information about this
+ local bufferline = {
+ BufferLineTab = { fg = fg, bg = bg },
+ BufferLineTabClose = { fg = fg, bg = bg, gui = "bold" },
+ BufferLineTabSelected = { fg = blue, bg = bg, gui = "bold,italic" },
+ BufferLineBackground = { fg = fg_alt, bg = bg },
+ BufferLineBufferSelected = { fg = fg, bg = bg, gui = "bold,italic" },
+ BufferLineBufferVisible = { fg = fg, bg = bg },
+ BufferLineCloseButton = { fg = fg_alt, bg = bg },
+ BufferLineCloseButtonSelected = { fg = fg, bg = bg, gui = "bold" },
+ BufferLineCloseButtonVisible = { fg = fg, bg = bg },
+ BufferLineModified = { fg = green, bg = bg },
+ BufferLineModifiedSelected = { fg = green, bg = bg },
+ BufferLineModifiedVisible = { fg = green, bg = bg },
+ BufferLineFill = { fg = blue, bg = bg_alt },
+ BufferLineIndicatorSelected = { fg = blue, bg = bg },
+ BufferLineSeparator = { fg = base0, bg = bg },
+ BufferLineSeparatorSelected = { fg = base0, bg = bg },
+ BufferLineSeparatorVisible = { fg = base0, bg = bg_alt },
+ BufferLinePick = { fg = fg, bg = bg, gui = "bold" },
+ BufferLinePickSelected = { fg = blue, bg = bg, gui = "bold,italic" },
+ BufferLinePickVisible = { fg = fg, bg = bg_alt },
+
+ BufferLineDiagnostic = { fg = fg, bg = bg, sp = fg },
+ BufferLineDiagnosticSelected = { fg = fg, bg = bg, sp = fg },
+ BufferLineDiagnosticVisible = { fg = fg, bg = bg, sp = fg },
+
+ BufferLineInfo = { fg = cyan, bg = bg, sp = cyan, gui = "bold" },
+ BufferLineInfoSelected = {
+ fg = cyan,
+ bg = bg,
+ sp = cyan,
+ gui = "bold,italic",
+ },
+ BufferLineInfoVisible = { fg = cyan, bg = bg, sp = cyan, gui = "bold" },
+ BufferLineInfoDiagnostic = { fg = cyan, bg = bg, sp = cyan },
+ BufferLineInfoDiagnosticSelected = { fg = cyan, bg = bg, sp = cyan },
+ BufferLineInfoDiagnosticVisible = { fg = cyan, bg = bg, sp = cyan },
+ BufferLineError = { fg = red, bg = bg, sp = red, gui = "bold" },
+ BufferLineErrorSelected = {
+ fg = red,
+ bg = bg,
+ sp = red,
+ gui = "bold,italic",
+ },
+ BufferLineErrorVisible = { fg = red, bg = bg, sp = red, gui = "bold" },
+ BufferLineErrorDiagnostic = { fg = red, bg = bg, sp = red },
+ BufferLineErrorDiagnosticSelected = { fg = red, bg = bg, sp = red },
+ BufferLineErrorDiagnosticVisible = { fg = red, bg = bg, sp = red },
+ BufferLineWarning = {
+ fg = yellow,
+ bg = bg,
+ sp = yellow,
+ gui = "bold,italic",
+ },
+ BufferLineWarningSelected = {
+ fg = yellow,
+ bg = bg,
+ sp = yellow,
+ gui = "bold,italic",
+ },
+ BufferLineWarningVisible = {
+ fg = yellow,
+ bg = bg,
+ sp = yellow,
+ gui = "bold",
+ },
+ BufferLineWarningDiagnostic = { fg = yellow, bg = bg, sp = yellow },
+ BufferLineWarningDiagnosticSelected = { fg = yellow, bg = bg, sp = yellow },
+ BufferLineWarningDiagnosticVisible = { fg = yellow, bg = bg, sp = yellow },
+ }
+
+ apply_highlight(bufferline)
+ end
+
+ -- }}}
+
+ -- Gitgutter {{{
+
+ if configuration.plugins_integrations.gitgutter then
+ high_link("GitGutterAdd", "DiffAddedGutter")
+ high_link("GitGutterChange", "DiffModifiedGutter")
+ high_link("GitGutterDelete", "DiffRemovedGutter")
+ high_link("GitGutterChangeDelete", "DiffModifiedGutter")
+
+ high_link("GitGutterAddLineNr", "DiffAddedGutterLineNr")
+ high_link("GitGutterChangeLineNr", "DiffModifiedGutterLineNr")
+ high_link("GitGutterDeleteLineNr", "DiffRemovedGutterLineNr")
+ high_link("GitGutterChangeDeleteLineNr", "DiffModifiedGutterLineNr")
+ end
+
+ -- }}}
+
+ -- Gitsigns {{{
+
+ if configuration.plugins_integrations.gitsigns then
+ high_link("GitSignsAdd", "DiffAddedGutter")
+ high_link("GitSignsChange", "DiffModifiedGutter")
+ high_link("GitSignsDelete", "DiffRemovedGutter")
+ high_link("GitSignsChangeDelete", "DiffModifiedGutter")
+ end
+
+ -- }}}
+
+ -- Telescope {{{
+
+ if configuration.plugins_integrations.telescope then
+ local telescope = {
+ TelescopeSelection = { fg = yellow, gui = "bold" },
+ TelescopeSelectionCaret = { fg = light_bg and orange or blue },
+ TelescopeMultiSelection = { fg = grey },
+ TelescopeNormal = { fg = fg },
+ TelescopeMatching = { fg = green, gui = "bold" },
+ TelescopePromptPrefix = { fg = light_bg and orange or blue },
+ TelescopeBorder = { fg = light_bg and orange or blue },
+ TelescopePromptBorder = { fg = light_bg and orange or blue },
+ TelescopeResultsBorder = { fg = light_bg and orange or blue },
+ TelescopePreviewBorder = { fg = light_bg and orange or blue },
+ }
+
+ apply_highlight(telescope)
+ high_link("TelescopePrompt", "TelescopeNormal")
+ end
+
+ -- }}}
+
+ -- Neogit {{{
+
+ if configuration.plugins_integrations.neogit then
+ local neogit = {
+ NeogitDiffAdd = { fg = ng_add_fg, bg = ng_add_bg },
+ NeogitDiffAddHighlight = { fg = ng_add_fg_hl, bg = ng_add_bg_hl, gui = "bold" },
+ NeogitDiffDelete = { fg = ng_delete_fg, bg = ng_delete_bg },
+ NeogitDiffDeleteHighlight = { fg = ng_delete_fg_hl, bg = ng_delete_bg_hl, gui = "bold" },
+ NeogitDiffContext = { fg = fg_alt, bg = bg },
+ NeogitDiffContextHighlight = { fg = fg, bg = bg_alt },
+ NeogitHunkHeader = { fg = bg, bg = ng_header_bg },
+ NeogitHunkHeaderHighlight = { fg = bg_alt, bg = ng_header_bg_hl, gui = "bold" },
+ NeogitStagedChanges = { fg = blue, gui = "bold" },
+ NeogitStagedChangesRegion = { bg = bg_highlight },
+ NeogitStashes = { fg = blue, gui = "bold" },
+ NeogitUnstagedChanges = { fg = blue, gui = "bold" },
+ NeogitUntrackedfiles = { fg = blue, gui = "bold" },
+ }
+
+ apply_highlight(neogit)
+ end
+
+ -- }}}
+
+ -- NvimTree {{{
+
+ if configuration.plugins_integrations.nvim_tree then
+ local nvim_tree = {
+ NvimTreeFolderName = { fg = light_bg and base9 or blue, gui = "bold" },
+ NvimTreeRootFolder = { fg = green },
+ NvimTreeEmptyFolderName = { fg = fg_alt, gui = "bold" },
+ NvimTreeSymlink = { fg = fg, gui = "underline" },
+ NvimTreeExecFile = { fg = green, gui = "bold" },
+ NvimTreeImageFile = { fg = light_bg and orange or blue },
+ NvimTreeOpenedFile = { fg = fg_alt },
+ NvimTreeSpecialFile = { fg = fg, gui = "underline" },
+ NvimTreeMarkdownFile = { fg = fg, gui = "underline" },
+ }
+
+ apply_highlight(nvim_tree)
+ high_link("NvimTreeGitDirty", "DiffModifiedGutter")
+ high_link("NvimTreeGitStaged", "DiffModifiedGutter")
+ high_link("NvimTreeGitMerge", "DiffModifiedGutter")
+ high_link("NvimTreeGitRenamed", "DiffModifiedGutter")
+ high_link("NvimTreeGitNew", "DiffAddedGutter")
+ high_link("NvimTreeGitDeleted", "DiffRemovedGutter")
+
+ high_link("NvimTreeIndentMarker", "IndentGuide")
+ high_link("NvimTreeOpenedFolderName", "NvimTreeFolderName")
+ end
+
+ -- }}}
+
+ -- Dashboard {{{
+
+ if configuration.plugins_integrations.dashboard then
+ local dashboard = {
+ dashboardHeader = { fg = "#586268" },
+ dashboardCenter = { fg = light_bg and orange or blue },
+ dashboardShortcut = { fg = "#9788b9" },
+ }
+
+ apply_highlight(dashboard)
+ high_link("dashboardFooter", "dashboardHeader")
+ end
+
+ -- }}}
+
+ -- Startify {{{
+
+ if configuration.plugins_integrations.startify then
+ local startify = {
+ StartifyHeader = { fg = bg_popup },
+ StartifyBracket = { fg = bg_popup },
+ StartifyNumber = { fg = blue },
+ StartifyPath = { fg = violet },
+ StartifySlash = { fg = violet },
+ StartifyFile = { fg = green },
+ }
+
+ apply_highlight(startify)
+ end
+
+ -- }}}
+
+ -- WhichKey {{{
+
+ if configuration.plugins_integrations.whichkey then
+ local whichkey = {
+ WhichKey = { fg = light_bg and orange or blue },
+ WhichKeyGroup = { fg = magenta },
+ WhichKeyDesc = { fg = magenta },
+ WhichKeySeparator = { fg = base5 },
+ WhichKeyFloat = { bg = base2 },
+ WhichKeyValue = { fg = grey },
+ }
+
+ apply_highlight(whichkey)
+ end
+
+ -- }}}
+
+ -- indent-blankline {{{
+
+ if configuration.plugins_integrations.indent_blankline then
+ local indent_blankline = {
+ IndentBlanklineChar = {
+ fg = base4,
+ cterm = "nocombine",
+ gui = "nocombine",
+ },
+ IndentBlanklineContextChar = {
+ fg = blue,
+ cterm = "nocombine",
+ gui = "nocombine",
+ },
+ IndentBlanklineSpaceChar = {
+ fg = base4,
+ cterm = "nocombine",
+ gui = "nocombine",
+ },
+ IndentBlanklineSpaceCharBlankline = {
+ fg = base4,
+ cterm = "nocombine",
+ gui = "nocombine",
+ },
+ }
+
+ apply_highlight(indent_blankline)
+ end
+
+ -- }}}
+
+ -- vim-illuminate {{{
+
+ if configuration.plugins_integrations.vim_illuminate then
+ local illuminated = {
+ illuminatedWord = {
+ cterm = "underline",
+ gui = "underline",
+ },
+ }
+
+ apply_highlight(illuminated)
+ end
+
+ -- }}}
+
+ -- LspSaga {{{
+
+ if configuration.plugins_integrations.lspsaga then
+ local lspsaga = {
+ SagaShadow = { bg = bg },
+ LspSagaDiagnosticHeader = { fg = red },
+ }
+
+ apply_highlight(lspsaga)
+ high_link("LspSagaDiagnosticBorder", "Normal")
+ high_link("LspSagaDiagnosticTruncateLine", "Normal")
+ high_link("LspFloatWinBorder", "Normal")
+ high_link("LspSagaBorderTitle", "Title")
+ high_link("TargetWord", "Error")
+ high_link("ReferencesCount", "Title")
+ high_link("ReferencesIcon", "Special")
+ high_link("DefinitionCount", "Title")
+ high_link("TargetFileName", "Comment")
+ high_link("DefinitionIcon", "Special")
+ high_link("ProviderTruncateLine", "Normal")
+ high_link("LspSagaFinderSelection", "Search")
+ high_link("DiagnosticTruncateLine", "Normal")
+ high_link("DiagnosticError", "LspDiagnosticsDefaultError")
+ high_link("DiagnosticWarn", "LspDiagnosticsDefaultWarning")
+ high_link("DiagnosticInfo", "LspDiagnosticsDefaultInformation")
+ high_link("DiagnosticHint", "LspDiagnosticsDefaultHint")
+ high_link("DefinitionPreviewTitle", "Title")
+ high_link("LspSagaShTruncateLine", "Normal")
+ high_link("LspSagaDocTruncateLine", "Normal")
+ high_link("LineDiagTuncateLine", "Normal")
+ high_link("LspSagaCodeActionTitle", "Title")
+ high_link("LspSagaCodeActionTruncateLine", "Normal")
+ high_link("LspSagaCodeActionContent", "Normal")
+ high_link("LspSagaRenamePromptPrefix", "Normal")
+ high_link("LspSagaRenameBorder", "Bold")
+ high_link("LspSagaHoverBorder", "Bold")
+ high_link("LspSagaSignatureHelpBorder", "Bold")
+ high_link("LspSagaCodeActionBorder", "Bold")
+ high_link("LspSagaDefPreviewBorder", "Bold")
+ high_link("LspLinesDiagBorder", "Bold")
+ end
+
+ -- }}}
+
+ -- Neorg {{{
+
+ if configuration.plugins_integrations.neorg then
+ local neorg = {
+ -- Colors are for nested quotes
+ Blue = { fg = cyan },
+ Yellow = { fg = yellow },
+ Red = { fg = red },
+ Green = { fg = green },
+ Brown = { fg = orange },
+ }
+
+ apply_highlight(neorg)
+ end
+
+ -- }}}
+
+ -- }}}
+
+ -- LSP {{{
+
+ local msg_underline = {
+ ErrorMsgUnderline = { fg = red, gui = "underline" },
+ WarningMsgUnderline = { fg = yellow, gui = "underline" },
+ MoreMsgUnderline = { fg = blue, gui = "underline" },
+ MsgUnderline = { fg = green, gui = "underline" },
+ }
+
+ apply_highlight(msg_underline)
+ high_link("LspDiagnosticsFloatingError", "ErrorMsg")
+ high_link("LspDiagnosticsFloatingWarning", "WarningMsg")
+ high_link("LspDiagnosticsFloatingInformation", "MoreMsg")
+ high_link("LspDiagnosticsFloatingHint", "Msg")
+ high_link("LspDiagnosticsDefaultError", "ErrorMsg")
+ high_link("LspDiagnosticsDefaultWarning", "WarningMsg")
+ high_link("LspDiagnosticsDefaultInformation", "MoreMsg")
+ high_link("LspDiagnosticsDefaultHint", "Msg")
+ high_link("LspDiagnosticsVirtualTextError", "ErrorMsg")
+ high_link("LspDiagnosticsVirtualTextWarning", "WarningMsg")
+ high_link("LspDiagnosticsVirtualTextInformation", "MoreMsg")
+ high_link("LspDiagnosticsVirtualTextHint", "Msg")
+ high_link("LspDiagnosticsUnderlineError", "ErrorMsgUnderline")
+ high_link("LspDiagnosticsUnderlineWarning", "WarningMsgUnderline")
+ high_link("LspDiagnosticsUnderlineInformation", "MoreMsgUnderline")
+ high_link("LspDiagnosticsUnderlineHint", "MsgUnderline")
+ high_link("LspDiagnosticsSignError", "ErrorMsg")
+ high_link("LspDiagnosticsSignWarning", "WarningMsg")
+ high_link("LspDiagnosticsSignInformation", "MoreMsg")
+ high_link("LspDiagnosticsSignHint", "Msg")
+ high_link("DiagnosticFloatingError", "ErrorMsg")
+ high_link("DiagnosticFloatingWarn", "WarningMsg")
+ high_link("DiagnosticFloatingInfo", "MoreMsg")
+ high_link("DiagnosticFloatingHint", "Msg")
+ high_link("DiagnosticDefaultError", "ErrorMsg")
+ high_link("DiagnosticDefaultWarn", "WarningMsg")
+ high_link("DiagnosticDefaultInfo", "MoreMsg")
+ high_link("DiagnosticDefaultHint", "Msg")
+ high_link("DiagnosticVirtualTextError", "ErrorMsg")
+ high_link("DiagnosticVirtualTextWarn", "WarningMsg")
+ high_link("DiagnosticVirtualTextInfo", "MoreMsg")
+ high_link("DiagnosticVirtualTextHint", "Msg")
+ high_link("DiagnosticUnderlineError", "ErrorMsgUnderline")
+ high_link("DiagnosticUnderlineWarn", "WarningMsgUnderline")
+ high_link("DiagnosticUnderlineInfo", "MoreMsgUnderline")
+ high_link("DiagnosticUnderlineHint", "MsgUnderline")
+ high_link("DiagnosticSignError", "ErrorMsg")
+ high_link("DiagnosticSignWarning", "WarningMsg")
+ high_link("DiagnosticSignInformation", "MoreMsg")
+ high_link("DiagnosticSignHint", "Msg")
+ high_link("LspReferenceText", "LspHighlight")
+ high_link("LspReferenceRead", "LspHighlight")
+ high_link("LspReferenceWrite", "LspHighlight")
+ high_link("TermCursor", "Cursor")
+ high_link("healthError", "ErrorMsg")
+ high_link("healthSuccess", "Msg")
+ high_link("healthWarning", "WarningMsg")
+
+ -- }}}
+
+ -- TreeSitter {{{
+
+ if configuration.enable_treesitter then
+ -- We will set a special definition for TSStrike here
+ local treesitter = {
+ TSStrike = { fg = utils.Darken(violet, 0.2), cterm = "strikethrough", gui = "strikethrough" },
+ }
+
+ apply_highlight(treesitter)
+ high_link("TSException", "Exception")
+ high_link("TSAnnotation", "PreProc")
+ high_link("TSAttribute", "Attribute")
+ high_link("TSConditional", "Conditional")
+ high_link("TSComment", "Comment")
+ high_link("TSConstructor", "Structure")
+ high_link("TSConstant", "Constant")
+ high_link("TSConstBuiltin", "Constant")
+ high_link("TSConstMacro", "Macro")
+ high_link("TSError", "Error")
+ high_link("TSField", "Field")
+ high_link("TSFloat", "Float")
+ high_link("TSFunction", "Function")
+ high_link("TSFuncBuiltin", "FunctionBuiltin")
+ high_link("TSFuncMacro", "Macro")
+ high_link("TSInclude", "Include")
+ high_link("TSKeyword", "Keyword")
+ high_link("TSKeywordFunction", "KeywordFunction")
+ high_link("TSLabel", "Label")
+ high_link("TSMethod", "Method")
+ high_link("TSNamespace", "Directory")
+ high_link("TSNumber", "Number")
+ high_link("TSOperator", "Operator")
+ high_link("TSParameter", "Argument")
+ high_link("TSParameterReference", "Argument")
+ high_link("TSProperty", "Property")
+ high_link("TSPunctDelimiter", "Delimiter")
+ high_link("TSPunctBracket", "Delimiter")
+ high_link("TSPunctSpecial", "Delimiter")
+ high_link("TSRepeat", "Repeat")
+ high_link("TSString", "String")
+ high_link("TSStringRegex", "StringDelimiter")
+ high_link("TSStringEscape", "StringDelimiter")
+ high_link("TSTag", "Tag")
+ high_link("TSTagDelimiter", "Delimiter")
+ high_link("TSStrong", "Bold")
+ high_link("TSURI", "URL")
+ high_link("TSWarning", "WarningMsg")
+ high_link("TSDanger", "ErrorMsg")
+ high_link("TSType", "Type")
+ high_link("TSTypeBuiltin", "TypeBuiltin")
+ high_link("TSVariable", "None")
+ high_link("TSVariableBuiltin", "VariableBuiltin")
+ end
+
+ -- }}}
+
+ -- Neovim Terminal Colors {{{
+
+ if configuration.terminal_colors then
+ vim.g.terminal_color_0 = bg
+ vim.g.terminal_color_1 = red
+ vim.g.terminal_color_2 = green
+ vim.g.terminal_color_3 = yellow
+ vim.g.terminal_color_4 = blue
+ vim.g.terminal_color_5 = violet
+ vim.g.terminal_color_6 = cyan
+ vim.g.terminal_color_7 = fg
+ vim.g.terminal_color_8 = grey
+ vim.g.terminal_color_9 = red
+ vim.g.terminal_color_10 = green
+ vim.g.terminal_color_11 = orange
+ vim.g.terminal_color_12 = blue
+ vim.g.terminal_color_13 = violet
+ vim.g.terminal_color_14 = cyan
+ vim.g.terminal_color_15 = white
+ vim.g.terminal_color_background = bg_alt
+ vim.g.terminal_color_foreground = fg_alt
+ end
+
+ -- }}}
end
--- }}}
+return doom_one
diff --git a/lua/colors/doom-one/utils/init.lua b/lua/colors/doom-one/utils/init.lua
new file mode 100644
index 000000000..e95019f1f
--- /dev/null
+++ b/lua/colors/doom-one/utils/init.lua
@@ -0,0 +1,109 @@
+---[[------------------------]]---
+-- COLOR UTILITIES --
+---]]------------------------[[---
+
+local M = {}
+
+-------------------------------------------------------------------------------
+-- Functions {{{
+
+-- Convert RGB to Hex color.
+-- @param r Red value
+-- @param g Green value
+-- @param b Blue value
+-- @return HEX color, e.g. '#1E1E1E'
+local function RGB_to_Hex(r, g, b)
+ return "#" .. string.format("%02X%02X%02X", r, g, b)
+end
+
+-- Convert Hex to RGB color.
+-- @param color HEX color
+-- @return RGB color, e.g. {30, 30, 30}
+local function Hex_to_RGB(color)
+ color = color:gsub("#", "")
+ return {
+ tonumber("0x" .. string.sub(color, 1, 2)),
+ tonumber("0x" .. string.sub(color, 3, 4)),
+ tonumber("0x" .. string.sub(color, 5, 6)),
+ }
+end
+
+-- }}}
+-------------------------------------------------------------------------------
+-- Composed functions {{{
+
+M.Lighten = function(color, percentage)
+ local amount = percentage == nil and 5.0 or percentage
+
+ if amount < 1.0 then
+ amount = 1.0 + amount
+ else
+ amount = 1.0 + (amount / 100.0)
+ end
+
+ -- Let's pass amount variable to Neovim so we can use
+ -- the Neovim map function
+ vim.g.amount = amount
+
+ local rgb = Hex_to_RGB(color)
+ rgb = vim.fn.map(rgb, "v:val * amount")
+ -- Let's delete the g:amount variable since we don't need it anymore
+ vim.cmd("unlet g:amount")
+
+ rgb = vim.fn.map(rgb, "v:val > 255.0 ? 255.0 : v:val")
+ rgb = vim.fn.map(rgb, "float2nr(v:val)")
+ local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3])
+
+ return hex
+end
+
+M.Darken = function(color, percentage)
+ local amount = percentage == nil and 5.0 or percentage
+
+ if amount < 1.0 then
+ amount = 1.0 - amount
+ else
+ amount = 1.0 - (amount / 100.0)
+ end
+ if amount < 0.0 then
+ amount = 0.0
+ end
+
+ -- Let's pass amount variable to Neovim so we can use
+ -- the Neovim map function
+ vim.g.amount = amount
+
+ local rgb = Hex_to_RGB(color)
+ rgb = vim.fn.map(rgb, "v:val * amount")
+ -- Let's delete the g:amount variable since we don't need it anymore
+ vim.cmd("unlet g:amount")
+
+ rgb = vim.fn.map(rgb, "v:val > 255.0 ? 255.0 : v:val")
+ rgb = vim.fn.map(rgb, "float2nr(v:val)")
+ local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3])
+
+ return hex
+end
+
+local function interpolate(start, _end, amount)
+ local diff = _end - start
+ return start + (diff * amount)
+end
+
+M.Mix = function(first, second, percentage)
+ local amount = percentage == nil and 0.0 or percentage
+
+ local first_rgb = Hex_to_RGB(first)
+ local second_rgb = Hex_to_RGB(second)
+
+ local r = interpolate(first_rgb[1], second_rgb[1], amount)
+ local g = interpolate(first_rgb[2], second_rgb[2], amount)
+ local b = interpolate(first_rgb[3], second_rgb[3], amount)
+
+ return RGB_to_Hex(r, g, b)
+end
+-- }}}
+
+return M
+
+-- vim: fdm=marker
diff --git a/lua/colors/utils/init.lua b/lua/colors/utils/init.lua
index 111c0e7c4..e95019f1f 100644
--- a/lua/colors/utils/init.lua
+++ b/lua/colors/utils/init.lua
@@ -13,19 +13,19 @@ local M = {}
-- @param b Blue value
-- @return HEX color, e.g. '#1E1E1E'
local function RGB_to_Hex(r, g, b)
- return '#' .. string.format('%02X%02X%02X', r, g, b)
+ return "#" .. string.format("%02X%02X%02X", r, g, b)
end
-- Convert Hex to RGB color.
-- @param color HEX color
-- @return RGB color, e.g. {30, 30, 30}
local function Hex_to_RGB(color)
- color = color:gsub('#', '')
- return {
- tonumber('0x' .. string.sub(color, 1, 2)),
- tonumber('0x' .. string.sub(color, 3, 4)),
- tonumber('0x' .. string.sub(color, 5, 6)),
- }
+ color = color:gsub("#", "")
+ return {
+ tonumber("0x" .. string.sub(color, 1, 2)),
+ tonumber("0x" .. string.sub(color, 3, 4)),
+ tonumber("0x" .. string.sub(color, 5, 6)),
+ }
end
-- }}}
@@ -33,74 +33,74 @@ end
-- Composed functions {{{
M.Lighten = function(color, percentage)
- local amount = percentage == nil and 5.0 or percentage
+ local amount = percentage == nil and 5.0 or percentage
- if amount < 1.0 then
- amount = 1.0 + amount
- else
- amount = 1.0 + (amount / 100.0)
- end
+ if amount < 1.0 then
+ amount = 1.0 + amount
+ else
+ amount = 1.0 + (amount / 100.0)
+ end
- -- Let's pass amount variable to Neovim so we can use
- -- the Neovim map function
- vim.g.amount = amount
+ -- Let's pass amount variable to Neovim so we can use
+ -- the Neovim map function
+ vim.g.amount = amount
- local rgb = Hex_to_RGB(color)
- rgb = vim.fn.map(rgb, 'v:val * amount')
- -- Let's delete the g:amount variable since we don't need it anymore
- vim.cmd('unlet g:amount')
+ local rgb = Hex_to_RGB(color)
+ rgb = vim.fn.map(rgb, "v:val * amount")
+ -- Let's delete the g:amount variable since we don't need it anymore
+ vim.cmd("unlet g:amount")
- rgb = vim.fn.map(rgb, 'v:val > 255.0 ? 255.0 : v:val')
- rgb = vim.fn.map(rgb, 'float2nr(v:val)')
- local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3])
+ rgb = vim.fn.map(rgb, "v:val > 255.0 ? 255.0 : v:val")
+ rgb = vim.fn.map(rgb, "float2nr(v:val)")
+ local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3])
- return hex
+ return hex
end
M.Darken = function(color, percentage)
- local amount = percentage == nil and 5.0 or percentage
-
- if amount < 1.0 then
- amount = 1.0 - amount
- else
- amount = 1.0 - (amount / 100.0)
- end
- if amount < 0.0 then
- amount = 0.0
- end
-
- -- Let's pass amount variable to Neovim so we can use
- -- the Neovim map function
- vim.g.amount = amount
-
- local rgb = Hex_to_RGB(color)
- rgb = vim.fn.map(rgb, 'v:val * amount')
- -- Let's delete the g:amount variable since we don't need it anymore
- vim.cmd('unlet g:amount')
-
- rgb = vim.fn.map(rgb, 'v:val > 255.0 ? 255.0 : v:val')
- rgb = vim.fn.map(rgb, 'float2nr(v:val)')
- local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3])
-
- return hex
+ local amount = percentage == nil and 5.0 or percentage
+
+ if amount < 1.0 then
+ amount = 1.0 - amount
+ else
+ amount = 1.0 - (amount / 100.0)
+ end
+ if amount < 0.0 then
+ amount = 0.0
+ end
+
+ -- Let's pass amount variable to Neovim so we can use
+ -- the Neovim map function
+ vim.g.amount = amount
+
+ local rgb = Hex_to_RGB(color)
+ rgb = vim.fn.map(rgb, "v:val * amount")
+ -- Let's delete the g:amount variable since we don't need it anymore
+ vim.cmd("unlet g:amount")
+
+ rgb = vim.fn.map(rgb, "v:val > 255.0 ? 255.0 : v:val")
+ rgb = vim.fn.map(rgb, "float2nr(v:val)")
+ local hex = RGB_to_Hex(rgb[1], rgb[2], rgb[3])
+
+ return hex
end
local function interpolate(start, _end, amount)
- local diff = _end - start
- return start + (diff * amount)
+ local diff = _end - start
+ return start + (diff * amount)
end
M.Mix = function(first, second, percentage)
- local amount = percentage == nil and 0.0 or percentage
+ local amount = percentage == nil and 0.0 or percentage
- local first_rgb = Hex_to_RGB(first)
- local second_rgb = Hex_to_RGB(second)
+ local first_rgb = Hex_to_RGB(first)
+ local second_rgb = Hex_to_RGB(second)
- local r = interpolate(first_rgb[1], second_rgb[1], amount)
- local g = interpolate(first_rgb[2], second_rgb[2], amount)
- local b = interpolate(first_rgb[3], second_rgb[3], amount)
+ local r = interpolate(first_rgb[1], second_rgb[1], amount)
+ local g = interpolate(first_rgb[2], second_rgb[2], amount)
+ local b = interpolate(first_rgb[3], second_rgb[3], amount)
- return RGB_to_Hex(r, g, b)
+ return RGB_to_Hex(r, g, b)
end
-- }}}
diff --git a/lua/doom/core/README.md b/lua/doom/core/README.md
index 5c8a547bf..aa1a2ec85 100644
--- a/lua/doom/core/README.md
+++ b/lua/doom/core/README.md
@@ -5,7 +5,7 @@ be Doom.
Those modules are the following:
-- config - Doom configurations, handles doomrc file and UI settings.
+- config - Doom configurations, handles `doom_*` file and UI settings.
- settings - Doom configurations for Neovim, e.g. `tabwidth`, `showmode`.
- functions - Doom core functions, e.g. `create_report`.
- health - Doom health add-on.
diff --git a/lua/doom/core/config/doomrc.lua b/lua/doom/core/config/doomrc.lua
deleted file mode 100644
index 7ba82cc76..000000000
--- a/lua/doom/core/config/doomrc.lua
+++ /dev/null
@@ -1,119 +0,0 @@
----[[---------------------------------------]]---
--- doomrc.lua - Load Doom Nvim doomrc --
--- Author: NTBBloodbath --
--- License: GPLv2 --
----[[---------------------------------------]]---
-
-local utils = require("doom.utils")
-local system = require("doom.core.system")
-local log = require("doom.extras.logging")
-
-local M = {}
-
-log.debug("Loading Doom doomrc module ...")
-
--- default_doomrc_values loads the default doomrc values
--- @return table
-local function default_doomrc_values()
- return {
- ui = {
- "dashboard", -- Start screen
- -- 'doom-themes', -- Additional doom emacs' colorschemes
- "statusline", -- Statusline
- "tabline", -- Tabline, shows your buffers list at top
- -- 'zen', -- Distraction free environment
- "which-key", -- Keybindings popup menu like Emacs' guide-key
- -- "show_registers", -- popup that shows register contents
- -- 'indentlines', -- Show indent lines
- },
- doom = {
- -- 'neorg', -- Life Organization Tool
- -- 'runner', -- Open a REPL for the current language or run the current file
- -- 'compiler', -- Compile (and run) your code with just pressing three keys!
- },
- editor = {
- "auto-session", -- A small automated session manager for Neovim
- -- 'terminal', -- Terminal for Neovim (NOTE: needed for runner and compiler)
- "explorer", -- Tree explorer
- -- "ranger", -- Ranger File Browser, requires ranger file browser
- "symbols", -- LSP symbols and tags
- -- 'minimap', -- Code minimap, requires github.com/wfxr/code-minimap
- "gitsigns", -- Git signs
- "telescope", -- Highly extendable fuzzy finder over lists
- "formatter", -- File formatting
- "autopairs", -- Autopairs
- -- 'editorconfig', -- EditorConfig support for Neovim
- "kommentary", -- Comments plugin
- "lsp", -- Language Server Protocols
- "snippets", -- LSP snippets
- },
- langs = {
- -- To enable the language server for a language just add the +lsp flag
- -- at the end, e.g. 'rust +lsp'. This will install the rust TreeSitter
- -- parser and rust-analyzer
- --
- -- 'html', -- HTML support
- -- 'css', -- CSS support
- -- 'javascript', -- JavaScript support
- -- 'typescript', -- TypeScript support
- -- 'bash', -- The terminal gods language
- -- 'python +lsp', -- Python support + lsp
- -- 'ruby', -- Look ma, I love the gems!
- "lua", -- Support for our gods language
- -- 'elixir', -- Build scalable and maintainable software
- -- 'haskell', -- Because Functional programming is fun, isn't it?
-
- -- 'rust +lsp', -- Let's get rusty!
- -- 'go', -- Hello, gopher
- -- 'cpp', -- C++ support
- -- 'java', -- Java support
-
- -- 'config', -- Configuration files (JSON, YAML, TOML)
- -- 'dockerfile', -- Do you like containers, right?
- },
- utilities = {
- -- 'suda', -- Write and read files without sudo permissions
- -- 'lazygit', -- LazyGit integration for Neovim, requires LazyGit
- -- 'neogit', -- Magit for Neovim
- "range-highlight", -- hightlights ranges you have entered in commandline
- },
- web = {
- -- 'restclient', -- A fast Neovim http client
- -- "firenvim", -- requires firenvim extension to be installed in webbrowser
- -- 'colorizer', -- Fastets colorizer for Neovim
- }
- }
-end
-
--- load_doomrc Loads the doomrc if it exists, otherwise it'll fallback to doom
--- default configs.
-M.load_doomrc = function()
- local config, doomrc_path
-
- -- Path cases:
- -- 1. /home/user/.config/doom-nvim/doomrc.lua
- -- 2. /home/user/.config/nvim/doomrc.lua
- if utils.file_exists(string.format("%s%sdoomrc.lua", system.doom_configs_root, system.sep)) then
- doomrc_path = string.format("%s%sdoomrc.lua", system.doom_configs_root, system.sep)
- elseif utils.file_exists(string.format("%s%sdoomrc.lua", system.doom_root, system.sep)) then
- doomrc_path = string.format("%s%sdoomrc.lua", system.doom_root, system.sep)
- end
-
- if doomrc_path then
- local loaded_doomrc, err = pcall(function()
- log.debug("Loading the doomrc file ...")
- config = dofile(doomrc_path)
- end)
-
- if not loaded_doomrc then
- log.error("Error while loading the doomrc. Traceback:\n" .. err)
- end
- else
- log.warn("No doomrc.lua file found, falling to defaults")
- config = default_doomrc_values()
- end
-
- return config
-end
-
-return M
diff --git a/lua/doom/core/config/init.lua b/lua/doom/core/config/init.lua
index 8c2b98300..22d48fc8b 100644
--- a/lua/doom/core/config/init.lua
+++ b/lua/doom/core/config/init.lua
@@ -4,13 +4,12 @@
-- License: GPLv2 --
---[[------------------------------]]---
-local M = {}
+local config = {}
local log = require("doom.extras.logging")
-local utils = require("doom.utils")
local system = require("doom.core.system")
-log.debug("Loading Doom core config module ...")
+log.debug("Loading Doom config module ...")
-- Check if running Neovim or Vim and fails if:
-- 1. Running Vim instead of Neovim
@@ -30,11 +29,9 @@ end
-- {{{ Default doom_config values
--- default_doom_config_values loads the default doom_config values
--- @return table
-local function default_doom_config_values()
+config.config = {
-- {{{ Doom
- local doom = {
+ doom = {
-- Autosave
-- false : Disable autosave
-- true : Enable autosave
@@ -50,8 +47,8 @@ local function default_doom_config_values()
-- Disable Vim macros
-- false : Enable Vim macros
-- true : Disable Vim macros
- -- @default = true
- disable_macros = true,
+ -- @default = false
+ disable_macros = false,
-- Autosave sessions
-- false : Disable session autosave
@@ -111,6 +108,12 @@ local function default_doom_config_values()
-- @default = false
preserve_edit_pos = false,
+ -- Allow overriding the default Doom Nvim keybinds
+ -- false : Default keybinds cannot be overwritten
+ -- true : Default keybinds can be overwritten
+ -- @default = true
+ allow_default_keymaps_overriding = true,
+
-- horizontal split on creating a new file (fn)
-- false : doesn't split the window when creating a new file
-- true : horizontal split on creating a new file
@@ -159,6 +162,12 @@ local function default_doom_config_values()
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
@@ -206,6 +215,46 @@ local function default_doom_config_values()
-- @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,
@@ -271,7 +320,7 @@ local function default_doom_config_values()
terminal_direction = "horizontal",
-- NOTE: This will only be activated if 'backup' is true.
- -- We don'recommend you put this outside of neovim so we've restricted to thepath: ~/.config/nvim
+ -- We don'recommend you put this outside of neovim so we've restricted to the path: ~/.config/nvim
-- WARNING: only put the folder name that you want. (eg: undo_dir = '/undodir')
-- @default_directory = '~/.config/nvim/undodir'
undo_dir = "/undodir",
@@ -313,18 +362,35 @@ local function default_doom_config_values()
guifont = "FiraCode Nerd Font",
guifont_size = "15",
- -- change Which Key background color
+ -- Change Which Key background color
-- can use hex, or normal color names (eg: Red, Gree, Blue)
-- @default = #202328
whichkey_bg = "#202328",
- -- set your custom lsp diagnostic symbols below
+ -- Set your custom lsp diagnostic symbols below
lsp_error = "๏",
- lsp_warning = "๏ฑ",
+ lsp_warn = "๏ฑ",
lsp_hint = "๏ช",
- lsp_information = "๏",
+ 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 = {
@@ -337,22 +403,31 @@ local function default_doom_config_values()
-- Set your custom dashboard header below
-- @default = doom emacs' default dashboard header
dashboard_custom_header = {},
- }
+ },
-- }}}
-- {{{ Nvim
- local nvim = {
+ nvim = {
-- Set custom Neovim global variables
-- @default = {}
-- example:
- -- { ['sonokai_style'] = 'andromeda' }
+ -- {
+ -- ['sonokai_style'] = 'andromeda',
+ -- ['modelineexpr'] = true,
+ -- }
+ --
+ -- modeline feature was turned off to reduce security exploit surfaces.
+ -- Since modeline now uses whitelist approach since nvim 0.4 /vim 8.1,
+ -- enabling this is as safe as external packages such as securemodelines.
+ -- See https://github.com/neovim/neovim/issues/2865
+ --
global_variables = {},
-- Set custom autocommands
-- @default = {}
-- example:
-- augroup_name = {
- -- { 'BufNewFile,BufRead', 'doomrc', 'set ft=lua'}
+ -- { 'BufNewFile,BufRead', 'doom_modules.lua', 'set ft=lua'}
-- }
autocmds = {},
@@ -360,13 +435,15 @@ local function default_doom_config_values()
-- @default = {}
-- example:
-- {
- -- {'n', 'ca', ':Lspsaga code_action'}
+ -- {'n', 'ca', ':Lspsaga code_action', options}
-- }
--
-- where
-- 'n' is the map scope
-- 'ca' is the map activator
-- ':Lspsaga ...' is the command to be executed
+ -- options is a Lua table containing the mapping options, e.g.
+ -- { silent = true }, see ':h map-arguments'.
mappings = {},
-- Set custom commands
@@ -381,101 +458,63 @@ local function default_doom_config_values()
-- @default = {}
-- example:
-- {
- -- hello_custom_func = function()
- -- print("Hello, custom functions!")
- -- end
+ -- {
+ -- hello_custom_func = function()
+ -- print("Hello, custom functions!")
+ -- end,
+ -- -- If the function should be ran on neovim launch or if it should
+ -- -- be a global function accesible from anywhere
+ -- run_on_start = false,
+ -- },
-- }
functions = {},
- }
- -- }}}
- return {
- doom = doom,
- nvim = nvim,
- }
-end
+ -- Set custom options
+ -- @default = {}
+ -- example:
+ -- {
+ -- { ['shiftwidth'] = 4 }
+ -- }
+ options = {},
+ },
+ -- }}}
+}
-- }}}
--- load_config Loads the doom_config.lua file if it exists
--- @return table
-M.load_config = function()
- local config = {
- doom = {},
- nvim = {},
- }
- local doom_config_path
-
- -- Path cases:
- -- 1. /home/user/.config/doom-nvim/doom_config.lua
- -- 2. /home/user/.config/nvim/doom_config.lua
- if
- utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep))
- then
- doom_config_path = string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)
- elseif utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) then
- doom_config_path = string.format("%s%sdoom_config.lua", system.doom_root, system.sep)
- end
+config.source = nil
- if doom_config_path then
- local loaded_doom_config, err = pcall(function()
- config = dofile(doom_config_path)
- end)
+log.debug("Loading Doom config module ...")
- if not loaded_doom_config then
- log.error("Error while loading the doom_config file. Traceback:\n" .. err)
- end
+-- Path cases:
+-- 1. /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
- log.warn("No doom_config.lua file found, falling to defaults")
- default_doom_config_values()
- end
-
- return config
-end
-
--- install_dap_clients will install the DAP clients for the languages with
--- the +debug flag.
---
--- @param langs The list of languages in the doomrc
-M.install_dap_clients = function(langs)
- -- selene: allow(undefined_variable)
- if
- packer_plugins
- and packer_plugins["DAPInstall.nvim"]
- and packer_plugins["DAPInstall.nvim"].loaded
- then
- local installed_clients = require("dap-install.api.debuggers").get_installed_debuggers()
- -- NOTE: not all the clients follows the 'language_dbg' standard and this
- -- can give some problems to us (maybe?)
- local available_clients = vim.tbl_keys(require("dap-install.api.debuggers").get_debuggers())
-
- for _, lang in ipairs(langs) do
- local lang_str = lang
- lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "")
-
- -- If the +debug flag exists and the language client is not installed yet
- if lang_str:find("%+debug") and (not utils.has_value(installed_clients, lang .. "_dbg")) then
- -- Try to install the client only if there is a client available for
- -- the language, oterwise raise a warning
- if utils.has_value(available_clients, lang .. "_dbg") then
- require("dap-install.tools.tool_install").install_debugger(lang .. "_dbg")
- else
- log.warn(
- "The language "
- .. lang
- .. ' does not have a DAP client, please remove the "+debug" flag'
- )
- end
- end
+ ok, ret = xpcall(require, debug.traceback, "doom_config")
+ if ok then
+ config.config = ret.config
+ config.source = ret.source
+ else
+ log.error("Error while loading doom_config.lua. Traceback:\n" .. ret)
end
end
end
-- Check plugins updates on start if enabled
-if M.load_config().doom.check_updates then
+if config.config.doom.check_updates then
require("doom.core.functions").check_updates()
end
-return M
+return config
-- vim: fdm=marker
diff --git a/lua/doom/core/config/modules.lua b/lua/doom/core/config/modules.lua
new file mode 100644
index 000000000..dfd2f8d62
--- /dev/null
+++ b/lua/doom/core/config/modules.lua
@@ -0,0 +1,111 @@
+---[[---------------------------------------------]]---
+-- modules - Load Doom Nvim doom_modules.lua --
+-- Author: NTBBloodbath --
+-- License: GPLv2 --
+---[[---------------------------------------------]]---
+
+local system = require("doom.core.system")
+local log = require("doom.extras.logging")
+
+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
+
+return modules
diff --git a/lua/doom/core/config/ui.lua b/lua/doom/core/config/ui.lua
index 9bc9f383e..bf8679c2b 100644
--- a/lua/doom/core/config/ui.lua
+++ b/lua/doom/core/config/ui.lua
@@ -6,20 +6,20 @@
local utils = require("doom.utils")
local log = require("doom.extras.logging")
-local config = require("doom.core.config").load_config()
+local config = require("doom.core.config").config
log.debug("Loading Doom UI module ...")
-- If no colorscheme was established then fallback to defauls
if not utils.is_empty(config.doom.colorscheme) then
- local loaded_colorscheme = pcall(function()
+ local loaded_colorscheme = xpcall(function()
vim.opt.background = config.doom.colorscheme_bg
vim.api.nvim_command("colorscheme " .. config.doom.colorscheme)
- end)
+ end, debug.traceback)
if not loaded_colorscheme then
- log.error("Colorscheme not found, falling to doom-one")
- vim.api.nvim_command("colorscheme " .. config.doom.colorscheme)
+ log.warn("Colorscheme '" .. config.doom.colorscheme .. "' not found, falling to doom-one")
+ vim.api.nvim_command("colorscheme doom-one")
end
else
log.warn("Forced default Doom colorscheme")
@@ -35,10 +35,36 @@ if config.doom.enable_guicolors then
end
end
+-- Set custom WhichKey background
+vim.cmd("highlight WhichKeyFloat guibg=" .. config.doom.whichkey_bg)
+
-- Set doom-one colorscheme settings
-vim.g.doom_one_cursor_coloring = config.doom.doom_one.cursor_coloring
-vim.g.doom_one_enable_treesitter = config.doom.doom_one.enable_treesitter
-vim.g.doom_one_italic_comments = config.doom.doom_one.italic_comments
-vim.g.doom_one_telescope_highlights = config.doom.doom_one.telescope_highlights
-vim.g.doom_one_terminal_colors = config.doom.doom_one.terminal_colors
-vim.g.doom_one_transparent_background = config.doom.doom_one.transparent_background
+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
new file mode 100644
index 000000000..03c6f620a
--- /dev/null
+++ b/lua/doom/core/config/userplugins.lua
@@ -0,0 +1,42 @@
+---[[---------------------------------------]]---
+-- 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/init.lua
index 17f58cada..ac88f863f 100644
--- a/lua/doom/core/functions/init.lua
+++ b/lua/doom/core/functions/init.lua
@@ -5,66 +5,48 @@
---[[---------------------------------------]]---
local log = require("doom.extras.logging")
-local utils = require("doom.utils")
+local utils, fs = require("doom.utils"), require("doom.utils.fs")
local system = require("doom.core.system")
-local config = require("doom.core.config").load_config()
+local config = require("doom.core.config").config
+local async = require("doom.modules.built-in.async")
-local M = {}
+local functions = {}
log.debug("Loading Doom functions module ...")
--- check_plugin checks if the given plugin exists
--- @tparam string plugin_name The plugin name, e.g. nvim-tree.lua
--- @tparam string path Where should be searched the plugin in packer's path, defaults to `start`
--- @return bool
-M.check_plugin = function(plugin_name, path)
- if not path then
- path = "start"
- end
-
- return vim.fn.isdirectory(
- vim.fn.stdpath("data") .. "/site/pack/packer/" .. path .. "/" .. plugin_name
- ) == 1
-end
-
--- is_plugin_disabled checks if the given plugin is disabled in doomrc
--- @tparam string plugin The plugin identifier, e.g. statusline
--- @return bool
-M.is_plugin_disabled = function(plugin)
- local doomrc = require("doom.core.config.doomrc").load_doomrc()
-
- -- Iterate over all doomrc sections (e.g. ui) and their plugins
- for _, section in pairs(doomrc) do
- if utils.has_value(section, plugin) then
- return false
- end
- end
-
- return true
-end
-
--- Load user-defined settings from the Neovim field in the doomrc
+-- Load user-defined settings from the Neovim field in the doom_config.lua
-- @param settings_tbl The settings table to iterate over
-- @param scope The settings scope, e.g. autocmds
-M.load_custom_settings = function(settings_tbl, scope)
+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 == "autocmds" then
- utils.create_augroups(settings_tbl)
- elseif scope == "commands" then
- for _, cmd in ipairs(settings_tbl) do
- vim.cmd(cmd)
- end
- elseif scope == "functions" then
- for _, func_body in pairs(settings_tbl) do
- func_body()
+ if scope == "functions" then
+ for _, func in ipairs(settings_tbl) do
+ -- Copy the function table so we can modify it safely
+ local func_tbl = func
+ -- Remove the additional table parameters
+ func_tbl.run_on_start = nil
+ local func_name = vim.tbl_keys(func_tbl)[1]
+
+ -- If we should run the function on launch or set it as a global function
+ if func.run_on_start then
+ func_tbl[func_name]()
+ else
+ _G[func_name] = func_tbl[func_name]
+ end
end
elseif scope == "mappings" then
for _, map in ipairs(settings_tbl) do
-- scope, lhs, rhs, options
vim.api.nvim_set_keymap(map[1], map[2], map[3], map[4] and map[4] or {})
end
+ elseif scope == "autocmds" then
+ utils.create_augroups(settings_tbl)
+ elseif scope == "commands" then
+ for _, cmd in ipairs(settings_tbl) do
+ vim.cmd(cmd)
+ end
elseif scope == "variables" then
for var, val in pairs(settings_tbl) do
vim.g[var] = val
@@ -79,68 +61,59 @@ end
-- reload_custom_settings reloads all the user-defined configurations
-- in the 'doom_config.lua' file.
-M.reload_custom_settings = function()
+functions.reload_custom_settings = function()
-- Get the user-defined settings, the 'nvim' field in our 'doom_config.lua'
- local custom_settings = require("doom.core.config").load_config().nvim
+ local custom_settings = require("doom.core.config").config.nvim
-- iterate over all the custom settings fields, e.g. global_variables, mappings, etc.
for scope, _ in pairs(custom_settings) do
- M.load_custom_settings(custom_settings[scope], scope)
+ functions.load_custom_settings(custom_settings[scope], scope)
end
end
-- Change the 'doom_config.lua' file configurations for the colorscheme and the
-- background if they were changed by the user within Neovim
-M.change_colors_and_bg = function()
- local changed_colorscheme, err = pcall(function()
+functions.change_colors_and_bg = function()
+ local changed_colorscheme, err = xpcall(function()
log.debug("Checking if the colorscheme or background were changed ...")
local target_colorscheme = vim.g.colors_name
local target_background = vim.opt.background:get()
-- Set the correct path for the 'doom_config.lua' file
- local doom_config_path
- if
- utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep))
- then
- doom_config_path = string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)
- elseif
- utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep))
- then
- doom_config_path = string.format("%s%sdoom_config.lua", system.doom_root, system.sep)
- end
+ local doom_config_path = require("doom.core.config").source
if target_colorscheme ~= config.doom.colorscheme then
- local doom_config = utils.read_file(doom_config_path)
+ local doom_config = fs.read_file(doom_config_path)
doom_config = string.gsub(
doom_config,
- string.format('"%s"', config.doom.colorscheme:gsub("[%-]", "%%%1")),
- string.format('"%s"', target_colorscheme:gsub("[%-]", "%%%1"))
+ string.format('"%s"', utils.escape_str(config.doom.colorscheme)),
+ string.format('"%s"', utils.escape_str(target_colorscheme))
)
- utils.write_file(doom_config_path, doom_config, "w+")
+ fs.write_file(doom_config_path, doom_config, "w+")
log.debug("Colorscheme successfully changed to " .. target_colorscheme)
end
if target_background ~= config.doom.colorscheme_bg then
- local doom_config = utils.read_file(doom_config_path)
+ local doom_config = fs.read_file(doom_config_path)
doom_config = string.gsub(
doom_config,
string.format('"%s"', config.doom.colorscheme_bg),
string.format('"%s"', target_background)
)
- utils.write_file(doom_config_path, doom_config, "w+")
+ fs.write_file(doom_config_path, doom_config, "w+")
log.debug("Background successfully changed to " .. target_background)
end
- end)
+ 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 doomrc if the colorscheme is not the same,
+-- Quit Neovim and change the colorscheme at doom_config.lua if the colorscheme is not the same,
-- dump all messages to doom.log file
-- @tparam bool write If doom should save before exiting
-- @tparam bool force If doom should force the exiting
-M.quit_doom = function(write, force)
- M.change_colors_and_bg()
+functions.quit_doom = function(write, force)
+ functions.change_colors_and_bg()
local quit_cmd = ""
if write then
@@ -154,33 +127,69 @@ M.quit_doom = function(write, force)
end
-- check_updates checks for plugins updates
-M.check_updates = function()
- local updated_plugins, err = pcall(function()
+functions.check_updates = function()
+ local updated_plugins, err = xpcall(function()
log.info("Updating the outdated plugins ...")
vim.cmd("PackerSync")
- end)
+ end, debug.traceback)
if not updated_plugins then
log.error("Unable to update plugins. Traceback:\n" .. err)
end
end
+-- Open Doom Nvim user manual and set extra options to buffer
+functions.open_docs = function()
+ -- NOTE: we aren't using the default Neovim way with ':h doom' because of some bugs
+ -- with the tags and Neovim overriding the filetype, causing some highlighting issues
+
+ -- Get the documentation path
+ local docs_path
+ if fs.file_exists(string.format("%s/doc/doom_nvim.norg", system.doom_root)) then
+ docs_path = string.format("%s/doc/doom_nvim.norg", system.doom_root)
+ else
+ docs_path = string.format("%s/doc/doom_nvim.norg", system.doom_configs_root)
+ end
+
+ -- Open the documentation in a split window
+ vim.cmd(string.format("split %s", docs_path))
+ -- Move cursor to table of contents section
+ vim.api.nvim_buf_call(vim.fn.bufnr("doom_nvim.norg"), function()
+ vim.fn.cursor(12, 1)
+ end)
+ -- Set local documentation options
+ vim.opt_local.modified = false
+ vim.opt_local.modifiable = false
+ vim.opt_local.signcolumn = "no"
+ vim.opt_local.foldcolumn = "0"
+ vim.opt_local.number = false
+ vim.opt_local.relativenumber = false
+ vim.opt_local.colorcolumn = "0"
+ vim.opt_local.shiftwidth = 2
+ vim.opt_local.tabstop = 2
+ vim.opt_local.conceallevel = 2
+ vim.opt_local.concealcursor = "n"
+ vim.opt_local.textwidth = 100
+ vim.opt_local.rightleft = false
+end
+
-- create_report creates a markdown report. It's meant to be used when a bug
-- occurs, useful for debugging issues.
-M.create_report = function()
+functions.create_report = function()
local date = os.date("%Y-%m-%d %H:%M:%S")
- local log_date_format = os.date("%a %d %b %Y")
-
- local created_report, err = pcall(function()
+ local created_report, err = xpcall(function()
-- Get and save only the warning and error logs from today
local today_logs = {}
- local doom_logs = vim.split(utils.read_file(system.doom_logs), "\n")
+ local doom_logs = vim.split(fs.read_file(system.doom_logs), "\n")
for _, doom_log in ipairs(doom_logs) do
- if
- string.find(doom_log, "ERROR " .. log_date_format)
- or string.find(doom_log, "WARN " .. log_date_format)
- then
- table.insert(today_logs, doom_log)
+ local preinfo = doom_log:match("%[(.+)%]")
+ if preinfo ~= nil then
+ local is_current_day = preinfo:find(os.date("%a %d %b")) ~= nil
+ and preinfo:find(os.date("%Y")) ~= nil
+ local error_or_warn = preinfo:find("ERROR ") or preinfo:find("WARN ")
+ if error_or_warn and is_current_day then
+ table.insert(today_logs, doom_log)
+ end
end
end
@@ -240,9 +249,9 @@ M.create_report = function()
system.doom_configs_root,
table.concat(today_logs, "\n")
)
- utils.write_file(system.doom_report, report, "w+")
+ fs.write_file(system.doom_report, report, "w+")
log.info("Report created at " .. system.doom_report)
- end)
+ end, debug.traceback)
if not created_report then
log.error("Error while writing report. Traceback:\n" .. err)
@@ -252,21 +261,17 @@ end
-- save_backup_hashes saves the commits or releases SHA for future rollbacks
local function save_backup_hashes()
-- Check for the current branch
- local branch_handler = io.popen(system.git_workspace .. "branch --show-current")
- local git_branch = branch_handler:read("*a"):gsub("[\r\n]", "")
- branch_handler:close()
+ local git_branch = utils.get_git_output("branch --show-current", true)
if git_branch == "main" then
local releases_database_path = string.format("%s%s.doom_releases", system.doom_root, system.sep)
-- Fetch for a file containing the releases tags
log.info("Saving the Doom releases for future rollbacks ...")
- local saved_releases, releases_err = pcall(function()
+ local saved_releases, releases_err = xpcall(function()
-- Get the releases
log.debug('Executing "' .. system.git_workspace .. 'show-ref --tags"')
- local releases_handler = io.popen(system.git_workspace .. "show-ref --tags")
- local doom_releases = releases_handler:read("*a")
- releases_handler:close()
+ local doom_releases = utils.get_git_output("show-ref --tags", false)
-- Put all the releases into a table so we can sort them later
local releases = {}
@@ -284,26 +289,26 @@ local function save_backup_hashes()
--
-- If the database does not exist yet then we will create it
if vim.fn.filereadable(releases_database_path) == 1 then
- local current_releases = utils.read_file(releases_database_path)
+ local current_releases = fs.read_file(releases_database_path)
if current_releases ~= doom_releases then
-- Write the first release in the list with 'w+' so the
-- actual content will be overwritten by this one
- utils.write_file(releases_database_path, sorted_releases[1] .. "\n", "w+")
+ fs.write_file(releases_database_path, sorted_releases[1] .. "\n", "w+")
-- Write the rest of the releases
for idx, release in ipairs(sorted_releases) do
-- Exclude the first release because we have already
-- written it in the database file
if idx ~= 1 then
- utils.write_file(releases_database_path, release .. "\n", "a+")
+ fs.write_file(releases_database_path, release .. "\n", "a+")
end
end
end
else
for _, release in ipairs(sorted_releases) do
- utils.write_file(releases_database_path, release .. "\n", "a+")
+ fs.write_file(releases_database_path, release .. "\n", "a+")
end
end
- end)
+ end, debug.traceback)
if not saved_releases then
log.error("Error while saving the Doom releases. Traceback:\n" .. releases_err)
@@ -311,7 +316,7 @@ local function save_backup_hashes()
else
-- Get the current commit SHA and store it into a hidden file
log.info("Saving the current commit SHA for future rollbacks ...")
- local saved_backup_hash, backup_err = pcall(function()
+ local saved_backup_hash, backup_err = xpcall(function()
os.execute(
system.git_workspace
.. "rev-parse --short HEAD > "
@@ -319,7 +324,7 @@ local function save_backup_hashes()
.. system.sep
.. ".doom_backup_hash"
)
- end)
+ end, debug.traceback)
if not saved_backup_hash then
log.error("Error while saving the backup commit hash. Traceback:\n" .. backup_err)
@@ -329,26 +334,35 @@ end
-- update_doom saves the current commit/release hash into a file for future
-- restore if needed and then updates Doom.
-M.update_doom = function()
+functions.update_doom = function()
save_backup_hashes()
log.info("Pulling Doom remote changes ...")
- local updated_doom, update_err = pcall(function()
- os.execute(system.git_workspace .. "pull -q")
- end)
- if not updated_doom then
- log.error("Error while updating Doom. Traceback:\n" .. update_err)
- end
- -- Run syntax_on event to fix UI if it's broke after the git pull
- vim.cmd("syntax on")
-
- log.info("Successfully updated Doom, please restart")
+ local updater = async:new({
+ cmd = "git pull",
+ cwd = system.doom_root,
+ on_stdout = function(_, data)
+ if data then
+ log.info("Successfully updated Doom!")
+ --- Completely reload Doom Nvim
+ require("doom.modules.built-in.reloader").full_reload()
+ end
+ end,
+ on_stderr = function(err, data)
+ if err then
+ log.error("Error while updating Doom. Traceback:\n" .. err)
+ elseif data then
+ log.error("Error while updating Doom. Traceback:\n" .. data:gsub("[\r\n]", ""))
+ end
+ end,
+ })
+ updater:start()
end
-- rollback_doom will rollback the local doom version to an older one
-- in case that the local one is broken
-M.rollback_doom = function()
+functions.rollback_doom = function()
-- Backup file for main (stable) branch
local releases_database_path = string.format("%s%s.doom_releases", system.doom_root, system.sep)
-- Backup file for development branch
@@ -357,7 +371,7 @@ M.rollback_doom = function()
-- Check if there's a rollback file and sets the rollback type
if vim.fn.filereadable(releases_database_path) == 1 then
-- Get the releases database and split it into a table
- local doom_releases = utils.read_file(releases_database_path)
+ local doom_releases = fs.read_file(releases_database_path)
-- Put all the releases into a table so we can sort them later
local releases = {}
@@ -373,9 +387,7 @@ M.rollback_doom = function()
-- Check the current commit hash and compare it with the ones in the
-- releases table
local current_version
- local commit_handler = io.popen(system.git_workspace .. "rev-parse HEAD")
- local current_commit = commit_handler:read("*a"):gsub("[\r\n]", "")
- commit_handler:close()
+ local current_commit = utils.get_git_output("rev-parse HEAD", true)
for _, version_info in ipairs(sorted_releases) do
for release_hash, version in version_info:gmatch("(%w+)%s(%w+%W+%w+%W+%w+)") do
if release_hash == current_commit then
@@ -409,9 +421,9 @@ M.rollback_doom = function()
end
log.info("Reverting back to version " .. rollback_version .. " (" .. rollback_sha .. ") ...")
- local rolled_back, rolled_err = pcall(function()
+ local rolled_back, rolled_err = xpcall(function()
os.execute(system.git_workspace .. "checkout " .. rollback_sha)
- end)
+ end, debug.traceback)
if not rolled_back then
log.error(
@@ -432,11 +444,11 @@ M.rollback_doom = function()
.. "), please restart"
)
elseif vim.fn.filereadable(rolling_backup) == 1 then
- local backup_commit = utils.read_file(rolling_backup):gsub("[\r\n]+", "")
+ local backup_commit = fs.read_file(rolling_backup):gsub("[\r\n]+", "")
log.info("Reverting back to commit " .. backup_commit .. " ...")
- local rolled_back, rolled_err = pcall(function()
+ local rolled_back, rolled_err = xpcall(function()
os.execute(system.git_workspace .. "checkout " .. backup_commit)
- end)
+ end, debug.traceback)
if not rolled_back then
log.error(
@@ -451,24 +463,188 @@ M.rollback_doom = function()
end
-- edit_config creates a prompt to modify a doom configuration file
-M.edit_config = function()
+functions.edit_config = function()
local selected_config = tonumber(vim.fn.inputlist({
"Select a configuration file to edit:",
"1. doom_config.lua",
- "2. doomrc.lua",
- "3. plugins.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(string.format("%s %s%sdoom_config.lua", open_command, system.doom_root, system.sep))
+ vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config").source))
elseif selected_config == 2 then
- vim.cmd(string.format("%s %s%sdoomrc.lua", open_command, system.doom_root, system.sep))
+ vim.cmd(("%s%s %s"):format(direction, open_command, require("doom.core.config.modules").source))
elseif selected_config == 3 then
- vim.cmd(string.format("%s %s%splugins.lua", open_command, system.doom_root, system.sep))
+ vim.cmd(
+ ("%s%s %s"):format(direction, open_command, require("doom.core.config.userplugins").source)
+ )
elseif selected_config ~= 0 then
log.error("Invalid option selected.")
end
end
-return M
+-- followings are called from lua/doom/extras/keybindings/leader.lua
+--
+-- toggle_background() -- tb -- toggle background light/dark
+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
+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")
+ end
+end
+
+-- toggle_signcolumn() -- tg -- signcolumn auto/no
+functions.toggle_signcolumn = function()
+ local signcolumn = vim.o.signcolumn
+ if signcolumn == "no" then
+ vim.o.signcolumn = "auto"
+ print("signcolumn=auto")
+ else
+ vim.o.signcolumn = "no"
+ print("signcolumn=no")
+ end
+end
+
+-- set_indent() -- ti -- set the indent and tab related numbers
+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): "
+ )
+ )
+ if (indent == nil) or (indent < 0) then
+ vim.cmd("set softtabstop? tabstop? shiftwidth? expandtab?")
+ elseif indent > 0 then
+ vim.o.tabstop = indent
+ vim.o.softtabstop = indent
+ vim.o.shiftwidth = indent
+ vim.o.expandtab = true
+ print(("\nindent=%i, expandtab"):format(indent))
+ else -- indent == 0
+ vim.o.tabstop = 8
+ vim.o.softtabstop = 0
+ vim.o.shiftwidth = 8
+ vim.o.expandtab = false
+ print("\nindent=8, noexpandtab")
+ end
+end
+
+-- change_number() -- tn -- change the number display modes
+functions.change_number = function()
+ local number = vim.o.number
+ local relativenumber = vim.o.relativenumber
+ if (number == false) and (relativenumber == false) then
+ vim.o.number = true
+ vim.o.relativenumber = false
+ print("number on, relativenumber off")
+ elseif (number == true) and (relativenumber == false) then
+ vim.o.number = false
+ vim.o.relativenumber = true
+ print("number off, relativenumber on")
+ elseif (number == false) and (relativenumber == true) then
+ vim.o.number = true
+ vim.o.relativenumber = true
+ print("number on, relativenumber on")
+ else -- (number == true) and (relativenumber == true) then
+ vim.o.number = false
+ vim.o.relativenumber = false
+ print("number off, relativenumber off")
+ end
+end
+
+-- toggle_autopairs() -- tp -- toggle autopairs
+functions.toggle_autopairs = function()
+ local ok, autopairs = xpcall(require, debug.traceback, "nvim-autopairs")
+ if ok then
+ if autopairs.state.disabled then
+ autopairs.enable()
+ print("autopairs on")
+ else
+ autopairs.disable()
+ print("autopairs off")
+ end
+ else
+ print("autopairs not available")
+ end
+end
+
+-- toggle_spell() -- ts -- toggle spell
+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
+end
+
+-- change_syntax() -- tx -- toggle syntax/treesetter
+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
+ vim.cmd("TSBufDisable highlight")
+ vim.cmd("syntax off")
+ print("syntax off, treesetter off")
+ else
+ vim.cmd("TSBufEnable highlight")
+ vim.cmd("syntax on")
+ print("syntax on, treesetter on")
+ end
+ else
+ if vim.o.syntax then
+ vim.cmd("syntax off")
+ print("syntax off")
+ else
+ vim.cmd("syntax on")
+ print("syntax on")
+ end
+ end
+end
+
+functions.sugar_folds = function()
+ local start_line = vim.fn.getline(vim.v.foldstart):gsub("\t", ("\t"):rep(vim.opt.tabstop:get()))
+ return string.format("%s ... (%d lines)", start_line, vim.v.foldend - vim.v.foldstart + 1)
+end
+
+return functions
diff --git a/lua/doom/core/init.lua b/lua/doom/core/init.lua
index 883d0b828..fb544585e 100644
--- a/lua/doom/core/init.lua
+++ b/lua/doom/core/init.lua
@@ -4,30 +4,28 @@
local log = require("doom.extras.logging")
-local core_modules = { "config", "config.ui", "settings" }
-for i = 1, #core_modules, 1 do
- local ok, err = xpcall(require, debug.traceback, string.format("doom.core.%s", core_modules[i]))
- if not ok then
- log.error(
- string.format(
- "There was an error loading the module 'doom.core.%s'. Traceback:\n%s",
- core_modules[i],
- err
- )
- )
- end
+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()
- elseif core_modules[i] == "config" then
- -- Automatically install language DAP clients
- require("doom.core.config").install_dap_clients(
- require("doom.core.config.doomrc").load_doomrc().langs
- )
+ -- 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
end
diff --git a/lua/doom/core/settings/init.lua b/lua/doom/core/settings/init.lua
index e2e346ac9..ac95600b2 100644
--- a/lua/doom/core/settings/init.lua
+++ b/lua/doom/core/settings/init.lua
@@ -6,20 +6,15 @@
local functions = require("doom.core.functions")
local log = require("doom.extras.logging")
-local config = require("doom.core.config").load_config()
+local config = require("doom.core.config").config
-local M = {}
+local settings = {}
log.debug("Loading Doom defaults module ...")
--- load_default_options sets and loads default Neovim options based on doomrc values
-M.load_default_options = function()
+-- load_default_options sets and loads default Neovim options based on doom_config.lua values
+settings.load_default_options = function()
----- Default Neovim configurations
- -- Set colorscheme
- vim.cmd("colorscheme " .. config.doom.colorscheme)
- vim.opt.background = config.doom.colorscheme_bg
- vim.cmd("highlight WhichKeyFloat guibg=" .. config.doom.whichkey_bg)
-
-- Global options
vim.opt.hidden = true
vim.opt.updatetime = 200
@@ -34,14 +29,26 @@ M.load_default_options = function()
vim.opt.shortmess:append("atsc")
vim.opt.inccommand = "split"
vim.opt.path = "**"
- vim.opt.signcolumn = "yes"
+ vim.opt.signcolumn = "auto:2-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
+ -- Set Gui Fonts
vim.opt.guifont = config.doom.guifont .. ":h" .. config.doom.guifont_size
-- Use clipboard outside vim
@@ -100,11 +107,13 @@ M.load_default_options = function()
end
-- Set numbering
- if config.doom.relative_num then
- vim.opt.number = true
- vim.opt.relativenumber = true
- else
- vim.opt.number = true
+ if 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
@@ -138,24 +147,49 @@ M.load_default_options = function()
vim.opt.softtabstop = config.doom.indent
vim.opt.colorcolumn = tostring(config.doom.max_columns)
vim.opt.conceallevel = config.doom.conceallevel
+ vim.opt.foldenable = config.doom.foldenable
+
+ -- Better folding
+ vim.cmd([[set foldtext=luaeval(\"require('doom.core.functions').sugar_folds()\")]])
end
--- Custom Doom Nvim commands
-M.custom_options = function()
+-- 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
- -- Load user-defined settings from the Neovim field in the doomrc file
+-- 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.functions, "functions")
functions.load_custom_settings(config.nvim.mappings, "mappings")
functions.load_custom_settings(config.nvim.global_variables, "variables")
functions.load_custom_settings(config.nvim.options, "options")
end
-return M
+return settings
diff --git a/lua/doom/core/settings/netrw.lua b/lua/doom/core/settings/netrw.lua
new file mode 100644
index 000000000..4d3560ad9
--- /dev/null
+++ b/lua/doom/core/settings/netrw.lua
@@ -0,0 +1,268 @@
+---[[---------------------------------------]]---
+-- netrw - Doom Nvim netrw setup --
+-- Author: NTBBloodbath --
+-- License: GPLv2 --
+---[[---------------------------------------]]---
+
+local utils = require("doom.utils")
+local system = require("doom.core.system")
+local config = require("doom.core.config").config.doom
+
+-- Netrw banner
+-- 0 : Disable banner
+-- 1 : Enable banner
+vim.g.netrw_banner = 0
+
+-- Keep the current directory and the browsing directory synced.
+-- This helps you avoid the move files error.
+vim.g.netrw_keepdir = 0
+
+-- Show directories first (sorting)
+vim.g.netrw_sort_sequence = [[[\/]$,*]]
+
+-- Human-readable files sizes
+vim.g.netrw_sizestyle = "H"
+
+-- Netrw list style
+-- 0 : thin listing (one file per line)
+-- 1 : long listing (one file per line with timestamp information and file size)
+-- 2 : wide listing (multiple files in columns)
+-- 3 : tree style listing
+vim.g.netrw_liststyle = 3
+
+-- Patterns for hiding files, e.g. node_modules
+-- NOTE: this works by reading '.gitignore' file
+vim.g.netrw_list_hide = vim.fn["netrw_gitignore#Hide"]()
+
+-- Show hidden files
+-- 0 : show all files
+-- 1 : show not-hidden files
+-- 2 : show hidden files only
+vim.g.netrw_hide = config.show_hidden and 0 or 1
+
+-- Change the size of the Netrw window when it creates a split
+vim.g.netrw_winsize = (0 - config.sidebar_width)
+
+-- Preview files in a vertical split window
+-- vim.g.netrw_preview = 1
+
+-- Open files in split
+-- 0 : re-use the same window (default)
+-- 1 : horizontally splitting the window first
+-- 2 : vertically splitting the window first
+-- 3 : open file in new tab
+-- 4 : act like "P" (ie. open previous window)
+vim.g.netrw_browse_split = 4
+
+-- Setup file operations commands
+-- TODO: figure out how to add these feature in Windows
+if system.sep == "/" then
+ -- Enable recursive copy of directories in *nix systems
+ vim.g.netrw_localcopydircmd = "cp -r"
+
+ -- Enable recursive creation of directories in *nix systems
+ vim.g.netrw_localmkdir = "mkdir -p"
+
+ -- Enable recursive removal of directories in *nix systems
+ -- NOTE: we use 'rm' instead of 'rmdir' (default) to be able to remove non-empty directories
+ vim.g.netrw_localrmdir = "rm -r"
+end
+
+-- Highlight marked files in the same way search matches are
+vim.cmd("hi! link netrwMarkFile Search")
+
+----- KEYBINDS ------------------------
+---------------------------------------
+local function netrw_maps()
+ if vim.bo.filetype ~= "netrw" then
+ return
+ end
+
+ local opts = { silent = true }
+ ----- General -----------------------
+ -------------------------------------
+ -- Toggle dotfiles
+ vim.api.nvim_buf_set_keymap(0, "n", ".", "gh", opts)
+
+ -- Open file and close netrw
+ vim.api.nvim_buf_set_keymap(0, "n", "l", ":Lexplore", opts)
+
+ -- Open file or directory
+ vim.api.nvim_buf_set_keymap(0, "n", "o", "", opts)
+
+ -- Show netrw help in a floating (or maybe sidebar?) window
+ -- TODO: implement show_help function so we can implement this mapping
+ --[[ vim.api.nvim_buf_set_keymap(
+ 0,
+ "n",
+ "?",
+ ":lua require('doom.core.settings.netrw').show_help()",
+ opts
+ ) ]]
+
+ -- Close netrw
+ vim.api.nvim_buf_set_keymap(0, "n", "q", ":Lexplore", opts)
+
+ ----- Files and Directories ---------
+ -------------------------------------
+ -- Create a new file and save it
+ vim.api.nvim_buf_set_keymap(0, "n", "ff", "%:w:buffer #", opts)
+
+ -- Create a new directory
+ vim.api.nvim_buf_set_keymap(0, "n", "fa", "d", opts)
+
+ -- Rename file
+ vim.api.nvim_buf_set_keymap(0, "n", "fr", "R", opts)
+
+ -- Remove file or directory
+ vim.api.nvim_buf_set_keymap(0, "n", "fd", "D", opts)
+
+ -- Copy marked file
+ vim.api.nvim_buf_set_keymap(0, "n", "fc", "mc", opts)
+
+ -- Copy marked file in one step, with this we can put the cursor in a directory
+ -- after marking the file to assign target directory and copy file
+ vim.api.nvim_buf_set_keymap(0, "n", "fC", "mtmc", opts)
+
+ -- Move marked file
+ vim.api.nvim_buf_set_keymap(0, "n", "fx", "mm", opts)
+
+ -- Move marked file in one step, same as fC but for moving files
+ vim.api.nvim_buf_set_keymap(0, "n", "fX", "mtmm", opts)
+
+ -- Execute commands in marked file or directory
+ vim.api.nvim_buf_set_keymap(0, "n", "fe", "mx", opts)
+
+ -- Show a list of marked files and directories
+ vim.api.nvim_buf_set_keymap(
+ 0,
+ "n",
+ "fm",
+ ':echo "Marked files:\n" . join(netrw#Expose("netrwmarkfilelist"), "\n")',
+ opts
+ )
+
+ -- Show target directory
+ vim.api.nvim_buf_set_keymap(
+ 0,
+ "n",
+ "ft",
+ ':echo "Target: " . netrw#Expose("netrwmftgt")',
+ opts
+ )
+
+ ----- Marks (selections) ------------
+ -------------------------------------
+ -- Toggle the mark on a file or directory
+ vim.api.nvim_buf_set_keymap(0, "n", "", "mf", opts)
+
+ -- Unmark all the files in the current buffer
+ vim.api.nvim_buf_set_keymap(0, "n", "", "mF", opts)
+
+ -- Remove all the marks on all files
+ vim.api.nvim_buf_set_keymap(0, "n", "", "mu", opts)
+
+ ----- Bookmarks ---------------------
+ -------------------------------------
+ -- Create a bookmark
+ vim.api.nvim_buf_set_keymap(0, "n", "bc", "mb", opts)
+
+ -- Remove the most recent bookmark
+ vim.api.nvim_buf_set_keymap(0, "n", "bd", "mB", opts)
+
+ -- Jumo to the most recent bookmark
+ vim.api.nvim_buf_set_keymap(0, "n", "bj", "gb", opts)
+end
+
+----- ICONS ---------------------------
+---------------------------------------
+local function draw_icons()
+ if vim.bo.filetype ~= "netrw" then
+ return
+ end
+ local is_devicons_available, devicons = pcall(require, "nvim-web-devicons")
+ if not is_devicons_available then
+ return
+ end
+ local default_signs = {
+ netrw_dir = {
+ text = "๎",
+ texthl = "netrwDir",
+ },
+ netrw_file = {
+ text = "๏ถ",
+ texthl = "netrwPlain",
+ },
+ netrw_exec = {
+ text = "๎",
+ texthl = "netrwExe",
+ },
+ netrw_link = {
+ text = "๏",
+ texthl = "netrwSymlink",
+ },
+ }
+
+ local bufnr = vim.api.nvim_win_get_buf(0)
+
+ -- Unplace all signs
+ vim.fn.sign_unplace("*", { buffer = bufnr })
+
+ -- Define default signs
+ for sign_name, sign_opts in pairs(default_signs) do
+ vim.fn.sign_define(sign_name, sign_opts)
+ end
+
+ local cur_line_nr = 1
+ local total_lines = vim.fn.line("$")
+ while cur_line_nr <= total_lines do
+ -- Set default sign
+ local sign_name = "netrw_file"
+
+ -- Get line contents
+ local line = vim.fn.getline(cur_line_nr)
+
+ if utils.is_empty(line) then
+ -- If current line is an empty line (newline) then increase current line count
+ -- without doing nothing more
+ cur_line_nr = cur_line_nr + 1
+ else
+ if line:find("/$") then
+ sign_name = "netrw_dir"
+ elseif line:find("@%s+-->") then
+ sign_name = "netrw_link"
+ elseif line:find("*$") then
+ sign_name:find("netrw_exec")
+ else
+ local filetype = line:match("^.*%.(.*)")
+ if not filetype and line:find("LICENSE") then
+ filetype = "md"
+ elseif line:find("rc$") then
+ filetype = "conf"
+ end
+
+ -- If filetype is still nil after manually setting extensions
+ -- for unknown filetypes then let's use 'default'
+ if not filetype then
+ filetype = "default"
+ end
+
+ local icon, icon_highlight = devicons.get_icon(line, filetype, { default = "๏ถ" })
+ sign_name = "netrw_" .. filetype
+ vim.fn.sign_define(sign_name, {
+ text = icon,
+ texthl = icon_highlight,
+ })
+ end
+ vim.fn.sign_place(cur_line_nr, sign_name, sign_name, bufnr, {
+ lnum = cur_line_nr,
+ })
+ cur_line_nr = cur_line_nr + 1
+ end
+ end
+end
+
+return {
+ draw_icons = draw_icons,
+ set_maps = netrw_maps,
+}
diff --git a/lua/doom/core/system/init.lua b/lua/doom/core/system/init.lua
index afd232f85..822f8553a 100644
--- a/lua/doom/core/system/init.lua
+++ b/lua/doom/core/system/init.lua
@@ -4,44 +4,33 @@
-- License: GPLv2 --
---[[---------------------------------------]]---
-local M = {}
-
--- get_config_dir will get the config path based in the current system, e.g.
--- 'C:\Users\JohnDoe\AppData\Local' for windows and '~/.config' for *nix
--- @return string
-local function get_config_dir()
- if string.find(vim.loop.os_uname().sysname, "Windows") then
- return os.getenv("USERPROFILE") .. "\\AppData\\Local\\"
- end
-
- return (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME"))
- or (os.getenv("HOME") .. "/.config")
-end
-
--- get_separator will return the system paths separator, e.g. \ for Windows and / for *nix
--- @return string
-local function get_separator()
- if vim.loop.os_uname().sysname == "Windows" then
- return "\\"
- end
-
- return "/"
-end
-
-M.config_dir = get_config_dir()
+local system = {}
+local stdpath = vim.fn.stdpath
+local config_dir = stdpath("config"):match(".*[/\\]"):sub(1, -2)
-M.sep = get_separator()
+system.sep = package.config:sub(1, 1)
-- The doom-nvim root directory, works as a fallback for looking Doom Nvim configurations
-- in case that doom_configs_root directory does not exists.
-M.doom_root = string.format("%s%snvim", M.config_dir, M.sep)
+system.doom_root = stdpath("config")
+
-- The doom-nvim configurations root directory
-M.doom_configs_root = string.format("%s%sdoom-nvim", M.config_dir, M.sep)
+system.doom_configs_root = table.concat({ config_dir, "doom-nvim" }, system.sep)
+
+local testdir = vim.loop.fs_opendir(system.doom_configs_root)
+if testdir then
+ vim.loop.fs_closedir(testdir)
+else
+ system.doom_configs_root = stdpath("config")
+end
+
-- The doom-nvim logs file path
-M.doom_logs = vim.fn.stdpath("data") .. string.format("%sdoom.log", M.sep)
+system.doom_logs = table.concat({ stdpath("data"), "doom.log" }, system.sep)
+
-- The doom-nvim bug report file path
-M.doom_report = vim.fn.stdpath("data") .. string.format("%sdoom_report.md", M.sep)
+system.doom_report = table.concat({ stdpath("data"), "doom_report.md" }, system.sep)
+
-- The git workspace for doom-nvim, e.g. 'git -C /home/JohnDoe/.config/nvim'
-M.git_workspace = string.format("git -C %s ", M.doom_root)
+system.git_workspace = string.format("git -C %s ", stdpath("config"))
-return M
+return system
diff --git a/lua/doom/extras/autocmds/init.lua b/lua/doom/extras/autocmds/init.lua
index 99173199d..9782eb70a 100644
--- a/lua/doom/extras/autocmds/init.lua
+++ b/lua/doom/extras/autocmds/init.lua
@@ -6,24 +6,44 @@
local utils = require("doom.utils")
local log = require("doom.extras.logging")
-local config = require("doom.core.config").load_config()
+local config = require("doom.core.config").config
+local is_plugin_disabled = require("doom.utils").is_plugin_disabled
log.debug("Loading Doom autocmds module ...")
local autocmds = {
doom_core = {
- -- Compile new plugins changes at save
+ -- Compile new plugins configurations changes at save
{
"BufWritePost",
- "*/doom-*.lua,doomrc.lua,plugins.lua",
+ "*/config/doom-*.lua",
"PackerCompile profile=true",
},
- -- Reload user-defined settings when 'doom_config.lua' file was modified
+ -- 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",
@@ -37,19 +57,21 @@ local autocmds = {
},
}
--- Set relative numbers
-if config.doom.relative_num then
- table.insert(autocmds["doom_core"], {
- "BufEnter,WinEnter",
- "*",
- "if &nu | set rnu | endif",
- })
-else
- table.insert(autocmds["doom_core"], {
- "BufEnter,WinEnter",
- "*",
- "if &nu | set nornu | endif",
- })
+-- Set numbering
+if 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
@@ -66,10 +88,14 @@ if config.doom.auto_install_plugins then
else
-- Clean disabled plugins
vim.cmd("PackerClean")
- -- Install the plugins
- vim.cmd("PackerInstall")
+ -- Defer the installation of new plugins to avoid a weird bug where packer
+ -- tries to clean the plugins that are being installed right now
+ vim.defer_fn(function()
+ -- Install the plugins
+ vim.cmd("PackerInstall")
+ end, 200)
end
- end, 200)
+ end, 400)
end
-- Set autosave
@@ -120,5 +146,51 @@ if config.doom.preserve_edit_pos then
})
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
+ table.insert(autocmds["doom_extras"], {
+ "CursorHold,CursorHoldI",
+ "",
+ 'lua vim.lsp.diagnostic.show_line_diagnostics({ focusable = false, border = "single" })',
+ })
+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
new file mode 100644
index 000000000..c3fc659d8
--- /dev/null
+++ b/lua/doom/extras/init.lua
@@ -0,0 +1,14 @@
+--- 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
new file mode 100644
index 000000000..926566566
--- /dev/null
+++ b/lua/doom/extras/keybindings/completion.lua
@@ -0,0 +1,142 @@
+---[[-----------------]]---
+-- 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
+mappings.map(
+ "n",
+ "",
+ ":lua vim.lsp.diagnostic.goto_prev()",
+ opts,
+ "LSP",
+ "prev_diagnostic",
+ "Jump to previous diagnostic"
+)
+-- Control+n: Jump to next diagnostic
+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
new file mode 100644
index 000000000..30b4ec586
--- /dev/null
+++ b/lua/doom/extras/keybindings/core.lua
@@ -0,0 +1,126 @@
+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
index 5f97ad19c..11b2e0670 100644
--- a/lua/doom/extras/keybindings/init.lua
+++ b/lua/doom/extras/keybindings/init.lua
@@ -4,32 +4,30 @@
-- License: GPLv2 --
---[[---------------------------------------]]---
-local utils = require("doom.utils")
local log = require("doom.extras.logging")
-local config = require("doom.core.config").load_config()
-local functions = require("doom.core.functions")
+local config = require("doom.core.config").config
log.debug("Loading Doom keybindings module ...")
--- Additional options for mappings
-local opts = { silent = true }
-
-utils.map("n", "", "", opts, "Editor", "open_whichkey", "Open WhichKey menu")
-vim.g.mapleader = " "
-
-------------------------------------------------
---[[---------------------------------]]---
-- Custom Key mappings --
-- --
--- b = Buffer Menu --
--- f = File Menu --
--- g = Git Menu --
--- p = Plugin Menu --
--- r = Runner Menu --
--- s = Session Menu --
--- t = Toggle Menu --
--- w = Window Menu --
+-- b = +buffers --
+-- c = +code --
+-- d = +debug --
+-- l = +lsp --
+-- d = +doom --
+-- f = +file --
+-- g = +git --
+--