diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md new file mode 100644 index 000000000..602cdd459 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -0,0 +1,47 @@ +--- +name: ๐Ÿž Bug +about: File a bug/issue +title: '[BUG] ' +labels: 'scope: bug' +assignees: '' +--- + +<!-- +Note: Please search to see if an issue already exists for the bug you encountered. +--> + +### Current Behavior: +<!-- A concise description of what you're experiencing. --> + +### Expected Behavior: +<!-- A concise description of what you expected to happen. --> + +### Steps To Reproduce: +<!-- +Example: steps to reproduce the behavior: +1. In this environment... +2. With this config... +3. Run '...' +4. See error... +--> + +### Logs + +<details> +<summary>Check Health Output</summary> + +<!-- Run `:checkhealth` and paste output here ** --> + +</details> + +<details> +<summary>Doom Report Output</summary> + +<!-- Run `:DoomReport` and copy the contents of `~/.local/share/nvim/doom_report.md` --> + +</details> + +### Anything else: +<!-- +Links? References? Screenshots? Anything that will give us more context about the issue that you are encountering! +--> diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md new file mode 100644 index 000000000..7bf27214a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -0,0 +1,23 @@ +--- +name: ๐Ÿ’ก Feature Request +about: File a feature request +title: '[FEATURE REQUEST] <title>' +labels: 'scope: enhancement' +assignees: '' +--- + +### What is the feature, what would you like to be able to do? +<!-- Provide a clear and concise description of what you want to happen. --> + +### What is the use case, why do you want this feature? +<!-- Provide a clear and concise description of why this feature would help you or other users. --> + +### Possible Implementation (if applicable) +<!-- If you have an idea of how this could be built, add it here. --> + +### Additional context +<!-- + Is there anything else you can add about the proposal? + You might want to link to related issues here, if you haven't already. +--> + diff --git a/.github/ISSUE_TEMPLATE/QUESTION.md b/.github/ISSUE_TEMPLATE/QUESTION.md new file mode 100644 index 000000000..0c4720424 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/QUESTION.md @@ -0,0 +1,15 @@ +--- +name: โ“ Question +about: Ask a question +title: '[QUESTION] <title>' +labels: 'scope: question' +assignees: '' +--- + +- [ ] I have searched open and closed issues for this question + +<!-- We also have a discord channel which is also a great place to ask questions + https://discord.gg/xhvBM45zBf +--> + + diff --git a/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md new file mode 100644 index 000000000..64cf9d734 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE.md @@ -0,0 +1,22 @@ +### Description + +<!-- A summary of your changes and the reasoning/motivation for making these changes. --> +<!-- If changes are complex, describe how you implemented / solved this issue --> + +<!-- Link the issue this PR fixes or addresses if relevant --> +Related issue: # (issue_number) + +### Type of change + +<!-- Please delete options that are not relevant. --> + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +### Checklist + +- [ ] I have checked [contributing guidelines](https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/contributing.md#contributing-code) +- [ ] I have tested my code +- [ ] I have updated the documentation (if necessary) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 0f0568355..4a4e76a89 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -2,7 +2,7 @@ name: format on: push: - paths: '**.lua' + paths: "**.lua" branches: [main, develop] jobs: @@ -14,7 +14,7 @@ jobs: uses: JohnnyMorganz/stylua-action@1.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --config-path=./.stylua.toml -g *.lua -g !doomrc.lua -g !lua/colors/**/*.lua -- . + args: --config-path=./.stylua.toml -g *.lua -g !doom_modules.lua -g !lua/colors/**/*.lua -- . - name: Commit files run: | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" diff --git a/.gitignore b/.gitignore index 3d027bec6..fb3a9c1dc 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,12 @@ tags # Backup files .doom_releases .doom_backup_hash +# editor artifacts +*~ +*.swp +# OS files +.DS_Store +# Doom Nvim Contrib files +contribute/doom-nvim-contrib +contribute/local-share-nvim +contribute/workspace diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a00de69e..a2ea97353 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,125 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.2.0] - 2021-11-24 + +### Added + +- Completely reload Doom after updating +- Hot reload plugins configurations +- Run `PackerCompile` on exit when Doom modulesor userplugins files were modified +- Automatically install or uninstall plugins on save in plugins files +- Improve debugging messages +- Better error catching +- Install http tree-sitter parser if `rest.nvim` plugin is enabled +- New languages in `doom_modules.lua` file +- New `contrib` entry in `doom_modules.lua` file, contrib module enables some documentation plugins +- Add `~/.config/nvim/doc` to neorg workspaces +- Add `statusline_show_file_path` option in `doom_config.lua` file +- Add Scala language server support out of the box (Metals) +- Override LSP using `+lsp(LSP_NAME)` syntax + - Use several LSPs using `+lsp(LSP_NAME, ANOTHER_LSP_NAME)` syntax +- Improve `netrw` look and feel +- Add `use_netrw` configuration option, decide if Doom sshoulduse netrw or nvim-tree as the file explorer +- Implement `keybinds_mdoules` option in `doom_config.lua`, enable or disable Doom keybindings modules as you wish + - Modularize keybindings +- Add extra field to custom functions in order to choose if the function should be ran on startup or if should be a global function +- Add modeline in `doom_config.lua` file [#139](https://github.com/NTBBloodbath/doom-nvim/pull/139) +- Ignore editor artifacts [#141](https://github.com/NTBBloodbath/doom-nvim/pull/141) +- Use a better syntax for Neovim folds +- Add `escape_str` function to utils module +- Add GTD (Getting Things Done) setup in Neorg +- Use `q` to quickly exit Neovim in dashboard +- Stay in visual mode after indenting a selection with `<` or `>` +- Add keybindings for `lsp_rename` functionality (`<leader>clr`) +- Add an option to turn off folding +- Improve statusline look and feel, show filetype + active language servers +- Add helper script for contributors to setup and run a docker image and create a git worktree +- Add helper script for contributors to update Doom plugins commits pins +- Provide workaround for `clang` users who run into treesitter complation issues +- Add debugging keybindings +- Add `disable_numbering` confiugration option +- Add user defined ESC sequences in `doom_config` file +- New plugins + - `nvim-lint`, async linter + - `vim-illuminate`, highlight word under cursor +- New commands + - `DoomManual`, open Doom user manual + - `DoomReport`, create a Doom crash report + - `DoomConfigs`, open a prompt to edit Doom configuration files + - `DoomConfigsReload`, reload Doom custom mappings, autocommands, etc + - `DoomInfo`, display a informational dashboard + - `DoomReload`, hot reload Doom Nvim +- New keybinds + - `<leader>di`, display a informational dashboard + - `<leader>t` section to tweak editor behaviors like numbering and spelling +- New built-in plugins + - `info`, show an useful informational dashboard + - `async`, run async system commands (e.g. running Git) + - `reloader`, reload Lua modules on the fly + +### Changed + +- General cleanup +- `:DoomUpdate` is now asynchronous, keep coding while Doom updates itself! +- Update doom-one colorscheme +- Reduce delay on LSP startup +- Replace built-in Neovim `.txt` docs with Neorg-based docs +- Refact configuration files handling [#108](https://github.com/NTBBloodbath/doom-nvim/pull/108) +- Invert Doom Lua modules loading order, in that way we will load Neovim configurations first +- Use `xpcall` instead of `pcall` in all modules to provide a better tracback in case of an error +- Rename all our Lua modules tables from `M` to a more logical name, e.g. `system` for system module +- Improve EmmyLua annotations and comments +- Fragment utilities module + - `fs`, filesystem utilities + - `mappings`, mappings utilities + - `modules`, Lua modules utilities +- Plugins + - Pin plugins to a certain commit to improve stability + - Lazy-load more plugins + - Do not lazy-load nvim-mapper + - Enable `neorg` by default + - Replace [nvim-compe](https://github.com/hrsh7th/nvim-compe) with [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) [#119](https://github.com/NTBBloodbath/doom-nvim/pull/119) + - Replace [nvim-lspinstall](https://github.com/kabouzeid/nvim-lspinstall) with [nvim-lsp-installer](https://github.com/williamboman/nvim-lsp-installer) + - Use NTBBloodbath's galaxyline fork + - Update `gitsigns` configurations + - Update `nvim-tree` configurations + - Update `bufferline` configurations + - Update `dap-ui` configurations [#114](https://github.com/NTBBloodbath/doom-nvim/pull/114) + - Update `neorg` tree-sitter parser files + - Use `,o` as neorg leader instead of `<leader>o` + - Drop a line from Doom logo in dashboard [#140](https://github.com/NTBBloodbath/doom-nvim/pull/140) + - Small statusline improvements for small windows + +### Fixed + +- Disable indent lines in norg files +- Proper conditional for enabling undodir +- Add missing entries for disabling certain plugins +- Update some plugins links +- Fix DAP auto installation +- Fix telescope indexing `.git` directory +- Fix Doom not respecting `CC` environment variable +- Fix `:DoomReport` command not including `warning`/`error` logs +- Provide Neovim 0.6 LSP API changes +- Proper precedence in paths to source Doom configuration files +- Proper example for custom options in `doom_config` file +- Make sure plugins are loaded in a correct order [#120](https://github.com/NTBBloodbath/doom-nvim/pull/120) +- Remove non-neeeded `bufdo e`. Fixes [#127](https://github.com/NTBBloodbath/doom-nvim/issues/127) +- Do not try to load `which-key.nvim` plugin if not installed. Fixes [#124](https://github.com/NTBBloodbath/doom-nvim/issues/124) +- Bufferline was not being loaded sometimes +- Run `BufEnter` autocommand after loading tree-sitter, fixes concealing on norg files +- Properly fallback to doom-one, better logging messages in UI module +- Use `0.5-compat` branch for TreeSitter when using Neovim 0.5.x +- Use `package.loaded` to check toggleterm existence in built-in modules + +### Removed + +- Selene linter comments and references [#106](https://github.com/NTBBloodbath/doom-nvim/pull/106) +- Do not disable syntax highlighting on launch. Closes [#131](https://github.com/NTBBloodbath/doom-nvim/issues/131) +- Remove some built-in Neovim plugins loading logic to allow them to be used +- Remove shada logic, we do not really need to temporarily disable it + ## [3.1.2] - 2021-10-01 ### Changed @@ -51,7 +170,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `SPC - d - l` keybinding for manually reload configurations - Windows support (note that some plugins does not work well on Windows and that's not a doom issue!) - `SPC - d - s` keybinding now offers a live preview for the colorschemes -- `tsx` treesitter parser is now installed alongside with the typescript one, see [#84](https://github.com/NTBBloodbath/doom-nvim/issues/84) +- `tsx` tree-sitter parser is now installed alongside with the typescript one, see [#84](https://github.com/NTBBloodbath/doom-nvim/issues/84) - Allow to override default keymappings - Quick save with `SPC - v / m` - Jump keybindings on which-key @@ -60,7 +179,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - You can now add your doom-nvim configurations to your dotfiles without having to use submodules! See [#79](https://github.com/NTBBloodbath/doom-nvim/issues/79) - Plugins: - - New plugin: treesitter companion plugins (autotag, docs, etc) + - New plugin: tree-sitter companion plugins (autotag, docs, etc) - New plugin: nvim-mapper, a keybindings cheatsheet - New plugin: DAP (Debugging Adapter Protocol) support - New plugin: trouble, better quickfix window @@ -102,7 +221,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Plugins: - Occasional bug with autosessions - Properly lazy-load TrueZen - - Use GCC compiler for haskell treesitter parser + - Use GCC compiler for haskell tree-sitter parser - bufferline will not be shown when: 1. Only one buffer is opened 2. While being in the dashboard @@ -557,7 +676,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial stable release -[unreleased]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.2...develop +[unreleased]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.2.0...develop +[3.2.0]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.2...v3.2.0 [3.1.2]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.1...v3.1.2 [3.1.1]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.1.0...v3.1.1 [3.1.0]: https://github.com/NTBBloodbath/doom-nvim/compare/v3.0.13...v3.1.0 diff --git a/README.md b/README.md index 1f6397f27..442f2a127 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ Its design is guided by these mantras: - GNU `find` - [ripgrep] 11.0+ or [fd] 7.3.0+ (optional but highly recommended, improves file indexing performance for some commands) - `nodejs` and `npm` (optional, required to use some Language Server Protocols) +- `wget`, `unzip` (optional, required for auto installing LSPs) Doom is comprised of [~40 optional plugins][modules], some of which may have additional dependencies. [Please visit their documentation][modules]. diff --git a/colors/doom-one.lua b/colors/doom-one.lua index 79c0eebac..c2ceb3903 100644 --- a/colors/doom-one.lua +++ b/colors/doom-one.lua @@ -6,4 +6,4 @@ end vim.g["colors_name"] = "doom-one" package.loaded["colors.doom-one"] = nil -require("colors.doom-one") +require("colors.doom-one").load_colorscheme() diff --git a/contribute/Dockerfile b/contribute/Dockerfile new file mode 100644 index 000000000..abea988a9 --- /dev/null +++ b/contribute/Dockerfile @@ -0,0 +1,52 @@ +FROM archlinux:latest + +LABEL \ + maintainer="n.debonnaire@gmail.com" \ + url.github="https://github.com/nicodebo/neovim-docker" \ + url.dockerhub="https://hub.docker.com/r/nicodebo/neovim-docker/" + +ENV \ + UID="1000" \ + GID="1000" \ + UNAME="doom" \ + GNAME="doom" \ + SHELL="/bin/bash" \ + WORKSPACE="" \ + NVIM_CONFIG="/home/doom/.config/nvim" \ + PATH="/home/doom/.local/bin:${PATH}" + +# Update repositories +RUN pacman -Syy + +# Install neovim +RUN pacman -Sy neovim --noconfirm + +# Install runtime dependencies of doom-nvim +RUN pacman -Sy ripgrep nodejs-lts-fermium npm git bash gcc jq --noconfirm + +# Required for nvim-lsp-installer +RUN pacman -Sy wget unzip + +# Required for watching Doom-nvim-contrib for changes +RUN npm i -g chokidar-cli + +# Create the doom user and group +RUN groupadd doom +RUN useradd -m -g doom doom + +RUN mkdir /usr/local/lib/node_modules +RUN chown -R ${UNAME}:${GNAME} /usr/local/lib/node_modules/ + +USER doom +WORKDIR /home/doom + +COPY _docker_entry.sh /usr/local/bin/ + +# Doom-nvim-contrib +VOLUME "~/.config/nvim" +# For storing packer plugins +VOLUME "~/.local/share/nvim" +# Files and projects for testing on disk +VOLUME "~/workspace" + +ENTRYPOINT ["sh", "/usr/local/bin/_docker_entry.sh"] diff --git a/contribute/README.md b/contribute/README.md new file mode 100644 index 000000000..809570fe6 --- /dev/null +++ b/contribute/README.md @@ -0,0 +1,58 @@ +# Contributing Tools for Doom Neovim + +This directory stores various tools and automations to help contributors or develpers of doom-nvim. + +## Doom Contrib Docker Image `./start_docker.sh` + +This docker image aids in development by setting up a docker virtual environment and git worktree of doom-nvim to make your changes within. + +### How to use + +The setup and start process is handled in the `./start_docker.sh` script. + +``` +Bootstraps a docker image for contributing changes to doom-nvim + +Syntax: ./start_docker.sh [-b <branch_name>] +options: +-b Create a new branch for the contribution (default is doom-nvim-contrib) +-h Shows this help menu +``` + +The script will start an instance of neovim that uses `./contribute/doom-nvim-contrib/` for configuration. +You will then be able to start making changes within `doom-nvim-contrib` without breaking your existing config. + +### What this script does + +1. On first execution it will setup a git worktree of doom-nvim, this means your main config and this copy of the repo will share the same git history. + - This worktree will be placed in the `contribute/doom-nvim-contrib` folder inside of this repository. + - Because they share history you wont be able to checkout the same branch on both copies of the repository. Unless specified, a new branch called `doom-nvim-contrib` will be created off the latest version of `develop`. +2. It will setup a new docker image to run this config within (if necessary). +3. It will then start the docker image and enter you into neovim. + +### Generated Folders + +These are the folders used by this docker image, they will be auto generated when `./start_docker.sh` is run + +`contribute/doom-nvim-contrib/` - Git worktree for doom-nvim contributions +`contribute/local-share-nvim/` - Stores the data from `~/.local/share/nvim/` +`contribute/workspace/` - Directory to store test files and project that you want to test your changes upon + +## Pinned Dependencies `./update_dependencies.sh` + +This script parses the `lua/doom/modules/init.lua` file and pins each plugin to the latest commit in the default branch. +We should update these dependencies with each release of doom-nvim, and test everything working together to ensure a stable experience for users. +Pinned/frozen dependencies can be disabled using the `freeze_dependencies` configuration option in `doom_config.lua`. + +### How to use + +Run the following command in the root of the neovim folder. +```bash +cd contribute && ./update_dependencies.sh` +``` + +### Issues +- The `commit = pin_commit(...)` line must be immediately after the package name +- It does not work if the dependency also has the `branch = '...'` option. These will have to be updated manually. +- It does not work if there is custom logic for determining pinned commits (such as depending on neovim version). These will have to be updated manually. +- Github API ratelimits requests, you can specify a GITHUB_API_KEY environment variable (docs)[https://docs.github.com/en/developers/apps/building-oauth-apps], or you can use a VPN to change IP addresses. diff --git a/contribute/_docker_entry.sh b/contribute/_docker_entry.sh new file mode 100755 index 000000000..40f8ff5c9 --- /dev/null +++ b/contribute/_docker_entry.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh +# Automatically enter into nvim (by doing this in entrypoint rather than Dockerfile you can still quit and re-enter neovim) +# Add alias to watch config for changes and reload nvim, +# this needs to be debounced otherwise it's quite hard to exit. + +echo "alias doomwatch=\"chokidar '/home/doom/.config/nvim/**/*.lua' -t 100 -c 'debounce 1 | nvim'\"" >> ~/.bashrc +echo "echo 'Use '\$ doomwatch' command to automatically restart nvim on changes to doom-nvim-contrib.'" >> ~/.bashrc +echo "echo ' This command is still buggy and hard to exit, you may have to close your terminal if you use it. :( '" >> ~/.bashrc + +echo "nvim" >> ~/.bashrc +# Cd into workspace folder +cd ~/workspace +# Start bash and therefore neovim +bash + diff --git a/contribute/start_docker.sh b/contribute/start_docker.sh new file mode 100755 index 000000000..4aaeb5a67 --- /dev/null +++ b/contribute/start_docker.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +if ! docker info > /dev/null 2>&1; then + echo "This script uses docker, and it isn't running - please start docker and try again!" + exit 1 +fi + +############################################################ +# Help # +############################################################ +Help() +{ + # Display Help + echo "Bootstraps a docker image for contributing changes to doom-nvim" + echo + echo "Syntax: ./start_docker.sh [-b <branch_name>]" + echo "options:" + echo "-b Create a new branch for the contribution" + echo "-h Shows this help menu" + echo +} + +# Get directory of script +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +# Default options +BRANCH_NAME=doom-nvim-contrib # Branch to checkout / create + +while getopts "b:h" option; do + case $option in + b) # set branch name + BRANCH_NAME=$OPTARG + echo "Setting branchname to $OPTARG" + ;; + h) # display Help + Help + exit;; + *) + Help + exit;; + esac +done + +cd "$SCRIPT_DIR" || exit + +# Create the worktree if it doesn't already exist +if [[ ! -d "$SCRIPT_DIR"/doom-nvim-contrib ]]; then + echo "0. Creating new git worktree of doom-nvim at $SCRIPT_DIR/doom-nvim-contrib" + if git show-ref --quiet refs/heads/"$BRANCH_NAME"; then + git worktree add ./doom-nvim-contrib "$BRANCH_NAME" + else + git worktree add ./doom-nvim-contrib origin/develop -b "$BRANCH_NAME" + fi +fi + +# CD into worktree +cd ./doom-nvim-contrib || exit + +echo "1. Setting up branch" +# If branch exists just check it out +if git show-ref --quiet refs/heads/"$BRANCH_NAME"; then + if [[ ! $( git rev-parse --abbrev-ref HEAD ) == "$BRANCH_NAME" ]]; then + echo " - Checking out branch $BRANCH_NAME..." + git checkout "$BRANCH_NAME" + fi +else + # Pull latest version of develop + echo " - Creating new branch off develop..." + git checkout -b "$BRANCH_NAME" develop + git fetch --quiet + # If changes between local and origin, get latest changes + if [[ ! $( git rev-list develop...origin/develop --count ) -eq 0 ]]; then + echo " - WARN: There are upstream changes to develop branch. Please pull latest changes" + read -p " Do you want to continue creating $BRANCH_NAME? (y/n) " -n 1 -r + fi + # Create new branch for feature and check it out + echo " - Creating new branch $BRANCH_NAME..." + git checkout -b "$BRANCH_NAME" +fi + +cd .. || exit +echo " - Success! Checked out $BRANCH_NAME branch at:" +echo " $SCRIPT_DIR/doom-nvim-contrib" +echo "" + +echo "2. Setting up docker environment" +# Ensure docker image exists +if [[ ! "$(docker images -q doom-nvim-contrib)" ]]; then + echo " - Docker image does not exist. Building docker image..." + docker build -t doom-nvim-contrib . +fi + +if [ "$(docker ps -aq -f status=exited -f name=doom-nvim-contrib-container)" ]; then + echo " - Cleaning up old container..." + # cleanup + docker rm doom-nvim-contrib-container >> /dev/null +fi + +# Create docker container if haven't already +echo " - Success! Running docker container doom-nvim-contrib-container..." +echo "" +docker run \ + -it \ + -e UID="1000" \ + -e GID="1000" \ + -v "$SCRIPT_DIR"/doom-nvim-contrib:/home/doom/.config/nvim \ + -v "$SCRIPT_DIR"/local-share-nvim:/home/doom/.local/share/nvim \ + -v "$SCRIPT_DIR"/workspace:/home/doom/workspace \ + --name doom-nvim-contrib-container \ + --user doom \ + doom-nvim-contrib + + diff --git a/contribute/update_dependencies.sh b/contribute/update_dependencies.sh new file mode 100755 index 000000000..29c2801c3 --- /dev/null +++ b/contribute/update_dependencies.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +# This script updates pinned dependencies in ../lua/doom/modules/init.lua +# It uses grep to find instances of packer.use, uses the repository url to fetch the latest commit sha, and modifies the values +# Dependencies +# perl -- used for Regexing the repository <account>/<repo_name> with capture groups to extract inner text +# grep -- Used for regexing the use({}) block with line numbers +# + +index=0 +repo_regex='"([^"]+)"' +pin_commit_regex='commit = pin_commit[(][^()]*[)]' + +repo='' +latest_commit='' + +while read -r line; do + if [[ $index -eq 1 ]]; then + # Get the repository name as `<username>/reponame` + if [[ $line =~ $repo_regex ]]; then # Regex $line against $repo_regex + repo="${BASH_REMATCH[1]}" # Get first capture group + echo "" + echo "Updating $repo:" + + # Sometimes the github api requests will fail, in which case we need to re-try after a delay. + while [ -z "$latest_commit" ]; do + # Get the commit sha from github, use GITHUB_API_KEY if provided + # GITHUB_API_KEY in this instance is an OAuth2 token + # https://docs.github.com/en/developers/apps/building-oauth-apps + if [ -z GITHUB_API_KEY ]; then + api_result=`curl -s \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/$repo/commits?per_page=1` + else + api_result=`curl -s \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authentication: token $GITHUB_API_KEY" \ + https://api.github.com/repos/$repo/commits?per_page=1` + fi + + # If there's an error, log it and wait 30 seconds + is_array=`echo $api_result | jq -r 'if type=="array" then "yes" else "no" end'` + if [ "$is_array" = "no" ]; then + echo "- Github API Error: $( echo "$api_result" | jq -r .message )" + echo "- Waiting 30 seconds before trying again..." + sleep 30 + else + latest_commit=`echo $api_result | jq -r .[0].sha` + fi + + done + else + echo " - ERROR: No repo name for $line :(" + fi + fi + + # Update the pinned commit if possible + if [[ $index -eq 2 ]]; then + if [ ! -z "$repo" ] && [ ! -z "$latest_commit" ] && [[ $line =~ $pin_commit_regex ]]; then + line_number=`echo $line | awk -F "-" '{print $1}'` + sed -r -i -- "${line_number}s/commit = pin_commit[(][^()]*[)]/commit = pin_commit('${latest_commit}')/" "../lua/doom/modules/init.lua" + echo " - Updated to $latest_commit" + else + echo " - ERROR: Did not update $repo because \`commit = pin_commit('...')\` was not immediately after the repo name or there is custom logic for determining the pinned commit. Please update this entry manually." + fi + fi + + let index+=1 + if [[ $line == '--' ]]; then + sleep 2 + index=0 + repo='' + latest_commit='' + fi +done < <(grep -n "use\(\{" -A 2 -E ../lua/doom/modules/init.lua) + + diff --git a/doc/doom_nvim.norg b/doc/doom_nvim.norg new file mode 100644 index 000000000..c94f01e96 --- /dev/null +++ b/doc/doom_nvim.norg @@ -0,0 +1,648 @@ +@document.meta + title: doom manual + description: Doom Nvim User Manual + author: NTBBloodbath + categories: doom neovim manual + created: 2021-08-15 + version: 0.1 +@end + += TOC Table of Contents + +* Table of Contents + -> [Introduction](#Introduction) + -> [Using Doom Nvim as your daily setup](#Using Doom Nvim as your daily setup) + --> [Moving around](#Moving around) + --> [Configuration](#Configuration) + ---> [Modules](#Modules) + ----> [Tweaking modules](#Tweaking modules) + ---> [Custom plugins](#Custom plugins) + ---> [Language Server Protocols](#Language Server Protocols) + --> [Autocompletion](#Autocompletion) + --> [Colorscheme](#Colorscheme) + --> [Layout](#Layout) + ---> [File Explorer](#File Explorer) + ---> [Main Buffer](#Main Buffer) + ---> [Terminal](#Terminal) + ---> [Minimap](#Minimap) + ---> [Outline](#Outline) + --> [Commands](#Commands) + --> [Keybindings](#Keybindings) + --> [Hacking Doom Nvim](#Hacking Doom Nvim) + -> [Known issues](#Known issues) + -> [FAQ](#FAQ) + --> [General](#General) + ---> [Who is Doom Nvim intended for?](#Who is Doom Nvim intended for?) + ---> [Why does Doom Nvim only support Neovim 0.5.0 (and beyond)?](#Why does Doom Nvim only support Neovim 0.5.0 and beyond?) + --> [Workaround](#Workaround) + ---> [Missing nvim help documentation](#Missing nvim help documentation) + -> [Acknowledgements](#Acknowledgements) + -> [Contributing](#Contributing) + -> [License](#License) + +* Introduction + Doom Nvim is a Neovim port of the [Doom Emacs](https://github.com/hlissner/doom-emacs) configuration framework, adapted for the Neovim user + that wants less framework in their framework and the performance of a hand-made configuration. + You can use it as your own setup or as a learning resource on how to achieve a great Neovim configuration. + + Doom Nvim features an opinionated collection of reasonable and optional defaults, with a focus on + runtime and startup performance, and a clean, readable and very robust code base. + +* Using Doom Nvim as your daily setup + You can start Doom Nvim by typing `nvim` in a terminal emulator or by executing your preferred + Neovim GUI client. + + By default, if no files were opened, Doom Nvim will show the start menu ([dashboard-nvim](https://github.com/glepnir/dashboard-nvim)) where you + can select files to edit or if you have a saved session in the current workspace, Doom Nvim will load + it automatically if you want to. + + ** Moving around + Doom Nvim uses the default Neovim keybindings to move around: `k, j, k, l` and the cursor keys. + If you are in the insert mode, you must type `Esc`-key first to change into the normal mode. + Use `h` to go left, `j` to go down, `k` to go up and `l` to go right. + + See `:Tutor` to know how to use Neovim and its keybindings. + + To move around buffers press `SPC - b` to select the `Buffers` section of keybindings and then press + the key `g` to select a buffer or press `TAB` to cycle buffers. + + ** Configuration + Doom Nvim offers easy access to the dynamic reconfiguration of some key editor featurs, such as + console background to be dark or light, auto-completion to be on or off, autopairs to be on or + off, indentation step width, line number display style, spell checker to be on or off, and more. + For these, press `SPC - t` and select the desired configuration item by another key stroke. + + The Doom Nvim configuration files resides under the `$HOME/.config/nvim` directory by default. + See [Hacking Doom Nvim](**Hacking Doom Nvim) for more information. + + *** Modules + Doom Nvim consists of around `6` modules. A Doom Nvim module is a bundle of plugins, + configurations and commands, organized into a unit that can be toggled easily. + + To give a quick summary, the modules are as follows: + - UI, everything related to Neovim UI. + - Doom, neorg and built-in plugins. + - Editor, everything related to editing, e.g. tree explorer, git signs, lsp, debugging. + - Langs, languages support for Doom, languages servers and debuggers. + - Utilities, some utility plugins like `neogit`. + - Web, web development related plugins like `rest.nvim`. + + You can see in a more detailed view the modules and its plugins at [modules.md](https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/modules.md). + + **** Tweaking modules + For persistently tweaking a module (enable / disable its plugins) you will only need to + comment or uncomment the desired plugin, e.g. for disabling the tree explorer you will only + need to comment it. + +@code lua + -- Right now the Tree explorer is enabled + "explorer", + + -- Now the Tree Explorer is disabled + -- "explorer", +@end + + *NOTE*: after doing changes to your modules you will only need to restart Neovim + and Doom Nvim will automatically handle your changes on here. + + *** Custom plugins + To use your own plugins in Doom Nvim you can use the `doom_userplugins.lua` file located + in the Doom Nvim root directory (`$HOME/.config/nvim` by default). + + To add plugins without extra configurations (e.g. if a plugin does not depends on other plugins), + you can simply set it as follow: + +@code lua + M.plugins = { + "andweeb/presence.nvim", + } +@end + + Otherwise, if your plugin depends on other or you do not want to enable it then you can + do it as follow: + +@code lua + M.plugins = { + { + "andweeb/presence.nvim", + -- Plugin dependencies + requires = { + "JohnDoe/foo" + }, + -- Disable plugin + disable = true, + }, + } +@end + + *NOTE*: if you are familiar with [packer.nvim](https://github.com/wbthomason/packer.nvim) then you can see that the `doom_userplugins.lua` file + is just a wrapper for it. + + *** Language Server Protocols + To easily install language servers and without having to do it system-wide or having to manually + configure servers, Doom Nvim makes use of [nvim-lspinstall](https://github.com/kabouzeid/nvim-lspinstall). + + To enable the language server for a certain programming language and automatically install it, + just append a `+lsp` flag at the end of the language field in your `doom_modules.lua`, + e.g. for enabling Rust support in Doom Nvim and install `rust-analyzer`: + +@code lua + M.modules = { + langs = { + "rust +lsp", -- Let's get rusty! + }, + } +@end + + *NOTE*: You can see a list of currently supported languages at [bundled installers](https://github.com/kabouzeid/nvim-lspinstall#bundled-installers). + + ** Autocompletion + Doom Nvim uses the [built-in LSP](https://neovim.io/doc/user/lsp.html) plus [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) plugin as completion engine. + + Use `<C-n>` to select the next suggestion and `<CR>` to select the current one. + + Autocompletion for parenthesis can be disabled by disabling the [nvim-autopairs](https://github.com/windwp/nvim-autopairs) + plugin (see [Tweaking modules](***Tweaking modules) for more information). + + ** Colorscheme + The colorscheme of Doom Nvim. Default is `doom-one`. There are some additional + doom emacs' colorschemes port for Neovim that can be enabled by uncommenting + the `doom-themes` entry in your `doom_modules.lua`. + + You can switch between colorschemes by doing `SPC - d - s` and then type the name + of the colorscheme you want to use. You can also edit the `doom_config.lua` + file located at `$HOME/.config/nvim` (see [Hacking Doom Nvim](**Hacking Doom Nvim)). + + *NOTE*: If you exit Neovim and you changed the colorscheme then Doom Nvim will automatically + update the `doom_config.lua` file to use the new colorscheme on next launch. + + ** Layout + Excluding the statusline and the tabline, Doom Nvim will mostly have the + following layout: + + โ”Œโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ + โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ + โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ + โ”‚ A* โ”‚ B โ”‚ D* โ”‚ E* โ”‚ + โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ + โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ + โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ + โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ โ”‚ + โ”‚ โ”‚ C* โ”‚ โ”‚ โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + + Where: + - 'A' is the file explorer (plugin: [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua)) + - 'B' is the main buffer + - 'C' is the terminal (plugin: [toggleterm.nvim](https://github.com/akinsho/toggleterm.nvim)) + - 'D' is the minimap (plugin: [minimap.vim](https://github.com/wfxr/minimap.vim)) + - 'E' is the symbol outline (plugin: [symbols-outline.nvim](https://github.com/simrat39/symbols-outline.nvim)) + + *NOTE*: Sections with `*` are not opened by default but can be toggled. + See [Commands](**Commands) for more information. + + *** File Explorer + Doom Nvim uses the `nvim-tree.lua` plugin as a file explorer. It can be toggled by + running the following keybinds: + - `SPC - o - e` + - `<F3>` + + To create a new file within the file explorer, press `a` and type the name of the + file. Append a `/` at the end if you want to create a directory. + + Check [nvim-tree.lua repository](https://github.com/kyazdani42/nvim-tree.lua) for more information. + + *** Main Buffer + The main buffer is the buffer where the code is opened. + + To split the main buffer, do `SPC - w` and then select the split method you + want to use horizontally (`s`), or vertically (`v`). + + *** Terminal + The terminal is placed like in others editors, e.g. Visual Studio Code. The + buffer of the terminal is automatically set to `INSERT` mode. + + The only way to close it is to enter `exit` to close the shell session, or if you + just want to toggle it, you can use the following keybinds: + - `SPC - o - t` (only `NORMAL` mode!) + - `<F4>` + + Check [toggleterm.nvim repository](https://github.com/akinsho/toggleterm.nvim) for more information. + + *** Minimap + Doom Nvim uses `wfxr/minimap.vim` plugin as its minimap. It can be toggled by + performing the following keybinds: + - `SPC - o - m` + - `<F5>` + + Check [minimap.vim repository](https://github.com/wfxr/minimap.vim) for more information. + + *** Outline + `Symbols-Outline` is a plugin that can show the tags and structure of the opened + file, ordered by its scope. + + For this function, Doom Nvim makes use of `simrat39/symbols-outline.nvim`. + It can be toggled by performing the following keybinds: + - `SPC - o - s` + - `<F2>` + + Check [symbols-outline.nvim repository](https://github.com/simrat39/symbols-outline.nvim) for more information. + + ** Commands + Doom Nvim has its own commands, to make your life easier when developing on it. + + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚Command โ”‚ Description โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚DoomUpdate โ”‚ Update Doom Nvim if there are updates โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚DoomRollback โ”‚ Rollback Doom Nvim to a previous version โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚DoomManual โ”‚ Open Doom Nvim User Manual โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚DoomConfigs โ”‚ Open a selection menu to edit Doom configs โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚DoomConfigsReload โ”‚ Reload user-defined keybindings, etc โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚DoomReload โ”‚ Reload Doom Nvim and simulate a new Neovim run โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚DoomReport โ”‚ Create a Doom Nvim markdown crash report โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚DoomInfo โ”‚ Open Doom Nivm information dashboard โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + + Doom Nvim also uses [which-key.nvim](https://github.com/folke/which-key.nvim) as a commands manager, inspired by emacs' guide-key. + To open it, press `SPC` and wait for the popup to show, it should not take much time. + Each section has a label and is mnemonic, e.g. + + `Open Terminal` > `SPC - o - t` + + There are multiple sections for Doom Nvim commands. Those sections create a path in the + decision tree that identifies any command. + + Let's say you want to go to the next buffer you are working on. You will need to perform + the following keystrokes: + + `SPC - b` + + In order to open the `Buffers` section. There we want to go to the next buffer. + + `SPC - b - n` + + Finally, we changed our current buffer to the next one in our workspace. You can see more + keybindings in [Keybindings](**Keybindings). + + ** Keybindings + In Doom Nvim, we make use of the `SPC` keystroke as the map leader. + + This is the list of all Doom Nvim leader mappings, `SPC` is omitted here to avoid redundancy. + + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ Keybind โ”‚ Description โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ , โ”‚ Switch buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ . โ”‚ Browse files โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ / โ”‚ Search โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ : โ”‚ Command history โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ ` โ”‚ Find file โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ h โ”‚ Man pages โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ m โ”‚ Save โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ v โ”‚ Save โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ b - [ โ”‚ Previous buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ b - ] โ”‚ Next Buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ b - b โ”‚ Switch to other buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ b - c โ”‚ Close current buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ b - f โ”‚ Format buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ b - g โ”‚ Goto buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ b - n โ”‚ Next buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ b - p โ”‚ Previous buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - b โ”‚ Compile project โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - c โ”‚ Compile and run project โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - d โ”‚ +debug โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - d - e โ”‚ Evaluate word under cursor โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - d - s โ”‚ Evaluate selection โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - h โ”‚ Run rest client on the line that the cursor is โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - i โ”‚ Start a REPL โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - r โ”‚ Run current file โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - l โ”‚ +lsp โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - l - a โ”‚ Code actions โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - l - d โ”‚ Show type definition โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - l - i โ”‚ Lsp info โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - l - L โ”‚ Diagnostics into location list โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ c - l - l โ”‚ Show line diagnostics โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ d - c โ”‚ Edit your Doom Nvim configurations โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ d - d โ”‚ Open Doom Nvim documentation โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ d - i โ”‚ Open Doom Nivm information dashboard โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ d - R โ”‚ Create crash reports, useful for debugging issues โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ d - r โ”‚ Rollback Doom Nvim version โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ d - s โ”‚ Change colorscheme โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ d - u โ”‚ Update Doom Nvim โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ f - c โ”‚ Edit Neovim configurations โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ f - f โ”‚ Find files โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ f - n โ”‚ New unnamed buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ f - R โ”‚ Re-open an unreadable file with sudo permissions โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ f - r โ”‚ Recently opened files โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ f - t โ”‚ Help tags โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ f - w โ”‚ Write an unwritable file with sudo permissions โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - B โ”‚ Branches โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - b โ”‚ Blame line โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - c โ”‚ Commits โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - h โ”‚ Preview hunk โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - R โ”‚ Reset buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - r โ”‚ Reset hunk โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - o โ”‚ Open LazyGit โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - l โ”‚ Pull โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - p โ”‚ Push โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - S โ”‚ Stage hunk โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - s โ”‚ Status โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - u โ”‚ Undo stage hunk โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ j - a โ”‚ Alternate file โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ j - j โ”‚ Jump back โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ j - k โ”‚ Jump forward โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ j - p โ”‚ Pop tag stack โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ j - t โ”‚ Jump to tag โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ o - d โ”‚ Start screen โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ o - e โ”‚ Tree Explorer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ o - m โ”‚ Minimap โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ o - s โ”‚ LSP Symbols โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ o - t โ”‚ Terminal โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ p - C โ”‚ Compile your plugins changes โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ p - c โ”‚ Clean unused plugins โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ p - i โ”‚ Install missing plugins โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ p - p โ”‚ Profile the time taken loading your plugins โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ p - S โ”‚ Sync plugins (runs Clean and Update) โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ p - s โ”‚ Plugins status โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ q - q โ”‚ Quit Neovim โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ q - r โ”‚ Restore previously saved session โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ q - w โ”‚ Save and quit Neovim โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ s - b โ”‚ Buffer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ s - g โ”‚ Grep โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ s - h โ”‚ Command history โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ s - m โ”‚ Jump to mark โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ s - s โ”‚ Goto symbol โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ t - - โ”‚ Tweak Neovim behavior โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ t - b โ”‚ Toggle background light/dark โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ t - c โ”‚ Turn on and off completion if available โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ t - g โ”‚ Turn on and off signcolumn for gitsigns, ... โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ t - i โ”‚ Set tabstop and indent steps to any integer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ t - n โ”‚ Change line number display (4 types) โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ t - p โ”‚ Turn on and off autopairs if available โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ t - s โ”‚ Spell check on/off โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ t - x โ”‚ Syntax/treesetter on/off โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - - โ”‚ Split window below โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - = โ”‚ Balance windows size โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - | โ”‚ Split window right โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - 2 โ”‚ Layout double columns โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - d โ”‚ Delete window โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - H โ”‚ Expand window left โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - h โ”‚ Window left โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - J โ”‚ Expand window below โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - j โ”‚ Window below โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - K โ”‚ Expand window up โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - k โ”‚ Window up โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - L โ”‚ Expand window right โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - l โ”‚ Window right โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - s โ”‚ Split window below โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - v โ”‚ Split window right โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ w - w โ”‚ Other window โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + + But there is still more, Doom Nvim knows that you love to use the keyboard but you do not + like to be typing so much so it has more keybindings that will make your life easier! + + | The following keybindings does not use the leader key. + + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ Keybind โ”‚ Description โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ TAB โ”‚ Cycle buffers (next buffer) โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Shift - TAB โ”‚ Cycle buffers (prev buffer) โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ ESC โ”‚ Search highlighting off โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ F2 โ”‚ Toggle Symbols-Outline โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ F3 โ”‚ Toggle Tree Explorer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ F4 โ”‚ Toggle Terminal โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ F5 โ”‚ Toggle Minimap โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ F6 โ”‚ Toggle Zen mode โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ F7 โ”‚ Run rest client on current cursor position โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Z - Z โ”‚ Toggle Symbols-Outline โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ j - k โ”‚ Toggle Tree Explorer โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - c - c โ”‚ Comment current line (NORMAL mode) โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ g - c โ”‚ Comment selected block (VISUAL mode) โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Control + h โ”‚ Select window left โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Control + j โ”‚ Select window below โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Control + k โ”‚ Select window up โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Control + l โ”‚ Select window right โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Control + Up โ”‚ Resize window up โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Control + Down โ”‚ Resize window below โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Control + Left โ”‚ Resize window left โ”‚ + โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค + โ”‚ Control + Right โ”‚ Resize window right โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + + You can modify the default keybindings by modifying the following files: + - General keybindings: `lua/doom/extras/keybindings/init.lua` + - Plugins keybindings: `lua/doom/modules/config` + - which-key keybindings: `lua/doom/modules/config/doom-whichkey.lua` + + *NOTE*: You can also make your own keybindings or override the default ones + by editing your `doom_config.lua` file. If you override, you need to update which-key + keybindings to make it work properly. This is known issue. + + ** Hacking Doom Nvim + Doom Nvim aims to be hackable to suit everyone's needs. Therefore this is the structure of Doom Nvim: + +@code + . -> Doom Nvim root + โ”œโ”€โ”€ colors -> Pre-installed colorschemes directory + โ”‚ โ””โ”€โ”€ doom-one.lua -> doom-one colorscheme ported to Nvim (default one) + โ”œโ”€โ”€ doc -> Docs to be used inside Nvim + โ”‚ โ””โ”€โ”€ doom_nvim.norg -> Doom Nvim User Manual + โ”œโ”€โ”€ docs -> Docs meant to be read on GitHub + โ”œโ”€โ”€ doom_modules.lua -> Doom modules configurations file + โ”œโ”€โ”€ doom_config.lua -> Doom main configurations file + โ”œโ”€โ”€ doom_userplugins.lua -> User defined plugins + โ”œโ”€โ”€ init.lua -> Init file + โ”œโ”€โ”€ LICENSE -> License + โ””โ”€โ”€ lua -> Location of Doom Nvim Lua files + โ”œโ”€โ”€ doom -> Doom Nvim core + โ”‚ โ”œโ”€โ”€ core -> Doom Nvim core functionality + โ”‚ โ”‚ โ”œโ”€โ”€ config -> Doom Nvim configuration files + โ”‚ โ”‚ โ”œโ”€โ”€ settings -> Doom Nvim Neovim settings + โ”‚ โ”‚ โ”œโ”€โ”€ functions -> Doom Nvim functions + โ”‚ โ”‚ โ””โ”€โ”€ system -> Doom Nvim system utilities + โ”‚ โ”œโ”€โ”€ extras -> Doom Nvim extra functionalities + โ”‚ โ”‚ โ”œโ”€โ”€ autocmds -> Doom Nvim autocommands + โ”‚ โ”‚ โ”œโ”€โ”€ keybindings -> Doom Nvim keybindings + โ”‚ โ”‚ โ””โ”€โ”€ logging -> Doom Nvim logging system + โ”‚ โ””โ”€โ”€ utils -> Doom Nvim utilities + โ””โ”€โ”€ modules -> Location of Doom Nvim plugins + โ”œโ”€โ”€ configs -> Plugins configurations + โ”œโ”€โ”€ built-in -> Doom Nvim built-in plugins + โ””โ”€โ”€ init.lua -> packer.nvim setup +@end + +* Known issues + Nothing here but chickens ... + + *NOTE*: If you are facing an undocummented issue, feel free to [open an issue](https://github.com/NTBBloodbath/doom-nvim/issues/new) at Doom Nvim repository on + GitHub and we will try to fix it together! + +* FAQ + ** General + *** Who is Doom Nvim intended for? + Doom Nvim is intended for anyone who wants a stable and efficient + development environment that just works without spending a lot of time setting everything up. + + *** Why does Doom Nvim only support Neovim 0.5.0 and beyond? + Doom Nvim relies on lua for the configuration and use of many plugins. Since + lua is not available in neovim 0.4.4 and below, it is not possible to use Doom + Nvim with a neovim version lower than 0.5.0. + + ** Workaround + *** Missing nvim help documentation + Since Doom Nvim extensively uses delayed loading of packages, their help documentation may not + show up under `LOCAL ADDITIONS:`. If this happens and you still wish to see them, you need to + make copies or symlinks of the help documentation of the affected packages in `doc/` of Doom + Nvim and update help tags file manually with `:helptags ALL` . + +* Acknowledgements + Doom Nvim would not have been possible had it not been for + - hlissner, creator of Doom Emacs + - All our contributors + +* Contributing + I really love pull requests and bug reports, please see the [Contributing Guidelines](https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/contributing.md) on GitHub + before contributing. + + Don't hesitate to tell me my Lua coding style sucks, but please tell me why. + +* License + Doom Nvim is distributed under GPLv2 license. + + +$comment +vim:sw=2:ts=2:cole=3:cocu=n:tw=100:norl: diff --git a/doc/doom_nvim.txt b/doc/doom_nvim.txt deleted file mode 100644 index 6096587cb..000000000 --- a/doc/doom_nvim.txt +++ /dev/null @@ -1,595 +0,0 @@ -*doom_nvim.txt* A Neovim configuration for the advanced martian hacker - -================= =============== =============== ======== ========~ -\\ . . . . . . .\\ //. . . . . . .\\ //. . . . . . .\\ \\. . .\\// . . //~ -||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\/ . . .||~ -|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||~ -||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||~ -|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\ . . . . ||~ -||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\_ . .|. .||~ -|| . _|| || || || || ||_ . || || . _|| || || || |\ `-_/| . ||~ -||_-' || .|/ || || \|. || `-_|| ||_-' || .|/ || || | \ / |-_.||~ -|| ||_-' || || `-_|| || || ||_-' || || | \ / | `||~ -|| `' || || `' || || `' || || | \ / | ||~ -|| .===' `===. .==='.`===. .===' /==. | \/ | ||~ -|| .==' \_|-_ `===. .===' _|_ `===. .===' _-|/ `== \/ | ||~ -|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \/ | ||~ -|| .==' _-' '-__\._-' '-_./__-' `' |. /| | ||~ -||.==' _-' `' | /==.||~ -==' _-' N E O V I M \/ `==~ -\ _-' `-_ /~ - `'' ``'~ - - NTBBloodbath *doom_nvim* - - ============================================================================= - CONTENTS *doom_nvim_contents* - 1. Introduction...........................................|doom_nvim_intro| - 2. Autocomplete..........................|doom_nvim_options_autocomplete| - 3. Colorscheme............................|doom_nvim_options_colorscheme| - 4. Configuration..................................|doom_nvim_configuration| - 1. Layout................................|doom_nvim_configuration_layout| - 2. File Explorer................|doom_nvim_configuration_layout_explorer| - 3. Main Buffer................|doom_nvim_configuration_layout_mainbuffer| - 4. Outline.......................|doom_nvim_configuration_layout_outline| - 5. Minimap.......................|doom_nvim_configuration_layout_minimap| - 6. Terminal.....................|doom_nvim_configuration_layout_terminal| - 7. Modules..............................|doom_nvim_configuration_modules| - 1. Tweaking modules..........|doom_nvim_configuration_modules_tweaking| - 8. Custom Plugins................|doom_nvim_configuration_custom_plugins| - 9. LSP......................................|doom_nvim_configuration_lsp| - 5. Commands............................................|doom_nvim_commands| - 1. Keybindings...........................|doom_nvim_commands_keybindings| - 6. Usage..................................................|doom_nvim_usage| - 1. Moving around..........................|doom_nvim_usage_moving_around| - 7. Known issues..........................................|doom_nvim_issues| - 8. FAQ......................................................|doom_nvim_faq| - 9. Hacking Doom Nvim....................................|doom_nvim_hacking| - 10. Acknowledgements...........................|doom_nvim_acknowledgements| - 11. License.............................................|doom_nvim_license| - 12. Contributing...................................|doom_nvim_contributing| - 13. Changelog.........................................|doom_nvim_changelog| - - -============================================================================== -INTRODUCTION *doom_nvim_intro* - -Doom Neovim is a Neovim port of the Doom Emacs configuration framework, adapted -for the Neovim user that wants less framework in their framework and the performance -of a hand-made configuration. You can use it as a base for your own setup or as -a learning resource on how to achieve a great Neovim configuration. - -Doom Neovim features an opinionated collection of reasonable and optional -defaults, with a focus on runtime and startup performance, and a clean, -readable code base. - - -============================================================================== -AUTOCOMPLETE *doom_nvim_autocomplete* - -Doom Neovim uses the built-in LSP as completion engine in Neovim 0.5.0. - -Use <C-n> to select the next suggestion and <CR> to select the current -suggestion. - -Autocompletion for parenthesis can be disabled by disabling the autopairs -plugin (see |doom_nvim_configuration_modules_disabling| for more information) - - -============================================================================== -COLORSCHEME *doom_nvim_colorscheme* - -The colorscheme of Doom Nvim. Default is `doom-one`. There are some additional -doom emacs' colorschemes port for Neovim that can be enabled by uncommenting -the `doom-themes` in your `doomrc.lua`. - -You can switch between colorschemes by doing <Space>ds and then type the name -of the colorscheme you want to use. You can also edit the `doom_config.lua` -file located at `$HOME/.config/doom-nvim` (see |doom_nvim_hacking|). - - -============================================================================== -CONFIGURATION *doom_nvim_configuration* - -The Doom Neovim configuration files reside under the -`$HOME/.config/doom-nvim/` directory. See |doom_nvim_hacking| for more -info. - - -============================================================================== -LAYOUT *doom_nvim_configuration_layout* - -Excluding the statusline and the tabline, Doom Nvim will mostly have the -following layout: - -|--------------------------------------|~ -| | | | |~ -| | | | |~ -| | | | |~ -| | B | D* | E* |~ -| A* | | | |~ -| | | | |~ -| | | | |~ -| |--------------------| | |~ -| | C* | | |~ -|--------------------------------------|~ - - - -'A' : The file explorer (Plugin: nvim-tree.lua) -'B' : The main buffer -'C' : The terminal (Plugin: nvim-toggleterm.lua) -'D' : The minimap (Plugin: minimap.vim) -'E' : The symbol outline (Plugin: SymbolsOutline) - -Sections with `*` are not opened by default but can be toggled. -See |doom_nvim_commands| for more information. - - -============================================================================== -FILE EXPLORER *doom_nvim_configuration_layout_explorer* - -Doom Neovim uses the `kyazdani42/nvim-tree.lua` plugin as a file explorer. -It can be toggled by running the following commands: -<Space>oe for `FileExplorer` -<F3> for `FileExplorer` - -To create a new file within the file explorer, do <n>[name_of_file] -Append a `/` if you want to create a directory. - -Check https://github.com/kyazdani42/nvim-tree.lua for more info. - - -============================================================================== -MAIN BUFFER *doom_nvim_configuration_layout_mainbuffer* - -The main buffer is the buffer where the code is opened. - -To split the main buffer, do <Space>w and then select the split method you -want to use horizontally (`s`), or vertically (`v`). - - -============================================================================== -OUTLINE *doom_nvim_configuration_layout_outline* - -Symbols-Outline is a plugin that can show the tags and structure of the opened -file, ordered by its scope. For this function, Doom Nvim makes use of -`simrat39/symbols-outline.nvim`. It can be toggled by performing the following -commands: - -<Space>os for `Symbols-Outline` -<F2> for `Symbols-Outline` - -See https://github.com/simrat39/symbols-outline.nvim for more information. - - -============================================================================== -MINIMAP *doom_nvim_configuration_layout_minimap* - -Doom Nvim uses `wfxr/minimap.vim` plugin as its minimap. -It can be toggled by performing the following commands: -<Space>om for `Minimap` -<F5> for `Minimap` - - -============================================================================== -TERMINAL *doom_nvim_configuration_layout_terminal* - -The terminal is placed like in others editors, e.g. Visual Studio Code. The -buffer of the terminal is automatically set to `INSERT` mode. The only way to -close it is to enter `exit` to close the shell session, or if you just want to -toggle it, you can enter in `NORMAL` mode: - -<Space>ot for `Terminal` -<F4> for `Terminal` - - -============================================================================== -MODULES *doom_nvim_configuration_modules* - -Doom Nvim consists of around 5 modules. A Doom Nvim Module is a -bundle of plugins, configuration and commands, organized into a unit that can -be toggled easily. - -To give a quick summary, the modules are as follows: - - UI, everything related to UI - - Doom, neorg and built-in plugins - - Editor, everything related to editing, e.g. tree explorer, git signs, lsp - - Langs, languages support for Doom and language servers - - Utilities, some utility plugins like neogit - -You can see in a more detailed view the modules and its plugins at -https://github.com/NTBBloodbath/doom-nvim/blob/main/docs/modules.md - - -============================================================================== -TWEAKING MODULES *doom_nvim_configuration_modules_tweaking* - -For tweaking a module (enable / disable its plugins) you will only need to -comment or uncomment the desired plugin, e.g. for disabling the tree explorer -you will only need to comment it. - -`-- Right now the Tree explorer is enabled` -`'explorer',` - -`-- Now the Tree explorer is disabled` -`-- 'explorer',` - -NOTE: after doing changes to your modules you will only need to restart Neovim -and Doom Nvim will automatically handle your changes on here. - - -============================================================================== -CUSTOM PLUGINS *doom_nvim_configuration_custom_plugins* - -To use your own plugins in Doom Nvim you can use the `plugins.lua` file -located in the Doom Nvim root directory. - -NOTE: if you are familiar with `packer.nvim` (the plugins manager used by Doom -Nvim) then you can see the `plugins.lua` file as a wrapper for it. - -To add plugins without extra configurations (e.g., if a plugin does not depend -on other plugins), you can simply set it as follow: - -` return {` -` 'andweeb/presence.nvim'` -` }` - -Otherwise, if your plugin depends on other or you do not want to enable it, -then you can do it as follow: - -` return {` -` {` -` 'andweeb/presence.nvim',` -` requires = { 'john/foo', 'doe/bar' },` -` }` -` }` - -As you can see, the second way depends on a structure to work. -All the fields for declaring plugins can be found at -https://github.com/wbthomason/packer.nvim#specifying-plugins - - -============================================================================== -LSP *doom_nvim_configuration_lsp* - -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`. - -To enable the language server for a certain programming language and -automatically install it, just append a `+lsp` flag at the end of the language -field in your `doomrc.lua`, e.g. for enabling Rust support in Doom and install -`rust-analyzer`: - -` local doom = {` -` langs = {` -` 'rust +lsp', -- Let's get rusty!` -` }` -` }` - -NOTE: You can see a list of currently supported languages at -https://github.com/kabouzeid/nvim-lspinstall#bundled-installers - - -============================================================================== -COMMANDS *doom_nvim_commands* - -Doom Nvim have its own commands, to make your life easier when developing. - -| `:DoomUpdate` | Update Doom Nvim if there are updates. -| `:DoomRollback` | Rollback Doom Nvim to a previous version. - -Doom Nvim also uses `WhichKey` as a commands manager, inspired by -emacs's guide-key. To open it, press <Space> and wait for the popup to show, -it should not take much time. Each section has a label and is mnemonic. -e.g: - - `Open Terminal` > <Space>ot - -There are multiple sections for Doom Nvim's commands. Those sections create a -path in the decision tree that identifies any command. - -Let's say you want to go to the next buffer you are working on. You will need -to perform the following keystrokes: - -<Space>b - -in order to open the `Buffer` section. There we want to go to the `n`ext -buffer. - -<Space>bn - -Finally, we changed our current buffer to the next buffer in our workspace. -You can see more keybindings in |doom_nvim_commands_keybindings| - - -============================================================================== -KEYBINDINGS *doom_nvim_commands_keybindings* - -In Doom Nvim, we make use of the <Space> keystroke as the map leader. - -| <,> | Switch buffer -| <.> | Browse files -| </> | Search -| <:> | Command history -| <`> | Switch buffer -| <Space> | Find file - -| <b>uffer -| | <[> Previous buffer -| | <]> Next buffer -| | <b> Switch to other buffer -| | <c> Close buffer -| | <f> Format buffer -| | <g> Goto buffer -| | <n> Next buffer -| | <p> Previous buffer -| <c>ode -| | <b> Compile project -| | <c> Compile and run project -| | <h> Run rest client on the line that the cursor is -| | <i> Start a REPL -| | <r> Run current file -| | <l> +lsp -| <d>oom -| | <c> Edit your Doom Nvim configuration -| | <d> Open Doom Nvim documentation -| | <R> Create crash reports, useful for debugging -| | <r> Rollback Doom Nvim version -| | <s> Change colorscheme -| | <u> Check Doom Nvim updates -| <f>ile -| | <c> Edit Neovim configuration -| | <f> Find files -| | <n> New unnamed buffer -| | <R> Re-open an unreadable file with sudo permissions -| | <r> Recently opened files -| | <t> Help tags -| | <w> Write an unwritable file with sudo permissions -| <g>it -| | <B> Branches -| | <b> Blame line -| | <c> Commits -| | <h> Preview hunk -| | <R> Reset buffer -| | <r> Reset hunk -| | <o> Open LazyGit -| | <l> Pull -| | <p> Push -| | <S> Stage hunk -| | <s> Status -| | <u> Undo stage hunk -| <l>sp -| | <a> Code actions -| | <d> Show type definition -| | <i> Lsp info -| | <l> Show line diagnostics -| | <L> Diagnostics into location list -| <o>pen -| | <d> Start screen -| | <e> Tree explorer -| | <m> Minimap -| | <s> LSP Symbols -| | <t> Terminal -| <p>lugin -| | <c> Clean unused plugins -| | <C> Compile your plugins changes -| | <i> Install missing plugins -| | <p> Profile the time taken loading your plugins -| | <s> Sync plugins (Clean and Update) -| | <S> Plugins status -| <q>uit / -| sessions -| | <l> Session switcher -| | <q> Quit -| | <r> Restore previously saved session -| | <s> Save current session -| | <w> Save and quit -| <s>earch -| | <b> Buffer -| | <g> Grep -| | <h> Command history -| | <m> Jump to mark -| | <s> Goto symbol -| <w>indow -| | <-> Split window below -| | <2> Layout double columns -| | <=> Balance window -| | <|> Split window right -| | <d> Delete window -| | <H> Expand window left -| | <h> Window left -| | <J> Expand window below -| | <j> Window below -| | <K> Expand window up -| | <k> Window up -| | <L> Expand window right -| | <l> Window right -| | <s> Split window below -| | <v> Split window right -| | <w> Other window - -But there is still more, Doom Nvim knows that you love to use the keyboard but -you do not like to be typing so much so it has more keybindings that will make -your life easier! - -| <TAB> | Cycle buffers (next buffer) -| <S-TAB> | Cycle buffers (prev buffer) -| <ESC> | Search highlighting off -| <F2> | Toggle Symbols-Outline -| <F3> | Toggle Tree Explorer -| <F4> | Toggle Terminal -| <F5> | Toggle Minimap -| <F6> | Toggle Zen mode -| <F7> | Run rest client -| <Z><Z> | Fast exit from Doom Nvim -| <j><k> | Fast exit from `INSERT` mode -| <g><c><c> | Comment current line (`NORMAL` mode) -| <g><c> | Comment selected block (`VISUAL` mode) -| <C-h> | Select window left -| <C-j> | Select window below -| <C-k> | Select window up -| <C-l> | Select window right -| <C-Up> | Resize window up -| <C-Down> | Resize window below -| <C-Left> | Resize window left -| <C-Right> | 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 - - <h ยท l> - - j - v - -See `Tutor` to know how to use Vim and its keybindings. - -To move around buffers execute <Space>b to select the `buffers` section -and then press the key <g> to select a buffer or press `<TAB>` 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 (<Leader>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 (<Leader>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<CR>', 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<CR>', 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 (<Leader>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<CR>'} + -- {'n', 'ca', ':Lspsaga code_action<CR>', 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. <runtimepath>/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. <runtimepath>/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. <runtimepath>/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() -- <leader>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() -- <leader>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() -- <leader>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() -- <leader>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() -- <leader>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() -- <leader>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() -- <leader>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() -- <leader>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", "<CR>:Lexplore<CR>", opts) + + -- Open file or directory + vim.api.nvim_buf_set_keymap(0, "n", "o", "<CR>", 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()<CR>", + opts + ) ]] + + -- Close netrw + vim.api.nvim_buf_set_keymap(0, "n", "q", ":Lexplore<CR>", opts) + + ----- Files and Directories --------- + ------------------------------------- + -- Create a new file and save it + vim.api.nvim_buf_set_keymap(0, "n", "ff", "%:w<CR>:buffer #<CR>", 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")<CR>', + opts + ) + + -- Show target directory + vim.api.nvim_buf_set_keymap( + 0, + "n", + "ft", + ':echo "Target: " . netrw#Expose("netrwmftgt")<CR>', + opts + ) + + ----- Marks (selections) ------------ + ------------------------------------- + -- Toggle the mark on a file or directory + vim.api.nvim_buf_set_keymap(0, "n", "<TAB>", "mf", opts) + + -- Unmark all the files in the current buffer + vim.api.nvim_buf_set_keymap(0, "n", "<S-TAB>", "mF", opts) + + -- Remove all the marks on all files + vim.api.nvim_buf_set_keymap(0, "n", "<Leader><TAB>", "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", + "<buffer>", + "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 <silent> <buffer> q :q<CR>", + }) +end + +-- Show line diagnostics on hover +if not config.doom.enable_lsp_virtual_text then + table.insert(autocmds["doom_extras"], { + "CursorHold,CursorHoldI", + "<buffer>", + '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()<CR>", + opts, + "LSP", + "jump_to_definition", + "Jump to definition" +) +-- gr: go to reference +mappings.map( + "n", + "gr", + ":lua vim.lsp.buf.references()<CR>", + opts, + "LSP", + "goto_reference", + "Goto reference" +) +-- gi: buf implementation +mappings.map( + "n", + "gi", + ":lua vim.lsp.buf.implementation()<CR>", + opts, + "LSP", + "goto_implementation", + "List implementations" +) +-- ca: code actions +mappings.map( + "n", + "ca", + ":lua vim.lsp.buf.code_action()<CR>", + opts, + "LSP", + "code_action", + "Code action" +) +-- K: hover doc +mappings.map( + "n", + "K", + ":lua vim.lsp.buf.hover()<CR>", + opts, + "LSP", + "hover_doc", + "Hover documentation" +) +-- Control+p: Jump to previous diagnostic +mappings.map( + "n", + "<C-p>", + ":lua vim.lsp.diagnostic.goto_prev()<CR>", + opts, + "LSP", + "prev_diagnostic", + "Jump to previous diagnostic" +) +-- Control+n: Jump to next diagnostic +mappings.map( + "n", + "<C-n>", + ":lua vim.lsp.diagnostic.goto_next()<CR>", + 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", + "<Tab>", + 'luasnip#expand_or_jumpable() ? "<Plug>luasnip-expand-or-jump" : "<Tab>"', + lsp_opts, + "Snippets", + "luasnip_expand", + "Expand snippet" + ) + mappings.map( + "i", + "<S-Tab>", + '<cmd>lua require("luasnip").jump(-1)<CR>', + opts, + "Snippets", + "luasnip_prev_sel", + "Previous snippet" + ) + + mappings.map( + "s", + "<Tab>", + '<cmd>lua require("luasnip").jump(1)<CR>', + opts, + "Snippets", + "luasnip_next_sel", + "Next snippet" + ) + mappings.map( + "s", + "<S-Tab>", + '<cmd>lua require("luasnip").jump(-1)<CR>', + opts, + "Snippets", + "luasnip_prev_sel_s", + "Previous snippet (Select mode)" + ) + + mappings.map( + "i", + "<C-E>", + 'luasnip#choice_active() ? "<Plug>luasnip-next-choice" : "<C-E>"', + lsp_opts, + "Snippets", + "luasnip_next_choice", + "Next snippets field" + ) + mappings.map( + "s", + "<C-E>", + 'luasnip#choice_active() ? "<Plug>luasnip-next-choice" : "<C-E>"', + 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", + '<cmd>lua require("doom.core.functions").quit_doom(true, true)<CR>', + opts, + "Editor", + "fast_exit", + "Fast exit from Doom Nvim" +) + +-- ESC to turn off search highlighting +mappings.map( + "n", + "<esc>", + ":noh<CR>", + opts, + "Editor", + "no_highlight", + "Turn off search highlighting" +) + +---[[-----------------]]--- +-- Disable keys -- +---]]-----------------[[--- +-- Disable accidentally pressing ctrl-z and suspending +mappings.map("n", "<c-z>", "<Nop>", opts, "Editor", "disable_suspending", "Disable suspending") + +-- Disable ex mode +mappings.map("n", "Q", "<Nop>", opts, "Editor", "disable_ex", "Disable ex mode") + +-- Disable recording macros +if config.doom.disable_macros then + mappings.map("n", "q", "<Nop>", 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, + "<ESC>", + 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<n> keybindings -- +---]]------------------[[--- +if not is_plugin_disabled("symbols") then + mappings.map( + "n", + "<F2>", + ":SymbolsOutline<CR>", + 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", + "<F3>", + ":NvimTreeToggle<CR>", + opts, + "Editor", + "open_tree", + "Toggle file explorer" + ) +else + mappings.map( + "n", + "<F3>", + string.format(":Lexplore%s<CR>", config.doom.explorer_right and "!" or ""), + opts, + "Editor", + "open_tree", + "Toggle file explorer" + ) +end +if not is_plugin_disabled("minimap") then + mappings.map( + "n", + "<F5>", + ":MinimapToggle<CR>", + opts, + "Editor", + "open_minimap", + "Toggle code minimap" + ) +end +if not is_plugin_disabled("zen") then + mappings.map("n", "<F6>", ":TZAtaraxis<CR>", opts, "Editor", "open_zen", "Toggle Zen mode") +end +if not is_plugin_disabled("restclient") then + mappings.map( + "n", + "<F7>", + ":<Plug>RestNvim<CR>", + 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", "<Space>", "<Nop>", opts, "Editor", "open_whichkey", "Open WhichKey menu") -vim.g.mapleader = " " - ------------------------------------------------- ---[[---------------------------------]]--- -- Custom Key mappings -- -- -- --- <leader>b = Buffer Menu -- --- <leader>f = File Menu -- --- <leader>g = Git Menu -- --- <leader>p = Plugin Menu -- --- <leader>r = Runner Menu -- --- <leader>s = Session Menu -- --- <leader>t = Toggle Menu -- --- <leader>w = Window Menu -- +-- <leader>b = +buffers -- +-- <leader>c = +code -- +-- <leader>d = +debug -- +-- <leader>l = +lsp -- +-- <leader>d = +doom -- +-- <leader>f = +file -- +-- <leader>g = +git -- +-- <leader>p = +plugins -- +-- <leader>q = +quit/sessions -- +-- <leader>s = +search -- +-- <leader>t = +tweak -- +-- <leader>w = +windows -- +-- <leader>o = +open -- +-- <leader>j = +jumps -- -- -- -- TAB = Cycle buffers -- -- ESC = Search highlight off -- @@ -43,1116 +41,30 @@ vim.g.mapleader = " " ------------------------------------------------- ----[[-----------------]]--- --- LSP Keybindings -- ----]]-----------------[[--- - -local lsp_opts = vim.tbl_extend("force", opts, { expr = true }) - --- If the LSP is not disabled and compe is installed then set its mappings. -if functions.check_plugin("nvim-compe", "opt") then - -- https://github.com/hrsh7th/nvim-compe#mappings - utils.map( - "i", - "<C-Space>", - "compe#complete()", - lsp_opts, - "Completion", - "compe_complete", - "Complete" - ) - utils.map( - "i", - "<CR>", - 'compe#confirm("<CR>")', - lsp_opts, - "Completion", - "compe_confirm", - "Confirm completion" - ) - utils.map( - "i", - "<C-e>", - 'compe#close("<C-e>")', - lsp_opts, - "Completion", - "compe_close", - "Close compe menu" - ) - utils.map( - "i", - "<C-f>", - 'compe#scroll({ "delta": +4 })', - lsp_opts, - "Completion", - "compe_indent", - "Indent current line" - ) - utils.map( - "i", - "<C-d>", - 'compe#scroll({ "delta": -4 })', - lsp_opts, - "Completion", - "compe_dedent", - "Dedent current line" - ) - -- gd: jump to definition - utils.map( - "n", - "gd", - ":lua vim.lsp.buf.definition()<CR>", - opts, - "LSP", - "jump_to_definition", - "Jump to definition" - ) - -- gr: go to reference - utils.map( - "n", - "gr", - ":lua vim.lsp.buf.references()<CR>", - opts, - "LSP", - "goto_reference", - "Goto reference" - ) - -- gi: buf implementation - utils.map( - "n", - "gi", - ":lua vim.lsp.buf.implementation()<CR>", - opts, - "LSP", - "goto_implementation", - "List implementations" - ) - -- ca: code actions - utils.map( - "n", - "ca", - ":lua vim.lsp.buf.code_action()<CR>", - opts, - "LSP", - "code_action", - "Code action" - ) - -- K: hover doc - utils.map( - "n", - "K", - ":lua vim.lsp.buf.hover()<CR>", - opts, - "LSP", - "hover_doc", - "Hover documentation" - ) - -- Control+p: Jump to previous diagnostic - utils.map( - "n", - "<C-p>", - ":lua vim.lsp.diagnostic.goto_prev()<CR>", - opts, - "LSP", - "prev_diagnostic", - "Jump to previous diagnostic" - ) - -- Control+n: Jump to next diagnostic - utils.map( - "n", - "<C-n>", - ":lua vim.lsp.diagnostic.goto_next()<CR>", - opts, - "LSP", - "next_diagnostic", - "Jump to next diagnostic" - ) - - vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') -end - --- LuaSnip mappings -utils.map( - "n", - "<Tab>", - 'luasnip#expand_or_jumpable() ? "<Plug>luasnip-expand-or-jump" : "<Tab>"', - lsp_opts, - "Snippets", - "luasnip_expand", - "Expand snippet" -) -utils.map( - "i", - "<S-Tab>", - '<cmd>lua require("luasnip").jump(-1)<CR>', - opts, - "Snippets", - "luasnip_prev_sel", - "Previous snippet" -) - -utils.map( - "s", - "<Tab>", - '<cmd>lua require("luasnip").jump(1)<CR>', - opts, - "Snippets", - "luasnip_next_sel", - "Next snippet" -) -utils.map( - "s", - "<S-Tab>", - '<cmd>lua require("luasnip").jump(-1)<CR>', - opts, - "Snippets", - "luasnip_prev_sel_s", - "Previous snippet (Select mode)" -) - -utils.map( - "i", - "<C-E>", - 'luasnip#choice_active() ? "<Plug>luasnip-next-choice" : "<C-E>"', - lsp_opts, - "Snippets", - "luasnip_next_choice", - "Next snippets field" -) -utils.map( - "s", - "<C-E>", - 'luasnip#choice_active() ? "<Plug>luasnip-next-choice" : "<C-E>"', - lsp_opts, - "Snippets", - "luasnip_next_choice_s", - "Next snippet field" -) - -if config.doom.new_file_split then - utils.map( - "n", - "<Leader>fn", - ":new<CR>", - opts, - "Editor", - "new_buffer_split", - "Open a new unnamed buffer in a split window" - ) -else - utils.map( - "n", - "<Leader>fn", - ":enew<CR>", - opts, - "Editor", - "new_buffer", - "Open a new unnamed buffer" - ) -end - --- TAB to cycle buffers too, why not? -utils.map("n", "<Tab>", ":bnext<CR>", opts, "Movement", "cycle_next_buffer", "Goto next buffer") -utils.map( - "n", - "<S-Tab>", - ":bprevious<CR>", - opts, - "Movement", - "cycle_prev_buffer", - "Goto prev buffer" -) - --- ESC to turn off search highlighting -utils.map("n", "<esc>", ":noh<CR>", opts, "Editor", "no_highlight", "Turn off search highlighting") - ---- F<n> keybindings -if not functions.is_plugin_disabled("symbols") then - utils.map( - "n", - "<F2>", - ":SymbolsOutline<CR>", - opts, - "Editor", - "open_symbols", - "Toggle SymbolsOutline (LSP tags)" - ) -end -if not functions.is_plugin_disabled("explorer") then - utils.map("n", "<F3>", ":NvimTreeToggle<CR>", opts, "Editor", "open_tree", "Toggle file explorer") -end -if not functions.is_plugin_disabled("minimap") then - utils.map( - "n", - "<F5>", - ":MinimapToggle<CR>", - opts, - "Editor", - "open_minimap", - "Toggle code minimap" - ) -end -if not functions.is_plugin_disabled("zen") then - utils.map("n", "<F6>", ":TZAtaraxis<CR>", opts, "Editor", "open_zen", "Toggle Zen mode") -end -if not functions.is_plugin_disabled("restclient") then - utils.map( - "n", - "<F7>", - ":<Plug>RestNvim<CR>", - opts, - "Editor", - "exec_http", - "Execute http client under cursor" - ) +local keybinds_modules = config.doom.keybinds_modules + or { + -- Core doom keybindings + core = true, + -- Movement keybindings, jump between your windows, buffers and code + movement = true, + -- Leader keybindings, a bunch of useful keybindings managed by space key + -- WARNING: disabling this will break which-key plugin if the plugin is enabled + leader = true, + -- Completion and snippets keybindings + completion = true, + } + +for module in pairs(keybinds_modules) do + if keybinds_modules[module] then + local ok, err = xpcall(require, debug.traceback, ("doom.extras.keybindings.%s"):format(module)) + if not ok then + log.error( + string.format( + "There was an error loading the module 'doom.extras.keybindings.%s'. Traceback:\n%s", + module, + err + ) + ) + end + end end - ----[[-------------------------]]--- --- Window Movements keys -- ----]]-------------------------]]--- -utils.map("n", "<C-h>", "<C-w>h", opts, "Movement", "left_window", "Goto left window") -utils.map("n", "<C-j>", "<C-w>j", opts, "Movement", "down_window", "Goto down window") -utils.map("n", "<C-k>", "<C-w>k", opts, "Movement", "up_window", "Goto upper window") -utils.map("n", "<C-l>", "<C-w>l", opts, "Movement", "right_window", "Goto right window") - ----[[-----------------]]--- --- Escape Remaps -- ----]]-----------------[[--- -utils.map("i", "jk", "<ESC>", opts, "Editor", "exit_insert", "Exit insert mode") - ----[[-----------------]]--- --- Make inclusive -- ----]]-----------------[[--- --- BUG: my nvim freezes from this when which key shows up --- NOTE: IMO inclusive is better --- utils.map("o", "T", "vT", opts, "Editor", "occurence_backw_inclusive", "Backwards occurence inclusive") --- utils.map("o", "F", "vF", opts, "Editor", "occurence_backw_till_inclusive", "Backwards occurence till inclusive") - ----[[-----------------]]--- --- Move Lines -- ----]]-----------------[[--- -utils.map( - "n", - "<a-j>", - ":m .+1<CR>==", - opts, - "Editor", - "normal_move_line_down", - "Normal Move line down" -) -utils.map( - "n", - "<a-k>", - ":m .-2<CR>==", - opts, - "Editor", - "normal_move_line_up", - "Normal Move line up" -) -utils.map( - "i", - "<a-j>", - "<esc>:m .+1<CR>==gi", - opts, - "Editor", - "instert_move_line_down", - "Insert Move line down" -) -utils.map( - "i", - "<a-k>", - "<esc>:m .-2<CR>==gi", - opts, - "Editor", - "instert_move_line_up", - "Insert Move line up" -) -utils.map( - "v", - "<a-j>", - ":m '>+1<CR>gv=gv", - opts, - "Editor", - "visual_move_line_down", - "Visual Move line down" -) -utils.map( - "v", - "<a-k>", - ":m '<-2<CR>gv=gv", - opts, - "Editor", - "visual_move_line_up", - "Visual Move line up" -) - ----[[-----------------]]--- --- Select Movement -- ----]]-----------------[[--- -utils.map("x", "K", ":move '<-2<CR>gv-gv", opts, "Editor", "select_right", "Move selection right") -utils.map("x", "J", ":move '>+1<CR>gv-gv", opts, "Editor", "select_left", "Move selection left") - --- get out of terminal insert mode into normal mode with Esc -utils.map( - "t", - "<Esc>", - "<C-\\><C-n>", - opts, - "Editor", - "exit_insert_term", - "Exit insert mode (inside a terminal)" -) - ----[[-----------------]]--- --- Resizing Splits -- ----]]-----------------[[--- -utils.map( - "n", - "<C-Up>", - ":resize +2<CR>", - opts, - "Window", - "resize_up", - "Resize window (increase width)" -) -utils.map( - "n", - "<C-Down>", - ":resize -2<CR>", - opts, - "Window", - "resize_down", - "Resize window (decrease width)" -) -utils.map( - "n", - "<C-Right>", - ":vertical resize -2<CR>", - opts, - "Window", - "resize_right", - "Resize window (decrease height)" -) -utils.map( - "n", - "<C-Left>", - ":vertical resize +2<CR>", - opts, - "Window", - "resize_left", - "Resize window (increase height)" -) - ----[[-----------------]]--- --- Disable keys -- ----]]-----------------[[--- --- Disable accidentally pressing ctrl-z and suspending -utils.map("n", "<c-z>", "<Nop>", opts, "Editor", "disable_suspending", "Disable suspending") - --- Disable ex mode -utils.map("n", "Q", "<Nop>", opts, "Editor", "disable_ex", "Disable ex mode") - --- Disable recording macros -if config.doom.disable_macros then - utils.map("n", "q", "<Nop>", opts, "Editor", "disable_macros", "Disable macros") -end - --- Fast exit from Doom Nvim -utils.map( - "n", - "ZZ", - '<cmd>lua require("doom.core.functions").quit_doom(true, true)<CR>', - opts, - "Editor", - "fast_exit", - "Fast exit from Doom Nvim" -) - ----[[-----------------]]--- --- WhichKey binds -- ----]]-----------------[[--- - --- Misc -utils.map( - "n", - "<leader>`", - "<cmd>Telescope find_files<CR>", - opts, - "Editor", - "find_files", - "Find file" -) -utils.map( - "n", - "<leader>.", - "<cmd>Telescope file_browser<CR>", - opts, - "Editor", - "file_browser", - "Browse files" -) -utils.map( - "n", - "<leader>,", - "<cmd>Telescope buffers show_all_buffers=true<CR>", - opts, - "Movement", - "switch_buffers", - "Switch buffers" -) -utils.map( - "n", - "<leader>/", - "<cmd>Telescope live_grep<CR>", - opts, - "Editor", - "live_grep", - "Search a word" -) -utils.map( - "n", - "<leader>:", - "<cmd>Telescope command_history<CR>", - opts, - "Editor", - "command_history", - "Command history" -) - --- Buffers -utils.map( - "n", - "<leader>bc", - '<cmd>lua require("bufferline").handle_close_buffer(vim.fn.bufnr("%"))<CR>', - opts, - "Buffer", - "close_current_buffer", - "Close current buffer" -) -utils.map( - "n", - "<leader>bb", - "<cmd>e #<CR>", - opts, - "Buffer", - "switch_buffer", - "Switch to other buffer" -) -utils.map( - "n", - "<leader>b]", - '<cmd>lua require("bufferline").cycle(1)<CR>', - opts, - "Buffer", - "next_buffer_alt", - "Goto next buffer" -) -utils.map( - "n", - "<leader>bn", - '<cmd>lua require("bufferline").cycle(1)<CR>', - opts, - "Buffer", - "next_buffer", - "Goto next buffer" -) -utils.map( - "n", - "<leader>bg", - '<cmd>lua require("bufferline").pick_buffer()<CR>', - opts, - "Buffer", - "goto_buffer", - "Goto buffer" -) -utils.map( - "n", - "<leader>b[", - '<cmd>lua require("bufferline").cycle(-1)<CR>', - opts, - "Buffer", - "prev_buffer_alt", - "Goto previous buffer" -) -utils.map( - "n", - "<leader>bp", - '<cmd>lua require("bufferline").cycle(-1)<CR>', - opts, - "Buffer", - "prev_buffer", - "Goto previous buffer" -) -utils.map( - "n", - "<leader>bf", - "<cmd>FormatWrite<CR>", - opts, - "Buffer", - "format_buffer", - "Format buffer" -) - --- Doom -utils.map( - "n", - "<leader>dc", - '<cmd>lua require("doom.core.functions").edit_config()<CR>', - opts, - "Doom", - "edit_doom_config", - "Edit Doom configuration" -) -utils.map( - "n", - "<leader>dd", - "<cmd>help doom_nvim<CR>", - opts, - "Doom", - "help_doom", - "Open Doom help pages" -) -utils.map("n", "<leader>du", "<cmd>DoomUpdate<CR>", opts, "Doom", "update_doom", "Update Doom Nvim") -utils.map( - "n", - "<leader>dr", - "<cmd>DoomRollback<CR>", - opts, - "Doom", - "rollback_doom", - "Rollback Doom Nvim version" -) -utils.map( - "n", - "<leader>dR", - '<cmd>lua require("doom.core.functions").create_report()<CR>', - opts, - "Doom", - "create_crash_report", - "Create crash report" -) -utils.map( - "n", - "<leader>ds", - "<cmd>lua require('telescope.builtin.internal').colorscheme({enable_preview = true})<CR>", - opts, - "Editor", - "change_colorscheme", - "Change colorscheme" -) -utils.map( - "n", - "<leader>db", - "<cmd>Telescope mapper<CR>", - opts, - "Doom", - "show_keybindings", - "Show Doom keybindings" -) -utils.map( - "n", - "<leader>dl", - "<cmd>lua require('doom.core.functions').reload_custom_settings()<CR>", - opts, - "Doom", - "reload_user_settings", - "Reload user custom settings" -) - --- Plugins -utils.map( - "n", - "<leader>ps", - "<cmd>PackerSync<CR>", - opts, - "Plugins", - "packer_sync", - "Synchronize your plugins" -) -utils.map( - "n", - "<leader>pi", - "<cmd>PackerInstall<CR>", - opts, - "Plugins", - "packer_install", - "Install missing plugins" -) -utils.map( - "n", - "<leader>pc", - "<cmd>PackerClean<CR>", - opts, - "Plugins", - "packer_clean", - "Clean unused plugins" -) -utils.map( - "n", - "<leader>pC", - "<cmd>PackerCompile<CR>", - opts, - "Plugins", - "packer_compile", - "Compile your plugins changes" -) -utils.map( - "n", - "<leader>pS", - "<cmd>PackerStatus<CR>", - opts, - "Plugins", - "packer_status", - "Plugins status" -) -utils.map( - "n", - "<leader>pp", - "<cmd>PackerProfile<CR>", - opts, - "Plugins", - "packer_profile", - "Profile the time taken loading your plugins" -) - --- files -utils.map( - "n", - "<leader>fc", - "<cmd>e $MYVIMRC<CR>", - opts, - "Editor", - "edit_vimrc", - "Edit your Neovim rc" -) -utils.map( - "n", - "<leader>ff", - "<cmd>Telescope find_files<CR>", - opts, - "Editor", - "find_files_alt", - "Find files" -) - -utils.map( - "n", - "<leader>fr", - "<cmd>Telescope oldfiles<CR>", - opts, - "Editor", - "recent_files", - "Recently opened files" -) -utils.map( - "n", - "<leader>ft", - "<cmd>Telescope help_tags<CR>", - opts, - "Editor", - "help_tags", - "Help tags" -) -utils.map( - "n", - "<leader>fR", - "<cmd>SudaRead<CR>", - opts, - "Editor", - "read_sudo", - "Re-open file with sudo permissions" -) -utils.map( - "n", - "<leader>fw", - "<cmd>SudaWrite<CR>", - opts, - "Editor", - "write_sudo", - "Write file with sudo permissions" -) - --- search -utils.map( - "n", - "<leader>sg", - "<cmd>Telescope live_grep<CR>", - opts, - "Editor", - "live_grep_alt", - "Search a word" -) -utils.map( - "n", - "<leader>sb", - "<cmd>Telescope current_buffer_fuzzy_find<CR>", - opts, - "Editor", - "fzf", - "Search in buffer" -) -utils.map( - "n", - "<leader>ss", - "<cmd>Telescope lsp_document_symbols<CR>", - opts, - "LSP", - "lsp_symbols", - "Goto symbol" -) -utils.map( - "n", - "<leader>sh", - "<cmd>Telescope command_history<CR>", - opts, - "Editor", - "command_history_alt", - "Command history" -) -utils.map( - "n", - "<leader>sm", - "<cmd>Telescope marks<CR>", - opts, - "Editor", - "jump_mark", - "Jump to mark" -) - --- windows -utils.map("n", "<leader>ww", "<C-W>p", opts, "Window", "other_window", "Goto other window") -utils.map("n", "<leader>wd", "<C-W>c", opts, "Window", "close_window", "Close current window") -utils.map("n", "<leader>w-", "<C-W>s", opts, "Window", "split_below", "Split window below") -utils.map("n", "<leader>w|", "<C-W>v", opts, "Window", "split_right", "Split window right") -utils.map("n", "<leader>w2", "<C-W>v", opts, "Window", "double_layout", "Layout double columns") -utils.map("n", "<leader>wh", "<C-W>h", opts, "Window", "window_left", "Window left") -utils.map("n", "<leader>wj", "<C-W>j", opts, "Window", "window_below", "Window below") -utils.map("n", "<leader>wl", "<C-W>l", opts, "Window", "window_right", "Window right") -utils.map("n", "<leader>wk", "<C-W>k", opts, "Window", "window_up", "Window up") -utils.map("n", "<leader>wH", "<C-W>5<", opts, "Window", "expand_window_left", "Expand window left") -utils.map( - "n", - "<leader>wJ", - "<cmd>resize +5<CR>", - opts, - "Window", - "expand_window_below", - "Expand window below" -) -utils.map( - "n", - "<leader>wL", - "<C-W>5>", - opts, - "Window", - "expand_window_right", - "Expand window right" -) -utils.map( - "n", - "<leader>wK", - "<cmd>resize -5<CR>", - opts, - "Window", - "expand_window_up", - "Expand window up" -) -utils.map("n", "<leader>w=", "<C-W>=", opts, "Window", "balance_window", "Balance window") -utils.map("n", "<leader>ws", "<C-W>s", opts, "Window", "split_below_alt", "Split window below") -utils.map("n", "<leader>wv", "<C-W>v", opts, "Window", "split_right_alt", "Split window right") - --- quit / sessions -utils.map( - "n", - "<leader>qq", - '<cmd>lua require("doom.core.functions").quit_doom()<CR>', - opts, - "Editor", - "save_nvim", - "Exit Neovim" -) -utils.map( - "n", - "<leader>qw", - '<cmd>lua require("doom.core.functions").quit_doom(true, true)<CR>', - opts, - "Editor", - "save_exit_nvim", - "Save and exit Neovim" -) -utils.map( - "n", - "<leader>qr", - "<cmd>lua require('persistence').load({ last = true })<CR>", - opts, - "Editor", - "restore_session", - "Restore previously saved session" -) - --- toggle -utils.map( - "n", - "<leader>ob", - "<cmd>lua require('dapui').toggle()<CR>", - opts, - "Editor", - "open_dapui", - "Open debugging UI" -) -utils.map( - "n", - "<leader>od", - "<cmd>Dashboard<CR>", - opts, - "Editor", - "open_dashboard", - "Open start screen" -) -utils.map( - "n", - "<leader>oe", - "<cmd>NvimTreeToggle<CR>", - opts, - "Editor", - "open_tree_alt", - "Toggle file explorer" -) -utils.map( - "n", - "<leader>om", - "<cmd>MinimapToggle<CR>", - opts, - "Editor", - "open_minimap_alt", - "Toggle code minimap" -) -utils.map( - "n", - "<leader>or", - "<cmd>Ranger<CR>", - opts, - "Editor", - "open_ranger_browser", - "Toggle Ranger File Browser" -) -utils.map( - "n", - "<leader>os", - "<cmd>SymbolsOutline<CR>", - opts, - "Editor", - "open_symbols_alt", - "Toggle SymbolsOutline (LSP symbols)" -) -utils.map( - "n", - "<leader>ot", - "<cmd>ToggleTerm<CR>", - opts, - "Editor", - "open_terminal", - "Toggle terminal" -) - --- git -utils.map("n", "<leader>go", "<cmd>LazyGit<CR>", opts, "Git", "lazygit", "Open LazyGit") -utils.map( - "n", - "<leader>gl", - '<cmd>TermExec cmd="git pull"<CR>', - opts, - "Git", - "git_pull", - "Pull remote changes" -) -utils.map( - "n", - "<leader>gp", - '<cmd>TermExec cmd="git push"<CR>', - opts, - "Git", - "git_push", - "Push git changes" -) -utils.map( - "n", - "<leader>gs", - "<cmd>Telescope git_status<CR>", - opts, - "Git", - "git_status", - "Browse git status" -) -utils.map( - "n", - "<leader>gB", - "<cmd>Telescope git_branches<CR>", - opts, - "Git", - "git_branches", - "Browse git branches" -) -utils.map( - "n", - "<leader>gc", - "<cmd>Telescope git_commits<CR>", - opts, - "Git", - "git_commits", - "Browse git commits" -) - --- code -utils.map( - "n", - "<leader>ch", - "<Plug>RestNvim<CR>", - opts, - "Editor", - "exec_http_alt", - "Execute http client under cursor" -) -utils.map( - "n", - "<leader>ci", - '<cmd>lua require("doom.modules.built-in.runner").start_repl()<CR>', - opts, - "Editor", - "start_repl", - "Start a REPL" -) -utils.map( - "n", - "<leader>cr", - '<cmd>lua require("doom.modules.built-in.runner").run_code()<CR>', - opts, - "Editor", - "run_file", - "Run the current file" -) -utils.map( - "n", - "<leader>cb", - '<cmd>lua require("doom.modules.built-in.compiler").compile()<cr>', - opts, - "Editor", - "compile", - "Compile project" -) -utils.map( - "n", - "<leader>cc", - '<cmd>lua require("doom.modules.built-in.compiler").compile_and_run()<cr>', - opts, - "Editor", - "compile_and_run", - "Compile and run project" -) - --- debugging -utils.map( - "n", - "<leader>cdb", - "<cmd>lua require('dap').toggle_breakpoint()<CR>", - opts, - "DAP", - "dap_toggle_brkpt", - "Toggle breakpoint on current line" -) -utils.map( - "n", - "<leader>cdc", - "<cmd>lua require('dap').continue()<CR>", - opts, - "DAP", - "dap_continue", - "Start (or continue) a debug session" -) -utils.map( - "n", - "<leader>cdd", - "<cmd>lua require('dap').disconnect()", - opts, - "DAP", - "dap_disconnect", - "End debugging session" -) -utils.map( - "n", - "<leader>cde", - "<cmd>lua require('dapui').eval()<CR>", - opts, - "DAP", - "dap_eval", - "Evaluate word under cursor" -) -utils.map( - "v", - "<leader>cds", - "<cmd>lua require('dapui').eval()<CR>", - opts, - "DAP", - "dap_eval_selection", - "Evaluate selection" -) - --- lsp -utils.map("n", "<leader>cli", "<cmd>LspInfo<CR>", opts, "LSP", "lsp_info", "LSP Information") -utils.map( - "n", - "<leader>cla", - "<cmd>lua vim.lsp.buf.code_action()<CR>", - opts, - "LSP", - "code_action_alt", - "Code actions" -) -utils.map( - "n", - "<leader>cld", - "<cmd>lua vim.lsp.buf.type_definition()<CR>", - opts, - "LSP", - "type_definition", - "Show type definition" -) -utils.map( - "n", - "<leader>cll", - "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", - opts, - "LSP", - "line_diagnostic", - "Show line diagnostics" -) -utils.map( - "n", - "<leader>clq", - "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", - opts, - "LSP", - "diagnostic_list", - "Diagnostics into location list" -) - --- jumps -utils.map("n", "<leader>ja", "<C-^>", opts, "Jumps", "jump_alternate_file", "Alternate file") -utils.map("n", "<leader>jj", "<C-o>", opts, "Jumps", "jump_older", "Jump to older pos") -utils.map("n", "<leader>jk", "<C-i>", opts, "Jumps", "jump_newer", "Jump to newer pos") -utils.map("n", "<leader>jp", ":pop<CR>", opts, "Jumps", "jump_pop_tag", "Pop from tag stack") -utils.map( - "n", - "<leader>jt", - ":tag<CR>", - opts, - "Jumps", - "jump_folow_tag", - "Follow tag / add to stack" -) --- save -utils.map("n", "<leader>v", "<cmd>w<cr>", opts, "Save", "save_left", "Save v") -utils.map("n", "<leader>m", "<cmd>w<cr>", opts, "Save", "save_right", "Save m") - --- man pages -utils.map("n", "<leader>h", ":Man ", { silent = false }, "Man page", "man_page", "Man page") diff --git a/lua/doom/extras/keybindings/leader.lua b/lua/doom/extras/keybindings/leader.lua new file mode 100644 index 000000000..7fd5b5120 --- /dev/null +++ b/lua/doom/extras/keybindings/leader.lua @@ -0,0 +1,858 @@ +---[[-----------------]]--- +-- WhichKey binds -- +---]]-----------------[[--- + +local mappings = require("doom.utils.mappings") +local config = require("doom.core.config").config +local is_plugin_disabled = require("doom.utils").is_plugin_disabled + +-- Additional options for mappings +local opts = { silent = true } + +-- Set Space key as leader +if is_plugin_disabled("which-key") then + mappings.map("n", "<Space>", "<Nop>", opts, "Editor", "open_whichkey", "Open WhichKey menu") +end +vim.g.mapleader = " " + +if config.doom.new_file_split then + if config.doom.vertical_split then + mappings.map( + "n", + "<Leader>fn", + ":vert new<CR>", + opts, + "Editor", + "new_buffer_split_vertical", + "Open a new unnamed buffer in a vertical split window" + ) + else + mappings.map( + "n", + "<Leader>fn", + ":new<CR>", + opts, + "Editor", + "new_buffer_split", + "Open a new unnamed buffer in a split window" + ) + end +else + mappings.map( + "n", + "<leader>fn", + ":enew<CR>", + opts, + "Editor", + "new_buffer", + "Open a new unnamed buffer" + ) +end + +-- Misc +mappings.map( + "n", + "<leader>`", + "<cmd>lua require('telescope.builtin').find_files({cwd=vim.fn.expand('%:p:h')})<CR>", + opts, + "Editor", + "cwd_file_browser", + "Find file from CWD of current file" +) +mappings.map( + "n", + "<leader>.", + "<cmd>Telescope file_browser<CR>", + opts, + "Editor", + "file_browser", + "Browse files" +) +mappings.map( + "n", + "<leader>,", + "<cmd>Telescope buffers show_all_buffers=true<CR>", + opts, + "Movement", + "switch_buffers", + "Switch buffers" +) +mappings.map( + "n", + "<leader>/", + "<cmd>Telescope live_grep<CR>", + opts, + "Editor", + "live_grep", + "Search a word" +) +mappings.map( + "n", + "<leader>:", + "<cmd>Telescope command_history<CR>", + opts, + "Editor", + "command_history", + "Command history" +) + +-- buffers +mappings.map( + "n", + "<leader>bc", + '<cmd>lua require("bufferline").handle_close_buffer(vim.fn.bufnr("%"))<CR>', + opts, + "Buffer", + "close_current_buffer", + "Close current buffer" +) +mappings.map( + "n", + "<leader>bb", + "<cmd>e #<CR>", + opts, + "Buffer", + "switch_buffer", + "Switch to other buffer" +) +mappings.map( + "n", + "<leader>b]", + '<cmd>lua require("bufferline").cycle(1)<CR>', + opts, + "Buffer", + "next_buffer_alt", + "Goto next buffer" +) +mappings.map( + "n", + "<leader>bn", + '<cmd>lua require("bufferline").cycle(1)<CR>', + opts, + "Buffer", + "next_buffer", + "Goto next buffer" +) +mappings.map( + "n", + "<leader>bg", + '<cmd>lua require("bufferline").pick_buffer()<CR>', + opts, + "Buffer", + "goto_buffer", + "Goto buffer" +) +mappings.map( + "n", + "<leader>b[", + '<cmd>lua require("bufferline").cycle(-1)<CR>', + opts, + "Buffer", + "prev_buffer_alt", + "Goto previous buffer" +) +mappings.map( + "n", + "<leader>bp", + '<cmd>lua require("bufferline").cycle(-1)<CR>', + opts, + "Buffer", + "prev_buffer", + "Goto previous buffer" +) +mappings.map( + "n", + "<leader>bf", + "<cmd>FormatWrite<CR>", + opts, + "Buffer", + "format_buffer", + "Format buffer" +) + +-- doom +mappings.map( + "n", + "<leader>dc", + "<cmd>DoomConfigs<CR>", + opts, + "Doom", + "edit_doom_config", + "Edit Doom configuration" +) +mappings.map( + "n", + "<leader>dd", + "<cmd>DoomManual<CR>", + opts, + "Doom", + "help_doom", + "Open Doom user manual" +) +mappings.map( + "n", + "<leader>du", + "<cmd>DoomUpdate<CR>", + opts, + "Doom", + "update_doom", + "Update Doom Nvim" +) +mappings.map( + "n", + "<leader>dr", + "<cmd>DoomRollback<CR>", + opts, + "Doom", + "rollback_doom", + "Rollback Doom Nvim version" +) +mappings.map( + "n", + "<leader>dR", + "<cmd>DoomReport<CR>", + opts, + "Doom", + "create_crash_report", + "Create crash report" +) +mappings.map( + "n", + "<leader>ds", + "<cmd>lua require('telescope.builtin.internal').colorscheme({enable_preview = true})<CR>", + opts, + "Editor", + "change_colorscheme", + "Change colorscheme" +) +mappings.map( + "n", + "<leader>db", + "<cmd>Telescope mapper<CR>", + opts, + "Doom", + "show_keybindings", + "Show Doom keybindings" +) +mappings.map( + "n", + "<leader>dl", + "<cmd>DoomConfigsReload<CR>", + opts, + "Doom", + "reload_user_settings", + "Reload user custom settings" +) +mappings.map( + "n", + "<leader>di", + "<cmd>DoomInfo<CR>", + opts, + "Doom", + "display_info_dashboard", + "Display information dashboard" +) + +-- plugins +mappings.map( + "n", + "<leader>ps", + "<cmd>PackerSync<CR>", + opts, + "Plugins", + "packer_sync", + "Synchronize your plugins" +) +mappings.map( + "n", + "<leader>pi", + "<cmd>PackerInstall<CR>", + opts, + "Plugins", + "packer_install", + "Install missing plugins" +) +mappings.map( + "n", + "<leader>pc", + "<cmd>PackerClean<CR>", + opts, + "Plugins", + "packer_clean", + "Clean unused plugins" +) +mappings.map( + "n", + "<leader>pC", + "<cmd>PackerCompile<CR>", + opts, + "Plugins", + "packer_compile", + "Compile your plugins changes" +) +mappings.map( + "n", + "<leader>pS", + "<cmd>PackerStatus<CR>", + opts, + "Plugins", + "packer_status", + "Plugins status" +) +mappings.map( + "n", + "<leader>pp", + "<cmd>PackerProfile<CR>", + opts, + "Plugins", + "packer_profile", + "Profile the time taken loading your plugins" +) + +-- files +mappings.map( + "n", + "<leader>fc", + "<cmd>e $MYVIMRC<CR>", + opts, + "Editor", + "edit_vimrc", + "Edit your Neovim rc" +) +mappings.map( + "n", + "<leader>ff", + "<cmd>Telescope find_files<CR>", + opts, + "Editor", + "find_files_alt", + "Find files" +) + +mappings.map( + "n", + "<leader>fr", + "<cmd>Telescope oldfiles<CR>", + opts, + "Editor", + "recent_files", + "Recently opened files" +) +mappings.map( + "n", + "<leader>ft", + "<cmd>Telescope help_tags<CR>", + opts, + "Editor", + "help_tags", + "Help tags" +) +mappings.map( + "n", + "<leader>fR", + "<cmd>SudaRead<CR>", + opts, + "Editor", + "read_sudo", + "Re-open file with sudo permissions" +) +mappings.map( + "n", + "<leader>fw", + "<cmd>SudaWrite<CR>", + opts, + "Editor", + "write_sudo", + "Write file with sudo permissions" +) + +-- search +mappings.map( + "n", + "<leader>sg", + "<cmd>Telescope live_grep<CR>", + opts, + "Editor", + "live_grep_alt", + "Search a word" +) +mappings.map( + "n", + "<leader>sb", + "<cmd>Telescope current_buffer_fuzzy_find<CR>", + opts, + "Editor", + "fzf", + "Search in buffer" +) +mappings.map( + "n", + "<leader>ss", + "<cmd>Telescope lsp_document_symbols<CR>", + opts, + "LSP", + "lsp_symbols", + "Goto symbol" +) +mappings.map( + "n", + "<leader>sh", + "<cmd>Telescope command_history<CR>", + opts, + "Editor", + "command_history_alt", + "Command history" +) +mappings.map( + "n", + "<leader>sm", + "<cmd>Telescope marks<CR>", + opts, + "Editor", + "jump_mark", + "Jump to mark" +) + +-- tweak +mappings.map( + "n", + "<leader>tb", + '<cmd>lua require("doom.core.functions").toggle_background()<CR>', + opts, + "Tweak", + "toggle_background", + "Toggle background" +) +mappings.map( + "n", + "<leader>tc", + '<cmd>lua require("doom.core.functions").toggle_completion()<CR>', + opts, + "Tweak", + "toggle_completion", + "Toggle completion" +) +-- "g" as gutter, git, ... (but this tweak is applicable for linter like ALE, too) +mappings.map( + "n", + "<leader>tg", + '<cmd>lua require("doom.core.functions").toggle_signcolumn()<CR>', + opts, + "Tweak", + "toggle_signcolumn", + "Toggle signcolumn" +) +mappings.map( + "n", + "<leader>ti", + '<cmd>lua require("doom.core.functions").set_indent()<CR>', + opts, + "Tweak", + "set_indent", + "Set tab and indent" +) +mappings.map( + "n", + "<leader>tn", + '<cmd>lua require("doom.core.functions").change_number()<CR>', + opts, + "Tweak", + "change_number", + "Change number" +) +if not is_plugin_disabled("autopairs") then + mappings.map( + "n", + "<leader>tp", + '<cmd>lua require("doom.core.functions").toggle_autopairs()<CR>', + opts, + "Tweak", + "toggle_autopairs", + "Toggle autopairs" + ) +end +mappings.map( + "n", + "<leader>ts", + '<cmd>lua require("doom.core.functions").toggle_spell()<CR>', + opts, + "Tweak", + "toggle_spell", + "Toggle spell" +) +mappings.map( + "n", + "<leader>tx", + '<cmd>lua require("doom.core.functions").change_syntax()<CR>', + opts, + "Tweak", + "change_syntax", + "Change syntax" +) + +-- windows +mappings.map("n", "<leader>ww", "<C-W>p", opts, "Window", "other_window", "Goto other window") +mappings.map("n", "<leader>wd", "<C-W>c", opts, "Window", "close_window", "Close current window") +mappings.map("n", "<leader>w-", "<C-W>s", opts, "Window", "split_below", "Split window below") +mappings.map("n", "<leader>w|", "<C-W>v", opts, "Window", "split_right", "Split window right") +mappings.map("n", "<leader>w2", "<C-W>v", opts, "Window", "double_layout", "Layout double columns") +mappings.map("n", "<leader>wh", "<C-W>h", opts, "Window", "window_left", "Window left") +mappings.map("n", "<leader>wj", "<C-W>j", opts, "Window", "window_below", "Window below") +mappings.map("n", "<leader>wl", "<C-W>l", opts, "Window", "window_right", "Window right") +mappings.map("n", "<leader>wk", "<C-W>k", opts, "Window", "window_up", "Window up") +mappings.map( + "n", + "<leader>wH", + "<C-W>5<", + opts, + "Window", + "expand_window_left", + "Expand window left" +) +mappings.map( + "n", + "<leader>wJ", + "<cmd>resize +5<CR>", + opts, + "Window", + "expand_window_below", + "Expand window below" +) +mappings.map( + "n", + "<leader>wL", + "<C-W>5>", + opts, + "Window", + "expand_window_right", + "Expand window right" +) +mappings.map( + "n", + "<leader>wK", + "<cmd>resize -5<CR>", + opts, + "Window", + "expand_window_up", + "Expand window up" +) +mappings.map("n", "<leader>w=", "<C-W>=", opts, "Window", "balance_window", "Balance window") +mappings.map("n", "<leader>ws", "<C-W>s", opts, "Window", "split_below_alt", "Split window below") +mappings.map("n", "<leader>wv", "<C-W>v", opts, "Window", "split_right_alt", "Split window right") + +-- quit / sessions +mappings.map( + "n", + "<leader>qq", + '<cmd>lua require("doom.core.functions").quit_doom()<CR>', + opts, + "Editor", + "save_nvim", + "Exit Neovim" +) +mappings.map( + "n", + "<leader>qw", + '<cmd>lua require("doom.core.functions").quit_doom(true, true)<CR>', + opts, + "Editor", + "save_exit_nvim", + "Save and exit Neovim" +) +mappings.map( + "n", + "<leader>qr", + "<cmd>lua require('persistence').load({ last = true })<CR>", + opts, + "Editor", + "restore_session", + "Restore previously saved session" +) + +-- open +mappings.map( + "n", + "<leader>ob", + "<cmd>lua require('dapui').toggle()<CR>", + opts, + "Editor", + "open_dapui", + "Open debugging UI" +) +mappings.map( + "n", + "<leader>od", + "<cmd>Dashboard<CR>", + opts, + "Editor", + "open_dashboard", + "Open start screen" +) +if not config.doom.use_netrw then + mappings.map( + "n", + "<leader>oe", + "<cmd>NvimTreeToggle<CR>", + opts, + "Editor", + "open_tree_alt", + "Toggle file explorer" + ) +else + mappings.map( + "n", + "<leader>oe", + string.format("<cmd>Lexplore%s<CR>", config.doom.explorer_right and "!" or ""), + opts, + "Editor", + "open_tree_alt", + "Toggle file explorer" + ) +end +mappings.map( + "n", + "<leader>om", + "<cmd>MinimapToggle<CR>", + opts, + "Editor", + "open_minimap_alt", + "Toggle code minimap" +) +mappings.map( + "n", + "<leader>or", + "<cmd>Ranger<CR>", + opts, + "Editor", + "open_ranger_browser", + "Toggle Ranger File Browser" +) +mappings.map( + "n", + "<leader>os", + "<cmd>SymbolsOutline<CR>", + opts, + "Editor", + "open_symbols_alt", + "Toggle SymbolsOutline (LSP symbols)" +) +mappings.map( + "n", + "<leader>ot", + "<cmd>ToggleTerm<CR>", + opts, + "Editor", + "open_terminal", + "Toggle terminal" +) + +-- git +mappings.map("n", "<leader>go", "<cmd>LazyGit<CR>", opts, "Git", "lazygit", "Open LazyGit") +mappings.map( + "n", + "<leader>gl", + '<cmd>TermExec cmd="git pull"<CR>', + opts, + "Git", + "git_pull", + "Pull remote changes" +) +mappings.map( + "n", + "<leader>gp", + '<cmd>TermExec cmd="git push"<CR>', + opts, + "Git", + "git_push", + "Push git changes" +) +mappings.map( + "n", + "<leader>gs", + "<cmd>Telescope git_status<CR>", + opts, + "Git", + "git_status", + "Browse git status" +) +mappings.map( + "n", + "<leader>gB", + "<cmd>Telescope git_branches<CR>", + opts, + "Git", + "git_branches", + "Browse git branches" +) +mappings.map( + "n", + "<leader>gc", + "<cmd>Telescope git_commits<CR>", + opts, + "Git", + "git_commits", + "Browse git commits" +) + +-- code +mappings.map( + "n", + "<leader>ch", + "<Plug>RestNvim<CR>", + opts, + "Editor", + "exec_http_alt", + "Execute http client under cursor" +) +mappings.map( + "n", + "<leader>ci", + '<cmd>lua require("doom.modules.built-in.runner").start_repl()<CR>', + opts, + "Editor", + "start_repl", + "Start a REPL" +) +mappings.map( + "n", + "<leader>cr", + '<cmd>lua require("doom.modules.built-in.runner").run_code()<CR>', + opts, + "Editor", + "run_file", + "Run the current file" +) +mappings.map( + "n", + "<leader>cb", + '<cmd>lua require("doom.modules.built-in.compiler").compile()<cr>', + opts, + "Editor", + "compile", + "Compile project" +) +mappings.map( + "n", + "<leader>cc", + '<cmd>lua require("doom.modules.built-in.compiler").compile_and_run()<cr>', + opts, + "Editor", + "compile_and_run", + "Compile and run project" +) + +-- debugging +mappings.map( + "n", + "<leader>cdb", + "<cmd>lua require('dap').toggle_breakpoint()<CR>", + opts, + "DAP", + "dap_toggle_brkpt", + "Toggle breakpoint on current line" +) +mappings.map( + "n", + "<leader>cdc", + "<cmd>lua require('dap').continue()<CR>", + opts, + "DAP", + "dap_continue", + "Start (or continue) a debug session" +) +mappings.map( + "n", + "<leader>cdd", + "<cmd>lua require('dap').disconnect()", + opts, + "DAP", + "dap_disconnect", + "End debugging session" +) +mappings.map( + "n", + "<leader>cde", + "<cmd>lua require('dapui').eval()<CR>", + opts, + "DAP", + "dap_eval", + "Evaluate word under cursor" +) +mappings.map( + "v", + "<leader>cds", + "<cmd>lua require('dapui').eval()<CR>", + opts, + "DAP", + "dap_eval_selection", + "Evaluate selection" +) + +-- lsp +mappings.map("n", "<leader>cli", "<cmd>LspInfo<CR>", opts, "LSP", "lsp_info", "LSP Information") +mappings.map( + "n", + "<leader>cla", + "<cmd>lua vim.lsp.buf.code_action()<CR>", + opts, + "LSP", + "code_action_alt", + "Code actions" +) +mappings.map( + "n", + "<leader>cld", + "<cmd>lua vim.lsp.buf.type_definition()<CR>", + opts, + "LSP", + "type_definition", + "Show type definition" +) +mappings.map( + "n", + "<leader>cll", + '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ focusable = false, border = "single" })<CR>', + opts, + "LSP", + "line_diagnostic", + "Show line diagnostics" +) +mappings.map( + "n", + "<leader>clq", + "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", + opts, + "LSP", + "diagnostic_list", + "Diagnostics into location list" +) +mappings.map( + "n", + "<leader>clr", + "<cmd>lua vim.lsp.buf.rename()<CR>", + opts, + "LSP", + "rename_reference", + "Rename the reference under cursor" +) + +-- jumps +mappings.map("n", "<leader>ja", "<C-^>", opts, "Jumps", "jump_alternate_file", "Alternate file") +mappings.map("n", "<leader>jj", "<C-o>", opts, "Jumps", "jump_older", "Jump to older pos") +mappings.map("n", "<leader>jk", "<C-i>", opts, "Jumps", "jump_newer", "Jump to newer pos") +mappings.map("n", "<leader>jp", ":pop<CR>", opts, "Jumps", "jump_pop_tag", "Pop from tag stack") +mappings.map( + "n", + "<leader>jt", + ":tag<CR>", + opts, + "Jumps", + "jump_folow_tag", + "Follow tag / add to stack" +) +-- save +mappings.map("n", "<leader>v", "<cmd>w<cr>", opts, "Save", "save_left", "Save v") +mappings.map("n", "<leader>m", "<cmd>w<cr>", opts, "Save", "save_right", "Save m") + +-- man pages +mappings.map("n", "<leader>h", ":Man ", { silent = false }, "Man page", "man_page", "Man page") diff --git a/lua/doom/extras/keybindings/movement.lua b/lua/doom/extras/keybindings/movement.lua new file mode 100644 index 000000000..fc3b63f19 --- /dev/null +++ b/lua/doom/extras/keybindings/movement.lua @@ -0,0 +1,167 @@ +local mappings = require("doom.utils.mappings") + +-- Additional options for mappings +local opts = { silent = true } + +-- TAB to cycle buffers too, why not? +mappings.map("n", "<Tab>", ":bnext<CR>", opts, "Movement", "cycle_next_buffer", "Goto next buffer") +mappings.map( + "n", + "<S-Tab>", + ":bprevious<CR>", + opts, + "Movement", + "cycle_prev_buffer", + "Goto prev buffer" +) + +---[[-------------------------]]--- +-- Window Movements keys -- +---]]-------------------------]]--- +mappings.map("n", "<C-h>", "<C-w>h", opts, "Movement", "left_window", "Goto left window") +mappings.map("n", "<C-j>", "<C-w>j", opts, "Movement", "down_window", "Goto down window") +mappings.map("n", "<C-k>", "<C-w>k", opts, "Movement", "up_window", "Goto upper window") +mappings.map("n", "<C-l>", "<C-w>l", opts, "Movement", "right_window", "Goto right window") + +---[[-----------------]]--- +-- Move Lines -- +---]]-----------------[[--- +mappings.map( + "n", + "<a-j>", + ":m .+1<CR>==", + opts, + "Editor", + "normal_move_line_down", + "Normal Move line down" +) +mappings.map( + "n", + "<a-k>", + ":m .-2<CR>==", + opts, + "Editor", + "normal_move_line_up", + "Normal Move line up" +) +mappings.map( + "i", + "<a-j>", + "<esc>:m .+1<CR>==gi", + opts, + "Editor", + "instert_move_line_down", + "Insert Move line down" +) +mappings.map( + "i", + "<a-k>", + "<esc>:m .-2<CR>==gi", + opts, + "Editor", + "instert_move_line_up", + "Insert Move line up" +) +mappings.map( + "v", + "<a-j>", + ":m '>+1<CR>gv=gv", + opts, + "Editor", + "visual_move_line_down", + "Visual Move line down" +) +mappings.map( + "v", + "<a-k>", + ":m '<-2<CR>gv=gv", + opts, + "Editor", + "visual_move_line_up", + "Visual Move line up" +) + +---[[-----------------]]--- +-- Select Movement -- +---]]-----------------[[--- +mappings.map( + "x", + "K", + ":move '<-2<CR>gv-gv", + opts, + "Editor", + "select_right", + "Move selection right" +) +mappings.map("x", "J", ":move '>+1<CR>gv-gv", opts, "Editor", "select_left", "Move selection left") + +-- stay in visual mode after indenting with < or > +mappings.map( + "v", + ">", + ">gv", + opts, + "Editor", + "stay_vselect_indent", + "Stay in visual mode after indenting a selection" +) +mappings.map( + "v", + "<", + "<gv", + opts, + "Editor", + "stay_vselect_deindent", + "Stay in visual mode after unindenting a selection" +) + +-- get out of terminal insert mode into normal mode with Esc +mappings.map( + "t", + "<Esc>", + "<C-\\><C-n>", + opts, + "Editor", + "exit_insert_term", + "Exit insert mode (inside a terminal)" +) + +---[[-----------------]]--- +-- Resizing Splits -- +---]]-----------------[[--- +mappings.map( + "n", + "<C-Up>", + ":resize +2<CR>", + opts, + "Window", + "resize_up", + "Resize window (increase width)" +) +mappings.map( + "n", + "<C-Down>", + ":resize -2<CR>", + opts, + "Window", + "resize_down", + "Resize window (decrease width)" +) +mappings.map( + "n", + "<C-Right>", + ":vertical resize -2<CR>", + opts, + "Window", + "resize_right", + "Resize window (decrease height)" +) +mappings.map( + "n", + "<C-Left>", + ":vertical resize +2<CR>", + opts, + "Window", + "resize_left", + "Resize window (increase height)" +) diff --git a/lua/doom/extras/logging/init.lua b/lua/doom/extras/logging/init.lua index 9dc12de41..6107c01fb 100644 --- a/lua/doom/extras/logging/init.lua +++ b/lua/doom/extras/logging/init.lua @@ -9,22 +9,20 @@ ----- CUSTOM SECTION -------------------------------------- ----------------------------------------------------------- -local utils = require("doom.utils") local system = require("doom.core.system") +local round = require("doom.utils").round -- logging defaults to "info" level -local doom_config = { - doom = { - logging = "info", - }, -} - --- /home/user/.config/doom-nvim/doom_config.lua -if utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) then - doom_config = dofile(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) -elseif - utils.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) -then - doom_config = dofile(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) +local logging_level = "info" + +-- Manually load doom_config.lua to avoid circular dependencies +local ok, ret = xpcall(require, debug.traceback, "doom_config") +if ok then + logging_level = ret.config.doom.logging or logging_level +else + ok, ret = xpcall(dofile, debug.traceback, system.doom_configs_root .. "/doom_config.lua") + if ok then + logging_level = ret.config.doom.logging or logging_level + end end ----------------------------------------------------------- @@ -46,7 +44,7 @@ local default_config = { -- Any messages above this level will be logged. -- defaults to info - level = doom_config.doom.logging, + level = logging_level, -- Level configuration modes = { @@ -58,25 +56,22 @@ local default_config = { { name = "fatal", hl = "ErrorMsg" }, }, - -- Can limit the number of decimals displayed for floats - float_precision = 0.01, + -- Can limit the number of decimals places for floats + decimal_places = 2, } -- {{{ NO NEED TO CHANGE local log = {} --- selene: allow(incorrect_standard_library_use) local unpack = unpack or table.unpack +--- Sets up self +--- @param config table +--- @param standalone boolean log.new = function(config, standalone) config = vim.tbl_deep_extend("force", default_config, config) - local outfile = string.format( - "%s%s%s.log", - vim.api.nvim_call_function("stdpath", { "data" }), - system.sep, - config.plugin - ) + local outfile = ("%s/%s.log"):format(vim.fn.stdpath("data"), config.plugin) local obj if standalone then @@ -90,19 +85,14 @@ log.new = function(config, standalone) levels[v.name] = i end - local round = function(x, increment) - increment = increment or 1 - x = x / increment - return (x > 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)) * increment - end - + -- Concatenates tables into a string, handling numbers and dumping tables local make_string = function(...) local t = {} for i = 1, select("#", ...) do local x = select(i, ...) - if type(x) == "number" and config.float_precision then - x = tostring(round(x, config.float_precision)) + if type(x) == "number" and config.decimal_places then + x = tostring(round(x, config.decimal_places)) elseif type(x) == "table" then x = vim.inspect(x) else diff --git a/lua/doom/modules/built-in/async/init.lua b/lua/doom/modules/built-in/async/init.lua new file mode 100644 index 000000000..3ae04b4bb --- /dev/null +++ b/lua/doom/modules/built-in/async/init.lua @@ -0,0 +1,102 @@ +--- @class async +local async = {} + +--- Safely close child processes +--- @param handle uv_pipe_t +local function safe_close(handle) + if handle and not handle:is_closing() then + handle:close() + end +end + +--- Create a new async process +--- @param job_opts table The async job options +--- @return table +function async:new(job_opts) + job_opts = job_opts or {} + for opt, val in pairs(job_opts) do + self[opt] = val + end + setmetatable(job_opts, self) + self.__index = self + + return job_opts +end + +--- Set the async job options +--- @return table +function async.options() + local options = {} + local args = vim.split(async.cmd, " ") + + async.stdin = vim.loop.new_pipe(false) + async.stdout = vim.loop.new_pipe(false) + async.stderr = vim.loop.new_pipe(false) + + -- Get the async job command, e.g. 'git' + options.command = table.remove(args, 1) + options.args = args + options.stdio = { async.stdin, async.stdout, async.stderr } + + if async.cwd then + options.cwd = async.cwd + end + + if async.env then + options.env = async.env + end + + if async.detach then + options.detach = async.detach + end + + return options +end + +--- Send data to stdin +--- @param data string +async.send = function(data) + async.stdin:write(data) + async.stdin:shutdown() +end + +--- Shutdown stdio in async jobs +--- @param code number The exit code +--- @param signal number The exit signal +async.shutdown = function(code, signal) + if async.on_exit then + async.on_exit(code, signal) + end + if async.on_stdout then + async.stdout:read_stop() + end + if async.on_stderr then + async.stderr:read_stop() + end + async.stop() +end + +--- Start a new async job +async.start = function() + local opts = async.options() + local cmd = opts.command + opts.command = nil + + async.handle = vim.loop.spawn(cmd, opts, async.shutdown) + if async.on_stdout then + vim.loop.read_start(async.stdout, vim.schedule_wrap(async.on_stdout)) + end + if async.on_stderr then + vim.loop.read_start(async.stderr, async.on_stderr) + end +end + +--- Stop an async job +async.stop = function() + safe_close(async.stdin) + safe_close(async.stdout) + safe_close(async.stderr) + safe_close(async.handle) +end + +return async diff --git a/lua/doom/modules/built-in/compiler/init.lua b/lua/doom/modules/built-in/compiler/init.lua index 90751522f..c11c94f6d 100644 --- a/lua/doom/modules/built-in/compiler/init.lua +++ b/lua/doom/modules/built-in/compiler/init.lua @@ -1,12 +1,11 @@ local log = require("doom.extras.logging") local term --- selene: allow(undefined_variable) if packer_plugins and packer_plugins["toggleterm.nvim"] then term = require("toggleterm.terminal").Terminal else log.error( - "Doom compiler needs toggleterm plugin, please uncomment the 'terminal' entry in your doomrc" + "Doom compiler needs toggleterm plugin, please uncomment the 'terminal' entry in your doom_modules.lua" ) end @@ -24,7 +23,7 @@ M.compile = function() local filetype = vim.bo.filetype local lang_bin = languages[filetype] - local compiled_code, err = pcall(function() + local compiled_code, err = xpcall(function() if lang_bin then -- Set the properly builder command for the project local compiler_cmd @@ -40,7 +39,7 @@ M.compile = function() else log.error("The filetype " .. filetype .. " is not yet supported in the Doom compiler plugin") end - end) + end, debug.traceback) if not compiled_code then log.error("Error while trying to compile the project. Traceback:\n" .. err) @@ -52,7 +51,7 @@ M.compile_and_run = function() local filetype = vim.bo.filetype local lang_bin = languages[filetype] - local compiled_code, err = pcall(function() + local compiled_code, err = xpcall(function() if lang_bin then -- Set the properly builder command for the project local compiler_cmd @@ -73,7 +72,7 @@ M.compile_and_run = function() else log.error("The filetype " .. filetype .. " is not yet supported in the Doom compiler plugin") end - end) + end, debug.traceback) if not compiled_code then log.error("Error while trying to compile and run the project. Traceback:\n" .. err) diff --git a/lua/doom/modules/built-in/info/init.lua b/lua/doom/modules/built-in/info/init.lua new file mode 100644 index 000000000..1f25a142c --- /dev/null +++ b/lua/doom/modules/built-in/info/init.lua @@ -0,0 +1,617 @@ +local utils = require("doom.utils") +local system = require("doom.core.system") + +--- @class Info +local info = {} + +--- Info buffer namespace +local info_ns = vim.api.nvim_create_namespace("doom_info_ns") +--- Info buffer ID +local info_buffer +--- Current buffer ID, meant to be used for getting buffer information like treesitter parser +local curr_buffer = vim.api.nvim_win_get_buf(0) + +--- Doom Nvim banner +local doom_banner = { + " ", + "================= =============== =============== ======== ========", + "\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //", + "||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||", + "|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||", + "||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||", + "|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||", + "||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||", + "|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||", + "||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||", + "|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||", + "|| `' || || `' || || `' || || | \\ / | ||", + "|| .===' `===. .==='.`===. .===' /==. | \\/ | ||", + "|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||", + "|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||", + "|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||", + "||.==' _-' `' | /==.||", + "==' _-' N E O V I M \\/ `==", + "\\ _-' `-_ /", + " `'' ``' ", + " ", +} + +--- System-wide commands required by Doom (some of them are optional) +local additional_executables = { "rg", "fd", "git", "npm", "node", "tree-sitter" } + +--- Gets padding with N length +--- @param n number +--- @return string +local function get_padding(n) + return (" "):rep(n) +end + +--- Padding levels +local padding_level = { + get_padding(2), + get_padding(4), + get_padding(6), + get_padding(10), +} + +--- Aligns text to center +--- @param text_lines table +--- @param align_mode string +--- @return table +local function align_text(text_lines, align_mode) + local aligned_text = {} + local padding_amount + local window_width = vim.api.nvim_win_get_width(0) + + for _, line in ipairs(text_lines) do + if align_mode == "left" then + padding_amount = 2 + elseif align_mode == "center" then + padding_amount = math.floor(window_width / 2) - math.floor(line:len() / 2) + end + local padding = get_padding(padding_amount) + table.insert(aligned_text, padding .. line) + end + + return aligned_text +end + +--- Checks if a system command exists +--- @param command string +--- @return boolean +local function command_exists(command) + return vim.fn.executable(command) == 1 +end + +--- Extract the basename of given filepath, suffix is not trimed. +local function basename(path) + return string.match(path, string.format(".*%s(.*)", system.sep)) +end + +--- Get the active language servers, extracted from my galaxyline fork +--- @return string +local get_lsp_clients = function(bufnr) + local msg = "No Active Lsp" + local clients = vim.lsp.buf_get_clients(bufnr) + if next(clients) == nil then + return msg + end + + local client_names = "" + for _, client in pairs(clients) do + if string.len(client_names) < 1 then + client_names = client_names .. client.name + else + client_names = client_names .. ", " .. client.name + end + end + return string.len(client_names) > 0 and client_names or msg +end + +local function get_doom_info() + local doom_info = {} + + ----- DOOM INFORMATION ------------------------ + ----------------------------------------------- + -- Doom version + local doom_version = utils.doom_version + -- Doom branch + local doom_branch = utils.get_git_output("branch --show-current", true) + -- Configurations path + local config_path = require("doom.core.config").source + local modules_path = require("doom.core.config.modules").source + local userplugins_path = require("doom.core.config.userplugins").source + + ----- NVIM INFORMATION ------------------------ + ----------------------------------------------- + local nvim_dev_version = false + -- Neovim version + local version = vim.version() + if version.minor == 6 then + nvim_dev_version = true + end + local nvim_version = string.format( + "%s.%s.%s %s", + version.major, + version.minor, + version.patch, + nvim_dev_version and "(prerelease)" or "" + ) + + -- Local commit and last update date + local current_commit = utils.get_git_output("rev-parse HEAD", true) + local last_update_date = utils.get_git_output("show -s --format=%cD " .. current_commit, true) + + vim.list_extend(doom_info, { + "Doom Nvim Information", + string.format("%sโ€ข Neovim version: %s%s", padding_level[1], padding_level[1], nvim_version), + string.format( + "%sโ€ข Doom version: %s%s (%s branch)", + padding_level[1], + padding_level[2], + doom_version, + doom_branch + ), + string.format( + "%sโ€ข Doom root:%s%s", + padding_level[1], + padding_level[2]:rep(2), + system.doom_root + ), + string.format("%sโ€ข Last update date: %s", padding_level[1], last_update_date), + }) + if doom_branch == "develop" then + -- Current commit relevant information + local current_commit_author = utils.get_git_output( + 'show -s --format="%cN <%cE>" ' .. current_commit, + true + ) + local current_commit_message = utils.get_git_output( + "show -s --format=%s " .. current_commit, + true + ) + local current_commit_body = utils.get_git_output( + "show -s --format=%b " .. current_commit, + false + ) + + vim.list_extend(doom_info, { + "", + string.format("%sโ–ถ Doom current commit", padding_level[1]), + string.format("%sโ€ข Commit short hash: %s", padding_level[2], current_commit:sub(1, 7)), + string.format( + "%sโ€ข Commit author: %s%s", + padding_level[2], + padding_level[2], + current_commit_author + ), + string.format( + "%sโ€ข Commit subject:%s%s", + padding_level[2], + padding_level[2], + current_commit_message + ), + }) + -- Check if the commit body is empty before trying to add it + if current_commit_body:gsub("[\r\n]", ""):len() > 0 then + vim.list_extend(doom_info, { + "", + string.format("%sโ—‹ Commit body", padding_level[2]), + }) + -- Add each line separately because Neovim does not like newlines + for _, body_part in ipairs(vim.split(current_commit_body, "\n")) do + if body_part:len() > 0 then + vim.list_extend(doom_info, { + string.format( + "%s", + body_part + :gsub("^", string.format("%s", padding_level[3])) + :gsub("^%s+", string.format("%s", padding_level[3])) + :gsub("^%s+%-", string.format("%s-", padding_level[3])) + ), + }) + end + end + end + end + vim.list_extend(doom_info, { + "", + string.format("%sโ–ถ Doom configurations paths", padding_level[1]), + string.format("%s- %s", padding_level[2], config_path), + string.format("%s- %s", padding_level[2], modules_path), + string.format("%s- %s", padding_level[2], userplugins_path), + }) + + ----- TREESITTER INFORMATION ------------------ + ----------------------------------------------- + vim.list_extend(doom_info, { + "", + string.format("%sโ–ถ Installed treesitter parsers", padding_level[1]), + }) + for _, parser in ipairs(require("nvim-treesitter.info").installed_parsers()) do + table.insert(doom_info, string.format("%s- %s", padding_level[2], parser)) + end + + ----- LSP INFORMATION ------------------------- + ----------------------------------------------- + if not require("doom.utils").is_plugin_disabled("lsp") and packer_plugins["nvim-lspinstall"] then + vim.list_extend(doom_info, { + "", + string.format("%sโ–ถ Installed language servers", padding_level[1]), + }) + for _, server in ipairs(require("lspinstall").installed_servers()) do + -- Get the real name for the language server because lspinstall names them like the filetype + local server_path = require("lspconfig")[server].cmd[1] + local real_server_name = basename(server_path) + if not real_server_name then + -- If we were unable to get the server executable name then fallback to default server name (filetype) + real_server_name = server + else + -- Fix some server names that are "incorrect" + real_server_name = real_server_name + :gsub("%-language%-server", "") + :gsub("%-langserver", "") + :gsub("typescript", "tsserver") + :gsub("sumneko%-lua", "sumneko_lua") + end + table.insert(doom_info, string.format("%s- %s", padding_level[2], real_server_name)) + end + end + return doom_info +end + +local function get_buffer_info() + local buffer_info = {} + local buffer_ft = vim.api.nvim_buf_get_option(curr_buffer, "filetype") + + vim.list_extend(buffer_info, { + "Buffer Information", + string.format( + "%sโ€ข %s%s%s", + padding_level[1], + "Is read-only?", + padding_level[3], + vim.api.nvim_buf_get_option(curr_buffer, "readonly") and "yes" or "no" + ), + string.format("%sโ€ข %s: %s", padding_level[1], "Detected filetype", buffer_ft), + "", + string.format("%sโ–ถ Settings", padding_level[1]), + string.format( + "%sโ€ข %s: %s%s", + padding_level[2], + "File format", + padding_level[3], + vim.api.nvim_buf_get_option(curr_buffer, "fileformat"):upper() + ), + }) + if vim.api.nvim_buf_get_option(curr_buffer, "fileencoding"):len() > 0 then + vim.list_extend(buffer_info, { + string.format( + "%sโ€ข %s: %s%s", + padding_level[2], + "File encoding", + padding_level[2], + vim.api.nvim_buf_get_option(curr_buffer, "fileencoding"):upper() + ), + }) + end + vim.list_extend(buffer_info, { + string.format( + "%sโ€ข %s: %s", + padding_level[2], + "Indentation width", + vim.api.nvim_buf_get_option(curr_buffer, "tabstop") + ), + string.format( + "%sโ€ข %s: %s", + padding_level[2], + "Indentation style", + vim.api.nvim_buf_get_option(curr_buffer, "expandtab") and "Tabs" or "Spaces" + ), + "", + ----- TREESITTER INFORMATION ------------------ + ----------------------------------------------- + string.format("%sโ–ถ TreeSitter", padding_level[1]), + string.format( + "%sโ€ข %s%s", + padding_level[2], + "Is parser installed?" .. padding_level[2]:rep(3), + utils.has_value(require("nvim-treesitter.info").installed_parsers(), buffer_ft) and "yes" + or "no" + ), + string.format( + "%sโ€ข %s %s", + padding_level[2], + "Is indentation enabled?" .. padding_level[2]:rep(2), + require("nvim-treesitter.configs").is_enabled("indent", buffer_ft) and "yes" or "no" + ), + string.format( + "%sโ€ข %s %s", + padding_level[2], + "Is syntax highlighting enabled?", + require("nvim-treesitter.configs").is_enabled("highlight", buffer_ft) and "yes" or "no" + ), + }) + + ----- LSP INFORMATION ------------------------- + ----------------------------------------------- + if not require("doom.utils").is_plugin_disabled("lsp") and packer_plugins["nvim-lspinstall"] then + vim.list_extend(buffer_info, { + "", + string.format("%sโ–ถ Language Servers", padding_level[1]), + string.format( + "%sโ€ข %s %s", + padding_level[2], + "Is language server installed?", + utils.has_value(require("lspinstall").installed_servers(), buffer_ft) and "yes" or "no" + ), + string.format( + "%sโ€ข %s:%s%s", + padding_level[2], + "Active language servers", + padding_level[3], + get_lsp_clients(curr_buffer) + ), + }) + end + + return buffer_info +end + +local function get_system_info() + local sys_info = {} + + ----- OS -------------------------------------- + ----------------------------------------------- + -- Get the current OS and if the user is running Linux then get also the + -- distribution name, e.g. Manjaro + local sysname = vim.loop.os_uname().sysname + local distro_name + -- If the user is running Linux then get the distribution name + if sysname == "Linux" then + distro_name = vim.trim( + -- PRETTY_NAME="Distribution (Additional info)", e.g. + -- PRETTY_NAME="Fedora 34 (KDE Plasma)" + vim.fn.system( + 'cat /etc/os-release | grep "^PRETTY_NAME" | sed ' + .. "'s/^PRETTY_NAME=\"//' | sed " + .. "'s/\"//'" + ) + ) + end + vim.list_extend(sys_info, { + "System Information", + string.format("%sโ€ข %s: %s%s", padding_level[1], "OS", padding_level[4], sysname), + }) + if distro_name then + vim.list_extend(sys_info, { + string.format("%sโ€ข %s: %s%s", padding_level[1], "Distro", padding_level[3], distro_name), + }) + end + vim.list_extend(sys_info, { + string.format("%sโ€ข %s: %s", padding_level[1], "Architecture", vim.loop.os_uname().machine), + }) + + ----- PROGRAMS -------------------------------- + ----------------------------------------------- + vim.list_extend(sys_info, { + "", + string.format("%sโ–ถ Programs", padding_level[1]), + }) + for _, program in ipairs(additional_executables) do + local opt_message, extra_padding = "", "" + + -- We add an extra whitespace to 'no' so we can have an uniform format + local is_installed = command_exists(program) and "yes" or "no" + if (program == "node" or program == "npm") and (not command_exists(program)) then + opt_message = "(Optional, required by some language servers)" + elseif program == "fd" and (not command_exists(program)) then + opt_message = "(Optional, improves performance for many file indexing commands)" + elseif program == "rg" and (not command_exists(program)) then + opt_message = "(Optional, improves performance for many file indexing commands)" + elseif program == "tree-sitter" and (not command_exists(program)) then + opt_message = "(Optional, only needed for :TSInstallFromGrammar, not required for :TSInstall)" + end + + -- Add padding after the question, e.g. Found fd? yes/no + -- ^^ + -- padding + if program:len() ~= 11 then + extra_padding = get_padding(11 - program:len()) + end + table.insert( + sys_info, + string.format( + "%sโ€ข Found `%s`? %s%s%s", + padding_level[2], + program, + extra_padding, + -- Add extra whitespace to "no" + is_installed == "yes" and is_installed or is_installed .. " ", + opt_message:len() < 1 and opt_message or " " .. opt_message + ) + ) + end + + return sys_info +end + +--- Set buffer contents +--- @param buffer_id number +local function set_buffer_content(buffer_id) + local content = {} + + -- Doom banner + for _, banner_line in ipairs(align_text(doom_banner, "center")) do + table.insert(content, banner_line) + end + + -- Doom Nvim information + local doom_info = get_doom_info() + local buffer_info = get_buffer_info() + local system_info = get_system_info() + + for _, info_section in ipairs({ doom_info, { "", "" }, buffer_info, { "", "" }, system_info }) do + local aligned_info = align_text(info_section, "left") + vim.list_extend(content, aligned_info) + end + vim.api.nvim_buf_set_lines(buffer_id, 0, info_ns, false, content) +end + +local function set_syntax_highlighting(buffer_id) + for lnum, line in ipairs(vim.api.nvim_buf_get_lines(buffer_id, 0, vim.fn.line("$"), true)) do + if lnum < #doom_banner then + vim.api.nvim_buf_add_highlight(buffer_id, -1, "Comment", lnum, 0, -1) + else + local hl = "NONE" + local endl = -1 + if line:find("Information") then + -- Information headers + hl = "Title" -- "Structure" + elseif line:find("โ–ถ") then + -- Information subheaders (level 2) + hl = "VariableBuiltin" + elseif line:find("โ—‹") then + -- Information subheaders (level 3) + hl = "FunctionBuiltin" + elseif line:find(": ") or line:find("? ") then + -- Information fields + hl = "Bold" + if #vim.split(line, "?") < 2 then + -- Highlight only the field name, e.g. 'Version' + endl = vim.split(line, ":")[1]:len() + else + -- Highlight only the field name + endl = vim.split(line, "?")[1]:len() + end + end + vim.api.nvim_buf_add_highlight(buffer_id, -1, hl, lnum - 1, 0, endl) + end + end + + -- Extra highlights that we can't manually set with nvim_buf_add_highlight + -- NOTE: these extra newlines are for improving code readability, don't remove! + vim.cmd([[ + " True / False + " NOTE: Use String and ErrorMsg as a fallback if TextXBold does not exists in the current colorscheme + call matchadd(match(execute("hi TextSuccessBold"), "cleared") =~ -1 ? "TextSuccessBold" : "String", "yes") + call matchadd(match(execute("hi TextErrorBold"), "cleared") =~ -1 ? "TextErrorBold" : "ErrorMsg", '\(no\s\)\|\(no$\)\|\(No Active Lsp\)') + + " Commit author email + call matchadd("Bold", '\([-a-zA-Z0-9_]\+@[-a-zA-Z0-9_]\+\.\w\+\)') + + " Commit SHA + call matchadd("Constant", '\(\s[a-f0-9]\{7}$\)') + + " Commits scopes + call matchadd("Msg", '\(hotfix\)\|\(fix\)') + call matchadd("MoreMsg", "feat") + call matchadd("WarningMsg", "refact") + call matchadd("ErrorMsg", '\(refact\!\)\|\(BREAKING CHANGE\)') + call matchadd("SpecialComment", "docs") + call matchadd("Comment", "chore") + call matchadd("Constant", "release") + call matchadd("SpecialComment", '\(([-a-zA-Z0-9_]\+):\)\@>') + + " Release type and branches + call matchadd("Bold", '\(prerelease\)\|\(develop\|main\)\sbranch') + + " Strings + call matchadd("String", '".*"') + + " Numbers + call matchadd("Number", '\s[0-9]\+$') + + " Fields + call matchadd("String", "โ€ข") + + " Lists and delimiters + call matchadd("Operator", '\(\s\+-\s\)\|:\s\+\|<\|>\|@\|(\|)') + + " Neovim commands + " NOTE: Use Comment as a fallback if CommentBold does not exists in the current colorscheme + call matchadd(match(execute("hi CommentBold"), "cleared") =~ -1 ? "CommentBold" : "Comment", '\(:[A-Za-z]\+\)') + + " Inline code like markdown + call matchadd(match(execute("hi CommentBold"), "cleared") =~ -1 ? "CommentBold" : "Comment", '\(`[-a-zA-Z0-9_,\.\<\>@\$#+\!]\+`\)') + " Conceal start ` + call matchadd("Conceal", '\(`[-a-zA-Z0-9_,\.\<\>@\$#+\!]\+`\)\@=', 10, -1, {"conceal": ""}) + " Conceal ending ` + call matchadd("Conceal", '\(\(`?\)\|\(`$\)\|\(`\s\)\|\(`,\s\)\)\@=', 10, -1, {"conceal": ""}) + ]]) +end + +--- Open Doom information floating window +info.open = function() + -- Create a new scratch buffer + info_buffer = vim.api.nvim_create_buf(false, true) + vim.api.nvim_buf_set_option(info_buffer, "bufhidden", "wipe") + vim.api.nvim_buf_set_option(info_buffer, "filetype", "DoomInfo") + + -- Get terminal dimensions + local width = vim.api.nvim_get_option("columns") + local height = vim.api.nvim_get_option("lines") + -- Floating window dimensions and start position + local win_height = math.ceil(height * 0.9 - 2) + local win_width = math.ceil(width * 0.9) + local row = math.ceil((height - win_height) / 2 - 1) + local col = math.ceil((width - win_width) / 2) + -- Set our floating window options + local win_opts = { + style = "minimal", -- Disable most UI options + border = "single", -- Single whitespace padding + relative = "editor", -- Relative to global editor grid + width = win_width, -- Width + height = win_height, -- Height + row = row, -- Row position + col = col, -- Column position + } + + -- Create our window with attached buffer + vim.api.nvim_open_win(info_buffer, true, win_opts) + + -- Set the buffer contents + set_buffer_content(info_buffer) + + -- Set the buffer options + vim.api.nvim_buf_set_option(info_buffer, "modifiable", false) + -- Concealing for inline code + vim.opt_local.conceallevel = 2 + vim.opt_local.concealcursor = "nc" + -- Folding + vim.opt_local.foldtext = + [[substitute(substitute(substitute(getline(v:foldstart), '?\s\+', '? ', 'g'), ':\s\+', ': ', 'g'), '\\t', repeat('\ ',&tabstop), 'g') . ' ... ' . '(' . (v:foldend - v:foldstart + 1) . ' fields)']] + vim.opt_local.shiftwidth = 6 + vim.opt_local.foldignore = [[=\\\|]] + vim.opt_local.foldmethod = "indent" + vim.opt_local.fillchars = { + eob = " ", -- suppress ~ at EndOfBuffer + fold = " ", -- supress dots between folds info + } + + -- Set the buffer keybinds + vim.api.nvim_buf_set_keymap( + info_buffer, + "n", + "q", + "<cmd>bdelete<CR>", + { noremap = true, silent = true } + ) + + -- Set the buffer syntax + set_syntax_highlighting(info_buffer) +end + +info.close = function() + vim.api.nvim_buf_delete(info_buffer, {}) +end + +info.toggle = function() + if info_buffer and vim.fn.bufexists(info_buffer) == 1 then + info.close() + else + info.open() + end +end + +return info diff --git a/lua/doom/modules/built-in/reloader/init.lua b/lua/doom/modules/built-in/reloader/init.lua new file mode 100644 index 000000000..f72465aa2 --- /dev/null +++ b/lua/doom/modules/built-in/reloader/init.lua @@ -0,0 +1,237 @@ +--- @class Reloader +local reloader = {} + +--- Only show error reloading message once per session +reloader.has_failed_reload = false + +local fs = require("doom.utils.fs") +local utils = require("doom.utils") +local log = require("doom.extras.logging") +local system = require("doom.core.system") + +--- Paths to reload plugins +local plugins_files_path = string.format( + "%s%ssite%spack%spacker%sstart%s*", + vim.fn.stdpath("data"), + system.sep, + system.sep, + system.sep, + system.sep, + system.sep +) +local vim_subdirs = { "doc", "after", "syntax", "plugin" } + +local installed_plenary, _ = pcall(require, "plenary") +if not installed_plenary then + log.warn("Skipped reloader module loading, requires 'plenary.nvim' plugin to be installed") + return +end + +local scan_dir = require("plenary.scandir").scan_dir + +--- Converts a Lua module path into an acceptable Lua module format +--- @param module_path string The path to the module +--- @return string|nil +local function path_to_lua_module(module_path) + local lua_path = string.format("%s%slua", system.doom_root, system.sep) + + -- Remove the Neovim config dir and the file extension from the path + module_path = string.match( + module_path, + string.format("%s%s(.*)%%.lua", utils.escape_str(lua_path), system.sep) + ) + + if not module_path then + return nil + end + + -- Replace '/' with '.' to follow the common Lua modules format + module_path = module_path:gsub(system.sep, ".") + + -- Remove '.init' if the module ends with it + module_path = module_path:gsub("%.init$", "") + + return module_path +end + +--- Gets the runtime files found in the given path +--- @param parent_path string The parent path to look for files +--- @return table +local function get_runtime_files(parent_path) + local runtime_files = {} + + -- Look in each Neovim subdir for runtime files (documentation, syntax files, etc) + for _, subdir in ipairs(vim_subdirs) do + local path = string.format("%s%s%s", parent_path, system.sep, subdir) + + if fs.file_exists(path) then + local dir_files = {} + -- We scan VimL and Lua files because some plugins has a 'plugin/foo.lua' file + local dir_vim_files = scan_dir(path, { search_pattern = "%.vim$", hidden = true }) + local dir_lua_files = scan_dir(path, { search_pattern = "%.lua$", hidden = true }) + vim.list_extend(dir_files, dir_vim_files) + vim.list_extend(dir_files, dir_lua_files) + + for _, file in ipairs(dir_files) do + runtime_files[#runtime_files + 1] = file + end + end + end + + return runtime_files +end + +--- Gets all the Lua files found in '~/.config/nvim/lua' directory +--- @return table +local function get_lua_modules(path) + -- Look for Lua modules in Doom Nvim root + local modules = scan_dir(path, { search_pattern = "%.lua$", hidden = true }) + for idx, module in ipairs(modules) do + module = path_to_lua_module(module) + + -- Override previous value with new value + modules[idx] = module + end + + return modules +end + +--- Reloads all Neovim runtime files found in plugins +local function reload_runtime_files() + local paths = vim.fn.glob(plugins_files_path, 0, 1) + + for _, path in ipairs(paths) do + local runtime_files = get_runtime_files(path) + + for _, file in ipairs(runtime_files) do + vim.cmd("silent! source " .. file) + end + end +end + +--- Reload a Lua module +--- @param mod_path string The configuration module path +--- @param quiet boolean If the reloader should send an info log or not +reloader.reload_lua_module = function(mod_path, quiet) + if mod_path:find("/") then + mod_path = path_to_lua_module(mod_path) + end + + -- If doom-nvim fails to reload, warn user once per session + if mod_path == nil then + if reloader.has_failed_reload == false then + log.warn( + "reloader: Failed to reload doom config because this file is not in nvim config directory. Is your doom nvim config directory symlinked?" + ) + reloader.has_failed_reload = true + end + return + end + + -- Get the module from package table + local mod = package.loaded[mod_path] + + -- Unload the module and load it again + package.loaded[mod_path] = nil + require(mod_path) + + if type(mod) == "function" then + -- Call the loaded module function so the reloading will take effect as expected + local ok, _ = pcall(package.loaded[mod_path]) + if not ok then + log.error(string.format("Failed to reload '%s' module", mod_path)) + end + end + + if not quiet then + log.info(string.format("Successfully reloaded '%s' module", mod_path)) + end +end + +--- Reload all Lua modules +--- @param quiet boolean If the reloader should send an info log or not +reloader.reload_lua_modules = function(quiet) + local paths = vim.fn.glob(system.doom_root .. system.sep .. "lua", 0, 1) + + for _, path in ipairs(paths) do + local modules = get_lua_modules(path) + + for _, module in ipairs(modules) do + reloader.reload_lua_module(module, quiet) + end + end +end + +--- Reload the plugins definitions modules like doom_modules.lua to automatically +--- install or uninstall plugins on changes +reloader.reload_plugins_definitions = function() + -- Silently reload plugins modules + reloader.reload_lua_module("doom.core.config.modules", true) + reloader.reload_lua_module("doom.core.config.userplugins", true) + reloader.reload_lua_module("doom.modules", true) + + -- Cleanup disabled plugins + vim.cmd("PackerClean") + -- Defer the installation of new plugins to avoid a weird bug where packer + -- tries to clean the plugins that are being installed right now + vim.defer_fn(function() + vim.cmd("PackerInstall") + end, 200) + vim.defer_fn(function() + -- Compile plugins changes and simulate a new Neovim launch + -- to load recently installed plugins + -- NOTE: this won't work to live disable uninstalled plugins, + -- they will keep working until you relaunch Neovim + vim.cmd([[ + PackerCompile + doautocmd VimEnter + ]]) + end, 800) +end + +--- Reload all Neovim configurations +reloader.reload_configs = function() + --- Clear highlighting + vim.cmd("hi clear") + + --- Restart running language servers + if vim.fn.exists(":LspRestart") ~= 0 then + vim.cmd("silent! LspRestart") + end + + --- Source Doom init + vim.cmd("source $MYVIMRC") + + --- Reload all loaded Lua modules + reloader.reload_lua_modules(true) + + --- Reload start plugins + reload_runtime_files() + + --- Fix some syntax highlighting issues caused by clearing highlighting + vim.cmd("doautocmd Syntax") +end + +--- Reload Neovim and simulate a new run +reloader.full_reload = function() + -- Store the time taken to reload Doom + local reload_time = vim.fn.reltime() + log.info("Reloading Doom ...") + + --- Reload Neovim configurations + reloader.reload_configs() + + --- Run VimEnter autocommand to simulate a new Neovim launch + --- and reload all buffers + vim.cmd([[ + doautocmd VimEnter + ]]) + + log.info( + "Reloaded Doom in " + .. vim.fn.printf("%.3f", vim.fn.reltimefloat(vim.fn.reltime(reload_time))) + .. " seconds" + ) +end + +return reloader diff --git a/lua/doom/modules/built-in/runner/init.lua b/lua/doom/modules/built-in/runner/init.lua index 975c489a8..b1cc7ab77 100644 --- a/lua/doom/modules/built-in/runner/init.lua +++ b/lua/doom/modules/built-in/runner/init.lua @@ -1,12 +1,11 @@ local log = require("doom.extras.logging") local term --- selene: allow(undefined_variable) if packer_plugins and packer_plugins["toggleterm.nvim"] then term = require("toggleterm.terminal").Terminal else log.error( - "Doom runner needs toggleterm plugin, please uncomment the 'terminal' entry in your doomrc" + "Doom runner needs toggleterm plugin, please uncomment the 'terminal' entry in your doom_modules.lua" ) end @@ -29,7 +28,7 @@ M.start_repl = function() local filetype = vim.bo.filetype local repl_cmd = languages[filetype] - local opened_repl, err = pcall(function() + local opened_repl, err = xpcall(function() if repl_cmd then local repl = term:new({ cmd = repl_cmd, hidden = true }) repl:open() @@ -40,7 +39,7 @@ M.start_repl = function() .. ". Maybe it is not yet supported in the Doom runner plugin?" ) end - end) + end, debug.traceback) if not opened_repl then log.error("Error while trying to opening a repl for " .. filetype .. ". Traceback:\n" .. err) @@ -52,7 +51,7 @@ M.run_code = function() local filetype = vim.bo.filetype local lang_bin = languages[filetype] - local run_code, err = pcall(function() + local run_code, err = xpcall(function() if lang_bin then local runner = term:new({ cmd = lang_bin .. " " .. vim.fn.expand("%"), @@ -67,7 +66,7 @@ M.run_code = function() .. ". Maybe it is not yet supported in the Doom runner plugin?" ) end - end) + end, debug.traceback) if not run_code then log.error("Error while trying to run the current file. Traceback:\n" .. err) diff --git a/lua/doom/modules/config/doom-autopairs.lua b/lua/doom/modules/config/doom-autopairs.lua index 13940fdff..d0c0c3927 100644 --- a/lua/doom/modules/config/doom-autopairs.lua +++ b/lua/doom/modules/config/doom-autopairs.lua @@ -1,5 +1,5 @@ return function() - local is_plugin_disabled = require("doom.core.functions").is_plugin_disabled + local is_plugin_disabled = require("doom.utils").is_plugin_disabled require("nvim-autopairs").setup({ check_ts = is_plugin_disabled("treesitter") and false or true, enable_afterquote = true, diff --git a/lua/doom/modules/config/doom-blankline.lua b/lua/doom/modules/config/doom-blankline.lua index 4eb5dd912..b23bc58cd 100644 --- a/lua/doom/modules/config/doom-blankline.lua +++ b/lua/doom/modules/config/doom-blankline.lua @@ -1,14 +1,13 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config require("indent_blankline").setup({ enabled = config.doom.show_indent, char = "โ”‚", -- If treesitter plugin is enabled then use its indentation - use_treesitter = require("doom.core.functions").check_plugin("nvim-treesitter", "opt") and true - or false, + use_treesitter = require("doom.utils").check_plugin("nvim-treesitter", "opt"), show_first_indent_level = false, - filetype_exclude = { "help", "dashboard", "packer", "norg" }, + filetype_exclude = { "help", "dashboard", "packer", "norg", "DoomInfo" }, buftype_exclude = { "terminal" }, }) end diff --git a/lua/doom/modules/config/doom-bufferline.lua b/lua/doom/modules/config/doom-bufferline.lua index 0635279cc..6a6e5a817 100644 --- a/lua/doom/modules/config/doom-bufferline.lua +++ b/lua/doom/modules/config/doom-bufferline.lua @@ -28,12 +28,48 @@ return function() return true end end, + groups = { + options = { + toggle_hidden_on_enter = true, -- when you re-enter a hidden group this options re-opens that group so the buffer is visible + }, + items = { + { + name = "Tests", + auto_close = true, + matcher = function(buf) + return buf.filename:match("%_test") or buf.filename:match("%_spec") + end, + }, + { + name = "Docs", + auto_close = true, + matcher = function(buf) + return buf.filename:match("%.md") or buf.filename:match("%.txt") + end, + }, + { + name = "Doom", + auto_close = true, + matcher = function(buf) + if buf.filename:find("doom_") or buf.filename:find("doom-", 1, true) then + return true + end + return false + end, + }, + }, + }, offsets = { { filetype = "NvimTree", text = "File Explorer", text_align = "center", }, + { + filetype = "netrw", + text = "File Explorer", + text_align = "center", + }, { filetype = "minimap", text = "Minimap", diff --git a/lua/doom/modules/config/doom-cmp.lua b/lua/doom/modules/config/doom-cmp.lua new file mode 100644 index 000000000..43302d21f --- /dev/null +++ b/lua/doom/modules/config/doom-cmp.lua @@ -0,0 +1,129 @@ +return function() + local cmp = require("cmp") + local luasnip = require("luasnip") + + local kind_icons = { + Text = " ๏’ž ", + Method = " ๏šฆ ", + Function = " ๏ž” ", + Constructor = " ๏ฃ ", + Field = " ๏ดฒ ", + Variable = " ๎œ– ", + Class = " ๏ – ", + Interface = " ๏ฐฎ ", + Module = " ๏™จ ", + Property = " ๏ฐ  ", + Unit = " ๏‘ต ", + Value = " ๏ขŸ ", + Enum = " ๏ฉ—", + Keyword = " ๏ Š ", + Snippet = " ๏‘ ", + Color = " ๏ฃ— ", + File = " ๏œ“ ", + Reference = " ๏œœ ", + Folder = " ๏Š ", + EnumMember = " ๏… ", + Constant = " ๏ฒ€ ", + Struct = " ๏ณค ", + Event = " ๏ƒง ", + Operator = " ๏š” ", + TypeParameter = " ๏žƒ ", + } + --- Given an LSP item kind, returns a nerdfont icon + --- @param kind_type string LSP item kind + --- @return string Nerdfont Icon + local function get_kind_icon(kind_type) + return kind_icons[kind_type] + end + + --- Wraps nvim_replace_termcodes + --- @param str string + --- @return string + local function replace_termcodes(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) + end + --- Helper function to check what <Tab> behaviour to use + --- @return boolean + local function check_backspace() + local col = vim.fn.col(".") - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") + end + + cmp.setup({ + completion = { + completeopt = "menu,menuone,preview,noinsert", + }, + documentation = { + border = { "โ•ญ", "โ”€", "โ•ฎ", "โ”‚", "โ•ฏ", "โ”€", "โ•ฐ", "โ”‚" }, + }, + formatting = { + format = function(entry, item) + item.kind = string.format("%s %s", get_kind_icon(item.kind), item.kind) + item.menu = ({ + nvim_lsp = "[LSP]", + luasnip = "[Snp]", + buffer = "[Buf]", + nvim_lua = "[Lua]", + path = "[Path]", + })[entry.source.name] + item.dup = ({ + buffer = 1, + path = 1, + nvim_lsp = 0, + })[entry.source.name] or 0 + return item + end, + }, + mapping = { + ["<C-p>"] = cmp.mapping.select_prev_item(), + ["<C-n>"] = cmp.mapping.select_next_item(), + ["<C-d>"] = cmp.mapping.scroll_docs(-4), + ["<C-f>"] = cmp.mapping.scroll_docs(4), + ["<C-Space>"] = cmp.mapping.complete(), + ["<C-e>"] = cmp.mapping.close(), + -- ["<ESC>"] = cmp.mapping.close(), + ["<CR>"] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }), + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + vim.fn.feedkeys(replace_termcodes("<Plug>luasnip-expand-or-jump"), "") + elseif check_backspace() then + vim.fn.feedkeys(replace_termcodes("<Tab>"), "n") + else + fallback() + end + end, { + "i", + "s", + }), + ["<S-Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + vim.fn.feedkeys(replace_termcodes("<Plug>luasnip-jump-prev"), "") + else + fallback() + end + end, { + "i", + "s", + }), + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + sources = { + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + { name = "buffer" }, + }, + }) +end diff --git a/lua/doom/modules/config/doom-compe.lua b/lua/doom/modules/config/doom-compe.lua deleted file mode 100644 index 1f7c5e60e..000000000 --- a/lua/doom/modules/config/doom-compe.lua +++ /dev/null @@ -1,73 +0,0 @@ ---# selene: allow(global_usage) - ---- nvim-compe configuration --- https://github.com/hrsh7th/nvim-compe#lua-config -return function() - require("compe").setup({ - enabled = true, - autocomplete = true, - debug = false, - min_length = 4, - preselect = "enable", - throttle_time = 80, - source_timeout = 200, - incomplete_delay = 400, - max_abbr_width = 100, - max_kind_width = 100, - max_menu_width = 100, - documentation = true, - - source = { - path = true, - buffer = true, - calc = false, - vsnip = false, - nvim_lsp = true, - nvim_lua = true, - luasnip = true, - spell = false, - tags = true, - neorg = true, - snippets_nvim = false, - treesitter = true, - }, - }) - local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) - end - - local check_back_space = function() - local col = vim.fn.col(".") - 1 - if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then - return true - else - return false - end - end - - -- Use (s-)tab to: - --- move to prev/next item in completion menuone - --- jump to prev/next snippet's placeholder - _G.tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t("<C-n>") - elseif check_back_space() then - return t("<Tab>") - else - return vim.fn["compe#complete"]() - end - end - - _G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t("<C-p>") - else - return t("<S-Tab>") - end - end - - vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", { expr = true }) - vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", { expr = true }) - vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true }) - vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", { expr = true }) -end diff --git a/lua/doom/modules/config/doom-dap-install.lua b/lua/doom/modules/config/doom-dap-install.lua new file mode 100644 index 000000000..bae5aef06 --- /dev/null +++ b/lua/doom/modules/config/doom-dap-install.lua @@ -0,0 +1,71 @@ +return function() + local log = require("doom.extras.logging") + local utils = require("doom.utils") + -- Init dap-install + local dap_install = require("dap-install") + dap_install.setup({ + installation_path = vim.fn.stdpath("data") .. "/dapinstall/", + }) + + local dap_lang_lookup = { + cpp = { "ccppr_vsc" }, + c = { "ccppr_vsc" }, + rust = { "ccppr_vsc" }, + go = { "go_delve" }, + javascript = { "chrome", "jsnode" }, + typescript = { "chrome", "jsnode" }, + ruby = { "ruby_vsc" }, + } + + -- Iterates through langs and installs clients where possible + local install_dap_clients = function() + local modules = require("doom.core.config.modules").modules + local langs = modules.langs + + local installed_clients = require("dap-install.api.debuggers").get_installed_debuggers() + local available_clients = vim.tbl_keys(require("dap-install.api.debuggers").get_debuggers()) + + local daps_to_install = {} + + -- Iterate over each lang, get the required daps and push it to daps_to_install (to avoid duplicates) + for _, lang in ipairs(langs) do + local lang_str = lang + lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + + -- DAPInstall.nvim has different names for the DAPs so sometimes we need to lookup the correct DAP to install + if dap_lang_lookup[lang] ~= nil then + lang = dap_lang_lookup[lang] + else + lang = { lang } + end + + -- Iterate over DAPs installing them one by one + for _, dap_name in ipairs(lang) do + -- 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, dap_name)) 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, dap_name) then + -- Avoid installing duplicate daps + if not utils.has_value(daps_to_install, dap_name) then + table.insert(daps_to_install, dap_name) + end + else + log.warn( + "The language " + .. dap_name + .. ' does not have a DAP client, please remove the "+debug" flag' + ) + end + end + end + end + + -- Install the daps one by one + for _, dap_name in ipairs(daps_to_install) do + require("dap-install.core.install").install_debugger(dap_name) + end + end + + install_dap_clients() +end diff --git a/lua/doom/modules/config/doom-dashboard.lua b/lua/doom/modules/config/doom-dashboard.lua index b52216f8f..430ea3ff5 100644 --- a/lua/doom/modules/config/doom-dashboard.lua +++ b/lua/doom/modules/config/doom-dashboard.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config vim.g.dashboard_session_directory = require("doom.core.system").doom_root .. "/sessions" vim.g.dashboard_default_executive = "telescope" @@ -31,7 +31,7 @@ return function() }, g = { description = { "๏€ญ Open Documentation SPC d d" }, - command = "h doom_nvim", + command = 'lua require("doom.core.functions").open_docs()', }, } @@ -42,10 +42,6 @@ return function() ) .. " seconds.", } - if not config.doom.dashboard_statline then - vim.g.dashboard_disable_statusline = 1 - end - vim.g.dashboard_custom_header = vim.tbl_isempty(config.doom.dashboard_custom_header) and { " ", @@ -68,7 +64,6 @@ return function() "==' _-' N E O V I M \\/ `==", "\\ _-' `-_ /", " `'' ``' ", - " ", } or config.doom.dashboard_custom_header -- Header color diff --git a/lua/doom/modules/config/doom-eviline-palettes.lua b/lua/doom/modules/config/doom-eviline-palettes.lua deleted file mode 100644 index 7ea5b547e..000000000 --- a/lua/doom/modules/config/doom-eviline-palettes.lua +++ /dev/null @@ -1,93 +0,0 @@ -local M = {} - --- Dynamically change statusline colors, --- defaults to doom-one dark variant colors. --- --- @tparam string name The color name to be returned --- @return string -M.get_color = function(name) - return function() - local colors = { - bg = "#23272e", - fg = "#bbc2cf", - section_bg = "#5B6268", - yellow = "#ECBE7B", - cyan = "#46D9FF", - green = "#98be65", - orange = "#da8548", - magenta = "#c678dd", - blue = "#51afef", - red = "#ff6c6b", - } - - if vim.g.colors_name == "doom-one" and vim.opt.background:get() == "light" then - colors = { - bg = "#c6c7c7", - fg = "#383a42", - fg_alt = "#9ca0a4", - yellow = "#986801", - cyan = "#0184bc", - green = "#50a14f", - orange = "#da8548", - magenta = "#a626a4", - blue = "#4078f2", - red = "#e45649", - } - elseif vim.g.colors_name:find("gruvbox") then - colors = { - bg = "#32302f", - fg = "#d4be98", - fg_alt = "#ddc7a1", - yellow = "#d8a657", - cyan = "#89b482", - green = "#a9b665", - orange = "#e78a4e", - magenta = "#d3869b", - blue = "#7daea3", - red = "#ea6962", - } - elseif vim.g.colors_name:find("nord") then - colors = { - bg = "#3B4252", - fg = "#ECEFF4", - fg_alt = "#D8DEE9", - yellow = "#EBCB8B", - cyan = "#88C0D0", - green = "#A3BE8C", - orange = "#D08770", - magenta = "#B48EAD", - blue = "#5E81AC", - red = "#BF616A", - } - elseif vim.g.colors_name:find("tokyonight") then - colors = { - bg = "#292e42", - fg = "#c0caf5", - fg_alt = "#a9b1d6", - yellow = "#e0af68", - cyan = "#1abc9c", - green = "#9ece6a", - orange = "#ff9e64", - magenta = "#bb9af7", - blue = "#2ac3de", - red = "#f7768e", - } - elseif vim.g.colors_name:find("dracula") then - colors = { - bg = "#21222C", - fg = "#F8F8F2", - fg_alt = "#ABB2BF", - yellow = "#F1FA8C", - cyan = "#8BE9FD", - green = "#50FA7B", - orange = "#FFB86C", - magenta = "#BD93F9", - blue = "#A4FFFF", - red = "#FF5555", - } - end - return colors[name] - end -end - -return M diff --git a/lua/doom/modules/config/doom-eviline.lua b/lua/doom/modules/config/doom-eviline.lua index 973ad7905..bf9372f5a 100644 --- a/lua/doom/modules/config/doom-eviline.lua +++ b/lua/doom/modules/config/doom-eviline.lua @@ -1,12 +1,11 @@ return function() local utils = require("doom.utils") - local config = require("doom.core.config").load_config() - local get_color = require("doom.modules.config.doom-eviline-palettes").get_color + local config = require("doom.core.config").config + local colors = require("galaxyline.themes.colors").get_color - local bo = vim.bo local gl = require("galaxyline") - local lsp = require("galaxyline.provider_lsp") - local buffer = require("galaxyline.provider_buffer") + local lsp = require("galaxyline.providers.lsp") + local buffer = require("galaxyline.providers.buffer") local condition = require("galaxyline.condition") local gls = gl.section @@ -17,21 +16,22 @@ return function() "minimap", "Outline", "toggleterm", + "netrw", } + if not config.doom.dashboard_statline then + table.insert(gl.exclude_filetypes, "dashboard") + end + -- {{{ Utility functions local function is_dashboard() local buftype = buffer.get_buffer_filetype() - if buftype == "DASHBOARD" then - return true - end + return buftype == "DASHBOARD" end local function is_not_dashboard() local buftype = buffer.get_buffer_filetype() - if buftype ~= "DASHBOARD" then - return true - end + return buftype ~= "DASHBOARD" end -- }}} @@ -41,7 +41,7 @@ return function() provider = function() return "โ–Š " end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } gls.left[2] = { @@ -50,43 +50,43 @@ return function() -- auto change color according the vim mode -- TODO: find a less dirty way to set ViMode colors local mode_color = { - n = get_color("red")(), - i = get_color("green")(), - v = get_color("blue")(), - [""] = get_color("blue")(), - V = get_color("blue")(), - c = get_color("magenta")(), - no = get_color("red")(), - s = get_color("orange")(), - S = get_color("orange")(), - [""] = get_color("orange")(), - ic = get_color("yellow")(), - R = get_color("magenta")(), - Rv = get_color("magenta")(), - cv = get_color("red")(), - ce = get_color("red")(), - r = get_color("cyan")(), - rm = get_color("cyan")(), - ["r?"] = get_color("cyan")(), - ["!"] = get_color("red")(), - t = get_color("red")(), + n = colors("red"), + i = colors("green"), + v = colors("blue"), + [""] = colors("blue"), + V = colors("blue"), + c = colors("magenta"), + no = colors("red"), + s = colors("orange"), + S = colors("orange"), + [""] = colors("orange"), + ic = colors("yellow"), + R = colors("magenta"), + Rv = colors("magenta"), + cv = colors("red"), + ce = colors("red"), + r = colors("cyan"), + rm = colors("cyan"), + ["r?"] = colors("cyan"), + ["!"] = colors("red"), + t = colors("red"), } - vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()]) + vim.api.nvim_command("hi GalaxyViMode guifg=" .. mode_color[vim.fn.mode()]()) return "๏ŒŒ " end, - highlight = { get_color("red"), get_color("bg"), "bold" }, + highlight = { colors("red"), colors("bg"), "bold" }, }, } gls.left[3] = { FileSize = { provider = "FileSize", - condition = condition.buffer_not_empty and is_not_dashboard, + condition = condition.buffer_not_empty and condition.hide_in_width, highlight = { - get_color("fg"), - get_color("bg"), + colors("fg"), + colors("bg"), }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.left[4] = { @@ -94,18 +94,18 @@ return function() provider = "FileIcon", condition = condition.buffer_not_empty and is_not_dashboard, highlight = { - require("galaxyline.provider_fileinfo").get_file_icon_color, - get_color("bg"), + require("galaxyline.providers.fileinfo").get_file_icon_color, + colors("bg"), }, }, } gls.left[5] = { FileName = { - provider = "FileName", + provider = config.doom.statusline_show_file_path and "FilePath" or "FileName", condition = condition.buffer_not_empty and is_not_dashboard, - highlight = { get_color("fg"), get_color("bg"), "bold" }, + highlight = { colors("fg"), colors("bg"), "bold" }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.left[6] = { @@ -116,16 +116,16 @@ return function() return string.format("%3d : %2d ", line, column) end, condition = is_not_dashboard, - highlight = { get_color("fg_alt"), get_color("bg") }, + highlight = { colors("fg_alt"), colors("bg") }, }, } gls.left[7] = { LinePercent = { provider = "LinePercent", condition = is_not_dashboard, - highlight = { get_color("fg_alt"), get_color("bg") }, + highlight = { colors("fg_alt"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.left[8] = { @@ -133,15 +133,15 @@ return function() provider = "DiagnosticError", condition = is_not_dashboard, icon = config.doom.lsp_error .. " ", - highlight = { get_color("red"), get_color("bg") }, + highlight = { colors("red"), colors("bg") }, }, } gls.left[9] = { DiagnosticWarn = { provider = "DiagnosticWarn", condition = is_not_dashboard, - icon = config.doom.lsp_warning .. " ", - highlight = { get_color("orange"), get_color("bg") }, + icon = config.doom.lsp_warn .. " ", + highlight = { colors("orange"), colors("bg") }, }, } gls.left[10] = { @@ -149,7 +149,7 @@ return function() provider = "DiagnosticInfo", condition = is_not_dashboard, icon = config.doom.lsp_hint .. " ", - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } @@ -159,18 +159,19 @@ return function() FileFormat = { provider = "FileFormat", condition = condition.hide_in_width and is_not_dashboard, - highlight = { get_color("fg"), get_color("bg") }, + highlight = { colors("fg"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } + gls.right[2] = { FileEncode = { provider = "FileEncode", condition = condition.hide_in_width and is_not_dashboard, - highlight = { get_color("fg"), get_color("bg") }, + highlight = { colors("fg"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.right[3] = { @@ -179,40 +180,40 @@ return function() -- Check if there's a LSP client running to avoid redundant -- statusline elements if lsp.get_lsp_client() ~= "No Active Lsp" then - return "๎˜ " .. lsp.get_lsp_client():gsub("^%l", string.upper) + return string.format("๎˜ %s ยป %s ", vim.bo.filetype, lsp.get_lsp_client()) else - -- Use the filetype instead and capitalize it - return "๏ " .. (vim.bo.filetype:gsub("^%l", string.upper)) + -- Use the filetype instead + return string.format("๏ %s ", vim.bo.filetype) end end, condition = function() local tbl = { ["dashboard"] = true, [""] = true } - if tbl[bo.filetype] then + if tbl[vim.bo.filetype] then return false end return true end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.right[4] = { GitIcon = { provider = function() - return " ๏žก " + return "๏žก " end, condition = condition.check_git_workspace, - highlight = { get_color("red"), get_color("bg") }, + highlight = { colors("red"), colors("bg") }, separator = " ", - separator_highlight = { get_color("bg"), get_color("bg") }, + separator_highlight = { colors("bg"), colors("bg") }, }, } gls.right[5] = { GitBranch = { provider = "GitBranch", condition = condition.check_git_workspace, - highlight = { get_color("green"), get_color("bg"), "bold" }, + highlight = { colors("green"), colors("bg"), "bold" }, }, } gls.right[6] = { @@ -220,32 +221,32 @@ return function() provider = function() return " " end, - condition = is_not_dashboard, - highlight = { get_color("bg"), get_color("bg") }, + condition = condition.hide_in_width, + highlight = { colors("bg"), colors("bg") }, }, } gls.right[7] = { DiffAdd = { provider = "DiffAdd", - condition = condition.hide_in_width and is_not_dashboard, + condition = condition.hide_in_width, icon = "๏‘— ", - highlight = { get_color("green"), get_color("bg") }, + highlight = { colors("green"), colors("bg") }, }, } gls.right[8] = { DiffModified = { provider = "DiffModified", - condition = condition.hide_in_width and is_not_dashboard, + condition = condition.hide_in_width, icon = "๏‘™ ", - highlight = { get_color("orange"), get_color("bg") }, + highlight = { colors("orange"), colors("bg") }, }, } gls.right[9] = { DiffRemove = { provider = "DiffRemove", - condition = condition.hide_in_width and is_not_dashboard, + condition = condition.hide_in_width, icon = "๏‘˜ ", - highlight = { get_color("red"), get_color("bg") }, + highlight = { colors("red"), colors("bg") }, }, } @@ -257,11 +258,11 @@ return function() return "DOOM v" .. utils.doom_version .. " " end, condition = is_dashboard, - highlight = { get_color("blue"), get_color("bg"), "bold" }, + highlight = { colors("blue"), colors("bg"), "bold" }, separator = " ", separator_highlight = { - get_color("bg"), - get_color("bg"), + colors("bg"), + colors("bg"), }, }, } @@ -271,7 +272,7 @@ return function() provider = function() return " โ–Š" end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } @@ -281,14 +282,14 @@ return function() provider = function() return "โ–Š " end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } gls.short_line_left[2] = { BufferType = { provider = "FileTypeName", condition = is_not_dashboard, - highlight = { get_color("fg"), get_color("bg") }, + highlight = { colors("fg"), colors("bg") }, }, } @@ -296,7 +297,7 @@ return function() BufferIcon = { provider = "BufferIcon", condition = is_not_dashboard, - highlight = { get_color("yellow"), get_color("bg") }, + highlight = { colors("yellow"), colors("bg") }, }, } gls.short_line_right[2] = { @@ -304,7 +305,7 @@ return function() provider = function() return " โ–Š" end, - highlight = { get_color("blue"), get_color("bg") }, + highlight = { colors("blue"), colors("bg") }, }, } end diff --git a/lua/doom/modules/config/doom-gitsigns.lua b/lua/doom/modules/config/doom-gitsigns.lua index 2a8cee097..ac3f9374f 100644 --- a/lua/doom/modules/config/doom-gitsigns.lua +++ b/lua/doom/modules/config/doom-gitsigns.lua @@ -60,11 +60,15 @@ return function() ["x ih"] = ':<C-U>lua require"gitsigns".select_hunk()<CR>', }, watch_gitdir = { interval = 1000, follow_files = true }, - current_line_blame = false, - current_line_blame_opts = { delay = 1000, virt_text_pos = "eol" }, + current_line_blame_opts = { + delay = 1000, + position = "eol", + }, sign_priority = 6, update_debounce = 100, status_formatter = nil, -- Use default - diff_opts = { internal = true }, -- If luajit is present + diff_opts = { + internal = true, -- If luajit is present + }, }) end diff --git a/lua/doom/modules/config/doom-lint.lua b/lua/doom/modules/config/doom-lint.lua new file mode 100644 index 000000000..34de56abb --- /dev/null +++ b/lua/doom/modules/config/doom-lint.lua @@ -0,0 +1,18 @@ +return function() + local linters = require("doom.core.config").config.doom.linters + + require("lint").linters_by_ft = { + c = linters.c, + cpp = linters.cpp, + css = linters.css, + html = linters.html, + javascript = linters.javascript, + lua = linters.lua, + markdown = linters.markdown, + nix = linters.nix, + python = linters.python, + ruby = linters.ruby, + sh = linters.sh, + typescript = linters.typescript, + } +end diff --git a/lua/doom/modules/config/doom-lsp-installer.lua b/lua/doom/modules/config/doom-lsp-installer.lua new file mode 100644 index 000000000..0d05a542b --- /dev/null +++ b/lua/doom/modules/config/doom-lsp-installer.lua @@ -0,0 +1,261 @@ +return function() + local log = require("doom.extras.logging") + local utils = require("doom.utils") + local is_plugin_disabled = require("doom.utils").is_plugin_disabled + + -- Commented out defualt servers don't have treesitter configs + local servers = { + lua = { "sumneko_lua" }, + ansible = { "ansiblels" }, + angular = { "angularls" }, + bash = { "bashls" }, + -- bicep = { 'bicep' }, + c_sharp = { "omnisharp" }, + c = { "clangd" }, + cpp = { "clangd" }, + cmake = { "cmake" }, + css = { "cssls" }, + clojure = { "clojure_lsp" }, + -- codeql = { 'codeqlls' }, + -- deno = { 'denols' }, + -- dlang = { 'serve_d' }, + dockerfile = { "dockerls" }, + dot = { "dotls" }, + elixer = { "elixerls" }, + elm = { "elmls" }, + ember = { "ember" }, + fortran = { "fortls" }, + -- ['f#'] = { 'fsautocomplete' }, + go = { "gopls" }, + graphql = { "graphql" }, + groovy = { "groovyls" }, + html = { "html" }, + haskel = { "hls" }, + json = { "jsonls" }, + json5 = { "jsonls" }, + java = { "jdtls" }, + javascript = { "tsserver" }, + kotlin = { "kotlin_language_server" }, + latex = { "texlab" }, + ocaml = { "ocamells" }, + php = { "phpactor" }, + powershell = { "powershell_es" }, + -- prisma = { 'prismals' }, + -- puppet = { 'puppet' }, + -- purescript = { 'purescriptls' }, + python = { "pyright" }, + -- rescript = { 'rescriptls' }, + -- rome = { 'rome' }, + ruby = { "solargraph" }, + rust = { "rust_analyzer" }, + -- solang = { 'solang' }, + -- sorbet = { 'sorbet' }, + svelte = { "svelte" }, + typescript = { "tsserver" }, + -- vala = { 'valals' }, + vim = { "vimls" }, + vue = { "vuels" }, + xml = { "lemminx" }, + yaml = { "yamlls" }, + config = { "jsonls", "yamlls" }, + } + -- Add out-of-the-box support for Scala metals LSP + local should_setup_scala_lsp = false + + -- Snippets support + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.completion.completionItem.preselectSupport = true + capabilities.textDocument.completion.completionItem.insertReplaceSupport = true + capabilities.textDocument.completion.completionItem.labelDetailsSupport = true + capabilities.textDocument.completion.completionItem.deprecatedSupport = true + capabilities.textDocument.completion.completionItem.commitCharactersSupport = true + capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } + capabilities.textDocument.completion.completionItem.snippetSupport = true + capabilities.textDocument.completion.completionItem.resolveSupport = { + properties = { "documentation", "detail", "additionalTextEdits" }, + } + capabilities.textDocument.codeAction = { + dynamicRegistration = false, + codeActionLiteralSupport = { + codeActionKind = { + valueSet = { + "", + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports", + }, + }, + }, + } + + --- Intelligent highlighting of word under cursor + local on_attach + if not is_plugin_disabled("illuminated") and packer_plugins["vim-illuminate"] then + on_attach = function(client) + require("illuminate").on_attach(client) + -- Set underline highlighting for Lsp references + vim.cmd("hi! LspReferenceText cterm=underline gui=underline") + vim.cmd("hi! LspReferenceWrite cterm=underline gui=underline") + vim.cmd("hi! LspReferenceRead cterm=underline gui=underline") + end + end + + local lua_lsp = require("lua-dev").setup({ + lspconfig = { + settings = { + Lua = { + workspace = { + preloadFileSize = 200, + }, + diagnostics = { + globals = { "packer_plugins" }, + }, + }, + }, + capabilities = capabilities, + on_attach = on_attach, + }, + }) + + -- Load langs from doom_modules, install servers with +lsp flag and sets up their config + local function setup_servers() + local lsp_installer = require("nvim-lsp-installer") + + local modules = require("doom.core.config.modules").modules + local langs = modules.langs + + -- Find all LSPs that need to be installed + local ensure_installed = {} + for _, lang in ipairs(langs) do + -- Lang name used for key in servers table + local lang_name = lang + :gsub("%s+%+lsp(%(%a+%))", "") + :gsub("%s+%+lsp", "") + :gsub("%s+%+debug", "") + -- Get LSP override +lsp(<override>) if it exists + local lsp_override = lang:match("+lsp%((.+)%)") + -- Array of lsps to ensure are installed + local lang_lsps = lsp_override ~= nil and vim.split(lsp_override, ",") + or servers[lang_name] ~= nil and servers[lang_name] + or nil + + local should_install_lsp = lang:find("+lsp") + + -- Save all lsps to ensure_installed + if should_install_lsp then + if lang_lsps ~= nil then + for _, lsp_name in ipairs(lang_lsps) do + local trimmed_lsp_name = vim.trim(lsp_name) + if utils.has_value(ensure_installed, trimmed_lsp_name) == false then + table.insert(ensure_installed, trimmed_lsp_name) + end + end + else + if lang:find("scala") then + -- Enable setup for Scala Metals LSP + should_setup_scala_lsp = true + else + log.error( + 'The language "' .. lang .. '" does not have an LSP, please remove the "+lsp" flag.' + ) + end + end + end + end + + -- Flatten the array of default servers. + -- Default servers will be automatically uninstalled if no +lsp flag is provided. + local default_servers = {} + for _, lang_servers in pairs(servers) do + for _, lsp_name in ipairs(lang_servers) do + if not utils.has_value(default_servers, lsp_name) then + table.insert(default_servers, lsp_name) + end + end + end + -- Save which servers were installed/uninstalled so this info can be presented to user + local installing_servers = {} + local uninstalling_servers = {} + -- Install all LSPs that should be installed + for _, lsp_name in ipairs(default_servers) do + local ok, server = lsp_installer.get_server(lsp_name) + if ok then + if not utils.has_value(ensure_installed, lsp_name) then + if server:is_installed() then + table.insert(uninstalling_servers, lsp_name) + server:uninstall() + log.info("doom-lsp-installer: Uninstalling server " .. lsp_name .. ".") + end + else + local server_config = server.name == "sumneko_lua" and lua_lsp + or { + capabilities = capabilities, + on_attach = on_attach, + } + -- Setup server once it's ready + server:on_ready(function() + server:setup(server_config) + end) + if not server:is_installed() then + table.insert(installing_servers, lsp_name) + server:install() + log.info("doom-lsp-installer: Installing server " .. lsp_name .. ".") + end + end + end + end + + -- Install and setup non-default LSPs + for _, lsp_name in ipairs(ensure_installed) do + if not utils.has_value(default_servers, lsp_name) then + local ok, server = lsp_installer.get_server(lsp_name) + + if ok then + server:on_ready(function() + server:setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + end) + if not server:is_installed() then + table.insert(installing_servers, lsp_name) + server:install() + log.info("doom-lsp-installer: Installing server " .. lsp_name .. ".") + end + end + end + end + + -- Setup Scala Metals LSP + if should_setup_scala_lsp then + require("lspconfig").metals.setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + end + + -- Print intalling/uninstalling information to user on startup + if next(installing_servers) ~= nil or next(uninstalling_servers) ~= nil then + local msg = "Doom: " + local installing_count = #installing_servers + if installing_count > 0 then + msg = msg .. "Installing " .. installing_count .. " LSPs. " + end + local uninstalling_count = #uninstalling_servers + if uninstalling_count > 0 then + msg = msg .. "Uninstalling " .. installing_count .. " LSPs. " + end + msg = msg .. "Use :LspInstallInfo to check status. " + vim.notify(msg) + end + end + + -- Defer auto install to unblock startup + vim.defer_fn(function() + setup_servers() + end, 50) +end diff --git a/lua/doom/modules/config/doom-lsp-signature.lua b/lua/doom/modules/config/doom-lsp-signature.lua index 5bcf762e2..64c17e6ac 100644 --- a/lua/doom/modules/config/doom-lsp-signature.lua +++ b/lua/doom/modules/config/doom-lsp-signature.lua @@ -1,4 +1,31 @@ return function() -- Signature help - require("lsp_signature").on_attach() + local cfg = { + bind = true, + doc_lines = 10, + floating_window = false, -- show hint in a floating window, set to false for virtual text only mode + floating_window_above_cur_line = true, + fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters + hint_enable = true, -- virtual hint enable + -- hint_prefix = "๐Ÿผ ", -- Panda for parameter + hint_prefix = "๎žก ", + hint_scheme = "String", + -- use_lspsaga = false, -- set to true if you want to use lspsaga popup + hi_parameter = "Search", -- how your parameter will be highlight + max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down + -- to view the hiding contents + max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width + handler_opts = { + border = "single", -- double, single, shadow, none + }, + -- transpancy = 80, + extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} + zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom + debug = false, -- set to true to enable debug logging + log_path = "debug_log_file_path", -- debug log path + padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc + shadow_blend = 36, -- if you using shadow as border use this set the opacity + shadow_guibg = "Black", -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' + } + require("lsp_signature").setup(cfg) end diff --git a/lua/doom/modules/config/doom-lspconfig.lua b/lua/doom/modules/config/doom-lspconfig.lua index 0df003071..6a32f830a 100644 --- a/lua/doom/modules/config/doom-lspconfig.lua +++ b/lua/doom/modules/config/doom-lspconfig.lua @@ -1,39 +1,43 @@ return function() local fn = vim.fn local lsp = vim.lsp - local config = require("doom.core.config").load_config() - - -- Snippets support - local capabilities = lsp.protocol.make_client_capabilities() - capabilities.textDocument.completion.completionItem.snippetSupport = true + local config = require("doom.core.config").config -- Lsp Symbols - fn.sign_define("LspDiagnosticsSignError", { - texthl = "LspDiagnosticsSignError", - text = config.doom.lsp_error, - numhl = "LspDiagnosticsSignError", - }) - fn.sign_define("LspDiagnosticsSignWarning", { - texthl = "LspDiagnosticsSignWarning", - text = config.doom.lsp_warning, - numhl = "LspDiagnosticsSignWarning", - }) - fn.sign_define("LspDiagnosticsSignHint", { - texthl = "LspDiagnosticsSignHint", - text = config.doom.lsp_hint, - numhl = "LspDiagnosticsSignHint", - }) - fn.sign_define("LspDiagnosticsSignInformation", { - texthl = "LspDiagnosticsSignInformation", - text = config.doom.lsp_information, - numhl = "LspDiagnosticsSignInformation", - }) + local signs, hl + if vim.fn.has("nvim-0.6.0") == 1 then + signs = { + Error = config.doom.lsp_error, + Warn = config.doom.lsp_warn, + Info = config.doom.lsp_info, + Hint = config.doom.lsp_hint, + } + hl = "DiagnosticSign" + else + signs = { + Error = config.doom.lsp_error, + Warning = config.doom.lsp_warn, + Information = config.doom.lsp_info, + Hint = config.doom.lsp_hint, + } + hl = "LspDiagnosticsSign" + end + + for severity, icon in pairs(signs) do + local highlight = hl .. severity + + fn.sign_define(highlight, { + text = icon, + texthl = highlight, + numhl = highlight, + }) + end lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, { - virtual_text = { + virtual_text = config.doom.enable_lsp_virtual_text and { prefix = config.doom.lsp_virtual_text, -- change this to whatever you want your diagnostic icons to be - }, + } or false, }) -- Border for lsp_popups lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { @@ -47,18 +51,18 @@ return function() " ๏’ž (Text) ", " ๏šฆ (Method)", " ๏ž” (Function)", - " ๏ฅ (Constructor)", + " ๏ฃ (Constructor)", " ๏ดฒ (Field)", - "[๎œ–] (Variable)", + " ๎œ– (Variable)", " ๏ – (Class)", " ๏ฐฎ (Interface)", " ๏™จ (Module)", - " ๏ชถ (Property)", + " ๏ฐ  (Property)", " ๏‘ต (Unit)", " ๏ขŸ (Value)", " ๏ฉ— (Enum)", " ๏ Š (Keyword)", - " ๏ƒ„ (Snippet)", + " ๏‘ (Snippet)", " ๏ฃ— (Color)", " ๏œ“ (File)", " ๏œœ (Reference)", @@ -67,7 +71,7 @@ return function() " ๏ฒ€ (Constant)", " ๏ณค (Struct)", " ๏ƒง (Event)", - " ๏—ซ (Operator)", + " ๏š” (Operator)", " ๏žƒ (TypeParameter)", } diff --git a/lua/doom/modules/config/doom-lspinstall.lua b/lua/doom/modules/config/doom-lspinstall.lua deleted file mode 100644 index baf694e7b..000000000 --- a/lua/doom/modules/config/doom-lspinstall.lua +++ /dev/null @@ -1,71 +0,0 @@ -return function() - local log = require("doom.extras.logging") - local utils = require("doom.utils") - local nvim_lsp = require("lspconfig") - local lua_lsp = require("lua-dev").setup({ - lspconfig = { - settings = { - Lua = { - workspace = { - preloadFileSize = 200, - }, - }, - }, - }, - }) - - local lspinstall = require("lspinstall") - lspinstall.setup() - - -- Load langs from doomrc and install servers with +lsp - local function install_servers() - local installed_servers = lspinstall.installed_servers() - local available_servers = lspinstall.available_servers() - - local doomrc = require("doom.core.config.doomrc").load_doomrc() - local langs = doomrc.langs - - for _, lang in ipairs(langs) do - local lang_str = lang - lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") - - -- If the +lsp flag exists and the language server is not installed yet - if lang_str:find("%+lsp") and (not utils.has_value(installed_servers, lang)) then - -- Try to install the server only if there is a server available for - -- the language, oterwise raise a warning - if utils.has_value(available_servers, lang) then - lspinstall.install_server(lang) - else - log.warn( - "The language " .. lang .. ' does not have a server, please remove the "+lsp" flag' - ) - end - end - end - end - - install_servers() - - -- https://github.com/kabouzeid/nvim-lspinstall#advanced-configuration-recommended - local function setup_servers() - -- Provide the missing :LspInstall - local servers = require("lspinstall").installed_servers() - for _, server in pairs(servers) do - -- Configure sumneko for neovim lua development - if server == "lua" then - nvim_lsp.lua.setup(lua_lsp) - else - -- Use default settings for all the other language servers - nvim_lsp[server].setup({}) - end - end - end - - setup_servers() - - -- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim - require("lspinstall").post_install_hook = function() - setup_servers() -- reload installed servers - vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server - end -end diff --git a/lua/doom/modules/config/doom-luasnip.lua b/lua/doom/modules/config/doom-luasnip.lua index a572ed6c4..6b4b6a3ae 100644 --- a/lua/doom/modules/config/doom-luasnip.lua +++ b/lua/doom/modules/config/doom-luasnip.lua @@ -1,3 +1,27 @@ return function() - require("luasnip.loaders.from_vscode").lazy_load() + local mappings = require("doom.utils.mappings") + local luasnip = require("luasnip") + + luasnip.config.set_config({ + history = true, + -- Update more often, :h events for more info. + updateevents = "TextChanged,TextChangedI", + }) + + require("luasnip/loaders/from_vscode").load() + + --- <tab> to jump to next snippet's placeholder + local function on_tab() + return luasnip.jump(1) and "" or mappings.t("<Tab>") + end + + --- <s-tab> to jump to next snippet's placeholder + local function on_s_tab() + return luasnip.jump(-1) and "" or mappings.t("<S-Tab>") + end + + mappings.imap("<Tab>", on_tab, { expr = true }) + mappings.smap("<Tab>", on_tab, { expr = true }) + mappings.imap("<S-Tab>", on_s_tab, { expr = true }) + mappings.smap("<S-Tab>", on_s_tab, { expr = true }) end diff --git a/lua/doom/modules/config/doom-neorg.lua b/lua/doom/modules/config/doom-neorg.lua index 514ad1eac..bea69f79b 100644 --- a/lua/doom/modules/config/doom-neorg.lua +++ b/lua/doom/modules/config/doom-neorg.lua @@ -1,4 +1,6 @@ return function() + local doom_root = require("doom.core.system").doom_root + -- Default setup for Neorg require("neorg").setup({ -- Tell Neorg what modules to load @@ -15,9 +17,39 @@ return function() config = { workspaces = { default_workspace = "~/neorg", + gtd = "~/neorg/gtd", + doom_docs = string.format("%s/doc", doom_root), }, }, }, + ["core.gtd.base"] = { + config = { + workspace = "gtd", + }, + }, }, }) + + -- Check if user is using clang and notify that it has poor compatibility with treesitter + -- WARN: 19/11/2021 | issues: #222, #246 clang compatibility could improve in future + vim.defer_fn(function() + local log = require("doom.extras.logging") + local utils = require("doom.utils") + -- Matches logic from nvim-treesitter + local compiler = utils.find_executable_in_path({ + vim.fn.getenv("CC"), + "cc", + "gcc", + "clang", + "cl", + "zig", + }) + local version = vim.fn.systemlist(compiler .. (compiler == "cl" and "" or " --version"))[1] + + if version:match("clang") then + log.warn( + "doom-neorg: clang has poor compatibility compiling treesitter parsers. We recommend using gcc instead, see issue #246 for details. (https://github.com/NTBBloodbath/doom-nvim/issues/246)" + ) + end + end, 1000) end diff --git a/lua/doom/modules/config/doom-symbols.lua b/lua/doom/modules/config/doom-symbols.lua index 492bb0633..f58992c5c 100644 --- a/lua/doom/modules/config/doom-symbols.lua +++ b/lua/doom/modules/config/doom-symbols.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config vim.g.symbols_outline = { highlight_hovered_item = true, diff --git a/lua/doom/modules/config/doom-toggleterm.lua b/lua/doom/modules/config/doom-toggleterm.lua index 0384b3316..89f9037ae 100644 --- a/lua/doom/modules/config/doom-toggleterm.lua +++ b/lua/doom/modules/config/doom-toggleterm.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config require("toggleterm").setup({ size = config.doom.terminal_height, diff --git a/lua/doom/modules/config/doom-tree.lua b/lua/doom/modules/config/doom-tree.lua index de0ab75c0..62ccf804d 100644 --- a/lua/doom/modules/config/doom-tree.lua +++ b/lua/doom/modules/config/doom-tree.lua @@ -1,5 +1,5 @@ return function() - local config = require("doom.core.config").load_config() + local config = require("doom.core.config").config local tree_cb = require("nvim-tree.config").nvim_tree_callback ----- GLOBAL VARIABLES ------------------------ @@ -52,19 +52,24 @@ return function() -- if nvim-web-devicons is installed and on your runtimepath vim.g.nvim_tree_show_icons = { git = 1, folders = 1, files = 1, folder_arrows = 0 } + --- Tree icons -- default will show icon by default if no icon is provided -- default shows no icon by default vim.g.nvim_tree_icons = { default = "๎˜’", symlink = "๏’", git = { - unstaged = "โœ—", - staged = "โœ“", + unstaged = "๏‘—", + staged = "๏‘™", unmerged = "๎œง", - renamed = "โžœ", - untracked = "โ˜…", + renamed = "๏‘š", + untracked = "๏„จ", + deleted = "๏‘˜", + ignored = "โ—Œ", }, folder = { + arrow_open = "๏‘ผ", + arrow_closed = "๏‘ ", default = "๎—ฟ", open = "๎—พ", empty = "๏„”", @@ -72,6 +77,12 @@ return function() symlink = "๏’‚", symlink_open = "๎—พ", }, + lsp = { + hint = config.doom.lsp_hint, + info = config.doom.lsp_info, + warning = config.doom.lsp_warn, + error = config.doom.lsp_error, + }, } ----- SETUP CONFIGURATION --------------------- @@ -95,11 +106,11 @@ return function() update_cwd = true, -- show lsp diagnostics in the signcolumn diagnostics = { - enable = require("doom.core.functions").is_plugin_disabled("lsp") and false or true, + enable = require("doom.utils").is_plugin_disabled("lsp") and false or true, icons = { hint = config.doom.lsp_hint, - info = config.doom.lsp_information, - warning = config.doom.lsp_warning, + info = config.doom.lsp_info, + warning = config.doom.lsp_warn, error = config.doom.lsp_error, }, }, diff --git a/lua/doom/modules/config/doom-treesitter.lua b/lua/doom/modules/config/doom-treesitter.lua index 60089d17f..99ff91390 100644 --- a/lua/doom/modules/config/doom-treesitter.lua +++ b/lua/doom/modules/config/doom-treesitter.lua @@ -1,8 +1,11 @@ return function() local has_value = require("doom.utils").has_value - local doomrc = require("doom.core.config.doomrc").load_doomrc() - local functions = require("doom.core.functions") + local modules = require("doom.core.config.modules").modules + local is_plugin_disabled = require("doom.utils").is_plugin_disabled + --- Returns treesitter parsers from doom_modules.langs + --- @param languages table<number, string> + --- @return table<number, string> local function get_ts_parsers(languages) local langs = {} @@ -13,7 +16,7 @@ return function() table.insert(langs, "yaml") table.insert(langs, "toml") else - lang = lang:gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") + lang = lang:gsub("%s+%+lsp(%(%a+%))", ""):gsub("%s+%+lsp", ""):gsub("%s+%+debug", "") table.insert(langs, lang) end end @@ -34,21 +37,22 @@ return function() branch = "main", }, } - -- selene: allow(undefined_variable) if packer_plugins and packer_plugins["neorg"] then - table.insert(doomrc.langs, "norg") + table.insert(modules.langs, "norg") end - -- macos uses wrong c version - require("nvim-treesitter.install").compilers = { "gcc" } + if packer_plugins and packer_plugins["rest.nvim"] then + table.insert(modules.langs, "http") + end require("nvim-treesitter.configs").setup({ - ensure_installed = get_ts_parsers(doomrc.langs), + ensure_installed = get_ts_parsers(modules.langs), highlight = { enable = true }, autopairs = { - enable = functions.is_plugin_disabled("autopairs") and false or true, + enable = is_plugin_disabled("autopairs") and false or true, }, indent = { enable = true }, + playground = { enable = true }, tree_docs = { enable = true }, context_commentstring = { enable = true }, autotag = { @@ -65,4 +69,27 @@ return function() }, }, }) + + -- Check if user is using clang and notify that it has poor compatibility with treesitter + -- WARN: 19/11/2021 | issues: #222, #246 clang compatibility could improve in future + vim.defer_fn(function() + local log = require("doom.extras.logging") + local utils = require("doom.utils") + -- Matches logic from nvim-treesitter + local compiler = utils.find_executable_in_path({ + vim.fn.getenv("CC"), + "cc", + "gcc", + "clang", + "cl", + "zig", + }) + local version = vim.fn.systemlist(compiler .. (compiler == "cl" and "" or " --version"))[1] + + if version:match("clang") then + log.warn( + "doom-treesitter: clang has poor compatibility compiling treesitter parsers. We recommend using gcc, see issue #246 for details. (https://github.com/NTBBloodbath/doom-nvim/issues/246)" + ) + end + end, 1000) end diff --git a/lua/doom/modules/config/doom-whichkey.lua b/lua/doom/modules/config/doom-whichkey.lua index ec5badac3..e6f633158 100644 --- a/lua/doom/modules/config/doom-whichkey.lua +++ b/lua/doom/modules/config/doom-whichkey.lua @@ -43,6 +43,7 @@ return function() }, window = { padding = { 0, 0, 0, 0 }, -- extra window padding [top, right, bottom, left] + border = "single", }, layout = { height = { min = 1, max = 10 }, -- min and max height of the columns @@ -110,6 +111,7 @@ return function() ["d"] = { "Show type definition" }, ["l"] = { "Show line diagnostics" }, ["q"] = { "Diagnostics into location list" }, + ["r"] = { "Rename symbol under cursor" }, }, }, ["d"] = { @@ -117,6 +119,7 @@ return function() ["b"] = { "Show Doom keybindings" }, ["c"] = { "Edit your Doom Nvim configuration" }, ["d"] = { "Open Doom Nvim documentation" }, + ["i"] = { "Open Doom Nvim information dashboard" }, ["u"] = { "Update Doom Nvim" }, ["r"] = { "Rollback Doom Nvim version" }, ["R"] = { "Create crash report" }, @@ -171,6 +174,17 @@ return function() ["h"] = { "Command history" }, ["m"] = { "Jump to mark" }, }, + ["t"] = { + name = "+tweak", + ["b"] = { "background" }, + ["c"] = { "completion" }, + ["g"] = { "signcolumn" }, -- "g" for gitsigs (also for ale) + ["i"] = { "indent" }, + ["n"] = { "number" }, + -- ["p"] = { "autopairs" }, -- moved below as conditional + ["s"] = { "spell" }, + ["x"] = { "syntax/treesetter" }, + }, ["w"] = { name = "+windows", ["w"] = { "Other window" }, @@ -209,6 +223,9 @@ return function() ["t"] = { "jump to tag" }, }, } - + local is_plugin_disabled = require("doom.utils").is_plugin_disabled + if not is_plugin_disabled("autopairs") then + mappings["t"]["p"] = { "autopairs" } + end wk.register(mappings, { prefix = "<leader>" }) end diff --git a/lua/doom/modules/init.lua b/lua/doom/modules/init.lua index 94dc2753a..ebe99c206 100644 --- a/lua/doom/modules/init.lua +++ b/lua/doom/modules/init.lua @@ -3,15 +3,21 @@ -- NOTE: We do not provide other LSP integration like coc.nvim, please refer -- to our FAQ to see why. -local utils = require("doom.utils") -local system = require("doom.core.system") -local functions = require("doom.core.functions") +local is_plugin_disabled = require("doom.utils").is_plugin_disabled +local use_floating_win_packer = require("doom.core.config").config.doom.use_floating_win_packer + +-- Freeze dependencies and helper function for clean code +local freeze_dependencies = require("doom.core.config").config.doom.freeze_dependencies +local pin_commit = function(commit_sha) + return freeze_dependencies and commit_sha or nil +end ---- Packer Bootstrap --------------------------- ------------------------------------------------- local packer_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim" if vim.fn.empty(vim.fn.glob(packer_path)) > 0 then + require("doom.extras.logging").info("Bootstrapping packer.nvim, please wait ...") vim.fn.system({ "git", "clone", @@ -34,6 +40,11 @@ packer.init({ install = "clone --depth %i --progress", }, }, + display = { + open_fn = use_floating_win_packer and function() + return require("packer.util").float({ border = "single" }) + end or nil, + }, profile = { enable = true, }, @@ -52,6 +63,9 @@ packer.startup(function(use) -- Tree-Sitter use({ "nvim-treesitter/nvim-treesitter", + commit = vim.fn.has("nvim-0.6.0") == 1 and pin_commit( + "afed686e6a8fc1035475d8c56c1b5ff252c346e5" + ) or pin_commit("47cfda2c6711077625c90902d7722238a8294982"), opt = true, run = ":TSUpdate", branch = vim.fn.has("nvim-0.6.0") == 1 and "master" or "0.5-compat", @@ -59,22 +73,32 @@ packer.startup(function(use) }) use({ "JoosepAlviste/nvim-ts-context-commentstring", - requires = { "Olical/aniseed" }, + commit = pin_commit("9f5e422e1030e7073e593ad32c5354aa0bcb0176"), after = "nvim-treesitter", }) use({ "nvim-treesitter/nvim-tree-docs", + commit = pin_commit("15135bd18c8f0c4d67dd1b36d3b2cd64579aab6f"), after = "nvim-treesitter", }) use({ "windwp/nvim-ts-autotag", + commit = pin_commit("80d427af7b898768c8d8538663d52dee133da86f"), after = "nvim-treesitter", }) + -- Aniseed, required by some treesitter modules + use({ + "Olical/aniseed", + commit = pin_commit("9c8f2cd17d454a38b11cedd323579b579ee27f9c"), + module_pattern = "aniseed", + }) + -- Neorg - local disabled_neorg = functions.is_plugin_disabled("neorg") + local disabled_neorg = is_plugin_disabled("neorg") use({ "nvim-neorg/neorg", + commit = --[[NO AUTO UPDATE]]pin_commit("3b4d5bcd0f85b15d99183c7d29e0eb1c5f88350b"), branch = "unstable", config = require("doom.modules.config.doom-neorg"), disable = disabled_neorg, @@ -82,9 +106,10 @@ packer.startup(function(use) }) -- Sessions - local disabled_sessions = functions.is_plugin_disabled("auto-session") + local disabled_sessions = is_plugin_disabled("auto-session") use({ "folke/persistence.nvim", + commit = pin_commit("77cf5a6ee162013b97237ff25450080401849f85"), config = require("doom.modules.config.doom-persistence"), -- event = "VimEnter", disable = disabled_sessions, @@ -94,31 +119,35 @@ packer.startup(function(use) --- UI Related --- -----]]------------[[----- -- Fancy start screen - local disabled_dashboard = functions.is_plugin_disabled("dashboard") + local disabled_dashboard = is_plugin_disabled("dashboard") use({ "glepnir/dashboard-nvim", + commit = pin_commit("ba98ab86487b8eda3b0934b5423759944b5f7ebd"), config = require("doom.modules.config.doom-dashboard"), disable = disabled_dashboard, }) -- Doom Colorschemes - local disabled_doom_themes = functions.is_plugin_disabled("doom-themes") + local disabled_doom_themes = is_plugin_disabled("doom-themes") use({ "GustavoPrietoP/doom-themes.nvim", + commit = pin_commit("03d417d3eab71c320744f8da22251715ba6cee53"), disable = disabled_doom_themes, - event = "ColorSchemePre", }) -- Development icons use({ "kyazdani42/nvim-web-devicons", + commit = pin_commit("8df4988ecf8599fc1f8f387bbf2eae790e4c5ffb"), module = "nvim-web-devicons", }) -- File tree - local disabled_tree = functions.is_plugin_disabled("explorer") + local disabled_tree = is_plugin_disabled("explorer") + and require("doom.core.config").config.doom.use_netrw use({ "kyazdani42/nvim-tree.lua", + commit = pin_commit("5d8453dfbd34ab00cb3e8ce39660f9a54cdd35f3"), requires = "nvim-web-devicons", config = require("doom.modules.config.doom-tree"), disable = disabled_tree, @@ -133,38 +162,41 @@ packer.startup(function(use) }) -- Ranger File Browser - local disabled_ranger = functions.is_plugin_disabled("ranger") + local disabled_ranger = is_plugin_disabled("ranger") use({ "francoiscabrol/ranger.vim", + commit = pin_commit("91e82debdf566dfaf47df3aef0a5fd823cedf41c"), requires = "rbgrouleff/bclose.vim", disable = disabled_ranger, }) -- Statusline -- can be disabled to use your own statusline - local disabled_statusline = functions.is_plugin_disabled("statusline") + local disabled_statusline = is_plugin_disabled("statusline") use({ - "glepnir/galaxyline.nvim", + "NTBBloodbath/galaxyline.nvim", + commit = pin_commit("7b812cfddfcac7d9031e2f8e03f2b71fe8b2558d"), config = require("doom.modules.config.doom-eviline"), disable = disabled_statusline, - event = "ColorScheme", }) -- Tabline -- can be disabled to use your own tabline - local disabled_tabline = functions.is_plugin_disabled("tabline") + local disabled_tabline = is_plugin_disabled("tabline") use({ "akinsho/bufferline.nvim", + commit = pin_commit("463637a3ac86dcaacbcd47aa608f53aaad749696"), config = require("doom.modules.config.doom-bufferline"), disable = disabled_tabline, - event = "ColorScheme", + event = "BufWinEnter", }) -- Better terminal -- can be disabled to use your own terminal plugin - local disabled_terminal = functions.is_plugin_disabled("terminal") + local disabled_terminal = is_plugin_disabled("terminal") use({ "akinsho/toggleterm.nvim", + commit = pin_commit("ff168c8218b963cc7fc9d80b684d840488839bb5"), config = require("doom.modules.config.doom-toggleterm"), disable = disabled_terminal, module = { "toggleterm", "toggleterm.terminal" }, @@ -173,9 +205,10 @@ packer.startup(function(use) }) -- Viewer & finder for LSP symbols and tags - local disabled_outline = functions.is_plugin_disabled("symbols") + local disabled_outline = is_plugin_disabled("symbols") use({ "simrat39/symbols-outline.nvim", + commit = pin_commit("552b67993ed959993279e0b0f8a1da9f3c5e6fc0"), config = require("doom.modules.config.doom-symbols"), disable = disabled_outline, cmd = { @@ -187,9 +220,10 @@ packer.startup(function(use) -- Minimap -- Depends on wfxr/code-minimap to work! - local disabled_minimap = functions.is_plugin_disabled("minimap") + local disabled_minimap = is_plugin_disabled("minimap") use({ "wfxr/minimap.vim", + commit = pin_commit("35c0dd759938459d866aba1bdf0f1fc0b670ed61"), disable = disabled_minimap, cmd = { "Minimap", @@ -201,46 +235,73 @@ packer.startup(function(use) }) -- Keybindings menu like Emacs's guide-key - local disabled_whichkey = functions.is_plugin_disabled("which-key") + local disabled_whichkey = is_plugin_disabled("which-key") use({ "folke/which-key.nvim", + commit = pin_commit("d3032b6d3e0adb667975170f626cb693bfc66baa"), opt = true, config = require("doom.modules.config.doom-whichkey"), disable = disabled_whichkey, }) -- popup that shows contents of each register - local disabled_show_registers = functions.is_plugin_disabled("show_registers") + local disabled_show_registers = is_plugin_disabled("show_registers") use({ "tversteeg/registers.nvim", + commit = pin_commit("4d1f3525c6f9be4297e99e6aed515af3677d7241"), disable = disabled_show_registers, }) -- Distraction free environment - local disabled_zen = functions.is_plugin_disabled("zen") + local disabled_zen = is_plugin_disabled("zen") use({ - "kdav5758/TrueZen.nvim", + "Pocco81/TrueZen.nvim", + commit = pin_commit("508b977d71650da5c9243698614a9a1416f116d4"), config = require("doom.modules.config.doom-zen"), disable = disabled_zen, module = "true-zen", event = "BufWinEnter", }) + -- Highlight other uses of the word under the cursor like VSC + local disabled_illuminate = is_plugin_disabled("illuminated") + use({ + "RRethy/vim-illuminate", + commit = pin_commit("2beae0581caa66cf8c09fad7c7c557f92d49d2bd"), + setup = function() + vim.g.Illuminate_ftblacklist = { + "help", + "dashboard", + "packer", + "norg", + "DoomInfo", + "NvimTree", + "Outline", + "toggleterm", + } + end, + disable = disabled_illuminate, + event = "BufRead", + }) + -----[[--------------]]----- --- Fuzzy Search --- -----]]--------------[[----- use({ "nvim-lua/plenary.nvim", + commit = pin_commit("1c31adb35fcebe921f65e5c6ff6d5481fa5fa5ac"), module = "plenary", }) use({ "nvim-lua/popup.nvim", + commit = pin_commit("b7404d35d5d3548a82149238289fa71f7f6de4ac"), module = "popup", }) - local disabled_telescope = functions.is_plugin_disabled("telescope") + local disabled_telescope = is_plugin_disabled("telescope") use({ "nvim-telescope/telescope.nvim", + commit = pin_commit("1c57cc6140644695f0d9bd71b63de45feeca6ae7"), cmd = "Telescope", module = "telescope", requires = { @@ -252,16 +313,22 @@ packer.startup(function(use) }) use({ "lazytanuki/nvim-mapper", + commit = pin_commit("e11e852bafa41a4a2c160fcd2d38779add423db9"), config = function() local doom_root, sep = require("doom.core.system").doom_root, require("doom.core.system").sep require("nvim-mapper").setup({ -- do not assign the default keymap (<leader>MM) - no_map = false, - -- default config search path is ~/.config/nvim/lua + no_map = true, + -- where should ripgrep look for your keybinds definitions. + -- Default config search path is ~/.config/nvim/lua search_path = string.format("%s%slua", doom_root, sep), + -- what should be done with the selected keybind when pressing enter. + -- Available actions: + -- * "definition" - Go to keybind definition (default) + -- * "execute" - Execute the keybind command + action_on_enter = "execute", }) end, - module = "nvim-mapper", disable = disabled_telescope, }) @@ -270,9 +337,10 @@ packer.startup(function(use) -----]]-------------[[----- -- Git gutter better alternative, written in Lua -- can be disabled to use your own git gutter plugin - local disabled_gitsigns = functions.is_plugin_disabled("gitsigns") + local disabled_gitsigns = is_plugin_disabled("gitsigns") use({ "lewis6991/gitsigns.nvim", + commit = pin_commit("95845ef39ce0a98f68cdfdcf7dd586c5e965acc7"), config = require("doom.modules.config.doom-gitsigns"), disable = disabled_gitsigns, requires = "plenary.nvim", @@ -280,9 +348,10 @@ packer.startup(function(use) }) -- Neogit - local disabled_neogit = functions.is_plugin_disabled("neogit") + local disabled_neogit = is_plugin_disabled("neogit") use({ "TimUntersberger/neogit", + commit = pin_commit("ab772d21b108127ad6c703f7457c279f5817f379"), config = function() require("neogit").setup({}) end, @@ -292,9 +361,10 @@ packer.startup(function(use) }) -- LazyGit integration - local disabled_lazygit = functions.is_plugin_disabled("lazygit") + local disabled_lazygit = is_plugin_disabled("lazygit") use({ "kdheepak/lazygit.nvim", + commit = pin_commit("497ef5578e15f6c79deef1cad71adedd1c80abd4"), requires = "plenary.nvim", disable = disabled_lazygit, cmd = { "LazyGit", "LazyGitConfig" }, @@ -303,53 +373,102 @@ packer.startup(function(use) -----[[------------]]----- --- Completion --- -----]]------------[[----- - local disabled_lsp = functions.is_plugin_disabled("lsp") + local disabled_lsp = is_plugin_disabled("lsp") -- Built-in LSP Config use({ "neovim/nvim-lspconfig", + commit = pin_commit("1cb8583d186d28f2959eac5d74a74dc745fae099"), config = require("doom.modules.config.doom-lspconfig"), disable = disabled_lsp, - event = "ColorScheme", - commit = "2e6c94069e92cb4a43416b3ac0267e941b3fd47e", }) + -- Snippets + local disabled_snippets = is_plugin_disabled("snippets") + + -- Autopairs + -- can be disabled to use your own autopairs + local disabled_autopairs = is_plugin_disabled("autopairs") + -- Completion plugin -- can be disabled to use your own completion plugin use({ - "hrsh7th/nvim-compe", + "hrsh7th/nvim-cmp", + commit = pin_commit("2e4270d02843d15510b3549354e238788ca07ca5"), + wants = { "LuaSnip" }, requires = { { - "ray-x/lsp_signature.nvim", - config = require("doom.modules.config.doom-lsp-signature"), + "L3MON4D3/LuaSnip", + commit = pin_commit("a54b21aee0423dbdce121c858ad6a88a58ef6e0f"), + event = "BufReadPre", + wants = "friendly-snippets", + config = require("doom.modules.config.doom-luasnip"), + disable = disabled_snippets, + requires = { "rafamadriz/friendly-snippets" }, + }, + { + "windwp/nvim-autopairs", + commit = pin_commit("e6b1870cd2e319f467f99188f99b1c3efc5824d2"), + config = require("doom.modules.config.doom-autopairs"), + disable = disabled_autopairs, + event = "BufReadPre", }, }, - config = require("doom.modules.config.doom-compe"), + config = require("doom.modules.config.doom-cmp"), disable = disabled_lsp, - opt = true, - after = "nvim-lspconfig", + event = "InsertEnter", }) - - -- Snippets - local disabled_snippets = functions.is_plugin_disabled("snippets") use({ - "L3MON4D3/LuaSnip", - config = require("doom.modules.config.doom-luasnip"), - disable = disabled_snippets, - requires = { "rafamadriz/friendly-snippets" }, - event = "BufWinEnter", + "hrsh7th/cmp-nvim-lua", + commit = pin_commit("d276254e7198ab7d00f117e88e223b4bd8c02d21"), + disable = disabled_lsp, + after = "nvim-cmp", + }) + use({ + "hrsh7th/cmp-nvim-lsp", + commit = pin_commit("134117299ff9e34adde30a735cd8ca9cf8f3db81"), + disable = disabled_lsp, + after = "nvim-cmp", + }) + use({ + "hrsh7th/cmp-path", + commit = pin_commit("81518cf6ae29f5f0c79cd47770ae90ff5225ee13"), + disable = disabled_lsp, + after = "nvim-cmp", + }) + use({ + "hrsh7th/cmp-buffer", + commit = pin_commit("a706dc69c49110038fe570e5c9c33d6d4f67015b"), + disable = disabled_lsp, + after = "nvim-cmp", + }) + use({ + "saadparwaiz1/cmp_luasnip", + commit = pin_commit("16832bb50e760223a403ffa3042859845dd9ef9d"), + disable = disabled_lsp, + after = "nvim-cmp", }) - -- provides the missing `:LspInstall` for `nvim-lspconfig`. + -- Manage Language serverss with ease. use({ - "kabouzeid/nvim-lspinstall", - config = require("doom.modules.config.doom-lspinstall"), + "williamboman/nvim-lsp-installer", + commit = pin_commit("bcce5db53b966e2dbd97fc8d1bbfa7db4a405f13"), + config = require("doom.modules.config.doom-lsp-installer"), disable = disabled_lsp, + }) + + -- Show function signature when you type + use({ + "ray-x/lsp_signature.nvim", + commit = pin_commit("c7b2b2e14b597c077804ae201f1ec9a7dac76ad0"), + config = require("doom.modules.config.doom-lsp-signature"), after = "nvim-lspconfig", + event = "InsertEnter", }) -- Setup for Lua development in Neovim use({ "folke/lua-dev.nvim", + commit = pin_commit("6a7abb62af1b6a4411a3f5ea5cf0cb6b47878cc0"), disable = disabled_lsp, module = "lua-dev", }) @@ -357,15 +476,17 @@ packer.startup(function(use) -----[[-----------]]----- --- Debugging --- -----]]-----------[[----- - local disabled_dap = functions.is_plugin_disabled("dap") + local disabled_dap = is_plugin_disabled("dap") use({ "mfussenegger/nvim-dap", + commit = pin_commit("4e8bb7ca12dc8ca6f7a500cbb4ecea185665c7f1"), disable = disabled_dap, - event = "ColorScheme", + event = "BufWinEnter", }) use({ "rcarriga/nvim-dap-ui", + commit = pin_commit("649e0fee4f0b8dc6305dd29065c7623c3dc6a032"), config = require("doom.modules.config.doom-dap-ui"), disable = disabled_dap, after = "nvim-dap", @@ -373,6 +494,8 @@ packer.startup(function(use) use({ "Pocco81/DAPInstall.nvim", + commit = pin_commit("dd09e9dd3a6e29f02ac171515b8a089fb82bb425"), + config = require("doom.modules.config.doom-dap-install"), disable = disabled_dap, after = "nvim-dap", }) @@ -382,65 +505,85 @@ packer.startup(function(use) -----]]--------------[[----- -- Write / Read files without permissions (e.vim.g. /etc files) without having -- to use `sudo nvim /path/to/file` - local disabled_suda = functions.is_plugin_disabled("suda") + local disabled_suda = is_plugin_disabled("suda") use({ "lambdalisue/suda.vim", + commit = pin_commit("0290c93c148a14eab2b661a1933003d86436f6ec"), disable = disabled_suda, cmd = { "SudaRead", "SudaWrite" }, }) -- File formatting -- can be disabled to use your own file formatter - local disabled_formatter = functions.is_plugin_disabled("formatter") + local disabled_formatter = is_plugin_disabled("formatter") use({ "lukas-reineke/format.nvim", + commit = pin_commit("c46ab8b46100e26fce4d6ce69a94d4cea8b9f4d7"), config = require("doom.modules.config.doom-format"), disable = disabled_formatter, - event = "BufWinEnter", + cmd = { "Format", "FormatWrite" }, }) - -- Autopairs - -- can be disabled to use your own autopairs - local disabled_autopairs = functions.is_plugin_disabled("autopairs") + -- Linting + local disabled_linter = is_plugin_disabled("linter") use({ - "windwp/nvim-autopairs", - config = require("doom.modules.config.doom-autopairs"), - disable = disabled_autopairs, - event = "InsertEnter", + "mfussenegger/nvim-lint", + commit = pin_commit("c3c8a247fda421b0db1f2cbf50ab4340ba0ffc61"), + config = require("doom.modules.config.doom-lint"), + disable = disabled_linter, + module = "lint", }) -- Indent Lines - local disabled_indent_lines = functions.is_plugin_disabled("indentlines") + local disabled_indent_lines = is_plugin_disabled("indentlines") use({ "lukas-reineke/indent-blankline.nvim", + commit = pin_commit("caf7f61e94525bbd97e32f118efd6c0722430616"), config = require("doom.modules.config.doom-blankline"), disable = disabled_indent_lines, event = "ColorScheme", }) -- EditorConfig support - local disabled_editorconfig = functions.is_plugin_disabled("editorconfig") + local disabled_editorconfig = is_plugin_disabled("editorconfig") use({ "editorconfig/editorconfig-vim", + commit = pin_commit("3078cd10b28904e57d878c0d0dab42aa0a9fdc89"), disable = disabled_editorconfig, }) -- Comments -- can be disabled to use your own comments plugin - local disabled_kommentary = functions.is_plugin_disabled("kommentary") + local disabled_kommentary = is_plugin_disabled("kommentary") use({ "b3nj5m1n/kommentary", + commit = pin_commit("8f1cd74ad28de7d7c4fda5d8e8557ff240904b42"), disable = disabled_kommentary, event = "BufWinEnter", }) + local disabled_contrib = is_plugin_disabled("contrib") + -- Lua 5.1 docs + use({ + "milisims/nvim-luaref", + commit = pin_commit("dc40d606549db7df1a6e23efa743c90c178333d4"), + disable = disabled_contrib, + }) + -- LibUV docs + use({ + "nanotee/luv-vimdocs", + commit = pin_commit("fb04e1088a21eefcc396d5a5299468d8742d27a2"), + disable = disabled_contrib, + }) + -----[[-------------]]----- --- Web Related --- -----]]-------------[[----- -- Fastest colorizer without external dependencies! - local disabled_colorizer = functions.is_plugin_disabled("colorizer") + local disabled_colorizer = is_plugin_disabled("colorizer") use({ "norcalli/nvim-colorizer.lua", + commit = pin_commit("36c610a9717cc9ec426a07c8e6bf3b3abcb139d6"), config = require("doom.modules.config.doom-colorizer"), disable = disabled_colorizer, event = "ColorScheme", @@ -448,9 +591,10 @@ packer.startup(function(use) -- HTTP Client support -- Depends on bayne/dot-http to work! - local disabled_restclient = functions.is_plugin_disabled("restclient") + local disabled_restclient = is_plugin_disabled("restclient") use({ "NTBBloodbath/rest.nvim", + commit = pin_commit("e1c34175ee0b2293e8b9c06c11f2fc63f4262918"), requires = "plenary.nvim", config = function() require("rest-nvim").setup() @@ -459,9 +603,10 @@ packer.startup(function(use) event = "BufWinEnter", }) - local disabled_range_highlight = functions.is_plugin_disabled("range-highlight") + local disabled_range_highlight = is_plugin_disabled("range-highlight") use({ "winston0410/range-highlight.nvim", + commit = pin_commit("8b5e8ccb3460b2c3675f4639b9f54e64eaab36d9"), requires = { { "winston0410/cmd-parser.nvim", module = "cmd-parser" }, }, @@ -472,9 +617,10 @@ packer.startup(function(use) event = "BufRead", }) - local disabled_firenvim = functions.is_plugin_disabled("firenvim") + local disabled_firenvim = is_plugin_disabled("firenvim") use({ "glacambre/firenvim", + commit = pin_commit("7320a805f51b4cf03de4e3b30088838d3f84adda"), disable = disabled_firenvim, run = function() vim.fn["firenvim#install"](0) @@ -482,28 +628,39 @@ packer.startup(function(use) config = require("doom.modules.config.doom-fire"), }) + local disabled_todo = is_plugin_disabled("todo_comments") use({ "folke/todo-comments.nvim", + commit = pin_commit("9983edc5ef38c7a035c17c85f60ee13dbd75dcc8"), requires = "nvim-lua/plenary.nvim", config = require("doom.modules.config.doom-todo"), + disable = disabled_todo, + event = "ColorScheme", }) + + local disabled_trouble = is_plugin_disabled("trouble") use({ "folke/trouble.nvim", + commit = pin_commit("756f09de113a775ab16ba6d26c090616b40a999d"), + cmd = { "Trouble", "TroubleClose", "TroubleRefresh", "TroubleToggle" }, requires = "kyazdani42/nvim-web-devicons", config = require("doom.modules.config.doom-trouble"), + disable = disabled_trouble, + }) + + local disabled_superman = is_plugin_disabled("superman") + use({ + "jez/vim-superman", + commit = pin_commit("19d307446576d9118625c5d9d3c7a4c9bec5571a"), + cmd = "SuperMan", + disable = disabled_superman, }) - use({ "jez/vim-superman" }) -----[[----------------]]----- --- Custom Plugins --- -----]]----------------[[----- -- If there are custom plugins then also require them - local custom_plugins - if utils.file_exists(string.format("%s%splugins.lua", system.doom_configs_root, system.sep)) then - custom_plugins = dofile(string.format("%s%splugins.lua", system.doom_configs_root, system.sep)) - else - custom_plugins = dofile(string.format("%s%splugins.lua", system.doom_root, system.sep)) - end + local custom_plugins = require("doom.core.config.userplugins").plugins for _, plug in pairs(custom_plugins or {}) do packer.use(plug) diff --git a/lua/doom/utils/fs.lua b/lua/doom/utils/fs.lua new file mode 100644 index 000000000..325e7111a --- /dev/null +++ b/lua/doom/utils/fs.lua @@ -0,0 +1,50 @@ +---[[---------------------------------------]]--- +-- fs utils - Doom Nvim fs utilities -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------]]--- + +local fs = {} + +--- Check if the given file exists +--- @param path string The path of the file +--- @return boolean +fs.file_exists = function(path) + local fd = vim.loop.fs_open(path, "r", 438) + if fd then + vim.loop.fs_close(fd) + return true + end + + return false +end + +--- Returns the content of the given file +--- @param path string The path of the file +--- @return string +fs.read_file = function(path) + local fd = vim.loop.fs_open(path, "r", 438) + local stat = vim.loop.fs_fstat(fd) + local data = vim.loop.fs_read(fd, stat.size, 0) + vim.loop.fs_close(fd) + + return data +end + +--- write_file writes the given string into given file +--- @param path string The path of the file +--- @param content string The content to be written in the file +--- @param mode string The mode for opening the file, e.g. 'w+' +fs.write_file = function(path, content, mode) + -- 644 sets read and write permissions for the owner, and it sets read-only + -- mode for the group and others. + vim.loop.fs_open(path, mode, tonumber("644", 8), function(err, fd) + if not err then + local fpipe = vim.loop.new_pipe(false) + vim.loop.pipe_open(fpipe, fd) + vim.loop.write(fpipe, content) + end + end) +end + +return fs diff --git a/lua/doom/utils/init.lua b/lua/doom/utils/init.lua index 992418311..97ca68d4c 100644 --- a/lua/doom/utils/init.lua +++ b/lua/doom/utils/init.lua @@ -4,90 +4,19 @@ -- License: GPLv2 -- ---[[---------------------------------------]]--- -local M = {} +--- @class utils +local utils = {} + local system = require("doom.core.system") -------------------- HELPERS -------------------- --- Doom Nvim version -M.doom_version = "3.1.2" - --- file_exists checks if the given file exists --- @tparam string path The path to the file --- @return boolean -M.file_exists = function(path) - local fd = vim.loop.fs_open(path, "r", 438) - if fd then - vim.loop.fs_close(fd) - return true - end - - return false -end - --- Mappings wrapper, extracted from --- https://github.com/ojroques/dotfiles/blob/master/nvim/init.lua#L8-L12 --- https://github.com/lazytanuki/nvim-mapper#prevent-issues-when-module-is-not-installed -local function is_module_available(name) - if package.loaded[name] then - return true - else - for _, searcher in ipairs(package.searchers or package.loaders) do - local loader = searcher(name) - if type(loader) == "function" then - package.preload[name] = loader - return true - end - end - return false - end -end - -if is_module_available("nvim-mapper") then - local mapper = require("nvim-mapper") - - M.map = function(mode, lhs, rhs, opts, category, unique_identifier, description) - mapper.map(mode, lhs, rhs, opts, category, unique_identifier, description) - end - M.map_buf = function(bufnr, mode, lhs, rhs, opts, category, unique_identifier, description) - mapper.map_buf(bufnr, mode, lhs, rhs, opts, category, unique_identifier, description) - end - M.map_virtual = function(mode, lhs, rhs, opts, category, unique_identifier, description) - mapper.map_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) - end - M.map_buf_virtual = function(mode, lhs, rhs, opts, category, unique_identifier, description) - mapper.map_buf_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) - end -else - -- Manually load the doom_config.lua file to avoid circular dependencies - local doom_config_path - if M.file_exists(string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep)) then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_configs_root, system.sep) - elseif M.file_exists(string.format("%s%sdoom_config.lua", system.doom_root, system.sep)) then - doom_config_path = string.format("%s%sdoom_config.lua", system.doom_root, system.sep) - end - local config = dofile(doom_config_path) - - M.map = function(mode, lhs, rhs, opts, _, _, _) - local options = config.doom.allow_default_keymaps_overriding and {} or { noremap = true } - if opts then - options = vim.tbl_extend("force", options, opts) - end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) - end - M.map_buf = function(mode, lhs, rhs, opts, _, _, _) - vim.api.nvim_buf_set_keymap(mode, lhs, rhs, opts) - end - M.map_virtual = function(_, _, _, _, _, _, _) - return - end - M.map_buf_virtual = function(_, _, _, _, _, _, _) - return - end -end +--- Doom Nvim version +utils.doom_version = "3.2.0" --- For autocommands, extracted from --- https://github.com/norcalli/nvim_utils -M.create_augroups = function(definitions) +--- For autocommands, extracted from +--- https://github.com/norcalli/nvim_utils +--- @param definitions table<string, table<number, string>> +utils.create_augroups = function(definitions) for group_name, definition in pairs(definitions) do vim.api.nvim_command("augroup " .. group_name) vim.api.nvim_command("autocmd!") @@ -99,15 +28,41 @@ M.create_augroups = function(definitions) end end --- Check if string is empty or if it's nil --- @return boolean -M.is_empty = function(str) +--- Check if string is empty or if it's nil +--- @param str string The string to be checked +--- @return boolean +utils.is_empty = function(str) return str == "" or str == nil end --- Search if a table have the value we are looking for, --- useful for plugins management -M.has_value = function(tabl, val) +--- Escapes a string +--- @param str string String to escape +--- @return string +utils.escape_str = function(str) + local escape_patterns = { + "%^", + "%$", + "%(", + "%)", + "%[", + "%]", + "%%", + "%.", + "%-", + "%*", + "%+", + "%?", + } + + return str:gsub(("([%s])"):format(table.concat(escape_patterns)), "%%%1") +end + +--- Search if a table have the value we are looking for, +--- useful for plugins management +--- @param tabl table +--- @param val any +--- @return boolean +utils.has_value = function(tabl, val) for _, value in ipairs(tabl) do if value == val then return true @@ -117,52 +72,84 @@ M.has_value = function(tabl, val) return false end --- read_file returns the content of the given file --- @tparam string path The path of the file --- @return string -M.read_file = function(path) - local fd = vim.loop.fs_open(path, "r", 438) - local stat = vim.loop.fs_fstat(fd) - local data = vim.loop.fs_read(fd, stat.size, 0) - vim.loop.fs_close(fd) +--- Search if a table have the key we are looking for, +--- useful for plugins management +--- @param tabl table +--- @param key string +--- @return boolean +utils.has_key = function(tabl, key) + for _, k in ipairs(vim.tbl_keys(tabl)) do + if k == key then + return true + end + end - return data + return false end --- write_file writes the given string into given file --- @tparam string path The path of the file --- @tparam string content The content to be written in the file --- @tparam string mode The mode for opening the file, e.g. 'w+' -M.write_file = function(path, content, mode) - -- 644 sets read and write permissions for the owner, and it sets read-only - -- mode for the group and others. - vim.loop.fs_open(path, mode, tonumber("644", 8), function(err, fd) - if not err then - local fpipe = vim.loop.new_pipe(false) - vim.loop.pipe_open(fpipe, fd) - vim.loop.write(fpipe, content) - end - end) +--- Executes a git command and gets the output +--- @param command string +--- @param remove_newlines boolean +--- @return string +utils.get_git_output = function(command, remove_newlines) + local git_command_handler = io.popen(system.git_workspace .. command) + -- Read the command output and remove newlines if wanted + local command_output = git_command_handler:read("*a") + if remove_newlines then + command_output = command_output:gsub("[\r\n]", "") + end + -- Close child process + git_command_handler:close() + + return command_output end -M.load_modules = function(module_path, modules) - for i = 1, #modules, 1 do - local ok, err = xpcall( - require, - debug.traceback, - string.format("%s.%s", module_path, modules[i]) - ) - if not ok then - require("doom.extras.logging").error( - string.format( - "There was an error loading the module '%s.%s'. Traceback:\n%s", - module_path, - modules[i], - err - ) - ) +--- Check if the given plugin is disabled in doom_modules.lua +--- @param plugin string The plugin identifier, e.g. statusline +--- @return boolean +utils.is_plugin_disabled = function(plugin) + local modules = require("doom.core.config.modules").modules + + -- Iterate over all modules sections (e.g. ui) and their plugins + for _, section in pairs(modules) do + if utils.has_value(section, plugin) then + return false end end + + return true +end + +-- Check if the given plugin exists +-- @param plugin_name string The plugin name, e.g. nvim-tree.lua +-- @param path string Where should be searched the plugin in packer's path, defaults to `start` +-- @return boolean +utils.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 + +--- Rounds a number, optionally to the nearest decimal place +--- @param num number - Value to round +--- @param decimalplace number|nil - Number of decimal places +--- @return number +utils.round = function(num, decimalplace) + local mult = 10 ^ (decimalplace or 0) + return math.floor(num * mult + 0.5) / mult +end + +--- Searches for a number of executables in the user's path +--- @param executables table<number, string> Table of executables to search for +--- @return string|nil First valid executable in table +utils.find_executable_in_path = function(executables) + return vim.tbl_filter(function(c) + return c ~= vim.NIL and vim.fn.executable(c) == 1 + end, executables)[1] end -return M +return utils diff --git a/lua/doom/utils/mappings.lua b/lua/doom/utils/mappings.lua new file mode 100644 index 000000000..0194f3344 --- /dev/null +++ b/lua/doom/utils/mappings.lua @@ -0,0 +1,110 @@ +---[[---------------------------------------]]--- +-- utils - Doom Nvim utilities -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------]]--- + +--- @class mappings +local mappings = {} + +local mod_utils = require("doom.utils.modules") + +--- Mappings wrapper, extracted from +--- https://github.com/ojroques/dotfiles/blob/master/nvim/init.lua#L8-L12 +--- https://github.com/lazytanuki/nvim-mapper#prevent-issues-when-module-is-not-installed +if mod_utils.is_module_available("nvim-mapper") then + local mapper = require("nvim-mapper") + + mappings.map = function(mode, lhs, rhs, opts, category, unique_identifier, description) + mapper.map(mode, lhs, rhs, opts, category, unique_identifier, description) + end + mappings.map_buf = function(bufnr, mode, lhs, rhs, opts, category, unique_identifier, description) + mapper.map_buf(bufnr, mode, lhs, rhs, opts, category, unique_identifier, description) + end + mappings.map_virtual = function(mode, lhs, rhs, opts, category, unique_identifier, description) + mapper.map_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) + end + mappings.map_buf_virtual = + function(mode, lhs, rhs, opts, category, unique_identifier, description) + mapper.map_buf_virtual(mode, lhs, rhs, opts, category, unique_identifier, description) + end +else + local config = require("doom.core.config").config + + mappings.map = function(mode, lhs, rhs, opts, _, _, _) + local options = config.doom.allow_default_keymaps_overriding and {} or { noremap = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) + end + mappings.map_buf = function(mode, lhs, rhs, opts, _, _, _) + vim.api.nvim_buf_set_keymap(mode, lhs, rhs, opts) + end + mappings.map_virtual = function(_, _, _, _, _, _, _) + return + end + mappings.map_buf_virtual = function(_, _, _, _, _, _, _) + return + end +end + +--- keep functions that we want to call +--- @class functions +mappings.functions = {} + +--- Execute the given lua functions +--- @param id number Index of the function in mappings.functions +mappings.execute = function(id) + local func = mappings.functions[id] + if not func then + require("doom.extras.logging").error("Function doest not exist: " .. id) + end + return func() +end + +-- map keybindings to functions and cmds +local function key_map(mode, key, cmd, opts, defaults) + opts = vim.tbl_deep_extend("force", { silent = true }, defaults or {}, opts or {}) + + if type(cmd) == "function" then + table.insert(mappings.functions, cmd) + if opts.expr then + cmd = ([[luaeval('require("doom.utils").execute(%d)')]]):format(#mappings.functions) + else + cmd = ("<cmd>lua require('doom.utils').execute(%d)<cr>"):format(#mappings.functions) + end + end + if opts.buffer ~= nil then + local buffer = opts.buffer + opts.buffer = nil + return vim.api.nvim_buf_set_keymap(buffer, mode, key, cmd, opts) + else + return vim.api.nvim_set_keymap(mode, key, cmd, opts) + end +end + +--- Map termcode keybindings +--- @param str string +--- @return string +mappings.t = function(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end + +--- insert mode keybinding +--- @param key string +--- @param cmd string +--- @param opts table +mappings.imap = function(key, cmd, opts) + return key_map("i", key, cmd, opts) +end + +--- substitute mode keybinding +--- @param key string +--- @param cmd string +--- @param opts table +mappings.smap = function(key, cmd, opts) + return key_map("s", key, cmd, opts) +end + +return mappings diff --git a/lua/doom/utils/modules.lua b/lua/doom/utils/modules.lua new file mode 100644 index 000000000..d121a33f4 --- /dev/null +++ b/lua/doom/utils/modules.lua @@ -0,0 +1,51 @@ +---[[---------------------------------------]]--- +-- utils - Doom Nvim utilities -- +-- Author: NTBBloodbath -- +-- License: GPLv2 -- +---[[---------------------------------------]]--- + +--- @class modules +local modules = {} + +--- Check if a Lua module exists +--- @param mod string The module name, e.g. nvim-treesitter +--- @return boolean +modules.is_module_available = function(mod) + if package.loaded[mod] then + return true + else + for _, searcher in ipairs(package.searchers or package.loaders) do + local loader = searcher(mod) + if type(loader) == "function" then + package.preload[mod] = loader + return true + end + end + return false + end +end + +--- Load the specified Lua modules +--- @param module_path string The path to Lua modules, e.g. 'doom' โ†’ 'lua/doom' +--- @param mods table The modules that we want to load +modules.load_modules = function(module_path, mods) + for i = 1, #mods, 1 do + local ok, err = xpcall(require, debug.traceback, string.format("%s.%s", module_path, mods[i])) + if not ok then + require("doom.extras.logging").error( + string.format( + "There was an error loading the module '%s.%s'. Traceback:\n%s", + module_path, + mods[i], + err + ) + ) + else + require("doom.extras.logging").debug( + string.format("Successfully loaded '%s.%s' module", module_path, mods[i]) + ) + end + end +end + +return modules diff --git a/sessions/.init b/sessions/.init deleted file mode 100644 index b1b716105..000000000 --- a/sessions/.init +++ /dev/null @@ -1 +0,0 @@ -init